Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .kokoro/continuous/java11.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
}
7 changes: 7 additions & 0 deletions .kokoro/presubmit/java11.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ Java Version | Status
------------ | ------
Java 7 | [![Kokoro CI](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java7.svg)](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java7.html)
Java 8 | [![Kokoro CI](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java8.svg)](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java8.html)
Java 10 | [![Kokoro CI](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java10.svg)](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java10.html)
Java 11 | [![Kokoro CI](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java11.svg)](https://storage.googleapis.com/cloud-devrel-public/java/badges/google-api-java-client/java11.html)

## Dependencies
This library is built on top of two common libraries, also built by Google, and also designed to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,24 @@ private static ApiClientVersion getDefault() {

private static String getJavaVersion() {
String version = System.getProperty("java.version");
// Java 9 doesn't report a semver here: instead it's something like 9-Debian+0-x-y
if (version.startsWith("9")) {
return "9.0.0";
} else {
return formatSemver(version);
if (version == null) {
return null;
}

// Try parsing the full semver
String formatted = formatSemver(version, null);
if (formatted != null) {
return formatted;
}

// Some java versions start with the version number and may contain extra info
// e.g. Java 9 reports something like 9-Debian+0-x-y while Java 11 reports "11"
Matcher m = Pattern.compile("^(\\d+)[^\\d]?").matcher(version);
if (m.find()) {
return m.group(1) + ".0.0";
}

return null;
}

private static String formatName(String name) {
Expand All @@ -187,6 +199,10 @@ private static String formatName(String name) {
}

private static String formatSemver(String version) {
return formatSemver(version, version);
}

private static String formatSemver(String version, String defaultValue) {
if (version == null) {
return null;
}
Expand All @@ -196,7 +212,7 @@ private static String formatSemver(String version) {
if (m.find()) {
return m.group(1);
} else {
return version;
return defaultValue;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down Expand Up @@ -386,7 +386,7 @@
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
<doclint>none</doclint>
</configuration>
<executions>
<execution>
Expand Down