File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed
main/groovy/io/spring/gradle/convention
test/java/io/spring/gradle/convention Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -33,8 +33,8 @@ class IncludeCheckRemotePlugin implements Plugin<Project> {
33
33
void apply (Project project ) {
34
34
IncludeCheckRemoteExtension extension = project. extensions. create(' includeCheckRemote' , IncludeCheckRemoteExtension )
35
35
TaskProvider<IncludeRepoTask > includeRepoTask = project. tasks. register(' includeRepo' , IncludeRepoTask ) { IncludeRepoTask it ->
36
- it. repository = extension. repository. get()
37
- it. ref = extension. ref. get()
36
+ it. repository = extension. repository
37
+ it. ref = extension. ref
38
38
}
39
39
project. tasks. register(' checkRemote' , GradleBuild ) {
40
40
it. dependsOn ' includeRepo'
@@ -44,22 +44,22 @@ class IncludeCheckRemotePlugin implements Plugin<Project> {
44
44
}
45
45
46
46
abstract static class IncludeCheckRemoteExtension {
47
+
47
48
/**
48
49
* Git repository to clone
49
50
*/
50
- abstract Property<String > getRepository ();
51
+ String repository;
52
+
51
53
/**
52
54
* Git ref to checkout
53
55
*/
54
- abstract Property<String > getRef ();
56
+ String ref
57
+
55
58
/**
56
59
* Task to run in the repository
57
60
*/
58
61
List<String > tasks = [' check' ]
59
62
60
- void setTask (List<String > tasks ) {
61
- this . tasks = tasks
62
- }
63
63
}
64
64
65
65
}
Original file line number Diff line number Diff line change @@ -97,4 +97,15 @@ void applyWhenRegisterTasksThenCheckRemoteDirSameAsIncludeRepoOutputDir() {
97
97
GradleBuild checkRemote = (GradleBuild ) this .rootProject .getTasks ().named ("checkRemote" ).get ();
98
98
assertThat (checkRemote .getDir ()).isEqualTo (includeRepo .getOutputDirectory ());
99
99
}
100
+
101
+ @ Test
102
+ void applyWhenNoExtensionPropertiesThenRegisterTasks () {
103
+ this .rootProject = ProjectBuilder .builder ().build ();
104
+ this .rootProject .getPluginManager ().apply (IncludeCheckRemotePlugin .class );
105
+ IncludeRepoTask includeRepo = (IncludeRepoTask ) this .rootProject .getTasks ().named ("includeRepo" ).get ();
106
+ GradleBuild checkRemote = (GradleBuild ) this .rootProject .getTasks ().named ("checkRemote" ).get ();
107
+ assertThat (includeRepo ).isNotNull ();
108
+ assertThat (checkRemote ).isNotNull ();
109
+ }
110
+
100
111
}
You can’t perform that action at this time.
0 commit comments