From c82b8546bc01cdf36f425e3bbbfc8bdd7eff05a9 Mon Sep 17 00:00:00 2001 From: Thad House Date: Sun, 12 Apr 2020 10:36:25 -0700 Subject: [PATCH] [build] Work around azure windows library loading issue (#2481) Temporary fix until actions/virtual-environments#707 is deployed. --- shared/javacpp/setupBuild.gradle | 13 +++++++++++++ shared/jni/setupBuild.gradle | 12 ++++++++++++ wpilibj/build.gradle | 13 +++++++++++++ 3 files changed, 38 insertions(+) diff --git a/shared/javacpp/setupBuild.gradle b/shared/javacpp/setupBuild.gradle index 04086ad4e5..8d994c242a 100644 --- a/shared/javacpp/setupBuild.gradle +++ b/shared/javacpp/setupBuild.gradle @@ -1,3 +1,5 @@ +import org.gradle.internal.os.OperatingSystem + apply plugin: 'cpp' apply plugin: 'google-test-test-suite' apply plugin: 'visual-studio' @@ -125,12 +127,23 @@ model { test.dependsOn it.tasks.install test.systemProperty 'java.library.path', filePath test.environment 'LD_LIBRARY_PATH', filePath + + // Workaround for Azure issue + if (OperatingSystem.current().isWindows() && System.getenv('AGENT_ID') != null) { + test.environment 'PATH', filePath + } + test.workingDir filePath run.dependsOn it.tasks.install run.systemProperty 'java.library.path', filePath run.environment 'LD_LIBRARY_PATH', filePath run.workingDir filePath + // Workaround for Azure issue + if (OperatingSystem.current().isWindows() && System.getenv('AGENT_ID') != null) { + run.environment 'PATH', filePath + } + found = true } } diff --git a/shared/jni/setupBuild.gradle b/shared/jni/setupBuild.gradle index 6c6148cfe4..8bdd8585c4 100644 --- a/shared/jni/setupBuild.gradle +++ b/shared/jni/setupBuild.gradle @@ -1,3 +1,5 @@ +import org.gradle.internal.os.OperatingSystem + apply plugin: 'cpp' apply plugin: 'google-test-test-suite' apply plugin: 'visual-studio' @@ -259,12 +261,22 @@ model { test.dependsOn it.tasks.install test.systemProperty 'java.library.path', filePath test.environment 'LD_LIBRARY_PATH', filePath + + // Workaround for Azure issue + if (OperatingSystem.current().isWindows() && System.getenv('AGENT_ID') != null) { + test.environment 'PATH', filePath + } test.workingDir filePath run.dependsOn it.tasks.install run.systemProperty 'java.library.path', filePath run.environment 'LD_LIBRARY_PATH', filePath run.workingDir filePath + // Workaround for Azure issue + if (OperatingSystem.current().isWindows() && System.getenv('AGENT_ID') != null) { + run.environment 'PATH', filePath + } + found = true } } diff --git a/wpilibj/build.gradle b/wpilibj/build.gradle index b2e22fb39d..95ec3c357d 100644 --- a/wpilibj/build.gradle +++ b/wpilibj/build.gradle @@ -1,3 +1,5 @@ +import org.gradle.internal.os.OperatingSystem + evaluationDependsOn(':hal') evaluationDependsOn(':ntcore') evaluationDependsOn(':cscore') @@ -142,12 +144,23 @@ model { test.dependsOn it.tasks.install test.systemProperty 'java.library.path', filePath test.environment 'LD_LIBRARY_PATH', filePath + + // Workaround for Azure issue + if (OperatingSystem.current().isWindows() && System.getenv('AGENT_ID') != null) { + test.environment 'PATH', filePath + } + test.workingDir filePath run.dependsOn it.tasks.install run.systemProperty 'java.library.path', filePath run.environment 'LD_LIBRARY_PATH', filePath run.workingDir filePath + // Workaround for Azure issue + if (OperatingSystem.current().isWindows() && System.getenv('AGENT_ID') != null) { + run.environment 'PATH', filePath + } + found = true } }