Skip to content

Commit 97ba2c7

Browse files
authored
Configure Kokoro CI for Windows (#716)
* 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
1 parent 3c91a65 commit 97ba2c7

File tree

5 files changed

+36
-16
lines changed

5 files changed

+36
-16
lines changed

.kokoro/build.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:: See documentation in type-shell-output.bat
2+
3+
"C:\Program Files\Git\bin\bash.exe" github/google-http-java-client/.kokoro/build.sh

.kokoro/continuous/java8-win.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
build_file: "google-http-java-client/.kokoro/build.bat"

.kokoro/presubmit/java8-win.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
build_file: "google-http-java-client/.kokoro/build.bat"

google-http-client/src/test/java/com/google/api/client/util/IOUtilsTest.java

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import java.io.File;
1818
import java.io.IOException;
19+
import java.nio.file.Files;
1920
import junit.framework.TestCase;
2021

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

45-
public void testIsSymbolicLink_true() throws IOException, InterruptedException {
46+
public void testIsSymbolicLink_true() throws IOException {
4647
File file = File.createTempFile("tmp", null);
4748
file.deleteOnExit();
4849
File file2 = new File(file.getCanonicalPath() + "2");
4950
file2.deleteOnExit();
50-
try {
51-
Process process =
52-
Runtime.getRuntime()
53-
.exec(new String[] {"ln", "-s", file.getCanonicalPath(), file2.getCanonicalPath()});
54-
process.waitFor();
55-
process.destroy();
56-
} catch (IOException e) {
57-
// ignore because ln command may not be defined
58-
return;
59-
}
60-
// multiple versions of jdk6 cannot detect the symbolic link. Consider support best-effort on
61-
// jdk6
62-
boolean jdk6 = System.getProperty("java.version").startsWith("1.6.0_");
63-
assertTrue(IOUtils.isSymbolicLink(file2) || jdk6);
51+
Files.createSymbolicLink(file2.toPath(), file.toPath());
52+
53+
assertTrue(IOUtils.isSymbolicLink(file2));
6454
}
6555
}
56+

pom.xml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@
372372
<configuration>
373373
<rules>
374374
<requireMavenVersion>
375-
<version>[3.5.4,4.0.0)</version>
375+
<version>[3.5.2,4.0.0)</version>
376376
</requireMavenVersion>
377377
</rules>
378378
</configuration>
@@ -558,6 +558,26 @@
558558
</properties>
559559

560560
<profiles>
561+
<profile>
562+
<id>Windows</id>
563+
<activation>
564+
<os>
565+
<family>windows</family>
566+
</os>
567+
</activation>
568+
<build>
569+
<plugins>
570+
<plugin>
571+
<groupId>org.apache.maven.plugins</groupId>
572+
<artifactId>maven-checkstyle-plugin</artifactId>
573+
<configuration>
574+
<skip>true</skip>
575+
</configuration>
576+
</plugin>
577+
</plugins>
578+
</build>
579+
</profile>
580+
561581
<profile>
562582
<id>release-sign-artifacts</id>
563583
<activation>

0 commit comments

Comments
 (0)