-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace xjc with custom XSD Kotlin code gen (#1479)
* XSD Kotlin code gen * Disable test * Small cleanup to type generation * Renable one test * Fix a couple failing tests * Fix more tests, remove more JAXB * Fix bugs, remove unecessary null checks * Clean up warnings * Fix translator version number mismatches * Remove JAXB and Jackson modules --------- Co-authored-by: Jonathan Percival <[email protected]>
- Loading branch information
Showing
160 changed files
with
2,869 additions
and
2,202 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
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
42 changes: 42 additions & 0 deletions
42
Src/java/buildSrc/src/main/kotlin/cql.xjc-temp-conventions.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,42 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
kotlin("jvm") | ||
} | ||
|
||
val xjc: Configuration by configurations.creating | ||
|
||
dependencies { | ||
xjc("codes.rafael.jaxb2_commons:jaxb2-basics-ant:3.0.0") | ||
xjc("codes.rafael.jaxb2_commons:jaxb2-basics:3.0.0") | ||
xjc("codes.rafael.jaxb2_commons:jaxb2-fluent-api:3.0.0") | ||
// Eclipse has taken over all Java EE reference components | ||
// https://www.infoworld.com/article/3310042/eclipse-takes-over-all-java-ee-reference-components.html | ||
// https://wiki.eclipse.org/Jakarta_EE_Maven_Coordinates | ||
xjc("jakarta.xml.bind:jakarta.xml.bind-api:4.0.1") | ||
xjc("org.glassfish.jaxb:jaxb-xjc:3.0.2") | ||
xjc("org.glassfish.jaxb:jaxb-runtime:4.0.3") | ||
xjc("org.eclipse.persistence:org.eclipse.persistence.moxy:4.0.2") | ||
xjc("org.slf4j:slf4j-simple:1.7.36") | ||
xjc("org.apache.ant:ant:1.10.14") | ||
} | ||
|
||
var buildDir = project.layout.buildDirectory.get().toString() | ||
val destDir = "${buildDir}/generated/sources/$name-xjc-temp/main/java" | ||
|
||
tasks.withType<KotlinCompile>().configureEach { | ||
dependsOn(tasks.withType<XjcTask>()) | ||
} | ||
|
||
tasks.withType<JavaCompile>().configureEach { | ||
dependsOn(tasks.withType<XjcTask>()) | ||
} | ||
|
||
tasks.withType<XjcTask>().configureEach { | ||
outputDir = destDir | ||
outputs.dir(outputDir) | ||
} | ||
|
||
tasks.withType<Delete>().configureEach { | ||
delete(destDir) | ||
} |
50 changes: 50 additions & 0 deletions
50
Src/java/buildSrc/src/main/kotlin/cql.xsd-kotlin-gen-conventions.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,50 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
import com.github.gradle.node.task.NodeTask | ||
import org.gradle.kotlin.dsl.kotlin | ||
|
||
plugins { | ||
kotlin("jvm") | ||
kotlin("plugin.serialization") | ||
id("com.github.node-gradle.node") | ||
} | ||
|
||
dependencies { | ||
implementation("io.github.pdvrieze.xmlutil:core:0.90.3") | ||
implementation("io.github.pdvrieze.xmlutil:serialization:0.90.3") | ||
implementation("io.github.pdvrieze.xmlutil:serialization-jvm:0.90.3") | ||
|
||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.0") | ||
} | ||
|
||
node { | ||
download = true | ||
nodeProjectDir.set(file("../../js/xsd-kotlin-gen")) | ||
} | ||
|
||
val buildDir = project.layout.buildDirectory.get().toString() | ||
val destDir = "${buildDir}/generated/sources/$name/main/java" | ||
|
||
val runXsdKotlinGenTask = tasks.register<NodeTask>("runXsdKotlinGen") { | ||
dependsOn(tasks.npmInstall) | ||
script.set(file("../../js/xsd-kotlin-gen/generate.js")) | ||
} | ||
|
||
tasks.withType<KotlinCompile>().configureEach { | ||
dependsOn(runXsdKotlinGenTask) | ||
} | ||
|
||
tasks.withType<JavaCompile>().configureEach { | ||
dependsOn(runXsdKotlinGenTask) | ||
} | ||
|
||
tasks.withType<Delete>().configureEach { | ||
delete(destDir) | ||
} | ||
|
||
sourceSets { | ||
main { | ||
java { | ||
srcDir(destDir) | ||
} | ||
} | ||
} |
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
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
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
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
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
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
Oops, something went wrong.