plugins {
    id 'org.jetbrains.kotlin.jvm'
    id 'maven-publish'
    id("org.jetbrains.dokka")
    id("maven")
    id 'signing'
    id 'io.codearte.nexus-staging' version '0.21.0'
    id("com.bmuschko.nexus")

}

group = "de.jensklingenberg.cabret"
archivesBaseName = "cabret-compiler-runtime"
version = "1.0.4"

install {
    repositories.mavenInstaller {
        pom.artifactId = archivesBaseName
    }
}

repositories {
    mavenLocal()
}

dependencies {
    compileOnly "org.jetbrains.kotlin:kotlin-compiler-embeddable:1.5.10"
    compileOnly "org.jetbrains.kotlin:kotlin-stdlib"
    implementation "de.jensklingenberg.cabret:cabret-log-jvm:1.0.4"

    testImplementation("org.jetbrains.kotlin:kotlin-compiler-embeddable")
    testImplementation("com.github.tschuchortdev:kotlin-compile-testing:1.3.3")
    testImplementation group: 'junit', name: 'junit', version: '4.12'

}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}




build {
    finalizedBy(install)
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
    kotlinOptions {
        jvmTarget = "1.8"
        freeCompilerArgs += ["-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check"]
    }
}


modifyPom {
    project {
        name 'CabretLog'
        description 'Kotlin Native/JS/JVM Annotation Processor library'
        url 'https://github.com/Foso/Cabret-Log'
        inceptionYear '2020'
        scm {
            url 'https://github.com/Foso/Cabret-Log'
            connection 'scm:https://github.com/Foso/Cabret-Log.git'
            developerConnection 'scm:git://github.com/Foso/Cabret-Log.git'
        }
        licenses {
            license {
                name 'The Apache Software License, Version 2.0'
                url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                distribution 'repo'
            }
        }
        developers {
            developer {
                id 'Foso'
                name 'Jens Klingenberg'
                email 'mail@jensklingenberg.de'
            }
        }
    }
}


extraArchive {
    sources = true
    tests = true
    javadoc = true
}
nexus {
    sign = true
    repositoryUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
    snapshotRepositoryUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
}

nexusStaging {
    packageGroup = "de.jensklingenberg" //optional if packageGroup == project.getGroup()
    stagingProfileId = "d56228753311b0" //when not defined will be got from server using "packageGroup"
}