Merge branch '5.8.x'

Closes gh-11769
This commit is contained in:
Marcus Da Coregio 2022-08-30 11:01:15 -03:00
commit 00584327bd
3 changed files with 38 additions and 0 deletions

View File

@ -189,6 +189,7 @@ tasks.register('checkSamples') {
includeCheckRemote {
repository = 'spring-projects/spring-security-samples'
ref = samplesBranch
buildScan = true
if (project.hasProperty("samplesInitScript")) {
initScripts = [samplesInitScript]
projectProperties = ["localRepositoryPath": localRepositoryPath, "springSecurityVersion": project.version]

View File

@ -39,6 +39,7 @@ class IncludeCheckRemotePlugin implements Plugin<Project> {
it.dependsOn 'includeRepo'
it.dir = includeRepoTask.get().outputDirectory
it.tasks = extension.getTasks()
it.startParameter.buildScan = extension.getBuildScan()
extension.getInitScripts().forEach {script ->
it.startParameter.addInitScript(new File(script))
}
@ -75,6 +76,11 @@ class IncludeCheckRemotePlugin implements Plugin<Project> {
*/
Map<String, String> projectProperties = [:]
/**
* Whether the Build Scan should be published
*/
boolean buildScan = false
}
}

View File

@ -145,4 +145,35 @@ class IncludeCheckRemotePluginTest {
assertThat(checkRemote).isNotNull();
}
@Test
void applyWhenNoBuildScanSpecifiedThenRegisterCheckRemoteTaskWithBuildScanFalse() {
this.rootProject = ProjectBuilder.builder().build();
this.rootProject.getPluginManager().apply(IncludeCheckRemotePlugin.class);
this.rootProject.getExtensions().configure(IncludeCheckRemotePlugin.IncludeCheckRemoteExtension.class,
(includeCheckRemoteExtension) -> {
includeCheckRemoteExtension.setProperty("repository", "my-project/my-repository");
includeCheckRemoteExtension.setProperty("ref", "main");
});
GradleBuild checkRemote = (GradleBuild) this.rootProject.getTasks().named("checkRemote").get();
assertThat(checkRemote).isNotNull();
assertThat(checkRemote.getStartParameter().isBuildScan()).isFalse();
}
@Test
void applyWhenBuildScanTrueThenRegisterCheckRemoteTaskWithBuildScanTrue() {
this.rootProject = ProjectBuilder.builder().build();
this.rootProject.getPluginManager().apply(IncludeCheckRemotePlugin.class);
this.rootProject.getExtensions().configure(IncludeCheckRemotePlugin.IncludeCheckRemoteExtension.class,
(includeCheckRemoteExtension) -> {
includeCheckRemoteExtension.setProperty("repository", "my-project/my-repository");
includeCheckRemoteExtension.setProperty("ref", "main");
includeCheckRemoteExtension.setProperty("buildScan", true);
});
GradleBuild checkRemote = (GradleBuild) this.rootProject.getTasks().named("checkRemote").get();
assertThat(checkRemote).isNotNull();
assertThat(checkRemote.getStartParameter().isBuildScan()).isTrue();
}
}