aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Faber <s.faber@airbnb.com>2021-01-18 09:04:32 -0600
committerSzczepan Faber <s.faber@airbnb.com>2021-01-20 10:32:03 -0600
commit50f284af6bbdc5e7d6f07f477dc88580c0b7ee6b (patch)
tree14f17c9c13ac3ebe210673dc4b56e4b9bb620721
parent867e38640add2809f33fa5c0d8280c7897d1ce37 (diff)
downloadmockito-kotlin-50f284af6bbdc5e7d6f07f477dc88580c0b7ee6b.tar.gz
Working on Shipkit integration
-rw-r--r--.gitignore1
-rw-r--r--build.gradle32
-rw-r--r--gradle/publishing.gradle67
-rw-r--r--gradle/scripts/tagging.gradle22
-rw-r--r--mockito-kotlin/build.gradle6
-rw-r--r--publishing.gradle63
-rw-r--r--tests/build.gradle2
-rw-r--r--version.properties3
8 files changed, 94 insertions, 102 deletions
diff --git a/.gitignore b/.gitignore
index bfee7ef..f9e1291 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
.gradle
build/
out/
+repo
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
diff --git a/build.gradle b/build.gradle
index 40ac3cd..9de5a17 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,18 +1,24 @@
-buildscript {
- repositories {
- maven {
- url "https://plugins.gradle.org/m2/"
- }
- }
- dependencies {
- classpath "io.spring.gradle:spring-bintray-plugin:0.11.1"
- }
+plugins {
+ id "org.shipkit.shipkit-auto-version" version "1.1.1"
+ id "org.shipkit.shipkit-changelog" version "1.1.1"
+ id "org.shipkit.shipkit-github-release" version "1.1.1"
}
-plugins {
- id 'com.github.ben-manes.versions' version '0.20.0'
+//TODO: update the group to 'org.mockito'
+group = 'com.nhaarman.mockito-kotlin2'
+
+tasks.named("generateChangelog") {
+ previousRevision = project.ext.'shipkit-auto-version.previous-tag'
+ githubToken = System.getenv("GITHUB_TOKEN")
+ repository = "mockito/mockito-kotlin"
}
-apply from: 'gradle/scripts/tagging.gradle'
+tasks.named("githubRelease") {
+ def genTask = tasks.named("generateChangelog").get()
+ dependsOn genTask
+ repository = genTask.repository
+ changelog = genTask.outputFile
+ githubToken = System.getenv("GITHUB_TOKEN")
+ newTagRevision = System.getenv("GITHUB_SHA")
+}
-println ext.versionName \ No newline at end of file
diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle
new file mode 100644
index 0000000..716da43
--- /dev/null
+++ b/gradle/publishing.gradle
@@ -0,0 +1,67 @@
+apply plugin: 'maven-publish'
+
+//bintray.bintrayUser = hasProperty('bintray_username') ? bintray_username : System.getenv('BINTRAY_USER')
+//bintray.bintrayKey = hasProperty('bintray_key') ? bintray_key : System.getenv('BINTRAY_KEY')
+//bintray.repo = 'maven'
+//bintray.org = hasProperty('bintray_username') ? bintray_username : System.getenv('BINTRAY_USER')
+//bintray.packageName = 'Mockito-Kotlin'
+//bintray.publication = 'mavenJava'
+//
+//bintray.licenses = ['MIT']
+//bintray.ossrhUser = hasProperty('sonatype_username') ? sonatype_username : System.getenv('SONATYPE_USERNAME')
+//bintray.ossrhPassword = hasProperty('sonatype_password') ? sonatype_password : System.getenv('SONATYPE_PASSWORD')
+//bintray.overrideOnUpload = false
+//bintray.gpgPassphrase = hasProperty('signing_password') ? signing_password : System.getenv('SIGNING_PASSWORD')
+
+task javadocJar(type: Jar, dependsOn: javadoc) {
+ classifier = 'javadoc'
+ from 'build/javadoc'
+}
+
+task sourceJar(type: Jar) {
+ from sourceSets.main.allSource
+}
+
+publishing {
+ publications {
+ mavenJava(MavenPublication) {
+ artifactId 'mockito-kotlin'
+
+ from components.java
+
+ artifact sourceJar {
+ classifier "sources"
+ }
+
+ artifact javadocJar
+
+ pom.withXml {
+ def root = asNode()
+ root.appendNode('name', 'Mockito-Kotlin')
+ root.appendNode('description', 'Using Mockito with Kotlin.')
+ root.appendNode('url', 'https://github.com/mockito/mockito-kotlin')
+
+ def scm = root.appendNode('scm')
+ scm.appendNode('url', 'scm:git@github.com:mockito/mockito-kotlin.git')
+
+ def licenses = root.appendNode('licenses')
+ def mitLicense = licenses.appendNode('license')
+ mitLicense.appendNode('name', 'MIT')
+
+ def developers = root.appendNode('developers')
+ def nhaarman = developers.appendNode('developer')
+ nhaarman.appendNode('id', 'nhaarman')
+ nhaarman.appendNode('name', 'Niek Haarman')
+ }
+ }
+ }
+
+ //useful for testing - running "publish" will create artifacts/pom in a local dir
+ repositories { maven { url = "$rootProject.buildDir/repo" } }
+}
+
+// Avoid generation of the module metadata so that we don't have to publish an additional file
+// and keep the build logic simple.
+tasks.withType(GenerateModuleMetadata) {
+ enabled = false
+} \ No newline at end of file
diff --git a/gradle/scripts/tagging.gradle b/gradle/scripts/tagging.gradle
deleted file mode 100644
index 907707d..0000000
--- a/gradle/scripts/tagging.gradle
+++ /dev/null
@@ -1,22 +0,0 @@
-new ByteArrayOutputStream().withStream { os ->
-
- exec {
- commandLine 'git', 'describe', '--abbrev=0', '--tags'
- standardOutput = os
- }
-
- String tag = os.toString().trim();
- if (tag.length() == 0) {
- tag = "0.0.0"
- } else if (tag.indexOf('-') != -1 && tag.length() > tag.indexOf('-') + 1 && tag.charAt(tag.indexOf('-') + 1).isDigit()) {
- tag = tag.substring(0, tag.indexOf('-'));
- }
-
- ext.versionName = tag;
-
- if (isRelease == 'false') {
- int lastNumber = Integer.parseInt(tag.substring(tag.size() - 1))
- ext.versionName = tag.substring(0, tag.size() - 1) + (lastNumber + 1) + "-SNAPSHOT";
- }
-}
-
diff --git a/mockito-kotlin/build.gradle b/mockito-kotlin/build.gradle
index 7f5bc36..6b32f27 100644
--- a/mockito-kotlin/build.gradle
+++ b/mockito-kotlin/build.gradle
@@ -1,5 +1,5 @@
apply plugin: 'kotlin'
-apply from: '../publishing.gradle'
+apply from: '../gradle/publishing.gradle'
apply plugin: 'org.jetbrains.dokka'
buildscript {
@@ -13,8 +13,8 @@ buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.17"
- classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
- classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"
+ classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5"
+ classpath "com.github.dcendents:android-maven-gradle-plugin:2.1" //TODO do we need android-maven-gradle-plugin?
}
}
diff --git a/publishing.gradle b/publishing.gradle
deleted file mode 100644
index cb03d87..0000000
--- a/publishing.gradle
+++ /dev/null
@@ -1,63 +0,0 @@
-apply plugin: 'maven-publish'
-apply plugin: "io.spring.bintray"
-
-bintray.bintrayUser = hasProperty('bintray_username') ? bintray_username : System.getenv('BINTRAY_USER')
-bintray.bintrayKey = hasProperty('bintray_key') ? bintray_key : System.getenv('BINTRAY_KEY')
-bintray.repo = 'maven'
-bintray.org = hasProperty('bintray_username') ? bintray_username : System.getenv('BINTRAY_USER')
-bintray.packageName = 'Mockito-Kotlin'
-bintray.publication = 'mavenJava'
-
-bintray.licenses = ['MIT']
-bintray.ossrhUser = hasProperty('sonatype_username') ? sonatype_username : System.getenv('SONATYPE_USERNAME')
-bintray.ossrhPassword = hasProperty('sonatype_password') ? sonatype_password : System.getenv('SONATYPE_PASSWORD')
-bintray.overrideOnUpload = false
-bintray.gpgPassphrase = hasProperty('signing_password') ? signing_password : System.getenv('SIGNING_PASSWORD')
-
-task javadocJar(type: Jar, dependsOn: javadoc) {
- classifier = 'javadoc'
- from 'build/javadoc'
-}
-
-task sourceJar(type: Jar) {
- from sourceSets.main.allSource
-}
-
-group = 'com.nhaarman.mockito-kotlin2'
-version = rootProject.ext.versionName
-
-publishing {
- publications {
- mavenJava(MavenPublication) {
- groupId 'com.nhaarman.mockitokotlin2'
- artifactId 'mockito-kotlin'
-
- from components.java
-
- artifact sourceJar {
- classifier "sources"
- }
-
- artifact javadocJar
-
- pom.withXml {
- def root = asNode()
- root.appendNode('name', 'Mockito-Kotlin')
- root.appendNode('description', 'Using Mockito with Kotlin.')
- root.appendNode('url', 'https://github.com/nhaarman/mockito-kotlin')
-
- def scm = root.appendNode('scm')
- scm.appendNode('url', 'scm:git@github.com:nhaarman/mockito-kotlin.git')
-
- def licenses = root.appendNode('licenses')
- def mitLicense = licenses.appendNode('license')
- mitLicense.appendNode('name', 'MIT')
-
- def developers = root.appendNode('developers')
- def nhaarman = developers.appendNode('developer')
- nhaarman.appendNode('id', 'nhaarman')
- nhaarman.appendNode('name', 'Niek Haarman')
- }
- }
- }
-} \ No newline at end of file
diff --git a/tests/build.gradle b/tests/build.gradle
index cd11001..91da020 100644
--- a/tests/build.gradle
+++ b/tests/build.gradle
@@ -18,7 +18,7 @@ repositories {
}
dependencies {
- compile files("${rootProject.projectDir}/mockito-kotlin/build/libs/mockito-kotlin-${rootProject.ext.versionName}.jar")
+ compile files("${rootProject.projectDir}/mockito-kotlin/build/libs/mockito-kotlin-${version}.jar")
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.mockito:mockito-core:2.23.0"
diff --git a/version.properties b/version.properties
new file mode 100644
index 0000000..d3be764
--- /dev/null
+++ b/version.properties
@@ -0,0 +1,3 @@
+# Version of the produced binaries.
+# The version is inferred by shipkit-auto-version Gradle plugin (https://github.com/shipkit/shipkit-auto-version)
+version=2.2.1-SNAPSHOT