Skip to content

Commit 169f2b5

Browse files
committed
allow multiple processor-dependencies for easier core update
1 parent bfe8231 commit 169f2b5

2 files changed

Lines changed: 20 additions & 7 deletions

File tree

src/main/groovy/com/github/hauner/openapi/gradle/OpenApiProcessorPlugin.groovy

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,28 @@ class OpenApiProcessorPlugin implements Plugin<Project> {
145145

146146
def project = task.getProject ()
147147
def handler = project.getDependencies ()
148-
Dependency api = handler.create("io.openapiprocessor:openapi-processor-api:${Version.api}")
148+
List<Dependency> dependencies = []
149149

150-
if (!config.processorLib) {
150+
if (config.dependencies.empty) {
151151
task.logger.warn ("'openapiProcessor.${name}.processor' not set!")
152152
}
153153

154-
Dependency dep = handler.create (config.processorLib)
154+
dependencies.add (handler.create(
155+
"io.openapiprocessor:openapi-processor-api:${Version.api}"))
155156

156-
Configuration cfg = project.getConfigurations ().detachedConfiguration (api, dep)
157+
config.dependencies.each {
158+
dependencies.add (handler.create (it))
159+
}
160+
161+
Dependency[] deps = dependencies.toArray (new Dependency[0])
162+
163+
Configuration cfg = project.getConfigurations ()
164+
.detachedConfiguration (deps)
165+
// needed ?
166+
// cfg.resolutionStrategy {
167+
// force ("io.openapiprocessor:openapi-processor-api:${Version.api}")
168+
// force (config.dependencies)
169+
// }
157170
cfg.setVisible (false)
158171
cfg.setTransitive (true)
159172
cfg.setDescription ("the dependencies of the process${name.capitalize ()} task.")

src/main/groovy/com/github/hauner/openapi/gradle/Processor.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Processor {
2828
public static final String TARGET_DIR = 'targetDir'
2929

3030
String name
31-
def processorLib // String | FileCollection...
31+
def dependencies = [] // String | FileCollection...
3232

3333
Map<String, Object> other = [:]
3434

@@ -37,11 +37,11 @@ class Processor {
3737
}
3838

3939
void processor (FileCollection fc) {
40-
processorLib = fc
40+
dependencies.add (fc)
4141
}
4242

4343
void processor (String dep) {
44-
processorLib = dep
44+
dependencies.add (dep)
4545
}
4646

4747
void targetDir (String targetDir) {

0 commit comments

Comments
 (0)