Skip to content

Commit

Permalink
Configure Kokoro CI for Windows (#716)
Browse files Browse the repository at this point in the history
* Add windows 8 kokoro config

* Loosen maven requirements for the windows build

* Skip checkstyle on Windows (path exclusions don't behave on windows)

* Use nio for IOUtilsTest
  • Loading branch information
chingor13 authored Jun 16, 2019
1 parent 3c91a65 commit 97ba2c7
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .kokoro/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:: See documentation in type-shell-output.bat
"C:\Program Files\Git\bin\bash.exe" github/google-http-java-client/.kokoro/build.sh
3 changes: 3 additions & 0 deletions .kokoro/continuous/java8-win.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Format: //devtools/kokoro/config/proto/build.proto

build_file: "google-http-java-client/.kokoro/build.bat"
3 changes: 3 additions & 0 deletions .kokoro/presubmit/java8-win.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Format: //devtools/kokoro/config/proto/build.proto

build_file: "google-http-java-client/.kokoro/build.bat"
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import junit.framework.TestCase;

/**
Expand All @@ -42,24 +43,14 @@ public void testIsSymbolicLink_false() throws IOException {
assertFalse(IOUtils.isSymbolicLink(file));
}

public void testIsSymbolicLink_true() throws IOException, InterruptedException {
public void testIsSymbolicLink_true() throws IOException {
File file = File.createTempFile("tmp", null);
file.deleteOnExit();
File file2 = new File(file.getCanonicalPath() + "2");
file2.deleteOnExit();
try {
Process process =
Runtime.getRuntime()
.exec(new String[] {"ln", "-s", file.getCanonicalPath(), file2.getCanonicalPath()});
process.waitFor();
process.destroy();
} catch (IOException e) {
// ignore because ln command may not be defined
return;
}
// multiple versions of jdk6 cannot detect the symbolic link. Consider support best-effort on
// jdk6
boolean jdk6 = System.getProperty("java.version").startsWith("1.6.0_");
assertTrue(IOUtils.isSymbolicLink(file2) || jdk6);
Files.createSymbolicLink(file2.toPath(), file.toPath());

assertTrue(IOUtils.isSymbolicLink(file2));
}
}

22 changes: 21 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@
<configuration>
<rules>
<requireMavenVersion>
<version>[3.5.4,4.0.0)</version>
<version>[3.5.2,4.0.0)</version>
</requireMavenVersion>
</rules>
</configuration>
Expand Down Expand Up @@ -558,6 +558,26 @@
</properties>

<profiles>
<profile>
<id>Windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>release-sign-artifacts</id>
<activation>
Expand Down

0 comments on commit 97ba2c7

Please sign in to comment.