apply plugin: 'org.jetbrains.kotlin.multiplatform'
apply plugin: 'org.jetbrains.dokka'

kotlin {
    jvm {
        withJava()
        mavenPublication {
            artifactId = 'difference-jvm'
        }
    }

    js {
        browser()
        nodejs()
    }

    iosX64 {
        mavenPublication {
            artifactId = 'difference-ios-x64'
        }
    }
    iosArm64 {
        mavenPublication {
            artifactId = 'difference-ios-arm64'
        }
    }
    iosSimulatorArm64 {
        mavenPublication {
            artifactId = 'difference-ios-simulator-arm64'
        }
    }
    linuxX64 {
        mavenPublication {
            artifactId = 'difference-linux-x64'
        }
    }
    macosX64 {
        mavenPublication {
            artifactId = 'difference-macos-x64'
        }
    }
    macosArm64 {
        mavenPublication {
            artifactId = 'difference-macos-arm64'
        }
    }
    mingwX64 {
        mavenPublication {
            artifactId = 'difference-mingw-x64'
        }
    }

    sourceSets {
        commonMain {
            dependencies {
                implementation kotlin('stdlib-common')
            }
        }
        commonTest {
            dependencies {
                implementation kotlin('test-common')
                implementation kotlin('test-annotations-common')
            }
        }
        jvmMain {
            dependencies {
                implementation kotlin('stdlib-jdk8')
            }
        }
        jvmTest {
            dependencies {
                implementation kotlin('test')
                implementation kotlin('test-junit')
            }
        }
        jsMain {
            dependencies {
                implementation kotlin('stdlib-js')
            }
        }
        jsTest {
            dependencies {
                implementation kotlin('test')
                implementation kotlin('test-js')
            }
        }
    }
}

dokkaHtml {
    outputDirectory = file("$rootDir/docs/1.x")
}

tasks.register('javadocJar', Jar) {
    dependsOn dokkaHtml
    archiveClassifier = 'javadoc'
    from file("$rootDir/docs/1.x")
}

apply from: "$rootDir/gradle/publish.gradle"
