-
Notifications
You must be signed in to change notification settings - Fork 119
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
feat(jdbc/postgres): add compatibility for GraalVM native image #805
feat(jdbc/postgres): add compatibility for GraalVM native image #805
Conversation
Converting to draft until Kokoro GraalVM Native test passes. |
With recent surefire plugin release (> 3.0 M4), we no longer need to specify old version. https://graalvm.github.io/native-build-tools/latest/maven-plugin.html#testing-support-version-compatibility
Kokoro started to receive the job. CC: @mpeddada1 |
Only "jdbc/postgres" succeeded out of jdbc/postgres jdbc/mysql-j-5 jdbc/mysql-j-8 jdbc/sqlserver r2dbc/sqlserver r2dbc/sqlserver r2dbc/mysql. |
Moving native-image-support to gax throws these exceptions:
Todo: Is there Cloud SQL-specific configuration in native-image-support, but not in GAX? |
CloudSqlFeature used to be in a different repository ( https://github.com/GoogleCloudPlatform/native-image-support-java). Moving the class to this file because t's better to move the GraalVM native-image configuration to the configured class.
pom.xml
Outdated
<assembly.skipAssembly>true</assembly.skipAssembly> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<!-- Forcing the versions for Enforcer's dependency convergence rule --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll think about what to do with these dependency convergence error.
Without these settings, the enforcer rule fails:
[INFO] --- maven-enforcer-plugin:3.0.0:enforce (enforce) @ cloud-sql-connector-r2dbc-core ---
Downloading from oss-sonatype-snapshots: https://oss.sonatype.org/content/repositories/snapshots/com/google/cloud/sql/cloud-sql-connector-r2dbc-core/1.5.1-SNAPSHOT/maven-metadata.xml
[WARNING]
Dependency convergence error for org.graalvm.nativeimage:svm:jar:22.0.0.2:provided paths to dependency are:
+-com.google.cloud.sql:cloud-sql-connector-r2dbc-core:jar:1.5.1-SNAPSHOT
+-com.google.cloud.sql:jdbc-socket-factory-core:jar:1.5.1-SNAPSHOT:compile
+-org.graalvm.nativeimage:svm:jar:22.0.0.2:provided
and
+-com.google.cloud.sql:cloud-sql-connector-r2dbc-core:jar:1.5.1-SNAPSHOT
+-io.netty:netty-handler:jar:4.1.75.Final:compile
+-io.netty:netty-common:jar:4.1.75.Final:compile
+-org.graalvm.nativeimage:svm:jar:19.3.6:provided
pom.xml
Outdated
<artifactId>svm</artifactId> | ||
<version>22.0.0.2</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this, the enforcer fails:
[WARNING]
Dependency convergence error for org.graalvm.nativeimage:svm:jar:22.0.0.2:provided paths to dependency are:
+-com.google.cloud.sql:cloud-sql-connector-r2dbc-core:jar:1.5.1-SNAPSHOT
+-com.google.cloud.sql:jdbc-socket-factory-core:jar:1.5.1-SNAPSHOT:compile
+-org.graalvm.nativeimage:svm:jar:22.0.0.2:provided
and
+-com.google.cloud.sql:cloud-sql-connector-r2dbc-core:jar:1.5.1-SNAPSHOT
+-io.netty:netty-handler:jar:4.1.75.Final:compile
+-io.netty:netty-common:jar:4.1.75.Final:compile
+-org.graalvm.nativeimage:svm:jar:19.3.6:provided
pom.xml
Outdated
<artifactId>protobuf-java</artifactId> | ||
<version>3.19.4</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this, enforcer fails:
Dependency convergence error for com.google.protobuf:protobuf-java:jar:3.19.4:compile paths to dependency are:
+-com.google.cloud.sql:mysql-socket-factory-connector-j-8:jar:1.5.1-SNAPSHOT
+-com.google.cloud.sql:jdbc-socket-factory-core:jar:1.5.1-SNAPSHOT:compile
+-com.google.api:gax:jar:2.16.0:compile
+-com.google.api.grpc:proto-google-common-protos:jar:2.8.3:compile
+-com.google.protobuf:protobuf-java:jar:3.19.4:compile
and
+-com.google.cloud.sql:mysql-socket-factory-connector-j-8:jar:1.5.1-SNAPSHOT
+-mysql:mysql-connector-java:jar:8.0.17:provided
+-com.google.protobuf:protobuf-java:jar:3.6.1:compile
pom.xml
Outdated
<artifactId>opencensus-api</artifactId> | ||
<version>0.31.0</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this, the enforcer fails:
Dependency convergence error for io.opencensus:opencensus-api:jar:0.31.0:compile paths to dependency are:
+-com.google.cloud.sql:mysql-socket-factory:jar:1.5.1-SNAPSHOT
+-com.google.cloud.sql:jdbc-socket-factory-core:jar:1.5.1-SNAPSHOT:compile
+-com.google.http-client:google-http-client:jar:1.41.6:compile
+-io.opencensus:opencensus-api:jar:0.31.0:compile
and
+-com.google.cloud.sql:mysql-socket-factory:jar:1.5.1-SNAPSHOT
+-com.google.cloud.sql:jdbc-socket-factory-core:jar:1.5.1-SNAPSHOT:compile
+-com.google.http-client:google-http-client:jar:1.41.6:compile
+-io.opencensus:opencensus-contrib-http-util:jar:0.31.0:compile
+-io.opencensus:opencensus-api:jar:0.31.0:compile
and
+-com.google.cloud.sql:mysql-socket-factory:jar:1.5.1-SNAPSHOT
+-com.google.cloud.sql:jdbc-socket-factory-core:jar:1.5.1-SNAPSHOT:compile
+-com.google.api:gax:jar:2.16.0:compile
+-io.opencensus:opencensus-api:jar:0.28.0:runtime
I think that's a good plan for now! It'll get our build passing while you figure out how to get the other modules working |
"Code Coverage / Coverage check" failed:
|
<id>prepare-agent</id> | ||
<goals> | ||
<goal>prepare-agent</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>report</id> | ||
<phase>test</phase> | ||
<goals> | ||
<goal>report</goal> | ||
</goals> | ||
<configuration> | ||
<excludes> | ||
<!-- Native image test is not part of coverage execution --> | ||
<exclude>com/google/cloud/sql/nativeimage/*</exclude> | ||
</excludes> | ||
</configuration> | ||
</execution> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Fixed strange indent) The real change is adding exclusion for com/google/cloud/sql/nativeimage package.
[kokoro] GraalVM Native / Linux — Internal CI build successful |
@shubha-rajan Thank you for response. Now this PR limits the scope to jdbc/postgres. PTAL. |
for test_directory in jdbc/postgres; do | ||
pushd ${test_directory} | ||
echo -e "******************** Running tests in ${test_directory} ********************\n" | ||
mvn -e -B clean verify -P e2e,native -Dcheckstyle.skip -Denforcer.skip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need checkstyle.skip and enforcer.skip? aren't those already scoped to a lint step?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without -Denforcer.skip
, the test-scoped dependency fails in native profile:
[INFO] --- maven-enforcer-plugin:3.0.0:enforce (enforce) @ jdbc-socket-factory-parent ---
[WARNING]
Dependency convergence error for org.junit.platform:junit-platform-commons:jar:1.8.2:test paths to dependency are:
+-com.google.cloud.sql:jdbc-socket-factory-parent:pom:1.5.1-SNAPSHOT
+-org.junit.vintage:junit-vintage-engine:jar:5.8.2:test
+-org.junit.platform:junit-platform-engine:jar:1.8.2:test
+-org.junit.platform:junit-platform-commons:jar:1.8.2:test
and
+-com.google.cloud.sql:jdbc-socket-factory-parent:pom:1.5.1-SNAPSHOT
+-org.graalvm.buildtools:junit-platform-native:jar:0.9.11:test
+-org.junit.jupiter:junit-jupiter:jar:5.8.1:test
+-org.junit.jupiter:junit-jupiter-api:jar:5.8.1:test
+-org.junit.platform:junit-platform-commons:jar:1.8.1:test
[WARNING]
Dependency convergence error for org.junit.platform:junit-platform-engine:jar:1.8.2:test paths to dependency are:
+-com.google.cloud.sql:jdbc-socket-factory-parent:pom:1.5.1-SNAPSHOT
+-org.junit.vintage:junit-vintage-engine:jar:5.8.2:test
+-org.junit.platform:junit-platform-engine:jar:1.8.2:test
and
+-com.google.cloud.sql:jdbc-socket-factory-parent:pom:1.5.1-SNAPSHOT
+-org.graalvm.buildtools:junit-platform-native:jar:0.9.11:test
+-org.junit.platform:junit-platform-launcher:jar:1.8.1:test
+-org.junit.platform:junit-platform-engine:jar:1.8.1:test
and
+-com.google.cloud.sql:jdbc-socket-factory-parent:pom:1.5.1-SNAPSHOT
+-org.graalvm.buildtools:junit-platform-native:jar:0.9.11:test
+-org.junit.jupiter:junit-jupiter:jar:5.8.1:test
+-org.junit.jupiter:junit-jupiter-engine:jar:5.8.1:test
+-org.junit.platform:junit-platform-engine:jar:1.8.1:test
The -Dcheckstyle.skip
is from the existing run_tests.sh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a source-code comment to explain that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer we'd rather:
- Remove
-Dcheckstyle.skip
, as we move that functionality to a profile, so I think this is just a leftover from that - Remove
-Denforcer.skip
and replace it with a dependencyManagement section for thenative
profile
I'll approve for now but count on @shubha-rajan to make sure the dependencyManagement section gets updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the guide. The two flags are now removed. A dependencyManagement section is added to native profile. 7b73562
for test_directory in jdbc/postgres; do | ||
pushd ${test_directory} | ||
echo -e "******************** Running tests in ${test_directory} ********************\n" | ||
mvn -e -B clean verify -P e2e,native -Dcheckstyle.skip -Denforcer.skip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer we'd rather:
- Remove
-Dcheckstyle.skip
, as we move that functionality to a profile, so I think this is just a leftover from that - Remove
-Denforcer.skip
and replace it with a dependencyManagement section for thenative
profile
I'll approve for now but count on @shubha-rajan to make sure the dependencyManagement section gets updated.
r2dbc/core/pom.xml
Outdated
<exclusions> | ||
<exclusion> | ||
<!-- | ||
Because this svn dependency is provided-scope, the users of this | ||
library don't get this svn dependency anyway. Explicitly excluding | ||
this dependency for the dependencyConvergence enforcer rule. | ||
--> | ||
<groupId>org.graalvm.nativeimage</groupId> | ||
<artifactId>svm</artifactId> | ||
</exclusion> | ||
</exclusions> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we scoped this to just jdbc/postgres for now, should we revert the changes to other files until you update them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted the changes under r2dbc modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But they needed to have svm
elements for dependencyManagement sections.
Waiting for updates to dependencyManagement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shubha-rajan PTAL.
<dependencyManagement> | ||
<!-- Controlling version for dependencyConvergence enforcer rule --> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.junit.platform</groupId> | ||
<artifactId>junit-platform-engine</artifactId> | ||
<version>1.8.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.platform</groupId> | ||
<artifactId>junit-platform-commons</artifactId> | ||
<version>1.8.2</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now "native" profile has this dependencyManagement section to control the enforcer rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thanks for doing that.
LGTM 🎉 |
Adding GraalVM native image test. For now, only for jdbc/postgres module passes. (Followup: #824 )
Corresponding change in Kokoro job config: cl/441468021
Change Description
This pull request sets up GraalVM native image tests. For now, only for jdbc/postgres module passes. (Followup: #824 )
Checklist
bug/issue
before writing your code! That way we can discuss the change, evaluate
designs, and agree on the general idea.
Relevant issues: