-
-
Couldn't load subscription status.
- Fork 1.7k
chore: correct progress step count to 14 #16269
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
base: master
Are you sure you want to change the base?
Conversation
When using --progress, the final step displays `[14/13] Codegen (linking)`, which incorrectly suggests there are only 13 steps. ```shell $ crystal build --progress [1/13] Parse [2/13] Semantic (top level) [3/13] Semantic (new) [4/13] Semantic (type declarations) [5/13] Semantic (abstract def check) [6/13] Semantic (restrictions augmenter) [7/13] Semantic (ivars initializers) [8/13] Semantic (cvars initializers) [9/13] Semantic (main) [10/13] Semantic (cleanup) [11/13] Semantic (recursive struct check) [12/13] Codegen (crystal) [13/13] Codegen (bc+obj) [14/13] Codegen (linking) ``` This commit updates the maximum step count to 14 to align with the actual number of stages.
2e55dae to
90b7e2d
Compare
| class ProgressTracker | ||
| # FIXME: This assumption is not always true | ||
| STAGES = 13 | ||
| STAGES = 14 |
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.
thought: As the comment above points out, the number of steps is not fixed. It depends on the specific compiler settings.
So I'm not sure if it makes much sense to change from one value that can be wrong sometimes to a different one that can also be wrong sometimes.
I guess 14 is right more often than 13 so it's probably an improvement.
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.
Yes, it should be dynamically calculated depending on which command line argument (or refactor the whole thing to use a stages array). There are:
- 14 stages by default —maybe a stage got added but STAGES wasn't updated?
- 13 stages when
--cross-compile; - 11 stages when
--no-codegen(regardless of--cross-compile); are there other args that affect progress?crystal tool hierarchyhas 7 stages;- ...
Using 14 is better as a default.
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.
The added stage was the restrictions augmenter.
Also on macOS running dsymutil counts as its own extra stage.
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.
Than maybe it should be the following?
| STAGES = 14 | |
| STAGES = {{flag?(:darwin) ? 15 : 14}} |
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.
It would be more like program.has_flag?("darwin") because whether dsymutil is run or not depends on the target, not the host.
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.
Hm, apparently not:
crystal/src/compiler/crystal/compiler.cr
Lines 367 to 369 in cd3b454
| {% if flag?(:darwin) %} | |
| run_dsymutil(output_filename) unless debug.none? | |
| {% end %} |
It depends on the dsymutil being available, which probably isn't the case when cross-compiling?
So the entire condition for this stage would be something like {{ flag?(:darwin) }} && !debug.none? && Process.find_executable("dsymutil"). 🙈
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.
We could factor this all out and duplicate all the conditions in order to get a final count.
Or we just change it to 14, which is correct most of the time and be fine with that.
Or we simply remove the target value. Let steps just count upwards without saying how many are to be expected. This doesn't tell much anyway because the individual steps are very diverse.
When using --progress, the final step displays
[14/13] Codegen (linking),which incorrectly suggests there are only 13 steps.
Propose to update the maximum step count to 14 to align with the actual number of stages.
🎩 Tophat
I have tested localy the progress produces: