From 6d5a6680de8d0c1441c23c27b3bae8e5f004adfe Mon Sep 17 00:00:00 2001 From: mkoslacz Date: Thu, 9 Feb 2017 22:24:37 +0100 Subject: [PATCH] [moviper-test][gradle][core] add: moviper-test publishing script and extract moviper version code to the root gradle file --- build.gradle | 3 ++ moviper-test/build.gradle | 111 +++++++++++++++++++++++++++++++++++--- moviper/build.gradle | 4 +- 3 files changed, 110 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 34b84d5..4692653 100644 --- a/build.gradle +++ b/build.gradle @@ -32,6 +32,9 @@ task clean(type: Delete) { } ext { + releaseVersionCode = 4 + releaseVersionName = '1.3.0-alpha' + minSdkVersion = 16 targetSdkVersion = 25 compileSdkVersion = 25 diff --git a/moviper-test/build.gradle b/moviper-test/build.gradle index bcee154..af896c6 100644 --- a/moviper-test/build.gradle +++ b/moviper-test/build.gradle @@ -1,19 +1,24 @@ apply plugin: 'com.android.library' +apply plugin: 'com.github.dcendents.android-maven' +apply plugin: "com.jfrog.bintray" apply plugin: 'me.tatarka.retrolambda' +// This is the library version used when deploying the artifact +version = rootProject.ext.releaseVersionName + android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" + compileSdkVersion rootProject.ext.compileSdkVersion + buildToolsVersion rootProject.ext.buildToolsVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } defaultConfig { - minSdkVersion 16 - targetSdkVersion 25 - versionCode 1 - versionName "1.0" + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion + versionCode rootProject.ext.releaseVersionCode + versionName version } buildTypes { release { @@ -35,3 +40,97 @@ dependencies { compile 'junit:junit:' + rootProject.ext.junitVersion compile project(':moviper') } + + + +def siteUrl = 'https://github.com/mkoslacz/Moviper' // Homepage URL of the library +def gitUrl = 'https://github.com/mkoslacz/Moviper.git' // Git repository URL +group = "com.mateuszkoslacz.moviper" // Maven Group ID for the artifact + +install { + repositories.mavenInstaller { + // This generates POM.xml with proper parameters + pom { + project { + packaging 'aar' + + // Add your description here + name 'com.mateuszkoslacz.moviper:moviper-test-utils' + description = 'A test utils library for Moviper' + url siteUrl + + // Set your license + licenses { + license { + name 'The Apache Software License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id 'mkoslacz' + name 'Mateusz Koslacz' + email 'mateusz.koslacz@gmail.com' + } + } + scm { + connection gitUrl + developerConnection gitUrl + url siteUrl + } + } + } + } +} + +task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' +} + +task javadoc(type: Javadoc) { + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) +} + +afterEvaluate { + javadoc.classpath += files(android.libraryVariants.collect { variant -> + variant.javaCompile.classpath.files + }) +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} +artifacts { + archives javadocJar + archives sourcesJar +} + +Properties properties = new Properties() +properties.load(project.rootProject.file('local.properties').newDataInputStream()) + +// https://github.com/bintray/gradle-bintray-plugin +bintray { + user = properties.getProperty("bintray.user") + key = properties.getProperty("bintray.apikey") + + configurations = ['archives'] + pkg { + repo = "Moviper" + // it is the name that appears in bintray when logged + name = "com.mateuszkoslacz.moviper:moviper-test-utils" + websiteUrl = siteUrl + vcsUrl = gitUrl + licenses = ["Apache-2.0"] + publish = true + version { + gpg { + sign = true //Determines whether to GPG sign the files. The default is false + passphrase = properties.getProperty("bintray.gpg.password") + //Optional. The passphrase for GPG signing' + } + } + } +} diff --git a/moviper/build.gradle b/moviper/build.gradle index 9c81c53..f7f6e05 100644 --- a/moviper/build.gradle +++ b/moviper/build.gradle @@ -5,7 +5,7 @@ apply plugin: 'me.tatarka.retrolambda' apply plugin: 'android-apt' // This is the library version used when deploying the artifact -version = "1.2.0-alpha" +version = rootProject.ext.releaseVersionName android { @@ -24,7 +24,7 @@ android { defaultConfig { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 3 + versionCode rootProject.ext.releaseVersionCode versionName version } buildTypes {