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

Update dependency com.cjbooms:fabrikt to v16.6.0 #59

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repositories {
}

dependencies {
implementation("com.cjbooms:fabrikt:16.5.0")
implementation("com.cjbooms:fabrikt:16.6.0")
testImplementation(kotlin("test"))
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ internal fun GenerateTaskConfiguration.copy(block: GenerateTaskConfiguration.()
generate.set([email protected])
resilience4j.set([email protected])
suspendModifier.set([email protected])
springResponseEntityWrapper.set([email protected])
target.set([email protected])
}
controller.apply {
Expand Down Expand Up @@ -204,6 +205,10 @@ open class GenerateClientConfiguration @Inject constructor(objects: ObjectFactor
@get:Optional
val suspendModifier: Property<Boolean> = objects.property(Boolean::class.java)

@get:Input
@get:Optional
val springResponseEntityWrapper: Property<Boolean> = objects.property(Boolean::class.java)

@get:Input
@get:Optional
val target: Property<ClientTargetOption> = objects.property(ClientTargetOption::class.java)
Expand Down Expand Up @@ -232,6 +237,10 @@ open class GenerateControllerConfiguration @Inject constructor(objects: ObjectFa
@get:Optional
val suspendModifier: Property<Boolean> = objects.property(Boolean::class.java)

@get:Input
@get:Optional
val springResponseEntityWrapper: Property<Boolean> = objects.property(Boolean::class.java)

@get:Input
@get:Optional
val target: Property<ControllerTargetOption> = objects.property(ControllerTargetOption::class.java)
Expand Down Expand Up @@ -435,6 +444,10 @@ open class GenerateClientDefaults @Inject constructor(objects: ObjectFactory) {
@get:Optional
val suspendModifier: Property<Boolean> = objects.property(Boolean::class.java).convention(false)

@get:Input
@get:Optional
val springResponseEntityWrapper: Property<Boolean> = objects.property(Boolean::class.java).convention(false)

@get:Input
@get:Optional
val target: Property<ClientTargetOption> = objects.property(ClientTargetOption::class.java)
Expand Down Expand Up @@ -543,6 +556,10 @@ internal fun GenerateTaskConfiguration.withDefaults(defaults: GenerateTaskDefaul
it.generate.setDefaultIfNotSet(client.generate, clientDefaults.generate)
it.resilience4j.setDefaultIfNotSet(client.resilience4j, clientDefaults.resilience4j)
it.suspendModifier.setDefaultIfNotSet(client.suspendModifier, clientDefaults.suspendModifier)
it.springResponseEntityWrapper.setDefaultIfNotSet(
client.springResponseEntityWrapper,
clientDefaults.springResponseEntityWrapper
)
it.target.setDefaultIfNotSet(client.target, clientDefaults.target)
}
cfg.controller.also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ internal data class FabriktArguments(private val config: GenerateTaskConfigurati
args.add(CodeGenerationType.CLIENT.name)
args.addIfEnabled(resilience4j, ARG_CLIENT_OPTS, ClientCodeGenOptionType.RESILIENCE4J)
args.addIfEnabled(suspendModifier, ARG_CLIENT_OPTS, ClientCodeGenOptionType.SUSPEND_MODIFIER)
args.addIfEnabled(
springResponseEntityWrapper,
ARG_CLIENT_OPTS,
ClientCodeGenOptionType.SPRING_RESPONSE_ENTITY_WRAPPER
)
target.orNull?.let {
args.add(ARG_CLIENT_TARGET)
args.add(it.fabriktOption.name)
Expand Down
4 changes: 4 additions & 0 deletions src/test/kotlin/ch/acanda/gradle/fabrikt/FabriktPluginTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ class FabriktPluginTest : WordSpec({
target.set(OpenFeign)
resilience4j.set(it.enabled)
suspendModifier.set(it.enabled)
springResponseEntityWrapper.set(it.enabled)
}
with(it.controller) {
generate.set(it.enabled)
target.set(Micronaut)
authentication.set(it.enabled)
suspendModifier.set(it.enabled)
springResponseEntityWrapper.set(it.enabled)
}
with(it.model) {
generate.set(it.disabled)
Expand Down Expand Up @@ -103,6 +105,7 @@ class FabriktPluginTest : WordSpec({
generate shouldContain true
resilience4j shouldContain true
suspendModifier shouldContain true
springResponseEntityWrapper shouldContain true
target shouldContain ClientTargetOption.OpenFeign
}
with(controller) {
Expand Down Expand Up @@ -162,6 +165,7 @@ class FabriktPluginTest : WordSpec({
target shouldContain ClientTargetOption.OkHttp
resilience4j shouldContain false
suspendModifier shouldContain false
springResponseEntityWrapper shouldContain false
}
with(controller) {
generate shouldContain false
Expand Down
1 change: 1 addition & 0 deletions src/test/kotlin/ch/acanda/gradle/fabrikt/Generators.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ internal val generateTaskConfigGen: Arb<GenerateTaskConfiguration> = arbitrary {
client.generate.set(Arb.boolean().orNull(0.2).bind())
client.resilience4j.set(Arb.boolean().orNull(0.2).bind())
client.suspendModifier.set(Arb.boolean().orNull(0.2).bind())
client.springResponseEntityWrapper.set(Arb.boolean().orNull(0.2).bind())
client.target.set(Arb.enum<ClientTargetOption>().orNull(0.2).bind())
controller.generate.set(Arb.boolean().orNull(0.2).bind())
controller.authentication.set(Arb.boolean().orNull(0.2).bind())
Expand Down
2 changes: 2 additions & 0 deletions src/test/kotlin/ch/acanda/gradle/fabrikt/GradleTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class GradleTest : StringSpec({
| target = OpenFeign
| resilience4j = enabled
| suspendModifier = enabled
| springResponseEntityWrapper = enabled
| }
| controller {
| generate = enabled
Expand Down Expand Up @@ -121,6 +122,7 @@ class GradleTest : StringSpec({
| target = OpenFeign
| resilience4j = enabled
| suspendModifier = enabled
| springResponseEntityWrapper = enabled
| }
| controller {
| generate = enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ class FabriktArgumentsTest : StringSpec({
ARG_CLIENT_OPTS,
ClientCodeGenOptionType.SUSPEND_MODIFIER
)
cliArgs.shouldContainOptionally(
springResponseEntityWrapper,
ARG_CLIENT_OPTS,
ClientCodeGenOptionType.SPRING_RESPONSE_ENTITY_WRAPPER
)
cliArgs.shouldContainOptionally(target, ARG_CLIENT_TARGET)

} else {
Expand Down