This PR works on adding pre-defined code gen test projects and roundtrip tests for the generated code.
List of changes:
Renames beta-subcommand feature to experimental-code-gen (This makes it consistent with ion-rs on naming experimental feature. Also, since this feature is only used for code gen, using beta wouldn't be specific)
Changes in struct and class template to sort field based on field name to generate consistent constructor signature for generated code.
Adds code-gen-projects that has some pre-defined code generation projects for both Java(gradle project code-gen-demo) and Rust(cargo crate code-gene-demo).
Adds input Ion files for testing (/code-gen-proejcts/input)
Adds schema files for testing (/code-gen-proejcts/schema)
Adds cargo crate in rust/code-gen-demo for testing in Rust
Adds gradle project in java/code-gen-demo for testing in Java
Adds build process in both Rust and java projects, to generate code
while building and use it for tetsing
Adds tests in both Rust and Java projects
Adds code-gen-tests in ion-cli to invoke both Rust and Java
projects for testing
-Modifies CI workflow
Workflow modified to run code gen tests separately
Currently code gen tests only runs for ubuntu (Since code generation tests takes longer to clean previously generated code, generate code and then test for both Java and Rust, changed it to be just ubuntu. Also, seeing error in running gradle project in GitHub Actions for windows platform returns error which needs to be investigated: https://github.com/desaikd/ion-cli/actions/runs/8574599832/job/23501774774)
Adds changes to sort schema file paths to preserve anonymous type names
Sample of running tests on ion-cli for code generator:
Running tests/code-gen-tests.rs
running 2 tests
Removed X files, YMiB total
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :clean
> Task :ionCodegen
Started generating code...
Code generation complete successfully!
Path to generated code: ion-cli/code-gen-projects/java/code-gen-demo/build/generated/java
> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :test
BUILD SUCCESSFUL in Zs
5 actionable tasks: 5 executed
test roundtrip_tests_for_generated_code_gradle ... ok
running 3 tests
test tests::it_works ... ok
test tests::test_roundtrip_generated_code_structs_with_fields ... ok
test tests::test_roundtrip_generated_code_nested_structs ... ok
test result: ok. 3 passed; 0 failed; 0 ignored; 0
....
test roundtrip_tests_for_generated_code_cargo ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0
Tests
Adds code-gen-tests in ion-cli to invoke both Rust and Java
Adds tests in code-gen-projects for both Rust and Java projects
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #88:
Description of changes:
This PR works on adding pre-defined code gen test projects and roundtrip tests for the generated code.
List of changes:
beta-subcommand
feature toexperimental-code-gen
(This makes it consistent withion-rs
on naming experimental feature. Also, since this feature is only used for code gen, usingbeta
wouldn't be specific)code-gen-projects
that has some pre-defined code generation projects for both Java(gradle projectcode-gen-demo
) and Rust(cargo cratecode-gene-demo
).code-gen-tests
inion-cli
to invoke both Rust and Java projects for testing -Modifies CI workflowubuntu
. Also, seeing error in running gradle project in GitHub Actions forwindows
platform returns error which needs to be investigated: https://github.com/desaikd/ion-cli/actions/runs/8574599832/job/23501774774)Sample of running tests on
ion-cli
for code generator:Tests
code-gen-tests
inion-cli
to invoke both Rust and Javacode-gen-projects
for both Rust and Java projectsBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.