Skip to content

chore: centralize graal 23 downstream updates #3674

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Mar 17, 2025

Conversation

diegomarquezp
Copy link
Contributor

@diegomarquezp diegomarquezp commented Mar 4, 2025

Fixes #3638

Moves all added src/test/native-image configs done in HW repos. See:

Further investigation: some JUnit classes already existed in the production native image folder and some other JUnit classes had to be added in those configs. We need to find out why JUnit configs need to be in production native configs.

Local tests

java-spanner

googleapis/java-spanner#3687

[hi on] diegomarquezp@diegomarquezp:~/google/java-spanner$ git diff
diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml
index a460cc33..3bda6564 100644
--- a/google-cloud-spanner/pom.xml
+++ b/google-cloud-spanner/pom.xml
@@ -390,6 +390,7 @@
       <artifactId>gax</artifactId>
       <classifier>testlib</classifier>
       <scope>test</scope>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>com.google.api</groupId>
diff --git a/google-cloud-spanner/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-spanner/native-image.properties b/google-cloud-spanner/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-spanner/native-image.properties
deleted file mode 100644
index 383f5390..00000000
--- a/google-cloud-spanner/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-spanner/native-image.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-Args=--initialize-at-build-time=org.junit.runner.RunWith \
- --initialize-at-build-time=org.junit.experimental.categories.Category \
- --initialize-at-build-time=org.junit.runners.model.FrameworkField
...
[INFO] BUILD SUCCESS

java-logging

googleapis/java-logging#1778

[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  07:32 min
[INFO] Finished at: 2025-03-13T16:17:22Z
[INFO] ------------------------------------------------------------------------
[hi on] diegomarquezp@diegomarquezp:~/google/java-logging$ git diff
diff --git a/google-cloud-logging/pom.xml b/google-cloud-logging/pom.xml
index 46305c67..cb24da54 100644
--- a/google-cloud-logging/pom.xml
+++ b/google-cloud-logging/pom.xml
@@ -169,6 +169,13 @@
       <classifier>testlib</classifier>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>com.google.api</groupId>
+      <artifactId>gax</artifactId>
+      <classifier>testlib</classifier>
+      <scope>test</scope>
+      <version>2.62.1-SNAPSHOT</version>
+    </dependency>
   </dependencies>

   <build>
diff --git a/google-cloud-logging/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-logging/native-image.properties b/google-cloud-logging/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-logging/native-image.properties
deleted file mode 100644
index a62f3f19..00000000
--- a/google-cloud-logging/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-logging/native-image.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-Args=--initialize-at-build-time=org.junit.Ignore,\
-java.lang.annotation.Annotation,\
-org.junit.vintage.engine.discovery.FilterableIgnoringRunnerDecorator,\
-org.junit.runners.model.FrameworkField
[hi on] diegomarquezp@diegomarquezp:~/google/java-logging$

java-bigtable

googleapis/java-bigtable#2521

[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  15:43 min
[INFO] Finished at: 2025-03-13T16:24:19Z
[INFO] ------------------------------------------------------------------------
[hi on] diegomarquezp@diegomarquezp:~/google/java-bigtable$ git diff
diff --git a/google-cloud-bigtable-emulator/pom.xml b/google-cloud-bigtable-emulator/pom.xml
index 1d063a65..8f5be6df 100644
--- a/google-cloud-bigtable-emulator/pom.xml
+++ b/google-cloud-bigtable-emulator/pom.xml
@@ -120,6 +120,13 @@
       <groupId>com.google.api</groupId>
       <artifactId>gax-grpc</artifactId>
     </dependency>
+    <dependency>
+      <groupId>com.google.api</groupId>
+      <artifactId>gax</artifactId>
+      <version>2.62.1-SNAPSHOT</version>
+      <classifier>testlib</classifier>
+      <scope>test</scope>
+    </dependency>

     <dependency>
       <groupId>junit</groupId>
diff --git a/google-cloud-bigtable-emulator/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-bigtable-emulator/native-image.properties b/google-cloud-bigtable-emulator/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-bigtable-emulator/native-image.properties
deleted file mode 100644
index 0c5258dc..00000000
--- a/google-cloud-bigtable-emulator/src/test/resources/META-INF/native-image/com.google.cloud/google-cloud-bigtable-emulator/native-image.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-Args=--initialize-at-build-time=org.junit.runners.model.FrameworkField \
---initialize-at-build-time=org.junit.runner.RunWith \
---initialize-at-build-time=java.lang.annotation.Annotation
diff --git a/google-cloud-bigtable/pom.xml b/google-cloud-bigtable/pom.xml
index e36416b2..1204339a 100644
--- a/google-cloud-bigtable/pom.xml
+++ b/google-cloud-bigtable/pom.xml
@@ -81,6 +81,7 @@
     <dependency>
       <groupId>com.google.api</groupId>
       <artifactId>gax</artifactId>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>com.google.api.grpc</groupId>
@@ -248,6 +249,7 @@
       <artifactId>gax</artifactId>
       <classifier>testlib</classifier>
       <scope>test</scope>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <!-- Need testing utility classes for generated gRPC clients tests -->

java-pubsub

googleapis/java-pubsub#2368

[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  05:43 min
[INFO] Finished at: 2025-03-13T18:05:32Z
[INFO] ------------------------------------------------------------------------
[hi on] diegomarquezp@diegomarquezp:~/google/java-pubsub$ git diff
diff --git a/google-cloud-pubsub/pom.xml b/google-cloud-pubsub/pom.xml
index 1364c066..d0919326 100644
--- a/google-cloud-pubsub/pom.xml
+++ b/google-cloud-pubsub/pom.xml
@@ -61,6 +61,7 @@
     <dependency>
       <groupId>com.google.api</groupId>
       <artifactId>gax</artifactId>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>com.google.api</groupId>
@@ -175,6 +176,7 @@
       <artifactId>gax</artifactId>
       <classifier>testlib</classifier>
       <scope>test</scope>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>com.google.api</groupId>

java-firestore

googleapis/java-firestore#2041

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  18:50 min
[INFO] Finished at: 2025-03-13T18:53:36Z
[INFO] ------------------------------------------------------------------------
[hi on] diegomarquezp@diegomarquezp:~/google/java-firestore$ git status
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   google-cloud-firestore/pom.xml
        modified:   google-cloud-firestore/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-firestore/native-image.properties

no changes added to commit (use "git add" and/or "git commit -a")
[hi on] diegomarquezp@diegomarquezp:~/google/java-firestore$ git diff
diff --git a/google-cloud-firestore/pom.xml b/google-cloud-firestore/pom.xml
index 87579cce..716e7e77 100644
--- a/google-cloud-firestore/pom.xml
+++ b/google-cloud-firestore/pom.xml
@@ -162,6 +162,7 @@
       <artifactId>gax</artifactId>
       <classifier>testlib</classifier>
       <scope>test</scope>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>com.google.api</groupId>
diff --git a/google-cloud-firestore/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-firestore/native-image.properties b/google-cloud-firestore/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-firestore/native-image.properties
index 96207424..45007824 100644
--- a/google-cloud-firestore/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-firestore/native-image.properties
+++ b/google-cloud-firestore/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-firestore/native-image.properties
@@ -1,5 +1,3 @@
 # FirestoreImpl uses a random number generator so it needs to be initialized at
 # run-time.
-Args = --initialize-at-run-time=com.google.cloud.firestore.FirestoreImpl \
---initialize-at-build-time=org.junit.runner.RunWith,java.lang.annotation.Annotation \
---initialize-at-build-time=org.junit.Ignore,org.junit.runners.model.FrameworkField
\ No newline at end of file
+Args = --initialize-at-run-time=com.google.cloud.firestore.FirestoreImpl
\ No newline at end of file

java-spanner-jdbc

googleapis/java-spanner-jdbc#1954
Fails locally (may need further investigation on local) both using the in-repo config and the config in this PR via gax, after initializing the image, meaning that the configuration works but the failures are due to a separate issue.

java-storage-nio

googleapis/java-storage-nio#1559

[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  06:21 min
[INFO] Finished at: 2025-03-17T17:45:18Z
[INFO] ------------------------------------------------------------------------
[hi on] diegomarquezp@diegomarquezp:~/google/java-storage-nio$ git diff
diff --git a/google-cloud-nio/pom.xml b/google-cloud-nio/pom.xml
index e7989ac..3bf727a 100644
--- a/google-cloud-nio/pom.xml
+++ b/google-cloud-nio/pom.xml
@@ -33,6 +33,7 @@
     <dependency>
       <groupId>com.google.api</groupId>
       <artifactId>gax</artifactId>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>com.google.cloud</groupId>
@@ -61,6 +62,13 @@
       <groupId>com.google.code.findbugs</groupId>
       <artifactId>jsr305</artifactId>
     </dependency>
+    <dependency>
diff --git a/google-cloud-nio/pom.xml b/google-cloud-nio/pom.xml
index e7989ac..3bf727a 100644
--- a/google-cloud-nio/pom.xml
+++ b/google-cloud-nio/pom.xml
@@ -33,6 +33,7 @@
     <dependency>
       <groupId>com.google.api</groupId>
       <artifactId>gax</artifactId>
+      <version>2.62.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>com.google.cloud</groupId>
@@ -61,6 +62,13 @@
       <groupId>com.google.code.findbugs</groupId>
       <artifactId>jsr305</artifactId>
     </dependency>
+    <dependency>
+      <groupId>com.google.api</groupId>
+      <artifactId>gax</artifactId>
+      <version>2.62.1-SNAPSHOT</version>
+      <classifier>testlib</classifier>
+      <scope>test</scope>
+    </dependency>

     <dependency>
       <groupId>junit</groupId>
diff --git a/google-cloud-nio/src/main/resources/META-INF/native-image/com/google/cloud/google-cloud-nio/native-image.properties b/google-cloud-nio/src/main/resources/META-INF/native-image/com/google/cloud/google-cloud-nio/native-image.properties
index 1449dc0..be1730e 100644
--- a/google-cloud-nio/src/main/resources/META-INF/native-image/com/google/cloud/google-cloud-nio/native-image.properties
+++ b/google-cloud-nio/src/main/resources/META-INF/native-image/com/google/cloud/google-cloud-nio/native-image.properties
@@ -7,6 +7,3 @@
 Args = --initialize-at-build-time=com.google.cloud.storage.contrib.nio.CloudStorageFileSystemProvider,\
   com.google.cloud.storage.contrib.nio.CloudStorageConfiguration,\
   com.google.cloud.storage.contrib.nio.AutoValue_CloudStorageConfiguration,\
-  com.google.common.collect.RegularImmutableList,\
-  org.junit.runner.RunWith,java.lang.annotation.Annotation,\
-  org.junit.runners.model.FrameworkField

@product-auto-label product-auto-label bot added the size: xs Pull request size is extra small. label Mar 4, 2025
@diegomarquezp diegomarquezp marked this pull request as ready for review March 4, 2025 17:21
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you test in local that the GraalVM tests in downstream libraries still pass without the native-image.properties
in their repos?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a list of local test results in the description. I ended up further adjusting the configuration, so thanks!

@product-auto-label product-auto-label bot added size: s Pull request size is small. and removed size: xs Pull request size is extra small. labels Mar 10, 2025
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. and removed size: s Pull request size is small. labels Mar 10, 2025
Copy link

Copy link

Quality Gate Passed Quality Gate passed for 'java_showcase_integration_tests'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

Comment on lines +2 to +8
org.junit.experimental.categories.Category,\
org.junit.experimental.categories.CategoryValidator,\
org.junit.Ignore,\
org.junit.runner.RunWith,\
org.junit.runners.model.FrameworkField,\
org.junit.validator.AnnotationValidator,\
org.junit.vintage.engine.discovery.FilterableIgnoringRunnerDecorator
Copy link
Contributor

@lqiu96 lqiu96 Mar 14, 2025

Choose a reason for hiding this comment

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

q,, Is this only adding the junit configs because junit contains the common config between all the deps?

It's been a while since my release, but I recall storage-nio required some custom configurations: https://github.com/googleapis/java-storage-nio/blob/97c3624ac7e375621d78c7eea10b00359d7971fd/google-cloud-nio/src/main/resources/META-INF/native-image/com/google/cloud/google-cloud-nio/native-image.properties#L7-L12

I think one missing from there is guava's com.google.common.collect.RegularImmutableList, but not sure if adding that would mess with other downstream repos

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the catch. I was not aware that changes in storage-nio were necessary as well.
It should not break other repos since declaring the classes twice produces no problem.
I'm currently testing storage-nio after moving the configs to gax.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the relevant config and raise a PR to be merged once this one is released: googleapis/java-storage-nio#1559

@zhumin8
Copy link
Contributor

zhumin8 commented Mar 14, 2025

Further investigation: some JUnit classes already existed in the production native image folder and some other JUnit classes had to be added in those configs. We need to find out why JUnit configs need to be in production native configs.

Can you create an issue for this if we don't already have one? It sounds that we could potentially move to test configs instead.

@diegomarquezp
Copy link
Contributor Author

Further investigation: some JUnit classes already existed in the production native image folder and some other JUnit classes had to be added in those configs. We need to find out why JUnit configs need to be in production native configs.

Can you create an issue for this if we don't already have one? It sounds that we could potentially move to test configs instead.

Good idea, thanks. I created #3707.

Copy link
Contributor

@zhumin8 zhumin8 left a comment

Choose a reason for hiding this comment

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

LGTM

@diegomarquezp diegomarquezp merged commit 77aed97 into main Mar 17, 2025
51 of 52 checks passed
@diegomarquezp diegomarquezp deleted the centralize-graal-23-config branch March 17, 2025 18:04
diegomarquezp added a commit that referenced this pull request Mar 21, 2025
Follow up from #3674
Context: Some local changes were not pushed to that PR before it was
merged.
Main changes: 
 - include `src/test/.../native-image.properties` in testlib jar
- include java-storage-nio related classes for initialization at build
time
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
size: xs Pull request size is extra small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Centralize native image test configs
4 participants