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

refactor: build on LC_PROGRAM_AUTOBUILD=1 #41

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aptos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ generated in two ways:

- Automated: There is a build script located at `./aptos-programs/build.rs` that
will compile all the programs and place them in the `./aptos-programs/artifacts`
folder.
folder. To enable this feature, it is needed to set the environment variable `LC_PROGRAM_AUTOBUILD=1`.
- Manual: You can also compile the programs manually using `make` by running the following
command in the `./aptos-programs` folder:
```shell
Expand Down
8 changes: 8 additions & 0 deletions aptos/aptos-programs/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ const PROGRAM_PATTERNS: [&str; 2] = ["../programs/*", "../programs/benchmarks/*"
const TARGET_DIR: [&str; 2] = ["./artifacts", "./artifacts/benchmarks"];

fn main() {
// Get `LC_PROGRAM_AUTOBUILD` env variable, default to 0
let should_build: bool =
std::env::var("LC_PROGRAM_AUTOBUILD").unwrap_or_else(|_| "0".into()) == "1";

if !should_build {
return;
}

// Re-run if the core library changes
let core_dir = std::path::Path::new("../core");
println!("cargo:rerun-if-changed={}", core_dir.display());
Expand Down
Loading