-
Notifications
You must be signed in to change notification settings - Fork 843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to only compile script using stack shebang #5755
Comments
The current online help explains:
Rather than an environment variable, how about an additional flag for |
I thought further about this. I have a potential pull request that does the following: if new global flag So, for example, if you have a script {- stack script
--resolver lts-19.9
--package acme-missiles
-}
import Acme.Missiles (launchMissiles)
main :: IO ()
main = launchMissiles If you use:
then that gets translated (by
which is then forced (by my pull request) to be the equivalent of having asked for:
|
Adds a `--force-script-no-run-compile` flag (disabled by default) that forces the `--no-run` and `--compile` options with `stack script`. This enables a command like `stack --force-script-no-run-compile Script.hs` to behave like `stack script ... --no-run --compile -- Script.hs` but without having to list all the other arguments in the stack interpreter options comment (represented by `...`) on the command line.
Adds a `--force-script-no-run-compile` flag (disabled by default) that forces the `--no-run` and `--compile` options with `stack script`. This enables a command like `stack --force-script-no-run-compile Script.hs` to behave like `stack script ... --no-run --compile -- Script.hs` but without having to list all the other arguments in the stack interpreter options comment (represented by `...`) on the command line. Also adds an explanation to the online documentation.
Fix #5755 Add --script-no-run-compile flag
The option - now named |
I have a file
and running
./Script.hs
orstack Script.hs
works as expected. But I would like to have a CI job checking thatScript.hs
builds (but not runs). I do seestack script
has a--no-run
flag, but it seems like I would have to copy the entirestack script
command to do so:Doing
stack Script.hs --no-run
orstack script Script.hs --no-run
would fail; the first would pass--no-run
as an argument toScript.hs
, and the second would fail with "script
requires--resolver
".The most straightforward way I see here is to add a
STACK_INTERPRETER_NO_RUN=true
env var that will add the--no-run
flag tostack script
and the appropriate flags tostack runghc
.The text was updated successfully, but these errors were encountered: