File tree Expand file tree Collapse file tree
main/groovy/io/openapiprocessor/gradle
testInt/groovy/io/openapiprocessor/gradle Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -120,52 +120,16 @@ class OpenApiProcessorExtension {
120120
121121 // should be a nested processor configuration
122122 if (arg instanceof Closure ) {
123-
124123 // apply it to a new Processor () entry
125124 def processor = new Processor (name)
126- arg. delegate = processor
127- arg. resolveStrategy = Closure . DELEGATE_FIRST
128-
129- project. configure (project, wrapWithProjectDelegate (arg))
125+ project. configure (processor, arg)
130126 processors. put (name, processor)
131127 return processor
132128 }
133129
134130 throw new MissingMethodException (name, OpenApiProcessorExtension , args)
135131 }
136132
137- /**
138- * wraps the given closure with a closure that delegates to the project.
139- *
140- * this makes it possible to use any of the different dependency formats as value to the
141- * 'processor' property in a processor configuration block, e.g.
142- * <pre >
143- * ...
144- * spring {
145- * processor files ("../some/lib.jar")
146- * ....
147- * }
148- * ...
149- * </pre>
150- * or
151- * <pre >
152- * ...
153- * spring {
154- * processor "group:artifact:version"
155- * ....
156- * }
157- * ...
158- * </pre>
159- *
160- * @param processor configuration closure
161- * @return the created wrapper closure
162- */
163- private static Closure wrapWithProjectDelegate (Closure processor ) {
164- return {
165- processor. run ()
166- }
167- }
168-
169133 void apiPath (String apiPath ) {
170134 api. set (apiPath)
171135 }
Original file line number Diff line number Diff line change @@ -87,6 +87,15 @@ class Processor {
8787 }
8888
8989 def methodMissing (String name , def args ) {
90+ /*
91+ this way we could use processor (file ("...")) instead of processor (project.file ("..."))
92+
93+ def ignore = ['files']
94+ if (ignore.contains (name)) {
95+ throw new MissingMethodException(name, Processor, args)
96+ }
97+ */
98+
9099 if (args[0 ] instanceof Closure ) {
91100 def builder = new MapBuilder ()
92101 builder. with (args[0 ] as Closure )
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ class KotlinDslSpec extends PluginSpec {
2929 apiPath("\$ projectDir/src/api/openapi.yaml")
3030
3131 process("v1") {
32- processor(files("$projectDir /processor-v1/build/libs/processor-v1.jar"))
32+ processor(project. files("$projectDir /processor-v1/build/libs/processor-v1.jar"))
3333 targetDir("\$ buildDir/v1")
3434
3535 prop("v1", "value v1")
Original file line number Diff line number Diff line change @@ -30,21 +30,21 @@ class OpenApiProcessorPluginSpec extends PluginSpec {
3030 apiPath "\$ {projectDir}/src/api/openapi.yaml"
3131
3232 v1 {
33- processor files("${ projectDir} /processor-v1/build/libs/processor-v1.jar")
33+ processor project. files("${ projectDir} /processor-v1/build/libs/processor-v1.jar")
3434
3535 targetDir "\$ {buildDir}/v1"
3636 v1 "value v1"
3737 }
3838
3939 one {
40- processor files("${ projectDir} /processor-one/build/libs/processor-one.jar")
40+ processor project. files("${ projectDir} /processor-one/build/libs/processor-one.jar")
4141
4242 targetDir "\$ {buildDir}/one"
4343 other1 "value one"
4444 }
4545
4646 two {
47- processor files("${ projectDir} /processor-two/build/libs/processor-two.jar")
47+ processor project. files("${ projectDir} /processor-two/build/libs/processor-two.jar")
4848
4949 targetDir "\$ {buildDir}/two"
5050 other2 "value two"
You can’t perform that action at this time.
0 commit comments