Split toolchain into exec/target toolchain types#99
Open
lamcw wants to merge 2 commits intobazel-contrib:mainfrom
Open
Split toolchain into exec/target toolchain types#99lamcw wants to merge 2 commits intobazel-contrib:mainfrom
lamcw wants to merge 2 commits intobazel-contrib:mainfrom
Conversation
Previously, rules_perl only defined a single toolchain_type with exec_compatible_with constraints. This meant toolchain resolution always followed the execution platform, causing cross-compilation scenarios (e.g., exec=linux_amd64, target=linux_arm64) to bundle the wrong Perl interpreter into the final binary. Introduce a separate target_toolchain_type as the target-platform toolchain resolved via target_compatible_with, for build-time tools (perl_xs, genrule via current_toolchain) use toolchain_type. This ensures perl_binary and perl_test bundle the interpreter matching the target platform. Signed-off-by: Thomas Lam <thomaslam@canva.com>
Collaborator
|
@lamcw, thank you for the addition and the helpful comments in the code. Could you please add a section to the README with an example of how to use the target toolchain (maybe at the bottom of the Getting Started section: Getting Started -> Target Toolchain)? Also, it appears your formatter/linter is set to a line length of 80 chars. You may want to increase that to 100, as you will own several comments that have only been reformatted to 80 chars. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
rules_perlonly defined a single toolchain_type withexec_compatible_withconstraints. This meant toolchain resolution always followed the execution platform, causing cross-compilation scenarios (e.g., exec=linux_amd64, target=linux_arm64) to bundle the wrong Perl interpreter into the final binary.The solution here would be to introduce a separate
toolchain_typeas the target-platform toolchain resolved via target_compatible_with, for build-time tools (perl_xs, genrule via current_toolchain) continue to use toolchain_type. This ensuresperl_binaryandperl_testbundle the interpreter matching the target platform.