Repository: googleapis/google-api-java-client
Pull request #2072 (2022-05-10 23:03:34)

fix(deps): update dependency com.google.appengine:appengine-api-1.0-sdk to v2.0.5
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.appengine:appengine-api-1.0-sdk](https://togithub.com/GoogleCloudPlatform/appengine-java-standard) | `2.0.4` -> `2.0.5` | [![age](https://badges.renovateapi.com/packages/maven/com.google.appengine:appengine-api-1.0-sdk/2.0.5/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.appengine:appengine-api-1.0-sdk/2.0.5/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.appengine:appengine-api-1.0-sdk/2.0.5/compatibility-slim/2.0.4)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.appengine:appengine-api-1.0-sdk/2.0.5/confidence-slim/2.0.4)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>GoogleCloudPlatform/appengine-java-standard</summary>

### [`v2.0.5`](https://togithub.com/GoogleCloudPlatform/appengine-java-standard/releases/v2.0.5)

[Compare Source](https://togithub.com/GoogleCloudPlatform/appengine-java-standard/compare/v2.0.4...v2.0.5)

v2.0.5

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/google-api-java-client).


Patch:
diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequest.java b/google-api-client/src/main/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequest.java
index 72ab6e93..3b8d3cc3 100644
--- a/google-api-client/src/main/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequest.java
+++ b/google-api-client/src/main/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequest.java
@@ -37,6 +37,7 @@ import com.google.api.client.http.HttpResponseInterceptor;
 import com.google.api.client.http.UriTemplate;
 import com.google.api.client.util.GenericData;
 import com.google.api.client.util.Preconditions;
+import com.google.common.base.Joiner;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -164,6 +165,16 @@ public abstract class AbstractGoogleClientRequest<T> extends GenericData {
     }
 
     public String toString() {
+      // When running the application as a native image, append `-graalvm` to the
+      // version.
+      String imageCode = System.getProperty("org.graalvm.nativeimage.imagecode");
+      if (imageCode != null && imageCode.equals("runtime")) {
+        String[] tokens = versionString.split(" ");
+        if (tokens.length > 0 && tokens[0].startsWith("gl-java")) {
+          tokens[0] += "-graalvm";
+          return Joiner.on(" ").join(tokens);
+        }
+      }
       return versionString;
     }
 
diff --git a/pom.xml b/pom.xml
index e58b6ba5..4f100493 100644
--- a/pom.xml
+++ b/pom.xml
@@ -501,7 +501,7 @@
     <project.gson.version>2.8.6</project.gson.version>
     <project.protobuf-java.version>3.20.1</project.protobuf-java.version>
     <project.guava.version>31.1-jre</project.guava.version>
-    <project.appengine.version>2.0.4</project.appengine.version>
+    <project.appengine.version>2.0.5</project.appengine.version>
     <project.xpp3.version>1.1.4c</project.xpp3.version>
     <project.jdo2-api.version>2.3-20090302111651</project.jdo2-api.version>
     <project.datanucleus-core.version>3.2.2</project.datanucleus-core.version>


Test patch:
diff --git a/google-api-client/src/test/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequestTest.java b/google-api-client/src/test/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequestTest.java
index 734e3900..1eefdb13 100644
--- a/google-api-client/src/test/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequestTest.java
+++ b/google-api-client/src/test/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequestTest.java
@@ -261,6 +261,14 @@ public class AbstractGoogleClientRequestTest extends TestCase {
     assertTrue("Api version should contain the os version", version.matches(".* my-os/1.2.3"));
   }
 
+  public void testSetsApiClientHeader_NativeImage() throws IOException {
+    System.setProperty("org.graalvm.nativeimage.imagecode", "runtime");
+    System.setProperty("java.version", "11.0.0");
+    String version = new ApiClientVersion().toString();
+    assertTrue(
+        "Api version should contain -graalvm suffix", version.matches("gl-java/11.0.0-graalvm.*"));
+  }
+
   public void testSetsApiClientHeaderWithoutOsVersion() {
     System.setProperty("os.name", "My OS");
     System.clearProperty("os.version");