diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 771c934..0000000 --- a/build.gradle +++ /dev/null @@ -1,83 +0,0 @@ -plugins { - id 'maven-publish' - id 'org.jetbrains.kotlin.jvm' version '1.2.70' - id 'org.jetbrains.dokka' version '0.9.17' - id 'com.github.ben-manes.versions' version '0.20.0' - id 'com.jfrog.bintray' version '1.8.4' - id 'net.researchgate.release' version '2.7.0' -} - -description = 'A Result monad for modelling success or failure operations.' - -repositories { - mavenCentral() -} - -dependencies { - implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' - - testImplementation 'junit:junit:4.12' - testImplementation 'org.jetbrains.kotlin:kotlin-test-common' - testImplementation 'org.jetbrains.kotlin:kotlin-test-annotations-common' - testImplementation 'org.jetbrains.kotlin:kotlin-test-junit' - testImplementation 'org.jetbrains.kotlin:kotlin-test' -} - -compileKotlin { - kotlinOptions.jvmTarget = "1.8" -} - -compileTestKotlin { - kotlinOptions.jvmTarget = "1.8" -} - -dokka { - kotlinTasks { [ ] } - sourceDirs = sourceSets.main.kotlin.srcDirs - outputFormat = 'javadoc' - outputDirectory = "${docsDir}/javadoc" -} - -task javadocJar(type: Jar, dependsOn: dokka) { - group = LifecycleBasePlugin.BUILD_GROUP - description = 'Assembles a jar archive containing the Javadoc API documentation.' - classifier = 'javadoc' - from dokka.outputDirectory -} - -task sourcesJar(type: Jar) { - group = LifecycleBasePlugin.BUILD_GROUP - description = 'Assembles a jar archive containing the main classes with sources.' - classifier = 'sources' - from sourceSets.main.allSource -} - -publishing { - publications { - mavenJava(MavenPublication) { - from components.java - artifact javadocJar - artifact sourcesJar - } - } -} - -bintray { - user = project.findProperty('bintrayUser') ?: '' - key = project.findProperty('bintrayKey') ?: '' - publications = [ 'mavenJava' ] - - pkg { - repo = 'maven' - name = 'kotlin-result' - licenses = [ 'ISC' ] - vcsUrl = 'git@github.com:michaelbull/kotlin-result.git' - } -} - -bintrayUpload.dependsOn build -bintrayUpload.dependsOn sourcesJar -bintrayUpload.dependsOn javadocJar -bintrayUpload.dependsOn generatePomFileForMavenJavaPublication - -afterReleaseBuild.dependsOn bintrayUpload diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..a2b7e0b --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,111 @@ +import com.jfrog.bintray.gradle.BintrayExtension +import com.jfrog.bintray.gradle.tasks.BintrayUploadTask +import groovy.lang.Closure +import org.gradle.api.internal.HasConvention +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.jetbrains.dokka.gradle.DokkaTask +import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet + +description = "A Result monad for modelling success or failure operations." + +plugins { + `maven-publish` + kotlin("jvm") version ("1.2.70") + id("org.jetbrains.dokka") version ("0.9.17") + id("com.github.ben-manes.versions") version ("0.20.0") + id("com.jfrog.bintray") version ("1.8.4") + id("net.researchgate.release") version ("2.7.0") +} + +allprojects { + repositories { + mavenCentral() + } +} + +dependencies { + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + + testImplementation("junit:junit:4.12") + testImplementation("org.jetbrains.kotlin:kotlin-test-common") + testImplementation("org.jetbrains.kotlin:kotlin-test-annotations-common") + testImplementation("org.jetbrains.kotlin:kotlin-test-junit") + testImplementation("org.jetbrains.kotlin:kotlin-test") +} + +val SourceSet.kotlin: SourceDirectorySet + get() = withConvention(KotlinSourceSet::class) { kotlin } + +val compileKotlin by tasks.existing(KotlinCompile::class) +val compileTestKotlin by tasks.existing(KotlinCompile::class) +val dokka by tasks.existing(DokkaTask::class) + +compileKotlin { + kotlinOptions.jvmTarget = "1.8" +} + +compileTestKotlin { + kotlinOptions.jvmTarget = "1.8" +} + +dokka { + kotlinTasks(closureOf { emptyList() }) + sourceDirs = sourceSets["main"].kotlin.srcDirs + outputFormat = "javadoc" + outputDirectory = "$buildDir/docs/javadoc" +} + +val javadocJar by tasks.registering(Jar::class) { + group = LifecycleBasePlugin.BUILD_GROUP + description = "Assembles a jar archive containing the Javadoc API documentation." + classifier = "javadoc" + dependsOn(dokka.get()) + from(dokka.get().outputDirectory) +} + +val sourcesJar by tasks.registering(Jar::class) { + group = LifecycleBasePlugin.BUILD_GROUP + description = "Assembles a jar archive containing the main classes with sources." + classifier = "sources" + from(sourceSets["main"].allSource) +} + +publishing { + publications { + register("mavenJava", MavenPublication::class) { + from(components["java"]) + artifact(javadocJar.get()) + artifact(sourcesJar.get()) + } + } +} + +bintray { + user = project.findProperty("bintrayUser")?.toString() ?: "" + key = project.findProperty("bintrayKey")?.toString() ?: "" + setPublications("mavenJava") + + pkg(closureOf { + repo = "maven" + name = "kotlin-result" + vcsUrl = "git@github.com:michaelbull/kotlin-result.git" + setLicenses("ISC") + }) +} + +val build by tasks.existing +val generatePomFileForMavenJavaPublication by tasks.existing(GenerateMavenPom::class) +val bintrayUpload by tasks.existing(BintrayUploadTask::class) + +bintrayUpload { + dependsOn(build) + dependsOn(generatePomFileForMavenJavaPublication) + dependsOn(sourcesJar) + dependsOn(javadocJar) +} + +val afterReleaseBuild by tasks.existing + +afterReleaseBuild { + dependsOn(bintrayUpload) +} diff --git a/example/build.gradle b/example/build.gradle deleted file mode 100644 index 17b97aa..0000000 --- a/example/build.gradle +++ /dev/null @@ -1,35 +0,0 @@ -plugins { - id 'application' - id 'org.jetbrains.kotlin.jvm' -} - -mainClassName = 'io.ktor.server.netty.DevelopmentEngine' - -repositories { - mavenCentral() - maven { url = "http://dl.bintray.com/kotlin/ktor" } - maven { url = "https://dl.bintray.com/kotlin/kotlinx" } -} - -dependencies { - implementation project(":") - implementation "ch.qos.logback:logback-classic:$logbackVersion" - implementation "io.ktor:ktor-server-core:$ktorVersion" - implementation "io.ktor:ktor-server-netty:$ktorVersion" - implementation "io.ktor:ktor-gson:$ktorVersion" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" -} - -compileKotlin { - kotlinOptions.jvmTarget = "1.8" -} - -compileTestKotlin { - kotlinOptions.jvmTarget = "1.8" -} - -kotlin { - experimental { - coroutines "enable" - } -} diff --git a/example/build.gradle.kts b/example/build.gradle.kts new file mode 100644 index 0000000..48d26a5 --- /dev/null +++ b/example/build.gradle.kts @@ -0,0 +1,40 @@ +import org.jetbrains.kotlin.gradle.dsl.Coroutines +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + application + kotlin("jvm") +} + +application { + mainClassName = "io.ktor.server.netty.DevelopmentEngine" +} + +repositories { + maven(url = "http://dl.bintray.com/kotlin/ktor") + maven(url = "https://dl.bintray.com/kotlin/kotlinx") +} + +dependencies { + implementation(project(":")) + implementation(kotlin("stdlib-jdk8")) + implementation("ch.qos.logback:logback-classic:${ext["logbackVersion"]}") + implementation("io.ktor:ktor-server-core:${ext["ktorVersion"]}") + implementation("io.ktor:ktor-server-netty:${ext["ktorVersion"]}") + implementation("io.ktor:ktor-gson:${ext["ktorVersion"]}") +} + +val compileKotlin by tasks.existing(KotlinCompile::class) +val compileTestKotlin by tasks.existing(KotlinCompile::class) + +compileKotlin { + kotlinOptions.jvmTarget = "1.8" +} + +compileTestKotlin { + kotlinOptions.jvmTarget = "1.8" +} + +kotlin { + experimental.coroutines = Coroutines.ENABLE +} diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 31220da..0000000 --- a/settings.gradle +++ /dev/null @@ -1,5 +0,0 @@ -rootProject.name = 'kotlin-result' - -include 'example' - -enableFeaturePreview('STABLE_PUBLISHING') diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..57f4d96 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,5 @@ +enableFeaturePreview("STABLE_PUBLISHING") + +rootProject.name = "kotlin-result" + +include("example")