-
Notifications
You must be signed in to change notification settings - Fork 54
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 main
field to juvix.yaml
#2118
Add main
field to juvix.yaml
#2118
Conversation
exitMsg' :: ExitCode -> Text -> Sem r x | ||
exitMsg' exitCode t = embed (putStrLn t >> hFlush stdout >> exitWith exitCode) | ||
getMainFile' :: Maybe (AppPath File) -> Sem r (Path Abs File) | ||
getMainFile' m = case m of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getMainFile' m = case m of | |
getMainFile' = \case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
getMainFile' m = case m of | ||
Just p -> embed (prepathToAbsFile invDir (p ^. pathPath)) | ||
Nothing -> case pkg ^. packageMain of | ||
-- TODO do something special if it is the global package? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by "special"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that maybe we want to explicitly forbid the main
field in the global project.
I don't think there is ever a usecase for running juvix compile
outside of a project.
By default, the global project doesn't have a main
file by default, so maybe we leave it as it is and remove the TODO
comment
missingMainErr = | ||
exitMsg' | ||
(ExitFailure 1) | ||
( "A path to the main file must be given in the CLI or specified in the `main` field of the " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
( "A path to the main file must be given in the CLI or specified in the `main` field of the " | |
( "File path to the main file is not provided. Ensure to specify it in the `main` field of the " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see that this improves the error message. Moreover, it is incorrect, because it does not mention the CLI
./HelloWorld | ||
exit-status: 0 | ||
stdout: | | ||
hello world! | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a test to see the error in the absence fo the main field in the juvix. yaml?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
96fd11c
to
a2d4c3d
Compare
a2d4c3d
to
897bdc7
Compare
|
compile
subcommand functionality for projects #2067This pr adds the field
main
tojuvix.yaml
. This field is optional and should contain a path to a juvix file that is meant to be used for thecompile
(anddev compile
) command when no file is given as an argument in the CLI. This makes it possible to simply runjuvix compile
if themain
is specified in thejvuix.yaml
.I have updated the
juvix.yaml
of the milestone examples.