Skip to content

Commit

Permalink
Export maven.repo.local for gradle tests
Browse files Browse the repository at this point in the history
  • Loading branch information
glefloch committed Jun 3, 2021
1 parent cc94f11 commit 33bab86
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 33bab86

Please sign in to comment.