beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lc...@apache.org
Subject [08/50] [abbrv] beam git commit: Simplify ApexYarnLauncher matching Attempt to create dependency tree from Gradle to match the dependency-tree file that Apex relies on.
Date Fri, 17 Nov 2017 22:29:39 GMT
Simplify ApexYarnLauncher matching
Attempt to create dependency tree from Gradle to match the dependency-tree file that Apex
relies on.


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

Branch: refs/heads/master
Commit: 41d466bc288e6c51faefd7236b86e8f480537e51
Parents: 4562839
Author: Luke Cwik <lcwik@google.com>
Authored: Fri Nov 3 18:02:34 2017 -0700
Committer: Luke Cwik <lcwik@google.com>
Committed: Fri Nov 17 14:27:15 2017 -0800

----------------------------------------------------------------------
 runners/apex/build.gradle                         | 14 ++++++++++++--
 .../beam/runners/apex/ApexYarnLauncher.java       | 18 +++---------------
 2 files changed, 15 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/41d466bc/runners/apex/build.gradle
----------------------------------------------------------------------
diff --git a/runners/apex/build.gradle b/runners/apex/build.gradle
index 75393b4..496f00c 100644
--- a/runners/apex/build.gradle
+++ b/runners/apex/build.gradle
@@ -52,10 +52,20 @@ dependencies {
   testCompile library.java.jackson_dataformat_yaml
 }
 
-task testDependencyTree {
+// TODO: Update this so that the generated file is added to the explicitly added instead
of
+// just outputting the file in the correct path.
+task buildDependencyTree(type: DependencyReportTask) {
+  configurations = [project.configurations.runtimeClasspath]
+  outputFile = new File(buildDir, "classes/java/main/org/apache/beam/runners/apex/dependency-tree")
+  // TODO: Migrate ApexYarnLauncher to use the Gradles dependency tree output instead of
Mavens
+  // so we don't have to try to replace the format of the file on the fly
 
+  // TODO: Fix the regular expression replacement
+  doLast {
+    ant.replaceregexp(file: outputFile, match: "org.apache.hadoop[^:]*:[^:]*", replace: "\0:jar",
flags: "g")
+  }
 }
-test.dependsOn
+compileJava.dependsOn buildDependencyTree
 
 task packageTests(type: Jar) {
   from sourceSets.test.output

http://git-wip-us.apache.org/repos/asf/beam/blob/41d466bc/runners/apex/src/main/java/org/apache/beam/runners/apex/ApexYarnLauncher.java
----------------------------------------------------------------------
diff --git a/runners/apex/src/main/java/org/apache/beam/runners/apex/ApexYarnLauncher.java
b/runners/apex/src/main/java/org/apache/beam/runners/apex/ApexYarnLauncher.java
index 18d8e94..b1707e8 100644
--- a/runners/apex/src/main/java/org/apache/beam/runners/apex/ApexYarnLauncher.java
+++ b/runners/apex/src/main/java/org/apache/beam/runners/apex/ApexYarnLauncher.java
@@ -177,21 +177,9 @@ public class ApexYarnLauncher {
         List<String> excludes = new ArrayList<>();
         int excludeLevel = Integer.MAX_VALUE;
         while ((line = br.readLine()) != null) {
-          for (int i = 0; i < line.length(); i++) {
-            char c = line.charAt(i);
-            if (Character.isLetter(c)) {
-              if (i > excludeLevel) {
-                excludes.add(line.substring(i));
-              } else {
-                if (line.substring(i).startsWith("org.apache.hadoop")) {
-                  excludeLevel = i;
-                  excludes.add(line.substring(i));
-                } else {
-                  excludeLevel = Integer.MAX_VALUE;
-                }
-              }
-              break;
-            }
+          int startIndex = line.indexOf("org.apache.hadoop");
+          if (startIndex != -1) {
+            excludes.add(line.substring(startIndex));
           }
         }
 


Mime
View raw message