diff --git a/Src/java/buildSrc/src/main/kotlin/cql.xsd-kotlin-gen-conventions.gradle.kts b/Src/java/buildSrc/src/main/kotlin/cql.xsd-kotlin-gen-conventions.gradle.kts index f51aefe85..985ac06b1 100644 --- a/Src/java/buildSrc/src/main/kotlin/cql.xsd-kotlin-gen-conventions.gradle.kts +++ b/Src/java/buildSrc/src/main/kotlin/cql.xsd-kotlin-gen-conventions.gradle.kts @@ -22,7 +22,7 @@ node { } val buildDir = project.layout.buildDirectory.get().toString() -val destDir = "${buildDir}/generated/sources/$name/main/java" +val destDir = "${buildDir}/generated/sources/$name/main/kotlin" val runXsdKotlinGenTask = tasks.register("runXsdKotlinGen") { dependsOn(tasks.npmInstall) @@ -43,7 +43,7 @@ tasks.withType().configureEach { sourceSets { main { - java { + kotlin { srcDir(destDir) } } diff --git a/Src/java/buildSrc/src/main/kotlin/cql.xsd-kotlin-multiplatform-gen-conventions.gradle.kts b/Src/java/buildSrc/src/main/kotlin/cql.xsd-kotlin-multiplatform-gen-conventions.gradle.kts new file mode 100644 index 000000000..e4236d868 --- /dev/null +++ b/Src/java/buildSrc/src/main/kotlin/cql.xsd-kotlin-multiplatform-gen-conventions.gradle.kts @@ -0,0 +1,56 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import com.github.gradle.node.task.NodeTask +import gradle.kotlin.dsl.accessors._2dcd0a84416f85634c85a37519569374.sourceSets +import org.gradle.kotlin.dsl.kotlin + +plugins { + id("cql.kotlin-multiplatform-conventions") + kotlin("plugin.serialization") + id("com.github.node-gradle.node") +} + +val buildDir = project.layout.buildDirectory.get().toString() +val destDir = "${buildDir}/generated/sources/$name/commonMain/kotlin" + +kotlin { + sourceSets { + commonMain { + kotlin { + srcDir(destDir) + } + dependencies { + implementation("io.github.pdvrieze.xmlutil:core:0.90.3") + implementation("io.github.pdvrieze.xmlutil:serialization:0.90.3") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.0") + } + } + + jvmMain { + dependencies { + implementation("io.github.pdvrieze.xmlutil:serialization-jvm:0.90.3") + } + } + } +} + +node { + download = true + nodeProjectDir.set(file("../../js/xsd-kotlin-gen")) +} + +val runXsdKotlinGenTask = tasks.register("runXsdKotlinGen") { + dependsOn(tasks.npmInstall) + script.set(file("../../js/xsd-kotlin-gen/generate.js")) +} + +tasks.withType().configureEach { + dependsOn(runXsdKotlinGenTask) +} + +tasks.withType().configureEach { + dependsOn(runXsdKotlinGenTask) +} + +tasks.withType().configureEach { + delete(destDir) +} \ No newline at end of file diff --git a/Src/java/model/build.gradle.kts b/Src/java/model/build.gradle.kts index fab12acb4..68f8a8bb4 100644 --- a/Src/java/model/build.gradle.kts +++ b/Src/java/model/build.gradle.kts @@ -1,15 +1,14 @@ plugins { - id("cql.library-conventions") - id("cql.xjc-temp-conventions") - id("cql.xsd-kotlin-gen-conventions") + id("cql.xsd-kotlin-multiplatform-gen-conventions") } -tasks.register("generateModel") { - schema = "${projectDir}/../../cql-lm/schema/model/modelinfo.xsd" - extraArgs = listOf("-npa") -} -dependencies { - // circular dependency - testImplementation(project(":model-xmlutil")) +kotlin { + sourceSets { + jvmTest { + dependencies { + implementation(project(":model-xmlutil")) + } + } + } } \ No newline at end of file diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/BaseDataType.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/BaseDataType.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/BaseDataType.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/BaseDataType.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/ChoiceType.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ChoiceType.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/ChoiceType.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ChoiceType.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/ClassType.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ClassType.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/ClassType.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ClassType.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/ClassTypeElement.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ClassTypeElement.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/ClassTypeElement.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ClassTypeElement.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/DataType.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/DataType.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/DataType.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/DataType.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/GenericClassSignatureParser.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/GenericClassSignatureParser.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/GenericClassSignatureParser.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/GenericClassSignatureParser.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/InstantiationContext.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/InstantiationContext.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/InstantiationContext.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/InstantiationContext.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/IntervalType.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/IntervalType.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/IntervalType.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/IntervalType.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/InvalidRedeclarationException.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/InvalidRedeclarationException.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/InvalidRedeclarationException.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/InvalidRedeclarationException.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/ListType.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ListType.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/ListType.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ListType.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/ModelContext.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ModelContext.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/ModelContext.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ModelContext.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/ModelIdentifier.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ModelIdentifier.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/ModelIdentifier.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ModelIdentifier.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/ModelInfoProvider.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ModelInfoProvider.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/ModelInfoProvider.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ModelInfoProvider.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/NamedType.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/NamedType.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/NamedType.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/NamedType.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/NamespaceAware.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/NamespaceAware.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/NamespaceAware.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/NamespaceAware.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/NamespaceInfo.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/NamespaceInfo.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/NamespaceInfo.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/NamespaceInfo.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/NamespaceManager.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/NamespaceManager.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/NamespaceManager.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/NamespaceManager.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/ProfileType.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ProfileType.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/ProfileType.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/ProfileType.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/Relationship.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/Relationship.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/Relationship.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/Relationship.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/SearchType.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/SearchType.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/SearchType.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/SearchType.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/SimpleType.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/SimpleType.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/SimpleType.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/SimpleType.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/SystemModelInfoProvider.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/SystemModelInfoProvider.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/SystemModelInfoProvider.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/SystemModelInfoProvider.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/TupleType.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/TupleType.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/TupleType.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/TupleType.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/TupleTypeElement.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/TupleTypeElement.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/TupleTypeElement.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/TupleTypeElement.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/cql/model/TypeParameter.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/TypeParameter.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/cql/model/TypeParameter.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/cql/model/TypeParameter.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/elm_modelinfo/r1/serializing/BigDecimalSerializer.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/elm_modelinfo/r1/serializing/BigDecimalSerializer.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/elm_modelinfo/r1/serializing/BigDecimalSerializer.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/elm_modelinfo/r1/serializing/BigDecimalSerializer.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/elm_modelinfo/r1/serializing/ModelInfoReader.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/elm_modelinfo/r1/serializing/ModelInfoReader.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/elm_modelinfo/r1/serializing/ModelInfoReader.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/elm_modelinfo/r1/serializing/ModelInfoReader.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/elm_modelinfo/r1/serializing/ModelInfoReaderFactory.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/elm_modelinfo/r1/serializing/ModelInfoReaderFactory.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/elm_modelinfo/r1/serializing/ModelInfoReaderFactory.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/elm_modelinfo/r1/serializing/ModelInfoReaderFactory.kt diff --git a/Src/java/model/src/main/kotlin/org/hl7/elm_modelinfo/r1/serializing/ModelInfoReaderProvider.kt b/Src/java/model/src/commonMain/kotlin/org/hl7/elm_modelinfo/r1/serializing/ModelInfoReaderProvider.kt similarity index 100% rename from Src/java/model/src/main/kotlin/org/hl7/elm_modelinfo/r1/serializing/ModelInfoReaderProvider.kt rename to Src/java/model/src/commonMain/kotlin/org/hl7/elm_modelinfo/r1/serializing/ModelInfoReaderProvider.kt diff --git a/Src/java/model/src/main/resources/org/hl7/elm/r1/system-modelinfo.xml b/Src/java/model/src/commonMain/resources/org/hl7/elm/r1/system-modelinfo.xml similarity index 100% rename from Src/java/model/src/main/resources/org/hl7/elm/r1/system-modelinfo.xml rename to Src/java/model/src/commonMain/resources/org/hl7/elm/r1/system-modelinfo.xml diff --git a/Src/java/model/src/main/resources/META-INF/services/org.hl7.cql.model.ModelInfoProvider b/Src/java/model/src/jvmMain/resources/META-INF/services/org.hl7.cql.model.ModelInfoProvider similarity index 100% rename from Src/java/model/src/main/resources/META-INF/services/org.hl7.cql.model.ModelInfoProvider rename to Src/java/model/src/jvmMain/resources/META-INF/services/org.hl7.cql.model.ModelInfoProvider diff --git a/Src/java/model/src/test/java/org/hl7/cql/model/ChoiceTypeTests.java b/Src/java/model/src/jvmTest/resources/org/hl7/cql/model/ChoiceTypeTests.java similarity index 100% rename from Src/java/model/src/test/java/org/hl7/cql/model/ChoiceTypeTests.java rename to Src/java/model/src/jvmTest/resources/org/hl7/cql/model/ChoiceTypeTests.java diff --git a/Src/java/model/src/test/java/org/hl7/cql/model/GenericClassSignatureParserTest.java b/Src/java/model/src/jvmTest/resources/org/hl7/cql/model/GenericClassSignatureParserTest.java similarity index 100% rename from Src/java/model/src/test/java/org/hl7/cql/model/GenericClassSignatureParserTest.java rename to Src/java/model/src/jvmTest/resources/org/hl7/cql/model/GenericClassSignatureParserTest.java diff --git a/Src/java/model/src/test/java/org/hl7/cql/model/ModelInfoComparerTest.java b/Src/java/model/src/jvmTest/resources/org/hl7/cql/model/ModelInfoComparerTest.java similarity index 100% rename from Src/java/model/src/test/java/org/hl7/cql/model/ModelInfoComparerTest.java rename to Src/java/model/src/jvmTest/resources/org/hl7/cql/model/ModelInfoComparerTest.java diff --git a/Src/java/model/src/test/resources/org/hl7/cql/model/a-modelinfo.xml b/Src/java/model/src/jvmTest/resources/org/hl7/cql/model/a-modelinfo.xml similarity index 100% rename from Src/java/model/src/test/resources/org/hl7/cql/model/a-modelinfo.xml rename to Src/java/model/src/jvmTest/resources/org/hl7/cql/model/a-modelinfo.xml diff --git a/Src/java/model/src/test/resources/org/hl7/cql/model/b-modelinfo.xml b/Src/java/model/src/jvmTest/resources/org/hl7/cql/model/b-modelinfo.xml similarity index 100% rename from Src/java/model/src/test/resources/org/hl7/cql/model/b-modelinfo.xml rename to Src/java/model/src/jvmTest/resources/org/hl7/cql/model/b-modelinfo.xml diff --git a/Src/java/model/src/test/resources/org/hl7/cql/model/c-modelinfo.xml b/Src/java/model/src/jvmTest/resources/org/hl7/cql/model/c-modelinfo.xml similarity index 100% rename from Src/java/model/src/test/resources/org/hl7/cql/model/c-modelinfo.xml rename to Src/java/model/src/jvmTest/resources/org/hl7/cql/model/c-modelinfo.xml diff --git a/Src/java/model/src/test/resources/org/hl7/cql/model/fhir-modelinfo-4.0.1-1.5.1.xml b/Src/java/model/src/jvmTest/resources/org/hl7/cql/model/fhir-modelinfo-4.0.1-1.5.1.xml similarity index 100% rename from Src/java/model/src/test/resources/org/hl7/cql/model/fhir-modelinfo-4.0.1-1.5.1.xml rename to Src/java/model/src/jvmTest/resources/org/hl7/cql/model/fhir-modelinfo-4.0.1-1.5.1.xml diff --git a/Src/java/model/src/test/resources/org/hl7/cql/model/fhir-modelinfo-4.0.1-with-metadata.xml b/Src/java/model/src/jvmTest/resources/org/hl7/cql/model/fhir-modelinfo-4.0.1-with-metadata.xml similarity index 100% rename from Src/java/model/src/test/resources/org/hl7/cql/model/fhir-modelinfo-4.0.1-with-metadata.xml rename to Src/java/model/src/jvmTest/resources/org/hl7/cql/model/fhir-modelinfo-4.0.1-with-metadata.xml diff --git a/Src/java/model/src/test/resources/org/hl7/cql/model/fhir-modelinfo-4.0.1.xml b/Src/java/model/src/jvmTest/resources/org/hl7/cql/model/fhir-modelinfo-4.0.1.xml similarity index 100% rename from Src/java/model/src/test/resources/org/hl7/cql/model/fhir-modelinfo-4.0.1.xml rename to Src/java/model/src/jvmTest/resources/org/hl7/cql/model/fhir-modelinfo-4.0.1.xml diff --git a/Src/java/model/src/test/resources/org/hl7/cql/model/mat-fhir-modelinfo-4.0.1.xml b/Src/java/model/src/jvmTest/resources/org/hl7/cql/model/mat-fhir-modelinfo-4.0.1.xml similarity index 100% rename from Src/java/model/src/test/resources/org/hl7/cql/model/mat-fhir-modelinfo-4.0.1.xml rename to Src/java/model/src/jvmTest/resources/org/hl7/cql/model/mat-fhir-modelinfo-4.0.1.xml diff --git a/Src/java/model/src/test/resources/org/hl7/cql/model/new-fhir-modelinfo-4.0.1.xml b/Src/java/model/src/jvmTest/resources/org/hl7/cql/model/new-fhir-modelinfo-4.0.1.xml similarity index 100% rename from Src/java/model/src/test/resources/org/hl7/cql/model/new-fhir-modelinfo-4.0.1.xml rename to Src/java/model/src/jvmTest/resources/org/hl7/cql/model/new-fhir-modelinfo-4.0.1.xml diff --git a/Src/js/xsd-kotlin-gen/generate.js b/Src/js/xsd-kotlin-gen/generate.js index 58259d062..edbb1bdf5 100644 --- a/Src/js/xsd-kotlin-gen/generate.js +++ b/Src/js/xsd-kotlin-gen/generate.js @@ -170,7 +170,7 @@ const configs = [ xsd: __dirname + "/../../cql-lm/schema/model/modelinfo.xsd", outputDir: __dirname + - "/../../java/model/build/generated/sources/model/main/java/org/hl7/elm_modelinfo/r1", + "/../../java/model/build/generated/sources/model/commonMain/kotlin/org/hl7/elm_modelinfo/r1", packageName: "org.hl7.elm_modelinfo.r1", classes: {}, scope: "", @@ -184,7 +184,7 @@ const configs = [ xsd: __dirname + "/../../cql-lm/schema/elm/library.xsd", outputDir: __dirname + - "/../../java/elm/build/generated/sources/elm/main/java/org/hl7/elm/r1", + "/../../java/elm/build/generated/sources/elm/main/kotlin/org/hl7/elm/r1", packageName: "org.hl7.elm.r1", // autoExtend: "org.cqframework.cql.elm.tracking.Trackable", classes: {}, @@ -205,7 +205,7 @@ const configs = [ xsd: __dirname + "/../../cql-lm/schema/elm/cqlannotations.xsd", outputDir: __dirname + - "/../../java/elm/build/generated/sources/elm/main/java/org/hl7/cql_annotations/r1", + "/../../java/elm/build/generated/sources/elm/main/kotlin/org/hl7/cql_annotations/r1", packageName: "org.hl7.cql_annotations.r1", classes: {}, scope: "narrative",