Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert cql-to-elm to Kotlin Multiplatform (Kotlin feature branch) #1495

Merged
merged 11 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

plugins {
kotlin("multiplatform")
id("com.diffplug.spotless")
id("io.gitlab.arturbosch.detekt")
id("org.jetbrains.dokka")
kotlin("plugin.serialization")
}

repositories {
Expand All @@ -18,6 +19,10 @@ spotless {
}

kotlin {
compilerOptions {
apiVersion.set(KotlinVersion.KOTLIN_2_0)
languageVersion.set(KotlinVersion.KOTLIN_2_0)
}
jvmToolchain(17)
jvm {
withJava()
Expand Down Expand Up @@ -65,16 +70,31 @@ kotlin {
generateTypeScriptDefinitions()
}

// Add Kotlin/WASM compilation target.
// The output is in the JS packages directory.
@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser { }
binaries.executable()
generateTypeScriptDefinitions()
}

sourceSets {
commonMain {
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")
implementation("org.jetbrains.kotlinx:kotlinx-io-core:0.6.0")
implementation("io.github.oshai:kotlin-logging:7.0.3")
}
}

jvmMain {
dependencies {
implementation("io.github.pdvrieze.xmlutil:serialization-jvm:0.90.3")
implementation("org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.6.0")
}
}

jsMain {
dependencies {
implementation("io.github.pdvrieze.xmlutil:core-js:0.90.3")
implementation("io.github.pdvrieze.xmlutil:serialization-js:0.90.3")
}
}

commonTest {
dependencies {
implementation(kotlin("test"))
Expand All @@ -86,6 +106,7 @@ kotlin {
implementation(kotlin("test-junit5"))
implementation("org.junit.jupiter:junit-jupiter")
implementation("org.slf4j:slf4j-simple:2.0.13")
implementation("org.hamcrest:hamcrest-all:1.3")
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
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")
}

Expand All @@ -18,17 +15,6 @@ kotlin {
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")
}
}
}
}
Expand Down
35 changes: 21 additions & 14 deletions Src/java/cql-to-elm/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
plugins {
id("cql.library-conventions")
id("cql.kotlin-multiplatform-conventions")
}

dependencies {
api(project(":cql"))
api(project(":model"))
api(project(":elm"))

implementation("org.jetbrains.kotlinx:kotlinx-io-core-jvm:0.6.0")

testImplementation(project(":elm-xmlutil"))
testImplementation(project(":model-xmlutil"))
testImplementation(project(":quick"))
testImplementation(project(":qdm"))
testImplementation(project(":ucum"))
testImplementation("com.tngtech.archunit:archunit:1.2.1")
kotlin {
sourceSets {
commonMain {
dependencies {
api(project(":cql"))
api(project(":model"))
api(project(":elm"))
implementation(project(":elm-xmlutil"))
implementation(project(":model-xmlutil"))
}
}
jvmTest {
dependencies {
implementation(project(":quick"))
implementation(project(":qdm"))
implementation(project(":ucum"))
implementation("com.tngtech.archunit:archunit:1.2.1")
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.cqframework.cql.cql2elm

import java.util.*
import org.hl7.cql_annotations.r1.CqlToElmBase
import org.hl7.cql_annotations.r1.CqlToElmInfo
import org.hl7.elm.r1.Library
import kotlin.jvm.JvmStatic

/** This class provides functions for extracting and parsing CQL Compiler Options from a Library */
object CompilerOptions {
Expand Down Expand Up @@ -37,7 +37,7 @@ object CompilerOptions {
}

/**
* Parses a string representing CQL compiler Options into an EnumSet. The string is expected to
* Parses a string representing CQL compiler Options into a Set. The string is expected to
* be a comma-delimited list of values from the CqlCompiler.Options enumeration. For example
* "EnableListPromotion, EnableListDemotion".
*
Expand All @@ -49,8 +49,8 @@ object CompilerOptions {
if (compilerOptions.isNullOrEmpty()) {
return null
}
val optionSet: EnumSet<CqlCompilerOptions.Options> =
EnumSet.noneOf(CqlCompilerOptions.Options::class.java)
val optionSet =
mutableSetOf<CqlCompilerOptions.Options>()
val options =
compilerOptions.trim { it <= ' ' }.split(",".toRegex()).dropLastWhile { it.isEmpty() }
for (option in options) {
Expand Down
Loading
Loading