Skip to content

Commit 9b39279

Browse files
committed
chore: refactor build scripts and add prepareSpecs task
1 parent e35c0f7 commit 9b39279

File tree

5 files changed

+19
-14
lines changed

5 files changed

+19
-14
lines changed

build.gradle.kts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import java.time.Duration
21
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
import java.time.Duration
33

44
plugins {
55
kotlin("jvm") version "2.1.10"
@@ -63,10 +63,4 @@ kotlin {
6363
jvmToolchain(21)
6464
}
6565

66-
tasks.register("prepareSpecs") {
67-
dependsOn("mergeSpecs", "transformSpecs")
68-
69-
File("$rootDir", "specs/specs.yaml")
70-
}
71-
7266
apply("gradle-tasks/specs.gradle.kts")

generator/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import org.openapitools.codegen.CodegenConstants
2-
import com.expediagroup.sdk.xap.generator.mustache.AllowedMediaTypesLambda
2+
// import com.expediagroup.sdk.xap.generator.mustache.AllowedMediaTypesLambda
33

44
plugins {
55
`kotlin-dsl`
@@ -43,8 +43,8 @@ openApiGenerate {
4343
configFile = "$projectDir/src/main/resources/generator-config.yaml"
4444
outputDir = "$rootDir/xap-sdk/src/main/kotlin"
4545

46-
additionalProperties.put(CodegenConstants.ENUM_PROPERTY_NAMING, "UPPERCASE")
47-
additionalProperties.put("allowedMediaTypes", AllowedMediaTypesLambda())
46+
additionalProperties.put(CodegenConstants.ENUM_PROPERTY_NAMING.toString(), "UPPERCASE")
47+
// additionalProperties.put("allowedMediaTypes", AllowedMediaTypesLambda())
4848

4949
configOptions.put("sourceFolder", "")
5050

gradle-tasks/specs.gradle.kts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,18 @@ tasks.register("transformSpecs") {
1313
exec {
1414
commandLine(
1515
"npx --yes -p @expediagroup/spec-transformer cli --headers --operationIdsToTags -i specs.yaml -o specs.yaml"
16+
.split(" ")
1617
)
1718
workingDir = File(rootDir, "specs")
1819
}
1920
}
21+
22+
tasks.register("prepareSpecs") {
23+
dependsOn("mergeSpecs", "transformSpecs")
24+
25+
doLast {
26+
File("$rootDir", "specs/specs.yaml").copyTo(
27+
File("$rootDir", "generator/src/main/resources/specs-copied.yaml"),
28+
)
29+
}
30+
}

settings.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pluginManagement {
88
}
99
}
1010

11-
1211
plugins {
1312
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
1413
}

xap-sdk/build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ gradle.taskGraph.whenReady {
118118
}
119119

120120
tasks.register("publishSnapshots") {
121-
val snapshotModules = rootProject.subprojects.filter { project ->
122-
project.version.toString().contains("-SNAPSHOT") && project.tasks.names.contains("publish")
123-
}
121+
val snapshotModules =
122+
rootProject.subprojects.filter { project ->
123+
project.version.toString().contains("-SNAPSHOT") && project.tasks.names.contains("publish")
124+
}
124125

125126
if (snapshotModules.isNotEmpty()) {
126127
dependsOn(snapshotModules.map { ":${it.name}:publish" })

0 commit comments

Comments
 (0)