-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix: build --no-codegen
output file name error
#14239
fix: build --no-codegen
output file name error
#14239
Conversation
This avoids errors based on output file name when the `--no-codegen` command is passed to `crystal build` since it shouldn't be necessary to specify an output file if no file will be created anyway. Example: $ crystal build --no-codegen example/example.cr Error: can't use `example` as output filename because it's a directory
build --no-codegen
output file name warningbuild --no-codegen
output file name error
Hey @apainintheneck, thanks for picking this up! 👋 This PR looks all right, as in it should probably work. But I'm a bit concerned about the semantics and wondering if there couldn't be a better solution. Yet, wie have some duplication with Does this make sense to you? |
This makes sense to me. It shouldn't change semantics like you said but it will make the code easier to reason about. |
The idea here is to make the `#create_compiler` method easier to reason about by splitting up the responsibilities of the `no_codegen` input parameter which is used when building the options parser and the `compiler.no_codegen?` boolean value which is used when deciding how to compile the program.
This avoids errors based on output file name when the
--no-codegen
command is passed tocrystal build
since it shouldn't be necessary to specify an output file if no file will be created anyway.This change means that the following lines of code get skipped when using
--no-codegen
.crystal/src/compiler/crystal/command.cr
Lines 598 to 601 in bb96c53
crystal/src/compiler/crystal/command.cr
Lines 611 to 613 in bb96c53
It will also means that we skip the combine rpaths step.
crystal/src/compiler/crystal/command.cr
Line 619 in bb96c53