diff --git a/.travis.yml b/.travis.yml index 78bd255..04287f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ cache: directories: - "$HOME/.m2" after_success: -- "./gradlew cobertura coveralls --stacktrace" +- ./gradlew cobertura coveralls --stacktrace - test "${TRAVIS_PULL_REQUEST}" == "false" && test "${TRAVIS_TAG}" != "" && ./gradlew bintrayUpload --stacktrace env: diff --git a/build.gradle b/build.gradle index 1745e18..db2a0da 100644 --- a/build.gradle +++ b/build.gradle @@ -22,6 +22,7 @@ apply plugin: 'java' apply plugin: 'maven' apply plugin: 'com.jfrog.bintray' apply plugin: 'maven-publish' +apply plugin: "com.github.johnrengelman.shadow" sourceCompatibility = 1.7 targetCompatibility = 1.7 diff --git a/gradle.properties b/gradle.properties index 273f6f8..2a6d447 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,6 +14,6 @@ # limitations under the License. # -version=1.1.0 +version=1.2.0 groupId=com.nike artifactId=cerberus-client \ No newline at end of file diff --git a/gradle/bintray.gradle b/gradle/bintray.gradle index fcdcc67..c38c1b8 100644 --- a/gradle/bintray.gradle +++ b/gradle/bintray.gradle @@ -14,7 +14,6 @@ * limitations under the License. */ -def createPomOutputLocation = "${project.buildDir}/libs/pom.xml" def bintrayUser = project.hasProperty('bintrayUser') ? project.bintrayUser : System.getenv('BINTRAY_USER') ?: '' def bintrayKey = project.hasProperty('bintrayKey') ? project.bintrayKey : System.getenv('BINTRAY_KEY') ?: '' def bintrayVersion = "$version" @@ -24,7 +23,7 @@ bintray { key = bintrayKey dryRun = false publish = true - publications = ['mavenInfo'] + publications = ['jar'] pkg { repo = 'maven' @@ -62,52 +61,15 @@ artifacts { archives sourcesJar } -task createPom << { - pom { - project { - groupId groupId - artifactId artifactId - version version - name artifactId - description "Cerberus Client" - url 'https://github.com/Nike-Inc/cerberus-java-client' - inceptionYear '2016' - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' - } - } - scm { - url 'https://github.com/Nike-Inc/cerberus-java-client' - connection 'git@github.com:Nike-Inc/cerberus-java-client.git' - } - organization { - name 'Nike' - url 'http://nike-inc.github.io' - } - } - }.writeTo(createPomOutputLocation) -} - publishing { publications { - mavenInfo(MavenPublication) { - from components.java + jar(MavenPublication) { + from components.shadow artifact sourcesJar artifact javadocJar - - pom.withXml { - // The pom produced by this task is questionable - ALL dependencies are set to runtime rather than how we set them up in the build.gradle files. - // Unfortunately we need to use this task anyway for the bintray gradle plugin. - // Therefore we'll just wipe out the pom this produces and use one created by the normal maven plugin (see the createPom task) instead. - asString().delete(0, Integer.MAX_VALUE).append(new File(createPomOutputLocation).text) - } } } } -bintrayUpload.dependsOn(createPom) -assemble.finalizedBy(createPom) \ No newline at end of file +bintrayUpload.dependsOn(shadowJar) \ No newline at end of file diff --git a/gradle/buildscript.gradle b/gradle/buildscript.gradle index 2b57116..6019a59 100644 --- a/gradle/buildscript.gradle +++ b/gradle/buildscript.gradle @@ -22,4 +22,5 @@ dependencies { classpath "net.saliman:gradle-cobertura-plugin:2.3.0" classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6' classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.3' + classpath "com.github.jengelman.gradle.plugins:shadow:1.2.4" } diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index a3c3219..31b86f0 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -18,28 +18,27 @@ repositories { jcenter() } -final String AWS_SDK_VERSION = '1.10.50' +def AWS_SDK_VERSION = '1.11.75' //noinspection GroovyAssignabilityCheck -configurations.all { - resolutionStrategy { - // add a dependency resolve rule - eachDependency { DependencyResolveDetails details -> - //Force use of certain dependencies or versions - if (details.requested.group == 'com.amazonaws') { - details.useVersion(AWS_SDK_VERSION) - } - } - } -} - dependencies { + +/*********************************************************************************************************************** + * IMPORTANT! This project produces a fat jar! * + * * + * If you add a new compile dependency to this library and do not also verify that it gets shaded * + * you will introduce a transitive dependency nightmare for users of this library. * + * * + * We do this because AWS constantly breaks backwards compatibility of their SDK with minor version releases. * + * We do not want to dictate what SDK version users of Cerberus should use. * + ***********************************************************************************************************************/ compile "com.nike:vault-client:1.0.0" compile "joda-time:joda-time:2.8.1" compile "org.apache.commons:commons-lang3:3.4" compile "org.slf4j:slf4j-api:1.7.14" - compile "com.amazonaws:aws-java-sdk-core:1.10.50" - compile "com.amazonaws:aws-java-sdk-kms:1.10.50" - compile "com.amazonaws:aws-java-sdk-lambda:1.10.50" + + compile "com.amazonaws:aws-java-sdk-core:${AWS_SDK_VERSION}" + compile "com.amazonaws:aws-java-sdk-kms:${AWS_SDK_VERSION}" + compile "com.amazonaws:aws-java-sdk-lambda:${AWS_SDK_VERSION}" testCompile "junit:junit:4.12" testCompile ("org.mockito:mockito-core:1.10.19") { @@ -54,3 +53,17 @@ dependencies { testCompile "org.assertj:assertj-core:2.3.0" testCompile "com.squareup.okhttp3:mockwebserver:3.0.1" } + +shadowJar { + classifier = '' + relocate('com.', 'cerberus.com.') { + exclude 'com.nike.**' + } + relocate 'org.', 'cerberus.org.' + relocate 'javax.annotation', 'cerberus.javax.annotation' + relocate 'models.', 'cerberus.models.' + relocate 'mozilla.', 'cerberus.mozilla.' + relocate 'okhttp3.', 'cerberus.okhttp3.' + relocate 'okio.', 'cerberus.okio.' + relocate 'software.', 'cerberus.software.' +} \ No newline at end of file