From ffa0ee46f674374bcd278e0c61db05303ab22270 Mon Sep 17 00:00:00 2001 From: Andrey Mischenko Date: Thu, 26 Apr 2018 00:25:08 +0800 Subject: [PATCH] Version 0.10.0 (#36) - [Retrofit 2.4.0](https://github.com/square/retrofit/blob/parent-2.4.0/CHANGELOG.md#version-240-2018-03-14) - [kotlinx.coroutines 0.22.5](https://github.com/Kotlin/kotlinx.coroutines/releases/tag/0.22.5) - Compiled against Kotlin 1.2.40 - Migration of build.gradle to kotlin-dsl - Gradle 4.7 - Published proper javadoc --- CHANGELOG.md | 9 ++ README.md | 4 +- build.gradle | 34 ----- build.gradle.kts | 175 +++++++++++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- publish.gradle | 96 ------------- settings.gradle | 1 - settings.gradle.kts | 1 + 8 files changed, 188 insertions(+), 134 deletions(-) delete mode 100644 build.gradle create mode 100644 build.gradle.kts delete mode 100644 publish.gradle delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/CHANGELOG.md b/CHANGELOG.md index 59fef00..1cd261f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # CHANGELOG +## Version 0.10.0 (2017-04-26) + +- [Retrofit 2.4.0](https://github.com/square/retrofit/blob/parent-2.4.0/CHANGELOG.md#version-240-2018-03-14) +- [kotlinx.coroutines 0.22.5](https://github.com/Kotlin/kotlinx.coroutines/releases/tag/0.22.5) +- Compiled against Kotlin 1.2.40 +- Migration of build.gradle to kotlin-dsl +- Gradle 4.7 +- Published proper javadoc + ## Version 0.9.0 (2017-12-26) - [kotlinx.coroutines 0.20](https://github.com/Kotlin/kotlinx.coroutines/releases/tag/0.20) diff --git a/README.md b/README.md index a21fa82..47532ac 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Download the [JAR](https://bintray.com/gildor/maven/kotlin-coroutines-retrofit#f Gradle: ```groovy -compile 'ru.gildor.coroutines:kotlin-coroutines-retrofit:0.9.0' +compile 'ru.gildor.coroutines:kotlin-coroutines-retrofit:0.10.0' ``` Maven: @@ -23,7 +23,7 @@ Maven: ru.gildor.coroutines kotlin-coroutines-retrofit - 0.9.0 + 0.10.0 ``` diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 0afd3b7..0000000 --- a/build.gradle +++ /dev/null @@ -1,34 +0,0 @@ -plugins { - id "org.jetbrains.kotlin.jvm" version "1.2.10" - id "com.jfrog.bintray" version "1.7.3" apply false - id "jacoco" -} - -group 'ru.gildor.coroutines' -version '0.9.0' - -repositories { - jcenter() -} - -targetCompatibility = '1.6' -sourceCompatibility = '1.6' - -dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:${plugins.findPlugin("kotlin").properties["kotlinPluginVersion"]}" - compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.20" - compile 'com.squareup.retrofit2:retrofit:2.3.0' - testCompile 'junit:junit:4.12' -} - -kotlin { - experimental.coroutines = "enable" -} - -jacocoTestReport { - reports.xml.enabled = true -} - -tasks["test"].finalizedBy("jacocoTestReport") - -apply from: "publish.gradle" diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..4a5cc23 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,175 @@ +import com.jfrog.bintray.gradle.BintrayExtension +import com.jfrog.bintray.gradle.BintrayExtension.* +import groovy.util.Node +import org.gradle.jvm.tasks.Jar +import java.net.URL +import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.gradle.DokkaTask +import org.jetbrains.dokka.gradle.LinkMapping +import org.jetbrains.kotlin.builtins.isNumberedFunctionClassFqName +import org.jetbrains.kotlin.gradle.dsl.Coroutines +import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformJvmPlugin +import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper + +plugins { + id("org.jetbrains.kotlin.jvm") version "1.2.40" + id("com.jfrog.bintray") version "1.7.3" + jacoco + `maven-publish` + id("org.jetbrains.dokka") version "0.9.16" +} + +group = "ru.gildor.coroutines" +version = "0.10.0" +description = "Provides Kotlin Coroutines suspendable await() extensions for Retrofit Call" + +repositories { + jcenter() +} + +java { + targetCompatibility = JavaVersion.VERSION_1_6 + sourceCompatibility = JavaVersion.VERSION_1_6 +} + +dependencies { + compile("org.jetbrains.kotlin:kotlin-stdlib") + compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.5") + compile("com.squareup.retrofit2:retrofit:2.4.0") + testCompile("junit:junit:4.12") +} + +kotlin { + experimental.coroutines = Coroutines.ENABLE +} + +/* Code coverage */ + +val jacocoTestReport by tasks.getting(JacocoReport::class) { + reports.xml.isEnabled = true +} + +val test by tasks.getting { + finalizedBy(jacocoTestReport) +} + +/* KDoc */ + +val dokka by tasks.getting(DokkaTask::class) { + outputFormat = "javadoc" + outputDirectory = "$buildDir/javadoc" + + externalDocumentationLink(delegateClosureOf { + url = URL("https://square.github.io/okhttp/3.x/okhttp/") + }) + externalDocumentationLink(delegateClosureOf { + url = URL("https://square.github.io/retrofit/2.x/retrofit/") + }) +} + +/* Publishing */ + +val githubId = "gildor/kotlin-coroutines-retrofit" +val repoWeb = "https://github.com/$githubId" +val repoVcs = "$repoWeb.git" +val tags = listOf("retrofit", "kotlin", "coroutines") +val licenseId = "Apache-2.0" +val licenseName = "The Apache Software License, Version 2.0" +val licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0.txt" +val releaseTag = "v${project.version}" + +val sourcesJar by tasks.creating(Jar::class) { + dependsOn("classes") + classifier = "sources" + from(java.sourceSets["main"].allSource) +} + +val javadocJar by tasks.creating(Jar::class) { + dependsOn(dokka) + classifier = "javadoc" + from("$buildDir/javadoc") +} + +publishing { + publications { + create("MavenJava", MavenPublication::class.java) { + from(components["java"]) + artifact(sourcesJar) + artifact(javadocJar) + pom.withXml { + NodeScope(asNode()) { + "name" to project.name + "description" to project.description.toString() + "url" to repoWeb + "developers" { + "developer" { + "name" to "Andrey Mischenko" + "email" to "git@gildor.ru" + "organizationUrl" to "https://github.com/gildor" + } + } + "issueManagement" { + "system" to "GitHub Issues" + "url" to "$repoWeb/issues" + } + "scm" { + "url" to repoWeb + "connection" to "scm:git:$repoVcs" + "developerConnection" to "scm:git:$repoVcs" + "tag" to releaseTag + } + "licenses" { + "license" { + "name" to licenseName + "url" to licenseUrl + } + } + } + } + } + } +} + +bintray { + user = project.properties["bintray.user"]?.toString() + key = project.properties["bintray.key"]?.toString() + setPublications("MavenJava") + publish = true + pkg(delegateClosureOf { + repo = project.properties["bintray.repo"]?.toString() ?: "maven" + name = project.name + desc = description + githubRepo = githubId + githubReleaseNotesFile = "CHANGELOG.md" + websiteUrl = repoWeb + issueTrackerUrl = "$repoWeb/issues" + vcsUrl = repoVcs + setLicenses(licenseId) + setLabels(*tags.toTypedArray()) + version(delegateClosureOf { + name = project.version.toString() + vcsTag = releaseTag + mavenCentralSync(delegateClosureOf { + sync = project.properties["sonatype.user"] != null + user = project.properties["sonatype.user"]?.toString() + password = project.properties["sonatype.password"]?.toString() + close = "true" + }) + }) + }) +} + +/** + * Helper DSL to define Pom + */ +class NodeScope(private val node: Node, block: NodeScope.() -> Unit) { + init { + block() + } + infix fun String.to(value: String) { + node.appendNode(this, value) + } + operator fun String.invoke(block: NodeScope.() -> Unit) { + node.appendNode(this).apply { NodeScope(this, block) } + } +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 26b61d7..73bb13d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip diff --git a/publish.gradle b/publish.gradle deleted file mode 100644 index 8dbb61f..0000000 --- a/publish.gradle +++ /dev/null @@ -1,96 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'com.jfrog.bintray' - -def description = "Provides Kotlin Coroutines suspendable await() extensions for Retrofit Call" -def githubId = "gildor/kotlin-coroutines-retrofit" -def repoWeb = "https://github.com/${githubId}" -def repoVcs = "${repoWeb}.git" -def issueTracker = "${repoWeb}/issues" -def tags = ['retrofit', 'kotlin', 'coroutines'] -def licenseId = "Apache-2.0" -def licenseName = "The Apache Software License, Version 2.0" -def licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0.txt" -def releaseTag = "v${project.version}" - -// Create the pom configuration: -def pomConfig = { - developers { - developer { - name "Andrey Mischenko" - email "git@gildor.ru" - organizationUrl "https://github.com/gildor" - } - } - scm { - url repoWeb - connection "scm:git:${repoVcs}" - developerConnection "scm:git:${repoVcs}" - tag releaseTag - } - issueManagement { - system "GitHub Issues" - url issueTracker - } - licenses { - license { - name licenseName - url licenseUrl - } - } -} - -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' - from sourceSets.main.allSource -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -publishing { - publications { - Publication(MavenPublication) { - from components.java - artifact sourcesJar - artifact javadocJar - pom.withXml { - def root = asNode() - root.appendNode('name', project.name) - root.appendNode('description', description) - root.appendNode('url', repoWeb) - root.children().last() + pomConfig - } - } - } -} - -bintray { - user = project.properties['bintray.user'] - key = project.properties['bintray.key'] - publications = ['Publication'] - publish = true - pkg { - repo = project.properties['bintray.repo'] ?: 'maven' - name = project.name - desc = description - githubRepo = githubId - githubReleaseNotesFile = 'CHANGELOG.md' - websiteUrl = repoWeb - issueTrackerUrl = "${repoWeb}/issues" - vcsUrl = repoVcs - licenses = [licenseId] - labels = tags - version { - name = project.version - vcsTag = releaseTag - mavenCentralSync { - sync = project.properties['sonatype.user'] != null - user = project.properties['sonatype.user'] - password = project.properties['sonatype.password'] - close = true - } - } - } -} diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 55f5d19..0000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'kotlin-coroutines-retrofit' \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..572d265 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "kotlin-coroutines-retrofit" \ No newline at end of file