1 import com.vanniktech.maven.publish.JavadocJar.Dokka 2 import com.vanniktech.maven.publish.KotlinMultiplatform 3 import com.vanniktech.maven.publish.MavenPublishBaseExtension 4 <lambda>null5plugins { 6 kotlin("multiplatform") 7 id("org.jetbrains.dokka") 8 id("com.vanniktech.maven.publish.base") 9 id("binary-compatibility-validator") 10 id("build-support") 11 } 12 <lambda>null13kotlin { 14 jvm { 15 } 16 if (kmpJsEnabled) { 17 js { 18 compilations.all { 19 kotlinOptions { 20 moduleKind = "umd" 21 sourceMap = true 22 metaInfo = true 23 } 24 } 25 nodejs { 26 testTask { 27 useMocha { 28 timeout = "30s" 29 } 30 } 31 } 32 browser { 33 } 34 } 35 } 36 if (kmpNativeEnabled) { 37 configureOrCreateNativePlatforms() 38 } 39 sourceSets { 40 val commonMain by getting { 41 dependencies { 42 api(libs.kotlin.time) 43 api(projects.okio) 44 } 45 } 46 val commonTest by getting 47 if (kmpWasmEnabled) { 48 // Add support for wasmWasi when https://github.com/Kotlin/kotlinx-datetime/issues/324 is resolved. 49 configureOrCreateWasmPlatform(wasi = false) 50 createSourceSet("wasmMain", parent = commonMain, children = listOf("wasmJs")) 51 createSourceSet("wasmTest", parent = commonTest, children = listOf("wasmJs")) 52 } 53 } 54 } 55 <lambda>null56tasks { 57 val jvmJar by getting(Jar::class) { 58 // BundleTaskConvention() crashes unless there's a 'main' source set. 59 sourceSets.create(SourceSet.MAIN_SOURCE_SET_NAME) 60 val bndConvention = aQute.bnd.gradle.BundleTaskConvention(this) 61 bndConvention.setBnd( 62 """ 63 Export-Package: okio.fakefilesystem 64 Automatic-Module-Name: okio.fakefilesystem 65 Bundle-SymbolicName: com.squareup.okio.fakefilesystem 66 """ 67 ) 68 // Call the convention when the task has finished to modify the jar to contain OSGi metadata. 69 doLast { 70 bndConvention.buildBundle() 71 } 72 } 73 } 74 <lambda>null75configure<MavenPublishBaseExtension> { 76 configure( 77 KotlinMultiplatform(javadocJar = Dokka("dokkaGfm")) 78 ) 79 } 80