Skip to content

Commit

Permalink
Merge pull request #17643 from glefloch/fix/release-test
Browse files Browse the repository at this point in the history
Export maven.repo.local for gradle tests
  • Loading branch information
gsmet authored Jun 3, 2021
2 parents 707153c + 33bab86 commit e3cd280
Showing 1 changed file with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

Expand Down Expand Up @@ -54,16 +55,36 @@ void startGradleDaemon(boolean useWrapper) throws Exception {
gradle = ExecuteUtil.findExecutableFile("gradle");
}

CliDriver.Result result = CliDriver.executeArbitraryCommand(gradle.getAbsolutePath(), "--daemon", "-q",
"--project-dir=" + project.toAbsolutePath());
List<String> args = new ArrayList<>();
args.add(gradle.getAbsolutePath());
args.add("--daemon");
args.add("-q");
args.add("--project-dir=" + project.toAbsolutePath());

String localMavenRepo = System.getProperty("maven.repo.local", null);
if (localMavenRepo != null) {
args.add("-Dmaven.repo.local=" + localMavenRepo);
}

CliDriver.Result result = CliDriver.executeArbitraryCommand(args.toArray(new String[0]));
Assertions.assertEquals(0, result.exitCode, "Gradle daemon should start properly");
}

@AfterEach
void stopGradleDaemon() throws Exception {
if (gradle != null) {
CliDriver.Result result = CliDriver.executeArbitraryCommand(gradle.getAbsolutePath(), "--stop",
"--project-dir=" + project.toAbsolutePath());

List<String> args = new ArrayList<>();
args.add(gradle.getAbsolutePath());
args.add("--stop");
args.add("--project-dir=" + project.toAbsolutePath());

String localMavenRepo = System.getProperty("maven.repo.local", null);
if (localMavenRepo != null) {
args.add("-Dmaven.repo.local=" + localMavenRepo);
}

CliDriver.Result result = CliDriver.executeArbitraryCommand(args.toArray(new String[0]));
Assertions.assertEquals(0, result.exitCode, "Gradle daemon should stop properly");
}
}
Expand Down

0 comments on commit e3cd280

Please sign in to comment.