beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From al...@apache.org
Subject [beam] branch master updated: [BEAM-11365] Direct Runner: Handle pipeline option string quotes under windows os
Date Wed, 02 Dec 2020 17:45:18 GMT
This is an automated email from the ASF dual-hosted git repository.

altay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new dfc3fea  [BEAM-11365] Direct Runner: Handle pipeline option string quotes under windows
os
     new 1e008f7  Merge pull request #13449 from Sealina/master
dfc3fea is described below

commit dfc3fea5df58ff6a362fc0dea1524c1fe2ae4dad
Author: Haizhou Zhao <zhaohaizhou940527@gmail.com>
AuthorDate: Mon Nov 30 18:32:07 2020 -0800

    [BEAM-11365] Direct Runner: Handle pipeline option string quotes under windows os
---
 runners/direct-java/build.gradle | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/runners/direct-java/build.gradle b/runners/direct-java/build.gradle
index 1fdba85..42e0aa5 100644
--- a/runners/direct-java/build.gradle
+++ b/runners/direct-java/build.gradle
@@ -95,14 +95,28 @@ dependencies {
   validatesRunner project(path: project.path, configuration: "shadowTest")
 }
 
+// windows handles quotes differently from linux,
+// on linux, the pipeline option string looks like
+// "--runner=DirectRunner", "--runnerDeterminedSharding=false"
+// on windows, the pipeline option string needs to be
+// "\"--runner=DirectRunner\"", "\"--runnerDeterminedSharding=false\""
+// to achieve the same effect
+static def pipelineOptionsStringCrossPlatformHandling(String[] options) {
+  if (System.properties['os.name'].toLowerCase().contains('windows')) {
+    return JsonOutput.toJson(options.collect { "\"$it\"" })
+  } else {
+    return JsonOutput.toJson(options)
+  }
+}
+
 task needsRunnerTests(type: Test) {
   group = "Verification"
   description = "Runs tests that require a runner to validate that piplines/transforms work
correctly"
 
   testLogging.showStandardStreams = true
 
-  def pipelineOptions = JsonOutput.toJson(["--runner=DirectRunner", "--runnerDeterminedSharding=false"])
-  systemProperty "beamTestPipelineOptions", pipelineOptions
+  String[] pipelineOptions = ["--runner=DirectRunner", "--runnerDeterminedSharding=false"]
+  systemProperty "beamTestPipelineOptions", pipelineOptionsStringCrossPlatformHandling(pipelineOptions)
 
   classpath = configurations.needsRunner
   // NOTE: We only add to the test class dirs to ensure that the direct runner
@@ -131,8 +145,8 @@ task validatesRunner(type: Test) {
   group = "Verification"
   description "Validates Direct runner"
 
-  def pipelineOptions = JsonOutput.toJson(["--runner=DirectRunner", "--runnerDeterminedSharding=false"])
-  systemProperty "beamTestPipelineOptions", pipelineOptions
+  String[] pipelineOptions = ["--runner=DirectRunner", "--runnerDeterminedSharding=false"]
+  systemProperty "beamTestPipelineOptions", pipelineOptionsStringCrossPlatformHandling(pipelineOptions)
 
   classpath = configurations.validatesRunner
   // NOTE: We only add to the test class dirs to ensure that the direct runner


Mime
View raw message