Skip to content

Commit

Permalink
fix(build): JOOQ needs absolute path with Java 11 when Gradle dæmon i…
Browse files Browse the repository at this point in the history
…s used (#1426)
  • Loading branch information
robfletcher committed Aug 12, 2020
1 parent 0c3f500 commit 336e8ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
15 changes: 14 additions & 1 deletion keel-sql/keel-sql.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ch.ayedo.jooqmodelator.gradle.JooqModelatorTask
import com.diffplug.gradle.spotless.SpotlessExtension

plugins {
Expand Down Expand Up @@ -78,7 +79,7 @@ dependencies {
jooqModelator {
jooqVersion = "3.13.2"
jooqEdition = "OSS"
jooqConfigPath = "$projectDir/src/main/resources/jooqConfig.xml"
jooqConfigPath = "$buildDir/resources/main/jooqConfig.xml"
jooqOutputPath = "$projectDir/src/generated/java"
migrationEngine = "LIQUIBASE"
migrationsPaths = listOf("$projectDir/src/main/resources/db")
Expand All @@ -88,6 +89,18 @@ jooqModelator {
dockerContainerPort = 3306
}

// expand properties in jooqConfig.xml so it gets a fully-qualified directory to generate into
tasks.withType<ProcessResources> {
filesMatching("jooqConfig.xml") {
expand(project.properties)
}
}

// process resources before generating JOOQ stuff so we tokenize the config XML
tasks.withType<JooqModelatorTask> {
dependsOn("processResources")
}

// Don't enforce spotless for generated code
afterEvaluate {
configure<SpotlessExtension> {
Expand Down
3 changes: 2 additions & 1 deletion keel-sql/src/main/resources/jooqConfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
</database>
<target>
<packageName>com.netflix.spinnaker.keel.persistence.metamodel</packageName>
<directory>keel-sql/src/generated/java</directory>
<!-- tokenized by gradle's processResources task -->
<directory>$projectDir/src/generated/java</directory>
</target>
<generate>
<javaTimeTypes>true</javaTimeTypes>
Expand Down

0 comments on commit 336e8ac

Please sign in to comment.