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

Adds changes for code generation tests configuration #98

Merged
merged 1 commit into from
Apr 9, 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 code-gen-projects/java/code-gen-demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ tasks {
inputs.files(ionSchemaSourceCodeDir)
outputs.file(generatedIonSchemaModelDir)

val ionCli = "../../../target/debug/ion"
val ionCli = System.getenv("ION_CLI") ?: "ion"

commandLine(ionCli)
.args(
Expand Down
2 changes: 1 addition & 1 deletion code-gen-projects/rust/code-gen-demo/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn main() {
let out_dir = env::var("OUT_DIR").unwrap();

// Invoke cargo CLI
let ion_cli = "../../../target/debug/ion";
let ion_cli = env::var("ION_CLI").unwrap_or("ion".to_string());
println!("cargo:warn=Running command: {}", ion_cli);
let mut cmd = std::process::Command::new(ion_cli);
cmd.arg("beta")
Expand Down
4 changes: 4 additions & 0 deletions tests/code-gen-tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Result;

Check warning on line 1 in tests/code-gen-tests.rs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-latest)

unused import: `anyhow::Result`

Check warning on line 1 in tests/code-gen-tests.rs

View workflow job for this annotation

GitHub Actions / Build and Test (macos-latest)

unused import: `anyhow::Result`

Check warning on line 1 in tests/code-gen-tests.rs

View workflow job for this annotation

GitHub Actions / Build and Test (windows-2019)

unused import: `anyhow::Result`
use std::io::Write;

Check warning on line 2 in tests/code-gen-tests.rs

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-latest)

unused import: `std::io::Write`

Check warning on line 2 in tests/code-gen-tests.rs

View workflow job for this annotation

GitHub Actions / Build and Test (macos-latest)

unused import: `std::io::Write`

Check warning on line 2 in tests/code-gen-tests.rs

View workflow job for this annotation

GitHub Actions / Build and Test (windows-2019)

unused import: `std::io::Write`

#[cfg(feature = "experimental-code-gen")]
#[test]
Expand All @@ -10,6 +10,7 @@
// so simply running the tests on this project builds the project, generates code and runs tests

// absolute paths for gradle project and executables
let ion_executable = env!("CARGO_BIN_EXE_ion");
let test_crate_path = format!(
"{}/code-gen-projects/java/code-gen-demo",
env!("CARGO_MANIFEST_DIR")
Expand All @@ -19,6 +20,7 @@
// Clean and Test
let gradle_output = std::process::Command::new(gradle_executable)
.current_dir(&test_crate_path)
.env("ION_CLI", ion_executable)
.arg("clean")
.arg("test")
.output()
Expand All @@ -41,6 +43,7 @@
// so simply running the tests on this project builds the project, generates code and runs tests

// absolute paths for crate and executables
let ion_executable = env!("CARGO_BIN_EXE_ion");
let test_crate_path = format!(
"{}/code-gen-projects/rust/code-gen-demo",
env!("CARGO_MANIFEST_DIR")
Expand All @@ -66,6 +69,7 @@
let cargo_test_output = std::process::Command::new(cargo_executable)
.current_dir(&test_crate_path)
.arg("test")
.env("ION_CLI", ion_executable)
.output()
.expect("failed to execute 'cargo test'");

Expand Down
Loading