Skip to content

Commit

Permalink
Merge pull request #218 from ReactiveX/2.x-migr
Browse files Browse the repository at this point in the history
Update Kotlin, RxJava and Gradle
  • Loading branch information
vpriscan committed Jun 28, 2019
2 parents 1a5baf8 + c6c1133 commit 92df626
Show file tree
Hide file tree
Showing 10 changed files with 292 additions and 136 deletions.
40 changes: 0 additions & 40 deletions build.gradle

This file was deleted.

163 changes: 163 additions & 0 deletions build.gradle.kts
@@ -0,0 +1,163 @@
@file:Suppress("UNUSED_VARIABLE", "HasPlatformType")

import org.gradle.api.publish.maven.MavenPom
import org.jetbrains.dokka.gradle.DokkaTask

buildscript {
repositories {
jcenter()
}
}

plugins {
id("java-library")
kotlin("jvm") version "1.3.40"
id("org.jetbrains.dokka") version "0.9.18"
id("maven-publish")
id("com.jfrog.bintray") version "1.8.4"
}

repositories {
jcenter()
}

group = "io.reactivex.rxjava2"

//additional source sets
sourceSets {
val examples by creating {
java {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
}
}
}

//examples configuration
val examplesImplementation by configurations.getting {
extendsFrom(configurations.implementation.get())
}

dependencies {
implementation("io.reactivex.rxjava2:rxjava:2.2.10")
implementation(kotlin("stdlib"))

testImplementation("org.funktionale:funktionale-partials:1.0.0-final")
testImplementation("junit:junit:4.12")
testImplementation("org.mockito:mockito-core:1.10.19")

examplesImplementation("com.squareup.retrofit2:retrofit:2.6.0")
examplesImplementation("com.squareup.retrofit2:adapter-rxjava2:2.6.0")
examplesImplementation("com.squareup.retrofit2:converter-moshi:2.6.0")
}

//sources
val sourcesJar by tasks.creating(Jar::class) {
from(sourceSets.main.get().allSource)
archiveClassifier.set("sources")
}

//documentation
val dokka by tasks.getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$buildDir/javadoc"

}

//documentation
val dokkaJavadoc by tasks.creating(DokkaTask::class) {
outputFormat = "javadoc"
outputDirectory = "$buildDir/javadoc"
}

//documentation
val javadocJar by tasks.creating(Jar::class) {
dependsOn(dokkaJavadoc)
archiveClassifier.set("javadoc")
from("$buildDir/javadoc")
}

//publications
val snapshot = "snapshot"
val release = "release"

publishing {

fun MavenPom.initPom() {
name.set("RxKotlin")
description.set("RxJava bindings for Kotlin")
url.set("https://github.com/ReactiveX/RxKotlin")

licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
scm {
url.set("https://github.com/ReactiveX/RxKotlin.git")
}
}

publications {
create<MavenPublication>(snapshot) {
artifactId = "rxkotlin"
version = "${project.version}-SNAPSHOT"

from(components["java"])

pom.initPom()
}
create<MavenPublication>(release) {
artifactId = "rxkotlin"
version = "${project.version}"

from(components["java"])
artifact(sourcesJar)
artifact(javadocJar)

pom.initPom()
}
}
}

bintray {
user = project.findProperty("bintrayUser") as? String
key = project.findProperty("bintrayKey") as? String

val isRelease = project.findProperty("release") == "true"

publish = isRelease
override = false

setPublications(if (isRelease) release else snapshot)

// dryRun = true

with(pkg) {
userOrg = "reactivex"
repo = "RxJava"
name = "RxKotlin"
setLicenses("Apache-2.0")
setLabels("reactivex", "rxjava", "rxkotlin")
websiteUrl = "https://github.com/ReactiveX/RxKotlin"
issueTrackerUrl = "https://github.com/ReactiveX/RxKotlin/issues"
vcsUrl = "https://github.com/ReactiveX/RxKotlin.git"

with(version) {
name = project.version.toString()
vcsTag = project.version.toString()

with(gpg){
sign = true
}

with(mavenCentralSync) {
sync = true
user = project.findProperty("sonatypeUsername") as? String
password = project.findProperty("sonatypePassword") as? String
close = "1"
}
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
@@ -1,2 +1,2 @@
version=2.2.0
version=2.4.0
org.gradle.jvmargs=-Xms256m -Xmx1024m -XX:MaxPermSize=256m
10 changes: 6 additions & 4 deletions gradle/buildViaTravis.sh
Expand Up @@ -3,14 +3,16 @@

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo -e "Build Pull Request #$TRAVIS_PULL_REQUEST => Branch [$TRAVIS_BRANCH]"
./gradlew -Prelease.useLastTag=true build
./gradlew build
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" == "" ]; then
echo -e 'Build Branch with Snapshot => Branch ['$TRAVIS_BRANCH']'
./gradlew -Prelease.travisci=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" build snapshot --stacktrace
./gradlew build
echo -e 'To publish snapshot version to your local maven repo, execute: ./gradlew clean build publishSnapshotPublicationToMavenLocal'
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ]; then
echo -e 'Build Branch for Release => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG']'
./gradlew -Prelease.travisci=true -Prelease.useLastTag=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" final --stacktrace
./gradlew -Prelease.travisci=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" \
-Prelease=true build bintrayUpload --stacktrace
else
echo -e 'WARN: Should not be here => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG'] Pull Request ['$TRAVIS_PULL_REQUEST']'
./gradlew -Prelease.useLastTag=true build
./gradlew build
fi
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
#Sun Mar 05 07:47:21 SGT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-all.zip
24 changes: 20 additions & 4 deletions gradlew
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,16 +44,16 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand Down Expand Up @@ -155,7 +171,7 @@ if $cygwin ; then
fi

# Escape application args
save ( ) {
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
Expand Down

0 comments on commit 92df626

Please sign in to comment.