Skip to content

Commit

Permalink
Make Gradle IT tests debuggable (#58093)
Browse files Browse the repository at this point in the history
- This configures the testkit gradle runner to run with debug enabled automatically when
test is executed in debug mode (e.g. from the IDE)
- Allows step by step debugging of GradleIntegrationTestCase tests
  • Loading branch information
breskeby committed Jun 15, 2020
1 parent ce5b2ab commit e14926c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.lang.management.ManagementFactory;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
Expand Down Expand Up @@ -43,7 +44,11 @@ protected GradleRunner getGradleRunner(String sampleProject) {
} catch (IOException e) {
throw new UncheckedIOException(e);
}
return GradleRunner.create().withProjectDir(getProjectDir(sampleProject)).withPluginClasspath().withTestKitDir(testkit);
return GradleRunner.create()
.withProjectDir(getProjectDir(sampleProject))
.withPluginClasspath()
.withTestKitDir(testkit)
.withDebug(ManagementFactory.getRuntimeMXBean().getInputArguments().toString().indexOf("-agentlib:jdwp") > 0);
}

protected File getBuildDir(String name) {
Expand Down

0 comments on commit e14926c

Please sign in to comment.