diff --git a/.travis.yml b/.travis.yml index 2c50d07e..0cef83c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,25 @@ language: java +install: true + +sudo: false jdk: - oraclejdk8 - oraclejdk9 - openjdk8 -branches: - only: - - master - - /^v[0-9]/ + +before_install: + - chmod +x gradlew + +stages: + - name: build + +jobs: + include: + - stage: build + script: ./gradlew build + before_deploy: ./gradlew javadoc + deploy: - provider: pages local-dir: build/docs/javadoc @@ -17,3 +29,10 @@ deploy: on: branch: master jdk: openjdk8 + - provider: script + script: ./gradlew bintrayUpload -x test -Dbintray.user=$BINTRAY_USER -Dbintray.key=$BINTRAY_KEY -Dbuild.number=$TRAVIS_BUILD_NUMBER + script + on: + tags: true + jdk: openjdk8 + diff --git a/build.gradle b/build.gradle index cb16e111..d87b2166 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,19 @@ +buildscript { + repositories { + mavenLocal() + mavenCentral() + jcenter() + } +} + plugins { id 'io.franzbecker.gradle-lombok' version '1.12' id 'java' id 'net.saliman.cobertura' version '2.5.4' id 'checkstyle' id 'osgi' + id "maven-publish" + id "com.jfrog.bintray" version "1.7.3" } sourceCompatibility = 1.7 @@ -21,6 +31,8 @@ configurations { } repositories { + mavenLocal() + mavenCentral() jcenter() } @@ -72,9 +84,92 @@ javadoc { options.docletpath = configurations.doclava.files.asType(List) } - cobertura { coverageFormats = ['html', 'xml'] coverageIgnores = [ 'java.io.UnsupportedEncodingException', 'com.amadeus.resources.*' ] coverageIgnoreTrivial = true +} + +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives sourcesJar + archives javadocJar +} + +def pomConfig = { + licenses { + license { + name POM_LICENCE_NAME + url POM_LICENCE_URL + distribution POM_LICENCE_DIST + } + } + developers { + developer { + id "aroux" + name "Anthony Roux" + email "anthony.roux@amadeus.com" + } + developer { + id "cbetta" + name "Cristiano Betta" + email "cristiano@betta.io" + } + } + + scm { + url POM_SCM_URL + } +} + +publishing { + publications { + mavenPublication(MavenPublication) { + from components.java + artifact sourcesJar { + classifier "sources" + } + artifact javadocJar { + classifier "javadoc" + } + groupId GROUP + artifactId POM_ARTIFACT_ID + version VERSION_NAME + pom.withXml { + def root = asNode() + root.appendNode('description', POM_DESCRIPTION) + root.appendNode('name', POM_NAME) + root.appendNode('url', POM_URL) + root.children().last() + pomConfig + } + } + } +} + +bintray { + user = System.getProperty('bintray.user') + key = System.getProperty('bintray.key') + publications = ['mavenPublication'] + + pkg { + repo = BINTRAY_REPO + name = BINTRAY_NAME + licenses = ['MIT'] + vcsUrl = POM_SCM_URL + version { + name = VERSION_NAME + desc = VERSION_NAME + released = new Date() + } + } + } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 641d8b05..19ce2d44 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ GROUP=com.amadeus -VERSION_NAME=1.0.0-SNAPSHOT +VERSION_NAME=1.0.0 POM_URL=https://github.com/amadeus4dev/amadeus-java POM_SCM_URL=git@github.com:amadeus4dev/amadeus-java.git @@ -18,4 +18,7 @@ POM_ARTIFACT_ID=amadeus-java POM_PACKAGING=jar POM_ORGANIZATION_URL=https://developer.amadeus.com +BINTRAY_REPO=java +BINTRAY_NAME=amadeus-java + VENDOR_NAME=Amadeus IT Group SA (https://amadeus.com)