Skip to content

Commit

Permalink
Run help on root project to speed up project probe
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Friend <jfriend@squareup.com>
  • Loading branch information
joshfriend committed Jan 9, 2024
1 parent b2ea733 commit 304eaa6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private GradleBuildConfiguration probe(GradleConnector connector) {
GradleBuildConfiguration version;
try (ProjectConnection connection = connector.forProjectDirectory(projectDir).connect()) {
BuildEnvironment buildEnvironment = connection.getModel(BuildEnvironment.class);
new ToolingApiGradleClient(connection).runTasks(ImmutableList.of("help"), ImmutableList.of("-I", initScript.getAbsolutePath()), ImmutableList.of());
new ToolingApiGradleClient(connection).runTasks(ImmutableList.of(":help"), ImmutableList.of("-I", initScript.getAbsolutePath()), ImmutableList.of());
BuildDetails buildDetails = readBuildDetails();
JavaEnvironment javaEnvironment = buildEnvironment.getJava();
List<String> allJvmArgs = new ArrayList<>(javaEnvironment.getJvmArguments());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ genrule(
assert find("<gradle-version: $gradleVersion>").size() == 17
assert find("<daemon: true").size() == 17
assert find("<daemon: false").size() == 0
assert find("<tasks: [help]>").size() == 1
assert find("<tasks: [:help]>").size() == 1
assert find("<tasks: [${tasks.join(", ")}]>").size() == 16
assert containsOne("<invocations: 16>")
}
Expand All @@ -274,7 +274,7 @@ genrule(
assert find("<gradle-version: $gradleVersion>").size() == 12
assert find("<daemon: true").size() == 12
assert find("<daemon: false").size() == 0
assert find("<tasks: [help]>").size() == 1
assert find("<tasks: [:help]>").size() == 1
assert find("<tasks: [${tasks.join(", ")}]>").size() == 11
assert find("<invocations: 1>").size() == 12
}
Expand All @@ -290,7 +290,7 @@ genrule(
assert find("<gradle-version: $gradleVersion>").size() == 12
assert find("<daemon: true").size() == 1
assert find("<daemon: false").size() == 11
assert find("<tasks: [help]>").size() == 1
assert find("<tasks: [:help]>").size() == 1
assert find("<tasks: [${tasks.join(", ")}]>").size() == 11
assert find("<invocations: 1>").size() == 12
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class BenchmarkIntegrationTest extends AbstractProfilerIntegrationTest {
// Probe version, 6 warm up, 10 builds
logFile.find("<gradle-version: $minimalSupportedGradleVersion>").size() == 10
logFile.find("<gradle-version: 5.0>").size() == 17
logFile.find("<tasks: [help]>").size() == 2
logFile.find("<tasks: [:help]>").size() == 2
logFile.find("<tasks: [assemble]>").size() == 9 + 16

def lines = resultFile.lines
Expand Down Expand Up @@ -54,7 +54,7 @@ class BenchmarkIntegrationTest extends AbstractProfilerIntegrationTest {
// Probe version, 6 warm up, 10 builds
logFile.find("<gradle-version: $minimalSupportedGradleVersion>").size() == 5
logFile.find("<gradle-version: 5.0>").size() == 17
logFile.find("<tasks: [help]>").size() == 2
logFile.find("<tasks: [:help]>").size() == 2
logFile.find("<tasks: [assemble]>").size() == 4 + 16

def lines = resultFile.lines
Expand Down Expand Up @@ -91,7 +91,7 @@ class BenchmarkIntegrationTest extends AbstractProfilerIntegrationTest {
// Probe version, 6 warm up, 10 builds
logFile.find("<gradle-version: $minimalSupportedGradleVersion>").size() == 2
logFile.find("<gradle-version: 5.0>").size() == 17
logFile.find("<tasks: [help]>").size() == 2
logFile.find("<tasks: [:help]>").size() == 2
logFile.find("<tasks: [assemble]>").size() == 1 + 16

def lines = resultFile.lines
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ class ProfilerIntegrationTest extends AbstractProfilerIntegrationTest {
logFile.find("<gradle-version: $latestSupportedGradleVersion").size() == 17
logFile.find("<daemon: true").size() == 2 + 16 * 2
logFile.find("<daemon: false").size() == 11
logFile.find("<tasks: [help]>").size() == 2 + 11
logFile.find("<tasks: [:help]>").size() == 2 + 11
logFile.find("<tasks: [assemble]>").size() == 16 * 2

logFile.containsOne("* Running scenario assemble using Gradle $latestSupportedGradleVersion (scenario 1/3)")
Expand Down Expand Up @@ -461,7 +461,7 @@ class ProfilerIntegrationTest extends AbstractProfilerIntegrationTest {
// Probe version, 6 warm up, 10 builds
logFile.find("<gradle-version: $minimalSupportedGradleVersion>").size() == 17
logFile.find("<daemon: true").size() == 17
logFile.find("<tasks: [help]>").size() == 1
logFile.find("<tasks: [:help]>").size() == 1
logFile.find("<tasks: []>").size() == 16

logFile.containsOne("* Running scenario xyz using Gradle $minimalSupportedGradleVersion (scenario 1/1)")
Expand Down Expand Up @@ -498,7 +498,7 @@ class ProfilerIntegrationTest extends AbstractProfilerIntegrationTest {

then:
logFile.find("<gradle-version: $minimalSupportedGradleVersion>").size() == 7
logFile.find("<tasks: [help]>").size() == 4
logFile.find("<tasks: [:help]>").size() == 4
logFile.find("<tasks: [assemble]>").size() == 3

logFile.containsOne("* Running scenario assemble using Gradle $minimalSupportedGradleVersion (scenario 1/2)")
Expand Down Expand Up @@ -533,7 +533,7 @@ class ProfilerIntegrationTest extends AbstractProfilerIntegrationTest {
then:
logFile.find("<gradle-version: $minimalSupportedGradleVersion>").size() == 7
logFile.find("<gradle-version: $latestSupportedGradleVersion>").size() == 7
logFile.find("<tasks: [help]>").size() == 8
logFile.find("<tasks: [:help]>").size() == 8
logFile.find("<tasks: [assemble]>").size() == 6

logFile.containsOne("* Running scenario assemble using Gradle $minimalSupportedGradleVersion (scenario 1/4)")
Expand Down Expand Up @@ -582,7 +582,7 @@ class ProfilerIntegrationTest extends AbstractProfilerIntegrationTest {
logFile.find("<gradle-version: $minimalSupportedGradleVersion>").size() == 7
logFile.find("<gradle-version: $latestSupportedGradleVersion>").size() == 7
logFile.find("<tasks: [assemble]>").size() == 6
logFile.find("<tasks: [help]>").size() == 8
logFile.find("<tasks: [:help]>").size() == 8

logFile.containsOne("* Running scenario assemble using Gradle $minimalSupportedGradleVersion (scenario 1/4)")
logFile.containsOne("* Running scenario assemble using Gradle $latestSupportedGradleVersion (scenario 2/4)")
Expand Down Expand Up @@ -618,7 +618,7 @@ class ProfilerIntegrationTest extends AbstractProfilerIntegrationTest {
then:
// Probe version, 6 warm up, 10 builds
logFile.find("<gradle-version: $minimalSupportedGradleVersion>").size() == 33
logFile.find("<tasks: [help]>").size() == 17
logFile.find("<tasks: [:help]>").size() == 17

def lines = resultFile.lines
lines.size() == totalLinesForExecutions(16)
Expand Down Expand Up @@ -693,7 +693,7 @@ class ProfilerIntegrationTest extends AbstractProfilerIntegrationTest {
logFile.find("<gradle-version: $latestSupportedGradleVersion").size() == 3
logFile.find("<dry-run: false>").size() == 2
logFile.find("<dry-run: true>").size() == 6
logFile.find("<tasks: [help]>").size() == 2
logFile.find("<tasks: [:help]>").size() == 2
logFile.find("<tasks: [assemble]>").size() == 4
logFile.find("<tasks: [clean, assemble]>").size() == 2

Expand Down

0 comments on commit 304eaa6

Please sign in to comment.