commit
00584327bd
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue