From c10c1355c930080408db16439769d5fcb69de30b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A3=E7=BA=AC?= Date: Thu, 17 Jun 2021 16:25:40 +0800 Subject: [PATCH] Migrate from jcenter to mavenCentral and release 1.5.2 --- README.md | 6 +- README_CN.md | 10 +- arouter-annotation/build.gradle | 17 +-- arouter-annotation/gradle.properties | 5 + arouter-api/build.gradle | 13 +- arouter-api/gradle.properties | 5 + arouter-compiler/build.gradle | 11 +- arouter-compiler/gradle.properties | 5 + arouter-gradle-plugin/build.gradle | 11 +- arouter-gradle-plugin/gradle.properties | 5 + bintray.gradle | 61 --------- build.gradle | 11 +- gradle.properties | 31 ++--- gradle/publish.gradle | 174 ++++++++++++++++++++++++ install.gradle | 44 ------ 15 files changed, 230 insertions(+), 179 deletions(-) create mode 100644 arouter-annotation/gradle.properties create mode 100644 arouter-api/gradle.properties create mode 100644 arouter-compiler/gradle.properties create mode 100644 arouter-gradle-plugin/gradle.properties delete mode 100644 bintray.gradle create mode 100644 gradle/publish.gradle delete mode 100644 install.gradle diff --git a/README.md b/README.md index 481fe2b6..27a59803 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ module|arouter-api|arouter-compiler|arouter-register|arouter-idea-plugin ---|---|---|---|--- -version|[![Download](https://api.bintray.com/packages/zhi1ong/maven/arouter-api/images/download.svg)](https://bintray.com/zhi1ong/maven/arouter-api/_latestVersion)|[![Download](https://api.bintray.com/packages/zhi1ong/maven/arouter-compiler/images/download.svg)](https://bintray.com/zhi1ong/maven/arouter-compiler/_latestVersion)|[![Download](https://api.bintray.com/packages/zhi1ong/maven/arouter-register/images/download.svg)](https://bintray.com/zhi1ong/maven/arouter-register/_latestVersion)|[![as plugin](https://img.shields.io/jetbrains/plugin/d/11428-arouter-helper.svg)](https://plugins.jetbrains.com/plugin/11428-arouter-helper) +version|[![Download](https://maven-badges.herokuapp.com/maven-central/com.alibaba/arouter-api/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.alibaba/arouter-api)|[![Download](https://maven-badges.herokuapp.com/maven-central/com.alibaba/arouter-compiler/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.alibaba/arouter-compiler)|[![Download](https://maven-badges.herokuapp.com/maven-central/com.alibaba/arouter-register/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.alibaba/arouter-register)|[![as plugin](https://img.shields.io/jetbrains/plugin/d/11428-arouter-helper.svg)](https://plugins.jetbrains.com/plugin/11428-arouter-helper) #### Demo @@ -117,7 +117,7 @@ version|[![Download](https://api.bintray.com/packages/zhi1ong/maven/arouter-api/ buildscript { repositories { - jcenter() + mavenCentral() } dependencies { @@ -493,7 +493,7 @@ annotation,**Only the routing information of the same group can be registered buildscript { repositories { - jcenter() + mavenCentral() } dependencies { diff --git a/README_CN.md b/README_CN.md index 2f1778ee..8fe0dcb6 100644 --- a/README_CN.md +++ b/README_CN.md @@ -12,7 +12,7 @@ 模块|arouter-api|arouter-compiler|arouter-register|arouter-idea-plugin ---|---|---|---|--- -最新版本|[![Download](https://api.bintray.com/packages/zhi1ong/maven/arouter-api/images/download.svg)](https://bintray.com/zhi1ong/maven/arouter-api/_latestVersion)|[![Download](https://api.bintray.com/packages/zhi1ong/maven/arouter-compiler/images/download.svg)](https://bintray.com/zhi1ong/maven/arouter-compiler/_latestVersion)|[![Download](https://api.bintray.com/packages/zhi1ong/maven/arouter-register/images/download.svg)](https://bintray.com/zhi1ong/maven/arouter-register/_latestVersion)|[![as plugin](https://img.shields.io/jetbrains/plugin/d/11428-arouter-helper.svg)](https://plugins.jetbrains.com/plugin/11428-arouter-helper) +最新版本|[![Download](https://maven-badges.herokuapp.com/maven-central/com.alibaba/arouter-api/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.alibaba/arouter-api)|[![Download](https://maven-badges.herokuapp.com/maven-central/com.alibaba/arouter-compiler/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.alibaba/arouter-compiler)|[![Download](https://maven-badges.herokuapp.com/maven-central/com.alibaba/arouter-register/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.alibaba/arouter-register)|[![as plugin](https://img.shields.io/jetbrains/plugin/d/11428-arouter-helper.svg)](https://plugins.jetbrains.com/plugin/11428-arouter-helper) #### Demo展示 @@ -119,7 +119,7 @@ buildscript { repositories { - jcenter() + mavenCentral() } dependencies { @@ -534,17 +534,17 @@ buildscript { repositories { - jcenter() + mavenCentral() } dependencies { - classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4' + classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4' } } apt { arguments { - AROUTER_MODULE_NAME project.getName(); + AROUTER_MODULE_NAME project.getName(); } } diff --git a/arouter-annotation/build.gradle b/arouter-annotation/build.gradle index b0863590..2c1c2519 100644 --- a/arouter-annotation/build.gradle +++ b/arouter-annotation/build.gradle @@ -1,17 +1,8 @@ apply plugin: 'java' -ext { - bintrayName = 'arouter-annotation' - artifact = bintrayName - libraryName = 'ARouter annotation' - libraryDescription = 'The annotation used in arouter api' - libraryVersion = arouter_annotation_version +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } -compileJava { - sourceCompatibility = '1.8' - targetCompatibility = '1.8' -} - -apply from: '../install.gradle' -apply from: '../bintray.gradle' \ No newline at end of file +apply from: rootProject.file('gradle/publish.gradle') \ No newline at end of file diff --git a/arouter-annotation/gradle.properties b/arouter-annotation/gradle.properties new file mode 100644 index 00000000..2b89f853 --- /dev/null +++ b/arouter-annotation/gradle.properties @@ -0,0 +1,5 @@ +POM_NAME=ARouter Annotations +POM_ARTIFACT_ID=arouter-annotation +POM_PACKAGING=jar +POM_DESCRIPTION=The annotation used in arouter api +VERSION_NAME=1.0.6 \ No newline at end of file diff --git a/arouter-api/build.gradle b/arouter-api/build.gradle index c4f3b597..62afaf73 100644 --- a/arouter-api/build.gradle +++ b/arouter-api/build.gradle @@ -1,13 +1,5 @@ apply plugin: 'com.android.library' -ext { - bintrayName = 'arouter-api' - artifact = bintrayName - libraryName = 'ARouter sdk' - libraryDescription = 'A router for android' - libraryVersion = arouter_main_version -} - android { compileSdkVersion Integer.parseInt(COMPILE_SDK_VERSION) buildToolsVersion BUILDTOOLS_VERSION @@ -39,10 +31,9 @@ android { } dependencies { - annotationProcessor 'com.alibaba:arouter-compiler:1.5.1' + annotationProcessor 'com.alibaba:arouter-compiler:1.5.2' api 'com.alibaba:arouter-annotation:1.0.6' implementation "com.android.support:support-v4:${SUPPORT_LIB_VERSION}" } -apply from: '../install.gradle' -apply from: '../bintray.gradle' \ No newline at end of file +apply from: rootProject.file('gradle/publish.gradle') \ No newline at end of file diff --git a/arouter-api/gradle.properties b/arouter-api/gradle.properties new file mode 100644 index 00000000..e3ebdc12 --- /dev/null +++ b/arouter-api/gradle.properties @@ -0,0 +1,5 @@ +POM_NAME=ARouter SDK +POM_ARTIFACT_ID=arouter-api +POM_PACKAGING=aar +POM_DESCRIPTION=Route framework for android +VERSION_NAME=1.5.2 \ No newline at end of file diff --git a/arouter-compiler/build.gradle b/arouter-compiler/build.gradle index ed33584d..198766d4 100644 --- a/arouter-compiler/build.gradle +++ b/arouter-compiler/build.gradle @@ -1,13 +1,5 @@ apply plugin: 'java' -ext { - bintrayName = 'arouter-compiler' - artifact = bintrayName - libraryName = 'ARouter compiler' - libraryDescription = 'A compiler for ARouter to find route' - libraryVersion = arouter_main_version -} - compileJava { sourceCompatibility = '1.8' targetCompatibility = '1.8' @@ -27,5 +19,4 @@ dependencies { implementation 'com.alibaba:fastjson:1.2.69' } -apply from: '../install.gradle' -apply from: '../bintray.gradle' \ No newline at end of file +apply from: rootProject.file('gradle/publish.gradle') \ No newline at end of file diff --git a/arouter-compiler/gradle.properties b/arouter-compiler/gradle.properties new file mode 100644 index 00000000..07527010 --- /dev/null +++ b/arouter-compiler/gradle.properties @@ -0,0 +1,5 @@ +POM_NAME=ARouter Compiler +POM_ARTIFACT_ID=arouter-compiler +POM_PACKAGING=jar +POM_DESCRIPTION=Compiler for ARouter to find route +VERSION_NAME=1.5.2 \ No newline at end of file diff --git a/arouter-gradle-plugin/build.gradle b/arouter-gradle-plugin/build.gradle index cb24fd3a..0fa7f0f1 100644 --- a/arouter-gradle-plugin/build.gradle +++ b/arouter-gradle-plugin/build.gradle @@ -1,13 +1,5 @@ apply plugin: 'groovy' -ext { - bintrayName = 'arouter-register' - artifact = bintrayName - libraryName = 'ARouter register gradle plugin' - libraryDescription = 'A gradle plugin used for arouter route map register' - libraryVersion = arouter_register_version -} - dependencies { compile gradleApi() compile localGroovy() @@ -17,5 +9,4 @@ dependencies { compile 'com.android.tools.build:gradle:2.1.3' } -apply from: '../install.gradle' -apply from: '../bintray.gradle' \ No newline at end of file +apply from: rootProject.file('gradle/publish.gradle') \ No newline at end of file diff --git a/arouter-gradle-plugin/gradle.properties b/arouter-gradle-plugin/gradle.properties new file mode 100644 index 00000000..e03a4da7 --- /dev/null +++ b/arouter-gradle-plugin/gradle.properties @@ -0,0 +1,5 @@ +POM_NAME=ARouter Register +POM_ARTIFACT_ID=arouter-register +POM_PACKAGING=jar +POM_DESCRIPTION=Gradle plugin used for arouter route map register +VERSION_NAME=1.0.2 \ No newline at end of file diff --git a/bintray.gradle b/bintray.gradle deleted file mode 100644 index d49f042c..00000000 --- a/bintray.gradle +++ /dev/null @@ -1,61 +0,0 @@ -// backup of [https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle] - -apply plugin: 'com.jfrog.bintray' - -version = libraryVersion - -if (project.hasProperty("android")) { // Android libraries - task sourcesJar(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.srcDirs - } - - task javadoc(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - } -} else { // Java libraries - 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 javadocJar - archives sourcesJar -} - -// Bintray -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 = bintrayRepo - name = bintrayName - desc = libraryDescription - websiteUrl = siteUrl - vcsUrl = gitUrl - licenses = allLicenses - publish = true - publicDownloadNumbers = true - version { - desc = libraryDescription - 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/build.gradle b/build.gradle index b83980e7..8cfd44da 100644 --- a/build.gradle +++ b/build.gradle @@ -3,21 +3,16 @@ buildscript { ext.arouter_register_version = '1.0.2' repositories { - maven { - url "https://oss.sonatype.org/content/repositories/snapshots/" - } maven { url 'http://dl.bintray.com/jetbrains/intellij-plugin-service' } mavenCentral() - jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:4.1.1' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "com.alibaba:arouter-register:$arouter_register_version" @@ -26,7 +21,11 @@ buildscript { allprojects { repositories { - jcenter() + mavenLocal() + mavenCentral() + maven { + url "https://s01.oss.sonatype.org/content/repositories/releases/" + } google() } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 1a2f22b1..c07b94c4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,21 +24,20 @@ SUPPORT_LIB_VERSION=28.0.0 MIN_SDK_VERSION=14 TARGET_SDK_VERSION=28 -arouter_main_version=1.5.2 -arouter_annotation_version=1.0.6 -arouter_register_version=1.0.2 -arouter_idea_plugin_version=1.0.0 -support_idea_version=2016.2.5 -arouter_idea_plugin_name=ARouter Road Sign +GROUP=com.alibaba + +POM_URL=https://github.com/Alibaba/ARouter/ +POM_SCM_URL=https://github.com/Alibaba/ARouter/ +POM_SCM_CONNECTION=scm:git:git://github.com/Alibaba/ARouter.git +POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/Alibaba/ARouter.git -bintrayRepo=maven -publishedGroupId=com.alibaba -siteUrl=https://github.com/Alibaba/ARouter -gitUrl=https://github.com/Alibaba/ARouter.git -developerId=zhi1ong -developerName=zhilong.liu -developerEmail=zhilong.liu@aliyun.com +POM_LICENCE_NAME=The Apache Software License, Version 2.0 +POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt +POM_LICENCE_DIST=repo -licenseName=The Apache Software License, Version 2.0 -licenseUrl=http://www.apache.org/licenses/LICENSE-2.0.txt -allLicenses=["Apache-2.0"] \ No newline at end of file +POM_DEVELOPER_ID=zhi1ong +POM_DEVELOPER_NAME=ZhiLong Liu + +arouter_idea_plugin_version=1.0.0 +support_idea_version=2016.2.5 +arouter_idea_plugin_name=ARouter Road Sign \ No newline at end of file diff --git a/gradle/publish.gradle b/gradle/publish.gradle new file mode 100644 index 00000000..bd95c563 --- /dev/null +++ b/gradle/publish.gradle @@ -0,0 +1,174 @@ +/* + * Copyright 2013 Chris Banes + * + * 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. + */ + +apply plugin: 'maven' +apply plugin: 'signing' + +version = VERSION_NAME +group = GROUP + +def isReleaseBuild() { + return VERSION_NAME.contains("SNAPSHOT") == false +} + +def getReleaseRepositoryUrl() { + return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL + : "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" +} + +def getSnapshotRepositoryUrl() { + return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL + : "https://s01.oss.sonatype.org/content/repositories/snapshots/" +} + +def getRepositoryUsername() { + return hasProperty('SONATYPE_NEXUS_USERNAME') ? SONATYPE_NEXUS_USERNAME : "" +} + +def getRepositoryPassword() { + return hasProperty('SONATYPE_NEXUS_PASSWORD') ? SONATYPE_NEXUS_PASSWORD : "" +} + +def configurePom(pom) { + pom.groupId = GROUP + pom.artifactId = POM_ARTIFACT_ID + pom.version = VERSION_NAME + + pom.project { + name POM_NAME + packaging POM_PACKAGING + description POM_DESCRIPTION + url POM_URL + + scm { + url POM_SCM_URL + connection POM_SCM_CONNECTION + developerConnection POM_SCM_DEV_CONNECTION + } + + licenses { + license { + name POM_LICENCE_NAME + url POM_LICENCE_URL + distribution POM_LICENCE_DIST + } + } + + developers { + developer { + id POM_DEVELOPER_ID + name POM_DEVELOPER_NAME + } + } + } +} + +afterEvaluate { project -> + uploadArchives { + repositories { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + repository(url: getReleaseRepositoryUrl()) { + authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) + } + snapshotRepository(url: getSnapshotRepositoryUrl()) { + authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) + } + + configurePom(pom) + } + } + } + + tasks.create("installLocally", Upload) { + configuration = configurations.archives + + repositories { + mavenDeployer { + repository(url: "file://${rootProject.buildDir}/localMaven") + + configurePom(pom) + } + } + } + + signing { + required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } + sign configurations.archives + } + + if (project.getPlugins().hasPlugin('com.android.application') || + project.getPlugins().hasPlugin('com.android.library')) { + task install(type: Upload, dependsOn: assemble) { + repositories.mavenInstaller { + configuration = configurations.archives + + configurePom(pom) + } + } + + task androidJavadocs(type: Javadoc) { + source = android.sourceSets.main.java.source + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + } + + task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { + classifier = 'javadoc' + from androidJavadocs.destinationDir + } + + task androidSourcesJar(type: Jar) { + classifier = 'sources' + from android.sourceSets.main.java.source + } + } else { + install { + repositories.mavenInstaller { + configurePom(pom) + } + } + + task sourcesJar(type: Jar, dependsOn:classes) { + classifier = 'sources' + from sourceSets.main.allSource + } + + task javadocJar(type: Jar, dependsOn:javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir + } + } + + if (JavaVersion.current().isJava8Compatible()) { + allprojects { + tasks.withType(Javadoc) { + options.addStringOption('Xdoclint:none', '-quiet') + } + } + } + + artifacts { + if (project.getPlugins().hasPlugin('com.android.application') || + project.getPlugins().hasPlugin('com.android.library')) { + archives androidSourcesJar + archives androidJavadocsJar + } else { + archives sourcesJar + archives javadocJar + } + } +} diff --git a/install.gradle b/install.gradle deleted file mode 100644 index c4b0405c..00000000 --- a/install.gradle +++ /dev/null @@ -1,44 +0,0 @@ -// backup of [https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle] - -apply plugin: 'com.github.dcendents.android-maven' - -group = publishedGroupId - -install { - repositories.mavenInstaller { - // This generates POM.xml with proper parameters - pom { - project { - packaging 'aar' - groupId publishedGroupId - artifactId artifact - - // Add your description here - name libraryName - description libraryDescription - url siteUrl - - // Set your license - licenses { - license { - name licenseName - url licenseUrl - } - } - developers { - developer { - id developerId - name developerName - email developerEmail - } - } - scm { - connection gitUrl - developerConnection gitUrl - url siteUrl - - } - } - } - } -}