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

Fix Java 8 compatibiltiy #201

Merged
merged 1 commit into from
Jun 10, 2022
Merged

Conversation

snazy
Copy link
Member

@snazy snazy commented Jun 10, 2022

Although the CEL source code was always compatible with Java 8, the
compiled classes were not, because they were never build with
--release 8.

This change adds the changes to Java compilation.

CI didn't catch this issue bug, because the while build was run
with Java 8 and that caused the code to be built again against
Java 8.

So this change also updates the CI workflow to run the tests against
the classes built by Java 11.

@codecov
Copy link

codecov bot commented Jun 10, 2022

Codecov Report

Merging #201 (c8b0d17) into main (c44565d) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##               main     #201   +/-   ##
=========================================
  Coverage     80.37%   80.37%           
  Complexity     1835     1835           
=========================================
  Files           100      100           
  Lines          7899     7899           
  Branches       1143     1143           
=========================================
  Hits           6349     6349           
  Misses         1033     1033           
  Partials        517      517           
Flag Coverage Δ
java 80.37% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out 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 c44565d...c8b0d17. Read the comment docs.

Although the CEL source code was always compatible with Java 8, the
compiled classes were not, because they were never build with
`--release 8`.

This change adds the changes to Java compilation.

CI didn't catch this issue bug, because the while build was run
with Java 8 and that caused the code to be _built_ again against
Java 8.

So this change also updates the CI workflow to run the tests against
the classes built by Java 11.
@snazy snazy force-pushed the fix-java-8-compatibility branch from 61efe7b to c8b0d17 Compare June 10, 2022 14:51
Copy link
Contributor

@XN137 XN137 left a comment

Choose a reason for hiding this comment

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

+1 assuming testWithJava8 task gets executed in CI (even though i dont see it in logs atm)

.github/workflows/main.yml Show resolved Hide resolved
@@ -32,17 +32,46 @@ jobs:
with:
submodules: 'true'

# Special handling to test against Java 8:
# antlr version 4.10 requires Java 11 to run the antlr tool, but tests still need to run
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe extend to mention we compile with java11 as well but run with 8

uses: gradle/gradle-build-action@v2
with:
arguments: --rerun-tasks --info assemble check publishToMavenLocal -x jmh
arguments: --rerun-tasks assemble ${{ env.ADDITIONAL_GRADLE_OPTS }} check publishToMavenLocal -x jmh -x spotlessCheck
Copy link
Contributor

Choose a reason for hiding this comment

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

question: do the opts need to be inbetween task names? or could they come after --rerun-tasks instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

The order doesn't matter in this case.

val javaToolchains = extensions.findByType(JavaToolchainService::class.java)
if (javaToolchains != null) {
val testWithJava8 =
tasks.register<Test>("testWithJava8") {
Copy link
Contributor

Choose a reason for hiding this comment

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

doesnt this mean that gradle execution in CI should mention a testWithJava8 task being executed?
i am not seeing it in the CI run on this PR 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea - already fixed that

@snazy snazy merged commit da6dd16 into projectnessie:main Jun 10, 2022
@snazy snazy deleted the fix-java-8-compatibility branch June 10, 2022 15:21
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