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

make native-image creation hermetic to allow remoting via cross-compilation #7516

Closed
3 tasks
cosmicexplorer opened this issue Apr 8, 2019 · 1 comment
Closed
3 tasks

Comments

@cosmicexplorer
Copy link
Contributor

cosmicexplorer commented Apr 8, 2019

In #6893 we introduce the graal subsystem and use the native-image tool to build scalafmt, which is then executed hermetically. However, because the produced native image is platform-specific, this won't allow for remoting the native-image execution, e.g. if pants is invoked on an OSX machine (producing an OSX native image) and the remote execution environment is Linux (pants would then upload a native image which doesn't work on Linux, causing an error when the remote Linux server attempts to execute the OSX binary). Therefore, in order to make the execution of native image remoteable, we have to make the native image creation remoteable as well.

There was a TODO left in #6893 in graal.py to use v2 process execution for image building, and another TODO in binary_util.py to allow injecting the host_platform to binary tool selection. More concretely:

  • Snapshot the graal distribution in graal.py and the tool_classpath in order to use v2 process execution with context.execute_process_synchronously_or_raise().
    • see .hackily_snapshot() in binary_tool.py for an example of snapshotting a binary tool contained outside the buildroot
    • see zinc.py for an example of converting classpath entries into snapshots
    • see the NativeImageExecutor in executor.py for an example of v2 process execution which materializes the output into a directory!
  • Allow injecting a host_platform argument into BinaryUtil#select() to resolve a binary tool for a known target platform, and configure native-image building to use Linux when remoting is available.
  • (reach goal) Convert all of this into a v2 ruleset instead of a bunch of long methods.
@cosmicexplorer
Copy link
Contributor Author

As the current implementation of v2 process execution in pants either remotes zero executions or every execution, we currently don't have to worry about the platform, which will always be the platform of whatever environment the remote execution workers provide. Closing this until it becomes a problem.

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

No branches or pull requests

1 participant