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 cel-java work in Graal native images #23

Merged
merged 2 commits into from
Jun 25, 2021

Conversation

snazy
Copy link
Member

@snazy snazy commented Jun 24, 2021

The approach to make cel-java work in Graal native image files is to generate Graal native image meta files.

Introduces a Gradle plugin to scan the compiled classes and configuration-dependencies for classes that require an entry in reflection-config.json.

With the generated reflection-config.json + native-image.properties the Graal native-image tool has enough information to allow reflection for google-protobuf generated files.

Splits the generated project into generated-pb, which contains only the generated Java files for protobuf, and generated-antlr, which only contains the generated Java files for the CEL parser.

@snazy
Copy link
Member Author

snazy commented Jun 24, 2021

Note: includes a commit from #22

@snazy
Copy link
Member Author

snazy commented Jun 24, 2021

/cc @nastra

@codecov
Copy link

codecov bot commented Jun 24, 2021

Codecov Report

Merging #23 (80dd52b) into main (8718db8) will increase coverage by 0.01%.
The diff coverage is 57.03%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main      #23      +/-   ##
============================================
+ Coverage     79.73%   79.75%   +0.01%     
- Complexity     1665     1670       +5     
============================================
  Files            89       91       +2     
  Lines          7388     7394       +6     
  Branches       1085     1084       -1     
============================================
+ Hits           5891     5897       +6     
  Misses         1001     1001              
  Partials        496      496              
Flag Coverage Δ
java 79.75% <57.03%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
core/src/main/java/org/projectnessie/cel/Ast.java 76.47% <ø> (ø)
core/src/main/java/org/projectnessie/cel/CEL.java 89.04% <0.00%> (ø)
core/src/main/java/org/projectnessie/cel/Env.java 87.59% <ø> (ø)
...c/main/java/org/projectnessie/cel/EvalDetails.java 100.00% <ø> (ø)
...re/src/main/java/org/projectnessie/cel/Issues.java 83.33% <ø> (ø)
core/src/main/java/org/projectnessie/cel/Prog.java 92.85% <ø> (ø)
...e/src/main/java/org/projectnessie/cel/ProgGen.java 100.00% <ø> (ø)
...e/src/main/java/org/projectnessie/cel/Program.java 100.00% <ø> (ø)
...java/org/projectnessie/cel/checker/CheckerEnv.java 77.70% <ø> (ø)
...main/java/org/projectnessie/cel/checker/Decls.java 88.88% <0.00%> (ø)
... and 57 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e01679...80dd52b. Read the comment docs.

@nastra nastra self-requested a review June 24, 2021 16:52
@nastra
Copy link

nastra commented Jun 24, 2021

thanks for the ping. will test+review tomorrow

snazy added 2 commits June 24, 2021 19:40
Introduces a Gradle plugin to scan the compiled classes and configuration-dependencies
for classes that require an entry in `reflection-config.json`.

With the generated `reflection-config.json` + `native-image.properties` the Graal
`native-image` tool has enough information to allow reflection for google-protobuf
generated files.
Copy link

@nastra nastra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for fixing


package org.projectnessie.cel.tools.plugins

import org.gradle.api.Project
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finally some Kotlin code, yay!

@snazy snazy merged commit 695fda7 into projectnessie:main Jun 25, 2021
@snazy snazy deleted the split-pb-impl branch June 25, 2021 07:27
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

Successfully merging this pull request may close these issues.

2 participants