Skip to content

Commit

Permalink
Add Java 11 test configs (#1223)
Browse files Browse the repository at this point in the history
* Add Java 11 test configs

* Update README badges

* Update maven-javadoc-plugin for Java 11

* Fix X-Goog-Api-Client java version parsing for Java 11
  • Loading branch information
chingor13 authored Dec 12, 2018
1 parent f238d3c commit bee0525
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 9 deletions.
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

0 comments on commit bee0525

Please sign in to comment.