This repository has been archived by the owner on Jan 4, 2024. It is now read-only.
forked from Adyen/adyen-java-api-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Move openapi tasks into buildSrc
- Loading branch information
Esteban Lopez Valecky
committed
Nov 11, 2023
1 parent
c50a2ce
commit a791c1c
Showing
2 changed files
with
61 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
buildSrc/src/main/kotlin/adyen-openapi-generator.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import com.adyen.gradle.OpenApiGeneratorAuthorTemplateTask | ||
import com.adyen.gradle.OpenApiGeneratorCloneSpec | ||
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask | ||
|
||
tasks { | ||
// -------------------- | ||
// Makefile alternative | ||
|
||
// alt to: make templates | ||
val authorTemplate = register<OpenApiGeneratorAuthorTemplateTask>("openapiAuthorTemplates") { | ||
group = "Adyen OpenAPI Tools" | ||
generator = "java" | ||
library = "jersey3" | ||
output = layout.buildDirectory.dir("templates") | ||
} | ||
// alt to: make target/spec | ||
val cloneSpec = register<OpenApiGeneratorCloneSpec>("openapiCloneSpec") { | ||
group = "Adyen OpenAPI Tools" | ||
apiSpecRepo = "https://github.com/Adyen/adyen-openapi.git" | ||
target = layout.buildDirectory.dir("spec") | ||
} | ||
|
||
// TODO: make a predefined list of models to generate and create subtasks from there | ||
|
||
// alt to: make models | ||
// where models is spec=BalanceControlService-v1 | ||
val models = register<GenerateTask>("openapiModelBalanceControlService-v1") { | ||
dependsOn(cloneSpec) | ||
group = "Adyen OpenAPI Tools" | ||
inputSpec = cloneSpec.get().target.dir("json/BalanceControlService-v1.json").get().asFile.toString() | ||
generatorName = "java" | ||
templateDir = layout.projectDirectory.dir("templates").asFile.toString() | ||
outputDir = layout.buildDirectory.dir("out").get().asFile.toString() | ||
reservedWordsMappings = mapOf("configuration" to "configuration") | ||
//ignoreFileOverride = ".openapi-generator-ignore" | ||
skipValidateSpec = true | ||
modelPackage = "com.adyen.model.balancecontrol" | ||
library = "jersey3" | ||
globalProperties = mapOf( | ||
"modelDocs" to "false", | ||
"modelTests" to "false" | ||
) | ||
inlineSchemaNameMappings = mapOf( | ||
"PaymentRequest_paymentMethod" to "CheckoutPaymentMethod", | ||
"DonationPaymentRequest_paymentMethod" to "DonationPaymentMethod" | ||
) | ||
additionalProperties = mapOf( | ||
"dateLibrary" to "java8", | ||
"openApiNullable" to false, | ||
"resourceClass" to "$(resourceClass)Resource" | ||
) | ||
} | ||
|
||
// alt to: make | ||
register("openapiGenerator") { | ||
group = "Adyen OpenAPI Tools" | ||
dependsOn(authorTemplate, models) | ||
} | ||
// -------------------- | ||
} |