Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

filipemp
Copy link
Collaborator

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

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
@@ -93,14 +93,14 @@ To configure the generator, please use the `generateSwagger { }` block. Here an

```kotlin
generateSwagger {
platform = "kotlin"
Copy link
Collaborator

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()
Copy link
Collaborator

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)
Copy link
Collaborator

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) {
Copy link
Collaborator

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

@martinbonnin
Copy link
Contributor

@filipemp are you still working on this ? I might pick up where you left.

@filipemp
Copy link
Collaborator Author

filipemp commented Feb 3, 2020

@filipemp are you still working on this ? I might pick up where you left.

Nope, go for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the Gradle Plugin API to use Lazy Configuration
3 participants