forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bare minimum "Pants compiles its engine" (pantsbuild#19817)
This change introduces the necessary targets to allow for Pants as it exists right now, to compile the engine. It doesn't introduce any mechanism for actually compiling the engine when doing `pants`/`./pants` runs in the repo, as that'll come later. After this change, you should be able to do `pants export-codegen src/rust/engine:engine-and-client` and get the engine/client in your distdir (as well as again but with `MODE=debug`). In addition to the targets required for wiring this up, `rust-toolchain` was also moved under `src/rust/engine`. I also tested that: - editing `rust-toolchain` re-forces a new build - editing `cargo_build_shim.sh` does not force a new build --------- Co-authored-by: Huon Wilson <[email protected]>
- Loading branch information
1 parent
a064a6b
commit 0afc51c
Showing
11 changed files
with
115 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
file( | ||
name="compressed-python-build-standalone-3.9", | ||
source=per_platform( | ||
linux_arm64=http_source( | ||
url="https://github.com/indygreg/python-build-standalone/releases/download/20230507/cpython-3.9.16+20230507-aarch64-unknown-linux-gnu-install_only.tar.gz", | ||
len=23583066, | ||
sha256="f629b75ebfcafe9ceee2e796b7e4df5cf8dbd14f3c021afca078d159ab797acf", | ||
filename="python-build-standalone.tar.gz", | ||
), | ||
linux_x86_64=http_source( | ||
url="https://github.com/indygreg/python-build-standalone/releases/download/20230507/cpython-3.9.16+20230507-x86_64-unknown-linux-gnu-install_only.tar.gz", | ||
len=25738357, | ||
sha256="2b6e146234a4ef2a8946081fc3fbfffe0765b80b690425a49ebe40b47c33445b", | ||
filename="python-build-standalone.tar.gz", | ||
), | ||
macos_arm64=http_source( | ||
url="https://github.com/indygreg/python-build-standalone/releases/download/20230507/cpython-3.9.16+20230507-aarch64-apple-darwin-install_only.tar.gz", | ||
len=16634170, | ||
sha256="c1de1d854717a6245f45262ef1bb17b09e2c587590e7e3f406593c143ff875bd", | ||
filename="python-build-standalone.tar.gz", | ||
), | ||
macos_x86_64=http_source( | ||
url="https://github.com/indygreg/python-build-standalone/releases/download/20230507/cpython-3.9.16+20230507-x86_64-apple-darwin-install_only.tar.gz", | ||
len=16908516, | ||
sha256="3abc4d5fbbc80f5f848f280927ac5d13de8dc03aabb6ae65d8247cbb68e6f6bf", | ||
filename="python-build-standalone.tar.gz", | ||
), | ||
), | ||
) | ||
|
||
shell_command( | ||
name="python3", | ||
command="tar -xzf python-build-standalone.tar.gz", | ||
tools=["tar", "gzip"], | ||
execution_dependencies=[":compressed-python-build-standalone-3.9"], | ||
output_directories=["python"], | ||
) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
files( | ||
name="rust_sources", | ||
sources=[ | ||
"Cargo.lock", | ||
"build.rs", | ||
"**/Cargo.toml", | ||
"**/*.rs", | ||
"!**/*tests.rs", | ||
"**/*.proto", | ||
".cargo/config", | ||
"rust-toolchain", | ||
], | ||
) | ||
|
||
shell_sources(name="shell") | ||
|
||
shell_command( | ||
name="engine-and-client", | ||
command=f"./cargo_build_shim.sh --features=extension-module -p engine -p client", | ||
execution_dependencies=[ | ||
":rust_sources", | ||
"./cargo_build_shim.sh:shell", | ||
"3rdparty/tools/python3:python3", | ||
], | ||
extra_env_vars=["CHROOT={chroot}", "MODE"], | ||
tools=["bash", "cc", "ld", "as", "ar", "cargo", "protoc", "python3.9"], | ||
output_files=[ | ||
f"target/debug/libengine.so", | ||
f"target/debug/libengine.dylib", | ||
f"target/debug/pants", | ||
f"target/release/libengine.so", | ||
f"target/release/libengine.dylib", | ||
f"target/release/pants", | ||
], | ||
timeout=600, | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
# This simply exists because `shell_command` at the time of writing doesn't know how to merge `PATH` | ||
# from the rule's env and the `extra_env_vars`. | ||
|
||
PYTHON_PATH="${CHROOT}/3rdparty/tools/python3/python/bin" | ||
export PATH="$PATH:$PYTHON_PATH" | ||
|
||
RELTYPE_FLAG="" | ||
[ "$MODE" == "debug" ] || RELTYPE_FLAG="--release" | ||
|
||
cargo build $RELTYPE_FLAG "$@" |
File renamed without changes.