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 } 23 } 24 nodejs { 25 testTask { 26 useMocha { 27 timeout = "30s" 28 } 29 } 30 } 31 browser { 32 } 33 } 34 } 35 if (kmpNativeEnabled) { 36 configureOrCreateNativePlatforms() 37 } 38 sourceSets { 39 val commonMain by getting { 40 dependencies { 41 api(libs.kotlin.time) 42 api(projects.okio) 43 } 44 } 45 val commonTest by getting 46 if (kmpWasmEnabled) { 47 // Add support for wasmWasi when https://github.com/Kotlin/kotlinx-datetime/issues/324 is resolved. 48 configureOrCreateWasmPlatform(wasi = false) 49 createSourceSet("wasmMain", parent = commonMain, children = listOf("wasmJs")) 50 createSourceSet("wasmTest", parent = commonTest, children = listOf("wasmJs")) 51 } 52 } 53 } 54 <lambda>null55tasks { 56 val jvmJar by getting(Jar::class) { 57 // BundleTaskConvention() crashes unless there's a 'main' source set. 58 sourceSets.create(SourceSet.MAIN_SOURCE_SET_NAME) 59 val bndExtension = aQute.bnd.gradle.BundleTaskExtension(this) 60 bndExtension.setBnd( 61 """ 62 Export-Package: okio.fakefilesystem 63 Automatic-Module-Name: okio.fakefilesystem 64 Bundle-SymbolicName: com.squareup.okio.fakefilesystem 65 """ 66 ) 67 // Call the convention when the task has finished to modify the jar to contain OSGi metadata. 68 doLast { 69 bndExtension.buildAction() 70 .execute(this) 71 } 72 } 73 } 74 <lambda>null75configure<MavenPublishBaseExtension> { 76 configure( 77 KotlinMultiplatform(javadocJar = Dokka("dokkaGfm")) 78 ) 79 } 80