Skip to content
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

Express cross-platform-ness of beam files #189

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft

Conversation

pjk25
Copy link
Contributor

@pjk25 pjk25 commented May 1, 2023

in erlang_bytecode2 rule

@pjk25 pjk25 added this to the 3.10.0 milestone May 2, 2023
@pjk25 pjk25 force-pushed the beam_transition branch 4 times, most recently from 7b4887e to 62bb217 Compare May 4, 2023 10:20
@pjk25 pjk25 modified the milestones: 3.10.0, 3.11.0 May 4, 2023
@pjk25
Copy link
Contributor Author

pjk25 commented May 11, 2023

Like there is for rules_docker, there should probably be a flag to disable these transitions (--@io_bazel_rules_docker//transitions:enable=false).

@pjk25 pjk25 force-pushed the beam_transition branch 5 times, most recently from d1a2f0b to 92fa2e4 Compare May 24, 2023 08:04
@pjk25
Copy link
Contributor Author

pjk25 commented Jun 15, 2023

Like there is for rules_docker, there should probably be a flag to disable these transitions (--@io_bazel_rules_docker//transitions:enable=false).

Done

@pjk25
Copy link
Contributor Author

pjk25 commented Jun 15, 2023

It has occurred to me that it's possible we want to also represent the beam version with this transition, to be able to for instance target an otp 26 runtime, but compile with 25. I think this should be possible, if we indicate the otp version in the host or exec platform definition as well. The transition will then have to handle this compatibility, and also the @erlang_config repository will have to define cpu's for each beam version instead of the single beam cpu that this PR currently contains.

@pjk25 pjk25 force-pushed the beam_transition branch 2 times, most recently from 7910f04 to 1ffb5c5 Compare June 16, 2023 12:29
@pjk25
Copy link
Contributor Author

pjk25 commented Jun 19, 2023

It has occurred to me that it's possible we want to also represent the beam version with this transition, to be able to for instance target an otp 26 runtime, but compile with 25. I think this should be possible, if we indicate the otp version in the host or exec platform definition as well. The transition will then have to handle this compatibility, and also the @erlang_config repository will have to define cpu's for each beam version instead of the single beam cpu that this PR currently contains.

Thinking further about this, I'm inclined not to force/resolve the compatibility in the analysis phase of the build. This is partly because I can't think of how to achieve it without projecting out rules for each erlang version an annotating with exec_compatible_with & target_compatible_with and letting platform flags filter, and I see this being problematic when you just want to run with the host erlang, and see what happens. If we did just try to handle it with transitions, then I think we would need additional custom build settings to indicate what erlang jump is intended. Neither of these sound very good to me and so long as this PR is compatible with using host_platform/platform to set 2 erlang versions and test for example otp 25 bytecode running on otp 26, then this is sufficient with beam as a custom cpu that does not encode it's otp version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant