beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [1/2] incubator-beam git commit: [BEAM-357] Fix build on Windows
Date Wed, 06 Jul 2016 17:19:27 GMT
Repository: incubator-beam
Updated Branches:
  refs/heads/master 1a5dd59f0 -> 3bb78cb8e


[BEAM-357] Fix build on Windows


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/dc2532a4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/dc2532a4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/dc2532a4

Branch: refs/heads/master
Commit: dc2532a40950c8903b3c12b3977756016cb378e5
Parents: 1a5dd59
Author: Romain manni-Bucau <rmannibucau@gmail.com>
Authored: Wed Jun 22 10:42:45 2016 +0200
Committer: Jean-Baptiste Onofré <jbonofre@apache.org>
Committed: Wed Jul 6 19:05:29 2016 +0200

----------------------------------------------------------------------
 .../apache/beam/runners/flink/WriteSinkITCase.java    | 14 +++++++++++++-
 .../src/main/resources/beam/checkstyle.xml            |  5 ++++-
 .../java/org/apache/beam/sdk/io/FileBasedSink.java    |  7 ++++++-
 sdks/java/maven-archetypes/starter/pom.xml            |  6 ++++++
 4 files changed, 29 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/dc2532a4/runners/flink/runner/src/test/java/org/apache/beam/runners/flink/WriteSinkITCase.java
----------------------------------------------------------------------
diff --git a/runners/flink/runner/src/test/java/org/apache/beam/runners/flink/WriteSinkITCase.java
b/runners/flink/runner/src/test/java/org/apache/beam/runners/flink/WriteSinkITCase.java
index 36d3aef..f1d9097 100644
--- a/runners/flink/runner/src/test/java/org/apache/beam/runners/flink/WriteSinkITCase.java
+++ b/runners/flink/runner/src/test/java/org/apache/beam/runners/flink/WriteSinkITCase.java
@@ -35,6 +35,7 @@ import org.apache.flink.core.fs.Path;
 import org.apache.flink.test.util.JavaProgramTestBase;
 
 import java.io.File;
+import java.io.IOException;
 import java.io.PrintWriter;
 import java.net.URI;
 
@@ -53,7 +54,7 @@ public class WriteSinkITCase extends JavaProgramTestBase {
 
   @Override
   protected void preSubmit() throws Exception {
-    resultPath = getTempDirPath("result");
+    resultPath = getTempDirPath("result-" + System.nanoTime());
   }
 
   @Override
@@ -66,6 +67,17 @@ public class WriteSinkITCase extends JavaProgramTestBase {
     runProgram(resultPath);
   }
 
+  @Override
+  public void stopCluster() throws Exception {
+    try {
+      super.stopCluster();
+    } catch (final IOException ioe) {
+      if (ioe.getMessage().startsWith("Unable to delete file")) {
+        // that's ok for the test itself, just the OS playing with us on cleanup phase
+      }
+    }
+  }
+
   private static void runProgram(String resultPath) {
     Pipeline p = FlinkTestPipeline.createForBatch();
 

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/dc2532a4/sdks/java/build-tools/src/main/resources/beam/checkstyle.xml
----------------------------------------------------------------------
diff --git a/sdks/java/build-tools/src/main/resources/beam/checkstyle.xml b/sdks/java/build-tools/src/main/resources/beam/checkstyle.xml
index 311f599..63bab09 100644
--- a/sdks/java/build-tools/src/main/resources/beam/checkstyle.xml
+++ b/sdks/java/build-tools/src/main/resources/beam/checkstyle.xml
@@ -29,7 +29,10 @@ page at http://checkstyle.sourceforge.net/config.html -->
     <!-- Checks that there are no tab characters in the file. -->
   </module>
 
-  <module name="NewlineAtEndOfFile"/>
+  <module name="NewlineAtEndOfFile">
+    <!-- windows can use \n\r vs \n, so enforce the most used one ie UNIx style -->
+    <property name="lineSeparator" value="lf" />
+  </module>
 
   <module name="RegexpSingleline">
     <!-- Checks that TODOs don't have stuff in parenthesis, e.g., username. -->

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/dc2532a4/sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSink.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSink.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSink.java
index 02fc63a..8246148 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSink.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSink.java
@@ -38,6 +38,7 @@ import com.google.common.collect.Ordering;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.Serializable;
 import java.nio.channels.WritableByteChannel;
@@ -648,7 +649,11 @@ public abstract class FileBasedSink<T> extends Sink<T> {
     private void copyOne(String source, String destination) throws IOException {
       try {
         // Copy the source file, replacing the existing destination.
-        Files.copy(Paths.get(source), Paths.get(destination), StandardCopyOption.REPLACE_EXISTING);
+        // Paths.get(x) will not work on win cause of the ":" after the drive letter
+        Files.copy(
+                new File(source).toPath(),
+                new File(destination).toPath(),
+                StandardCopyOption.REPLACE_EXISTING);
       } catch (NoSuchFileException e) {
         LOG.debug("{} does not exist.", source);
         // Suppress exception if file does not exist.

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/dc2532a4/sdks/java/maven-archetypes/starter/pom.xml
----------------------------------------------------------------------
diff --git a/sdks/java/maven-archetypes/starter/pom.xml b/sdks/java/maven-archetypes/starter/pom.xml
index 5b6cb2a..7c16e82 100644
--- a/sdks/java/maven-archetypes/starter/pom.xml
+++ b/sdks/java/maven-archetypes/starter/pom.xml
@@ -60,6 +60,12 @@
               <goals>
                 <goal>integration-test</goal>
               </goals>
+              <configuration>
+                <!--
+                On windows EOL will be \n\r but we expect \n in tests.
+                -->
+                <ignoreEOLStyle>true</ignoreEOLStyle>
+              </configuration>
             </execution>
           </executions>
         </plugin>


Mime
View raw message