brick icon indicating copy to clipboard operation
brick copied to clipboard

Please make brick compilation gracefully fail on Windows (cabal and stack)

Open geh opened this issue 3 years ago • 3 comments

brick does not currently support Windows because of the unix dependency. Is it possible to configure the brick.cabal so as to directly prevent Windows compilation with an informative error message? Not every potential user of brick knows that it does not work on that platform.

Pictures of the current situation:

error MicrosoftTeams-image

Thanks!

geh avatar Jun 09 '21 18:06 geh

Sorry I have taken a while to respond to this! When this was first opened, my first thought was "Yeah, this isn't great and it would be nice if it failed in a clearer way." But I think I've drug my feet on doing anything about it because I don't have any Windows systems to test on! If I write up a patch on a branch, would you be willing to give it a try on your system?

jtdaugherty avatar Apr 27 '22 03:04 jtdaugherty

If you're willing to try it out, I pushed a patch to the misc/windows-build-failure branch.

jtdaugherty avatar Apr 27 '22 04:04 jtdaugherty

@simonmichael also tagging you in case you're interested/willing to try this out.

jtdaugherty avatar May 13 '22 18:05 jtdaugherty

I'm going to close this because I don't currently have a path forward. I don't develop on Windows so I can't test a patch for this problem. If someone wants to provide evidence of testing for the branch I pushed, that would be helpful. In the mean time, as far as I am concerned the build failure on Windows is not that much worse than what was requested here.

jtdaugherty avatar Jan 31 '23 03:01 jtdaugherty

Same here, testing of @jtdaugherty's patch from any windows-based haskeller welcome.

simonmichael avatar Jan 31 '23 04:01 simonmichael

It works nicely. One could also add buildable: False in the same conditional block.

ShrykeWindgrace avatar Feb 22 '23 16:02 ShrykeWindgrace

@ShrykeWindgrace how does that change the error message that gets generated?

jtdaugherty avatar Feb 22 '23 20:02 jtdaugherty

@jtdaugherty with

diff --git a/brick.cabal b/brick.cabal
index c8caf36..cfac317 100644
--- a/brick.cabal
+++ b/brick.cabal
@@ -118,8 +118,13 @@ library
     Brick.Types.Internal
     Brick.Widgets.Internal

+
+  if os(windows)
+    build-depends: brick-is-not-supported-on-windows < 0
+    --buildable: False

I get

stack build

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for brick-1.6:
    brick-is-not-supported-on-windows must match <0, but the stack configuration has no specified version (no package with that name found, perhaps there is a typo in a package's build-depends or an
                                      omission from the stack.yaml packages list?)
needed since brick is a build target.
...

with brick-is-not-supported-on-windows highlighted in red and $LASTEXITCODE == 1

With

diff --git a/brick.cabal b/brick.cabal
index c8caf36..cfac317 100644
--- a/brick.cabal
+++ b/brick.cabal
@@ -118,8 +118,13 @@ library
     Brick.Types.Internal
     Brick.Widgets.Internal

+
+  if os(windows)
+    build-depends: brick-is-not-supported-on-windows < 0
+    buildable: False

I get no alarming output but I get $LASTEXITCODE == 0.

ShrykeWindgrace avatar Feb 28 '23 09:02 ShrykeWindgrace

@ShrykeWindgrace thanks! By $LASTEXITCODE do you mean $??

jtdaugherty avatar Feb 28 '23 15:02 jtdaugherty

@jtdaugherty in powershell - not quite. Copypasting from https://stackoverflow.com/a/10666052/3206165:

$LastExitCode is the return code of native applications. $? just returns True or False depending on whether the last command (cmdlet or native) exited without error or not.

Seen from afar, $? == ($LastExitCode > 0), but there are always subtleties and nuances =)

ShrykeWindgrace avatar Feb 28 '23 16:02 ShrykeWindgrace