plugins { kotlin("multiplatform") kotlin("plugin.serialization") id("com.android.library") `maven-publish` } group = "cc.unitmesh" version = project.findProperty("mppVersion") as String? ?: "0.1.5" repositories { google() mavenCentral() } // Force consistent Kotlin stdlib version across all dependencies configurations.all { resolutionStrategy { force("org.jetbrains.kotlin:kotlin-stdlib:2.2.0") force("org.jetbrains.kotlin:kotlin-stdlib-common:2.2.0") force("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.2.0") force("org.jetbrains.kotlin:kotlin-reflect:2.2.0") } } android { namespace = "cc.unitmesh.xiuper.ui" compileSdk = 34 defaultConfig { minSdk = 24 } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } } kotlin { jvmToolchain(17) androidTarget { compilerOptions { jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17) } } // JVM target jvm() // JS target (Node.js) js(IR) { nodejs() binaries.library() } // WasmJs target @OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class) wasmJs { browser() nodejs() } // iOS targets listOf( iosX64(), iosArm64(), iosSimulatorArm64() ).forEach { iosTarget -> iosTarget.binaries.framework { baseName = "XiuperUI" isStatic = true } } sourceSets { val commonMain by getting { dependencies { implementation(project(":mpp-core")) implementation(libs.kotlin.logging) implementation(libs.kotlinx.serialization.json) implementation(libs.kotlinx.coroutines.core) implementation(libs.kotlinx.datetime) } } val commonTest by getting { dependencies { implementation(kotlin("test")) implementation(libs.kotlinx.coroutines.test) } } val jvmMain by getting { dependencies { // JVM-specific logging implementation(libs.logback) } } val jvmTest by getting { dependencies { implementation(kotlin("test-junit5")) } } val jsMain by getting { dependencies { // JS-specific dependencies (if any) } } val wasmJsMain by getting { dependencies { // WasmJs-specific dependencies (if any) } } val iosX64Main by getting val iosArm64Main by getting val iosSimulatorArm64Main by getting val iosMain by creating { dependencies { // iOS-specific dependencies (if any) } } } } // Configure integration test source set for JVM only val jvmIntegrationTest by kotlin.jvm().compilations.creating { defaultSourceSet { dependencies { implementation(kotlin("test")) implementation(libs.kotlinx.coroutines.test) } } associateWith(kotlin.jvm().compilations.getByName("main")) associateWith(kotlin.jvm().compilations.getByName("test")) } tasks.register("jvmIntegrationTest") { group = "verification" description = "Run NanoDSL integration tests that call LLM and verify DSL compilation" testClassesDirs = jvmIntegrationTest.output.classesDirs classpath = jvmIntegrationTest.runtimeDependencyFiles useJUnitPlatform() // Pass environment variables for LLM configuration environment("OPENAI_API_KEY", System.getenv("OPENAI_API_KEY") ?: "") environment("ANTHROPIC_API_KEY", System.getenv("ANTHROPIC_API_KEY") ?: "") environment("DEEPSEEK_API_KEY", System.getenv("DEEPSEEK_API_KEY") ?: "") // Integration tests may take longer systemProperty("junit.jupiter.execution.timeout.default", "5m") // Show output for debugging testLogging { events("passed", "skipped", "failed") showStandardStreams = true } } tasks.named("jvmTest") { useJUnitPlatform() } // Custom task to run DSL evaluation tests (JVM only) tasks.register("runDslEval") { group = "verification" description = "Run NanoDSL AI evaluation tests" mainClass.set("cc.unitmesh.xuiper.eval.DslEvalRunnerKt") classpath = kotlin.jvm().compilations.getByName("main").runtimeDependencyFiles // Pass environment variables for LLM configuration environment("OPENAI_API_KEY", System.getenv("OPENAI_API_KEY") ?: "") environment("ANTHROPIC_API_KEY", System.getenv("ANTHROPIC_API_KEY") ?: "") environment("DEEPSEEK_API_KEY", System.getenv("DEEPSEEK_API_KEY") ?: "") } // Task to validate DSL files (JVM only) tasks.register("validateDsl") { group = "verification" description = "Validate NanoDSL files in a directory" mainClass.set("cc.unitmesh.xuiper.eval.DslValidatorKt") classpath = kotlin.jvm().compilations.getByName("main").runtimeDependencyFiles val dslDir = project.findProperty("dslDir") as? String ?: "testcases/actual/integration" val verbose = if (project.hasProperty("verbose")) "verbose" else "" args = listOf(dslDir, verbose) } // Task to render DSL files to HTML (JVM only) tasks.register("renderHtml") { group = "verification" description = "Render NanoDSL files to HTML" mainClass.set("cc.unitmesh.xuiper.eval.DslToHtmlRendererKt") classpath = kotlin.jvm().compilations.getByName("main").runtimeDependencyFiles val inputDir = project.findProperty("dslDir") as? String ?: "testcases/actual/integration" val outputDir = project.findProperty("outputDir") as? String ?: "testcases/html/integration" args = listOf(inputDir, outputDir) }