Skip to content

Gradle Improvements #475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions artifactory.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2015-2018 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.
*/

if (project.hasProperty('bintrayUser') && project.hasProperty('bintrayKey')) {
artifactory {
publish {
contextUrl = 'https://oss.jfrog.org'

repository {
repoKey = 'oss-snapshot-local'

// Credentials for oss.jfrog.org are a user's Bintray credentials
username = project.property('bintrayUser')
password = project.property('bintrayKey')
}
}
}

subprojects {
plugins.withId('com.jfrog.artifactory') {
artifactoryPublish {
publications('maven')
}
}
}
}
62 changes: 62 additions & 0 deletions bintray.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright 2015-2018 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.
*/

if (project.hasProperty('bintrayUser') && project.hasProperty('bintrayKey') &&
project.hasProperty('sonatypeUser') && project.hasProperty('sonatypePassword')) {

bintray {
user = project.property('bintrayUser')
key = project.property('bintrayKey')

publish = true

pkg {
repo = 'RSocket'
name = 'rsocket-java'
licenses = ['Apache-2.0']

issueTrackerUrl = 'https://github.com/rsocket/rsocket-java/issues'
websiteUrl = 'https://github.com/rsocket/rsocket-java'
vcsUrl = 'https://github.com/rsocket/rsocket-java.git'

githubRepo = 'rsocket/rsocket-java' //Optional Github repository
githubReleaseNotesFile = 'README.md' //Optional Github readme file

version {
name = project.version
released = new Date()
vcsTag = "v${project.version}"

gpg {
sign = true
}

mavenCentralSync {
user = project.property('sonatypeUser')
password = project.property('sonatypePassword')
}
}
}
}

subprojects {
plugins.withId('com.jfrog.bintray') {
bintray {
publications('maven')
}
}
}
}
199 changes: 73 additions & 126 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,159 +15,106 @@
*/

plugins {
id 'com.gradle.build-scan' version '1.9' // declare before any other plugin
id 'com.gradle.build-scan' version '1.12.1'

id 'com.github.johnrengelman.shadow' version '2.0.2' apply false
id 'com.github.sherter.google-java-format' version '0.6'
id 'com.github.johnrengelman.shadow' version '2.0.1' apply false
id 'me.champeau.gradle.jmh' version '0.4.4' apply false
id 'io.morethan.jmhreport' version '0.6.2.1' apply false

id 'com.jfrog.artifactory' version '4.5.2'
id 'com.jfrog.bintray' version '1.7.3'
id 'com.jfrog.artifactory' version '4.7.0'
id 'com.jfrog.bintray' version '1.8.0'
id 'me.champeau.gradle.jmh' version '0.4.5' apply false
id 'io.spring.dependency-management' version '1.0.4.RELEASE' apply false
id 'io.morethan.jmhreport' version '0.7.0' apply false
}

repositories {
jcenter()
allprojects {
version '0.10.0.BUILD-SNAPSHOT'
}

description = 'RSocket: stream oriented messaging passing with Reactive Stream semantics.'

buildScan { licenseAgreementUrl = 'https://gradle.com/terms-of-service'; licenseAgree = 'yes' }
subprojects {
apply plugin: 'io.spring.dependency-management'

googleJavaFormat {
toolVersion = '1.4'
}
dependencyManagement {
imports {
// TODO: Upgrade to latest version
mavenBom 'io.projectreactor:reactor-bom:Bismuth-SR6'
}

subprojects {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.jfrog.artifactory'

group = 'io.rsocket'
version = mavenversion

compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
options.compilerArgs << '-Xlint:all,-overloads,-rawtypes,-unchecked'
}
dependencies {
dependency 'com.google.code.findbugs:jsr305:3.0.2'
dependency 'com.netflix.spectator:spectator-api:0.63.0'
dependency 'io.netty:netty-buffer:4.1.21.Final'
dependency 'junit:junit:4.12'
dependency 'io.aeron:aeron-all:1.4.1'
dependency 'org.hamcrest:hamcrest-library:1.3'
dependency 'org.hdrhistogram:HdrHistogram:2.1.10'
dependency 'org.mockito:mockito-core:2.16.0'
dependency 'org.openjdk.jmh:jmh-core:1.20'

dependencySet(group: 'org.openjdk.jmh', version: '1.20') {
entry 'jmh-core'
entry 'jmh-generator-annprocess'
}

// custom tasks for creating source/javadoc jars
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
dependencySet(group: 'org.slf4j', version: '1.7.25') {
entry 'slf4j-api'
entry 'slf4j-nop'
}
}
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
repositories {
mavenCentral()
}

tasks.bintrayUpload.dependsOn tasks.jar, tasks.sourcesJar, tasks.javadocJar
plugins.withType(JavaPlugin) {
compileJava {
sourceCompatibility = 1.8

// add javadoc/source jar tasks as artifacts
artifacts {
archives sourcesJar, javadocJar, jar
// TODO: Cleanup warnings so no need to exclude
options.compilerArgs << '-Xlint:all,-overloads,-rawtypes,-unchecked'
}
}

repositories {
jcenter()
}
plugins.withType(JavaLibraryPlugin) {
task sourcesJar(type: Jar) {
classifier 'sources'
from sourceSets.main.allJava
}

dependencies {
compile "io.projectreactor:reactor-core:3.1.3.RELEASE"
compile "io.netty:netty-buffer:4.1.20.Final"
compile "org.slf4j:slf4j-api:1.7.25"
compile "com.google.code.findbugs:jsr305:3.0.2"

testCompile "junit:junit:4.12"
testCompile "org.mockito:mockito-core:2.10.0"
testCompile "org.hamcrest:hamcrest-library:1.3"
testCompile "org.slf4j:slf4j-log4j12:1.7.25"
testCompile "io.projectreactor:reactor-test:3.1.3.RELEASE"
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier 'javadoc'
from javadoc.destinationDir
}
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
plugins.withType(MavenPublishPlugin) {
publishing {
publications {
maven(MavenPublication) {
groupId 'io.rsocket'

artifact sourcesJar {
classifier "sources"
}
from components.java

artifact javadocJar {
classifier "javadoc"
artifact sourcesJar
artifact javadocJar
}
}
}
}
}

artifactory {
publish {
contextUrl = 'https://oss.jfrog.org'

repository {
repoKey = 'oss-snapshot-local' //The Artifactory repository key to publish to
//when using oss.jfrog.org the credentials are from Bintray. For local build we expect them to be found in
//~/.gradle/gradle.properties, otherwise to be set in the build server
// Conditionalize for the users who don't have bintray credentials setup
if (project.hasProperty('bintrayUser')) {
username = project.property('bintrayUser')
password = project.property('bintrayKey')
}
}

publications('mavenJava')
apply from: 'artifactory.gradle'
apply from: 'bintray.gradle'

defaults {
// Reference to Gradle publications defined in the build script.
// This is how we tell the Artifactory Plugin which artifacts should be
// published to Artifactory.
publications('mavenJava')
publishArtifacts = true
}
}
}
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}

artifactoryPublish {
dependsOn jar
}
googleJavaFormat {
toolVersion = '1.5'
}

bintray {
if (project.hasProperty('bintrayUser')) {
user = project.property('bintrayUser')
key = project.property('bintrayKey')
}
publications = ['mavenJava']
dryRun = false
publish = true
override = false
pkg {
repo = 'RSocket'
name = 'rsocket-java'
desc = 'RSocket'
websiteUrl = 'https://github.com/rsocket/rsocket-java'
issueTrackerUrl = 'https://github.com/rsocket/rsocket-java'
vcsUrl = 'https://github.com/rsocket/rsocket-java.git'
licenses = ['Apache-2.0']
githubRepo = 'rsocket/rsocket-java' //Optional Github repository
githubReleaseNotesFile = 'README.md' //Optional Github readme file
if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')) {
def sonatypeUsername = project.property('sonatypeUsername')
def sonatypePassword = project.property('sonatypePassword')
version {
name = "v${project.version}"
vcsTag = "${project.version}"
mavenCentralSync {
sync = false
user = sonatypeUsername
password = sonatypePassword
}
}
}
}
}
repositories {
mavenCentral()
}
19 changes: 0 additions & 19 deletions gradle.properties

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip
Loading