Skip to content

Commit

Permalink
Excavator: Upgrade gradle wrapper to the latest version (#2000)
Browse files Browse the repository at this point in the history
  • Loading branch information
svc-excavator-bot authored Feb 1, 2022
1 parent d5c219d commit 717bec1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.gradle.api.Task;
import org.gradle.api.artifacts.component.ModuleComponentIdentifier;
import org.gradle.api.artifacts.result.ResolvedComponentResult;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.SourceSet;
Expand Down Expand Up @@ -63,7 +62,7 @@ public void apply(Project project) {
}
});

project.getPlugins().withType(JavaPlugin.class, unusedPlugin -> {
project.getPluginManager().withPlugin("java-base", unusedPlugin -> {
TaskProvider<CheckJUnitDependencies> checkJUnitDependencies =
project.getTasks().register("checkJUnitDependencies", CheckJUnitDependencies.class);

Expand Down Expand Up @@ -120,8 +119,8 @@ private static void ifHasResolvedCompileDependenciesMatching(
.afterResolve(deps -> {
boolean anyMatch = deps.getResolutionResult().getAllComponents().stream()
.map(ResolvedComponentResult::getId)
.filter(componentId -> componentId instanceof ModuleComponentIdentifier)
.map(componentId -> (ModuleComponentIdentifier) componentId)
.filter(ModuleComponentIdentifier.class::isInstance)
.map(ModuleComponentIdentifier.class::cast)
.anyMatch(spec);

if (anyMatch) {
Expand Down Expand Up @@ -179,9 +178,9 @@ public static boolean useJUnitPlatformEnabled(Test task) {
if (GradleVersion.current().compareTo(GradleVersion.version("7.3")) < 0) {
return task.getOptions() instanceof JUnitPlatformOptions;
}
Property<org.gradle.api.internal.tasks.testing.TestFramework> testFramework =
getTestFrameworkWithReflection(task);
return testFramework.isPresent() && (testFramework.get().getOptions() instanceof JUnitPlatformOptions);
return getTestFrameworkWithReflection(task)
.map(org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestFramework.class::isInstance)
.getOrElse(false);
}

@SuppressWarnings("IllegalImports")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,19 @@ class BaselineTestingIntegrationTest extends IntegrationSpec {
file('src/integrationTest/java/test/TestClass5.java') << junit5Test

then:
runTasksSuccessfully('integrationTest')
// Explicitly testing broken state that needs fixing before gradle 8
runTasksSuccessfully('-DignoreDeprecations=true', 'integrationTest')
fileExists("build/reports/tests/integrationTest/classes/test.TestClass5.html")
}

def 'runs nebula-test version 10+ tests that require junit platform'() {
when:
buildFile << standardBuildFile

buildFile << '''
apply plugin: 'groovy'
dependencies {
testImplementation 'com.netflix.nebula:nebula-test:10.0.0'
testImplementation 'com.netflix.nebula:nebula-test:10.2.0'
}
'''.stripIndent(true)

Expand All @@ -128,11 +130,9 @@ class BaselineTestingIntegrationTest extends IntegrationSpec {
}
'''.stripIndent(true)

when:
runTasksSuccessfully('test')

then:
true
// Explicitly testing broken state that needs fixing before gradle 8
runTasksSuccessfully('-DignoreDeprecations=true', 'test')
}

def 'checkJUnitDependencies ensures mixture of junit4 and 5 tests => legacy must be present'() {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 717bec1

Please sign in to comment.