fix: build --no-codegen output file name error#14239
fix: build --no-codegen output file name error#14239straight-shoota merged 2 commits intocrystal-lang:masterfrom
build --no-codegen output file name error#14239Conversation
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-codegencommand is passed tocrystal buildsince 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