-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Gradle lazy configuration #69
Conversation
538d6e4
to
e44572d
Compare
Takes advantage of https://docs.gradle.org/current/userguide/lazy_configuration.html to instantiate configuration of the plugin's task so that when configuring the plugin it will only break if generateSwagger is run
e44572d
to
6858a24
Compare
@@ -93,14 +93,14 @@ To configure the generator, please use the `generateSwagger { }` block. Here an | |||
|
|||
```kotlin | |||
generateSwagger { | |||
platform = "kotlin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use the Groovy DSL here?
@@ -7,5 +7,5 @@ open class FeatureConfiguration { | |||
|
|||
@Input | |||
@Optional | |||
var headersToRemove: Array<String> = arrayOf() | |||
var headersToRemove: Array<String> = emptyArray() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be converted to a Provider
/Property
as well?
@@ -30,44 +33,51 @@ open class GenerateTask : DefaultTask() { | |||
@Input | |||
@Optional | |||
@Option(option = "platform", description = "Configures the platform that is used for generating the code.") | |||
var platform: String? = null | |||
var platformProvider: Provider<String> = project.objects.property(String::class.javaObjectType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name should not be changed here as this is part of the public API (same for all of them).
if (source != null && destin != null) { | ||
source.copyRecursively(destin, overwrite = true) | ||
} | ||
} | ||
|
||
private fun readVersionFromSpecfile(specFile: File) { | ||
val swaggerSpec = SwaggerParser().readWithInfo(specFile.absolutePath, listOf(), false).swagger | ||
specVersion = when (val version = swaggerSpec.info.version) { | ||
|
||
this.specVersionProvider = when (val version = swaggerSpec.info.version) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably don't need to re-assign this.specVersionProvider
here
@filipemp are you still working on this ? I might pick up where you left. |
Nope, go for it |
Takes advantage of
https://docs.gradle.org/current/userguide/lazy_configuration.html to
instantiate configuration of the plugin's task so that when configuring
the plugin it will only break if generateSwagger is run
Fixes #63