diff --git a/build.gradle b/build.gradle index fba5db2..942fc8d 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,10 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.2.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.novoda:bintray-release:0.8.1' + + // plugin for jcenter + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' } } @@ -30,9 +33,4 @@ allprojects { task clean(type: Delete) { delete rootProject.buildDir -} - -tasks.getByPath(":rximagepicker:releaseAndroidJavadocs").enabled = false -tasks.getByPath(":rximagepicker_support:releaseAndroidJavadocs").enabled = false -tasks.getByPath(":rximagepicker_support_wechat:releaseAndroidJavadocs").enabled = false -tasks.getByPath(":rximagepicker_support_zhihu:releaseAndroidJavadocs").enabled = false +} \ No newline at end of file diff --git a/config.gradle b/config.gradle index df86431..9a08dcb 100644 --- a/config.gradle +++ b/config.gradle @@ -10,7 +10,13 @@ project.ext { minSdkVersion : 16, targetSdkVersion : 28, versionCode : 21, - versionName : "2.3.0-alpha" + versionName : "2.3.0-alpha01" + ] + + constants = [ + siteUrl: "https://github.com/qingmei2/RxImagePicker", + gitUrl : "https://github.com/qingmei2/RxImagePicker.git", + group : "com.github.qingmei2" ] dependencies = [ diff --git a/rximagepicker/build.gradle b/rximagepicker/build.gradle index ba7e21b..e1c3f4e 100644 --- a/rximagepicker/build.gradle +++ b/rximagepicker/build.gradle @@ -1,7 +1,9 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' -apply plugin: 'com.novoda.bintray-release' + +apply plugin: 'com.github.dcendents.android-maven' +apply plugin: 'com.jfrog.bintray' android { compileSdkVersion rootProject.ext.android["compileSdkVersion"] @@ -41,11 +43,78 @@ repositories { mavenCentral() } -publish { - userOrg = 'mq2553299' - groupId = 'com.github.qingmei2' - artifactId = 'rximagepicker' - publishVersion = rootProject.ext.android["versionName"] - desc = 'The library which choosing pictures from camera or gallery in Android.' - website = 'https://github.com/qingmei2/RxImagePicker' +version = rootProject.ext.android["versionName"] +group = rootProject.ext.constants["group"] +def siteUrl = rootProject.ext.constants["siteUrl"] +def gitUrl = rootProject.ext.constants["gitUrl"] +def libName = "rximagepicker" +def projectName = "RxImagePicker" + +install { + repositories.mavenInstaller { + // This generates POM.xml with proper parameters + pom { + project { + packaging 'aar' + name projectName + url siteUrl + licenses { + license { + name 'MIT license' + url 'https://github.com/qingmei2/RxImagePicker/blob/2.x/LICENSE' + } + } + developers { + developer { + id 'qingmei2' + name 'qingmei2' + email 'mq2553299@qq.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 + failOnError false + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) +} + +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()) + +bintray { + user = properties.getProperty("bintray.user") + key = properties.getProperty("bintray.apikey") + configurations = ['archives'] + pkg { + repo = "maven" + name = libName + websiteUrl = siteUrl + vcsUrl = gitUrl + licenses = ["MIT"] + publish = true + } } \ No newline at end of file diff --git a/rximagepicker_support/build.gradle b/rximagepicker_support/build.gradle index 144b92f..e1d85fe 100644 --- a/rximagepicker_support/build.gradle +++ b/rximagepicker_support/build.gradle @@ -1,7 +1,9 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' -apply plugin: 'com.novoda.bintray-release' + +apply plugin: 'com.github.dcendents.android-maven' +apply plugin: 'com.jfrog.bintray' android { compileSdkVersion rootProject.ext.android["compileSdkVersion"] @@ -43,11 +45,78 @@ repositories { mavenCentral() } -publish { - userOrg = 'mq2553299' - groupId = 'com.github.qingmei2' - artifactId = 'rximagepicker_support' - publishVersion = rootProject.ext.android["versionName"] - desc = 'The library which choosing pictures from camera or gallery in Android.' - website = 'https://github.com/qingmei2/RxImagePicker' +version = rootProject.ext.android["versionName"] +group = rootProject.ext.constants["group"] +def siteUrl = rootProject.ext.constants["siteUrl"] +def gitUrl = rootProject.ext.constants["gitUrl"] +def libName = "rximagepicker_support" +def projectName = "RxImagePicker" + +install { + repositories.mavenInstaller { + // This generates POM.xml with proper parameters + pom { + project { + packaging 'aar' + name projectName + url siteUrl + licenses { + license { + name 'MIT license' + url 'https://github.com/qingmei2/RxImagePicker/blob/2.x/LICENSE' + } + } + developers { + developer { + id 'qingmei2' + name 'qingmei2' + email 'mq2553299@qq.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 + failOnError false + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) +} + +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()) + +bintray { + user = properties.getProperty("bintray.user") + key = properties.getProperty("bintray.apikey") + configurations = ['archives'] + pkg { + repo = "maven" + name = libName + websiteUrl = siteUrl + vcsUrl = gitUrl + licenses = ["MIT"] + publish = true + } } \ No newline at end of file diff --git a/rximagepicker_support_wechat/build.gradle b/rximagepicker_support_wechat/build.gradle index 8e7c361..a3aa30f 100644 --- a/rximagepicker_support_wechat/build.gradle +++ b/rximagepicker_support_wechat/build.gradle @@ -2,7 +2,9 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' -apply plugin: 'com.novoda.bintray-release' + +apply plugin: 'com.github.dcendents.android-maven' +apply plugin: 'com.jfrog.bintray' android { compileSdkVersion rootProject.ext.android["compileSdkVersion"] @@ -51,14 +53,82 @@ dependencies { repositories { mavenCentral() } -publish { - userOrg = 'mq2553299' - groupId = 'com.github.qingmei2' - artifactId = 'rximagepicker_support_wechat' - publishVersion = rootProject.ext.android["versionName"] - desc = 'The library which choosing pictures from camera or gallery in Android.' - website = 'https://github.com/qingmei2/RxImagePicker' -} kapt { generateStubs = true +} + +version = rootProject.ext.android["versionName"] +group = rootProject.ext.constants["group"] +def siteUrl = rootProject.ext.constants["siteUrl"] +def gitUrl = rootProject.ext.constants["gitUrl"] +def libName = "rximagepicker_support_wechat" +def projectName = "RxImagePicker" + +install { + repositories.mavenInstaller { + // This generates POM.xml with proper parameters + pom { + project { + packaging 'aar' + name projectName + url siteUrl + licenses { + license { + name 'MIT license' + url 'https://github.com/qingmei2/RxImagePicker/blob/2.x/LICENSE' + } + } + developers { + developer { + id 'qingmei2' + name 'qingmei2' + email 'mq2553299@qq.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 + failOnError false + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) +} + +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()) + +bintray { + user = properties.getProperty("bintray.user") + key = properties.getProperty("bintray.apikey") + configurations = ['archives'] + pkg { + repo = "maven" + name = libName + websiteUrl = siteUrl + vcsUrl = gitUrl + licenses = ["MIT"] + publish = true + } } \ No newline at end of file diff --git a/rximagepicker_support_zhihu/build.gradle b/rximagepicker_support_zhihu/build.gradle index f61d589..305c304 100644 --- a/rximagepicker_support_zhihu/build.gradle +++ b/rximagepicker_support_zhihu/build.gradle @@ -2,7 +2,9 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' -apply plugin: 'com.novoda.bintray-release' + +apply plugin: 'com.github.dcendents.android-maven' +apply plugin: 'com.jfrog.bintray' android { compileSdkVersion rootProject.ext.android["compileSdkVersion"] @@ -52,14 +54,82 @@ dependencies { repositories { mavenCentral() } -publish { - userOrg = 'mq2553299' - groupId = 'com.github.qingmei2' - artifactId = 'rximagepicker_support_zhihu' - publishVersion = rootProject.ext.android["versionName"] - desc = 'The library which choosing pictures from camera or gallery in Android.' - website = 'https://github.com/qingmei2/RxImagePicker' -} kapt { generateStubs = true +} + +version = rootProject.ext.android["versionName"] +group = rootProject.ext.constants["group"] +def siteUrl = rootProject.ext.constants["siteUrl"] +def gitUrl = rootProject.ext.constants["gitUrl"] +def libName = "rximagepicker_support_zhihu" +def projectName = "RxImagePicker" + +install { + repositories.mavenInstaller { + // This generates POM.xml with proper parameters + pom { + project { + packaging 'aar' + name projectName + url siteUrl + licenses { + license { + name 'MIT license' + url 'https://github.com/qingmei2/RxImagePicker/blob/2.x/LICENSE' + } + } + developers { + developer { + id 'qingmei2' + name 'qingmei2' + email 'mq2553299@qq.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 + failOnError false + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) +} + +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()) + +bintray { + user = properties.getProperty("bintray.user") + key = properties.getProperty("bintray.apikey") + configurations = ['archives'] + pkg { + repo = "maven" + name = libName + websiteUrl = siteUrl + vcsUrl = gitUrl + licenses = ["MIT"] + publish = true + } } \ No newline at end of file diff --git a/sample/build.gradle b/sample/build.gradle index d2a4317..bc3126c 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -34,7 +34,7 @@ android { } } -def testJcenter = false +def dependRemote = true dependencies { implementation rootProject.ext.dependencies["kotlin-android"] @@ -51,7 +51,7 @@ dependencies { androidTestImplementation rootProject.ext.dependencies["test-runner"] androidTestImplementation rootProject.ext.dependencies["test-rules"] - if (testJcenter) { + if (dependRemote) { implementation "com.github.qingmei2:rximagepicker:$rootProject.ext.android.versionName" implementation "com.github.qingmei2:rximagepicker_support:$rootProject.ext.android.versionName" implementation "com.github.qingmei2:rximagepicker_support_zhihu:$rootProject.ext.android.versionName"