/* * Note: If the Android plugin is enabled, since Gradle 5.4, the annotation processor will not run * with kapt (using project or files to locate the annotation processor). */ group rootProject.group version rootProject.version apply plugin: "kotlin-multiplatform" apply plugin: 'kotlinx-serialization' apply plugin: "maven-publish" apply plugin: "jacoco" apply plugin: "kotlin-kapt" sourceCompatibility = '1.8' targetCompatibility = '1.8' group rootProject.group version rootProject.version kotlin { jvm { compilations.main.kotlinOptions { // Setup the Kotlin compiler options for the 'main' compilation: jvmTarget = "$version_kotlin_jvmTarget" } compilations.test.kotlinOptions { // Setup the Kotlin compiler options for the 'main' compilation: jvmTarget = "$version_kotlin_jvmTarget" } } js(LEGACY) { browser { testTask { useKarma { useChromeHeadless() //change to useChrome to run the actual browser webpackConfig.cssSupport.enabled = true } } } } sourceSets { //This adds a common DAO. It must be in the source so the annotation processor can see // parameter names etc. doorDao { } commonMain { dependsOn doorDao dependencies { implementation kotlin('stdlib-common') implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$version_kotlinx_serialization" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version_coroutines" implementation project(":lib-util") implementation project(":lib-database-entities") implementation "com.github.UstadMobile.door:door-runtime:$version_door" implementation "io.github.aakira:napier:$version_napier" compileOnly "com.github.UstadMobile.door:room-annotations:$version_door" } } jvmMain { dependencies { } } } } // workaround for https://youtrack.jetbrains.com/issue/KT-27170 configurations { compileClasspath } kapt { arguments { arg("doordb_android_out", rootProject.file("lib-database-android/build/generated/source/door").absolutePath) arg("doordb_jvm_out", rootProject.file("lib-database-mpp/build/generated/source/door").absolutePath) arg("doordb_js_out", rootProject.file("lib-database-mpp/build/generated/source/door-js").absolutePath) arg("doordb_ktor_out", rootProject.file("app-ktor-server/build/generated/source/door").absolutePath) arg("doordb_source_path", project.file("src/commonMain/kotlin")) arg("doordb_template_fixupdatetrigger_sqlite", project.file("build/migrationtemplates")) arg("doordb_migrations_out", "$buildDir/generated/source/door-migrations") arg("doordb_postgres_url", rootProject.ext.buildConfigProperties.getProperty("door.postgresUrl", "")) arg("doordb_postgres_user", rootProject.ext.buildConfigProperties.getProperty("door.postgresUser", "")) arg("doordb_postgres_password", rootProject.ext.buildConfigProperties.getProperty("door.postgresPass", "")) } } dependencies { kapt "com.github.UstadMobile.door:door-compiler:$version_door" } def platformTypeAttr = Attribute.of("org.jetbrains.kotlin.platform.type", String) afterEvaluate { configurations.all { configuration -> // Workaround for kapt bug with MPP dependencies // https://youtrack.jetbrains.com/issue/KT-31641 // https://youtrack.jetbrains.com/issue/KT-33206 if (name.contains('kapt')) { attributes.attribute(platformTypeAttr, "jvm") } } } publishing { publications { maven(MavenPublication) { groupId rootProject.group artifactId project.name version rootProject.version } } repositories { maven { url rootProject.ext.buildConfigProperties['repo.dir'] } } }