kennknowles commented on a change in pull request #11792: URL: https://github.com/apache/beam/pull/11792#discussion_r431350972
########## File path: runners/portability/java/build.gradle ########## @@ -31,9 +45,123 @@ dependencies { compile project(path: ":sdks:java:harness", configuration: "shadow") compile library.java.vendored_grpc_1_26_0 compile library.java.slf4j_api + testCompile project(path: ":runners:core-construction-java", configuration: "testRuntime") testCompile library.java.hamcrest_core testCompile library.java.junit testCompile library.java.mockito_core testCompile library.java.slf4j_jdk14 + + validatesRunner project(path: ":sdks:java:core", configuration: "shadowTest") + validatesRunner project(path: ":runners:core-java", configuration: "testRuntime") + validatesRunner project(path: project.path, configuration: "testRuntime") +} + + +project.evaluationDependsOn(":sdks:java:core") +project.evaluationDependsOn(":runners:core-java") + +ext.virtualenvDir = "${project.buildDir}/virtualenv" +ext.localJobServicePidFile = "${project.buildDir}/local_job_service_pid" +ext.localJobServicePortFile = project.hasProperty("localJobServicePortFile") ? project.property("localJobServicePortFile") : "${project.buildDir}/local_job_service_port" +ext.localJobServiceStdoutFile = "${project.buildDir}/local_job_service_stdout" + +ext.pythonSdkDir = "${project.rootDir}/sdks/python" + +void execInVirtualenv(String... args) { + String shellCommand = ". ${virtualenvDir}/bin/activate && " + args.collect { arg -> "'" + arg.replaceAll("'", "\\'") + "'" }.join(" ") + exec { + workingDir pythonSdkDir + commandLine "sh", "-c", shellCommand + } } + +void execBackgroundInVirtualenv(String... args) { + String shellCommand = ". ${virtualenvDir}/bin/activate && " + args.collect { arg -> "'" + arg.replaceAll("'", "\\'") + "'" }.join(" ") + println "execBackgroundInVirtualEnv: ${shellCommand}" + ProcessBuilder pb = new ProcessBuilder().redirectErrorStream(true).directory(new File(pythonSdkDir)).command(["sh", "-c", shellCommand]) + Process proc = pb.start(); + + // redirectIO does not work for connecting to groovy/gradle stdout + BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream())); + String line + while ((line = reader.readLine()) != null) { + println line + } + proc.waitFor(); +} + +task virtualenv { Review comment: I hey now I recall - `applyPythonNature` causes conflicting configurations. Really would like to move away from these nature things. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org