Skip to content

Commit

Permalink
Migrate to maven central.
Browse files Browse the repository at this point in the history
  • Loading branch information
chenenyu committed Apr 20, 2021
1 parent d6123b2 commit 2e9528f
Show file tree
Hide file tree
Showing 15 changed files with 72 additions and 75 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
// jcenter() // deprecated
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
classpath "com.chenenyu.router:gradle-plugin:版本号"
classpath "com.chenenyu.router:gradle-plugin:x.y.z"
}
}
```
latest `router-gradle-plugin` version: ![Download](https://api.bintray.com/packages/chenenyu/maven/router-gradle-plugin/images/download.svg)
latest `router-gradle-plugin` version: ![maven](https://img.shields.io/maven-central/v/com.chenenyu.router/gradle-plugin)


* Apply router plugin in your module-level 'build.gradle'.
Expand All @@ -41,9 +42,9 @@ ext {
compilerLoggable = true/false // 打开/关闭编译期log
}
```
latest `router` version: ![Download](https://api.bintray.com/packages/chenenyu/maven/router/images/download.svg)
latest `router` version: ![maven](https://img.shields.io/maven-central/v/com.chenenyu.router/router)

latest `compiler` version: ![compiler](https://api.bintray.com/packages/chenenyu/maven/router-compiler/images/download.svg)
latest `compiler` version: ![maven](https://img.shields.io/maven-central/v/com.chenenyu.router/compiler)


## 基本用法
Expand Down
2 changes: 0 additions & 2 deletions annotation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ ext {
GROUP = 'com.chenenyu.router'
ARTIFACT = 'annotation'
VERSION = ANNOTATION_VERSION
BINTRAY_NAME = 'router-annotation'
}

apply from: '../gradle/publish.gradle'
//apply from: 'https://raw.githubusercontent.com/chenenyu/gradle-bintray-plugin/master/publish.gradle'
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
buildscript {
ext.kotlin_version = '1.4.10'
ext.kotlin_version = '1.4.32'
repositories {
maven { url 'repo' }
// maven { url 'repo' }
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5"
if (Boolean.valueOf(applyRemotePlugin)) {
Expand Down
2 changes: 0 additions & 2 deletions compiler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ ext {
GROUP = 'com.chenenyu.router'
ARTIFACT = 'compiler'
VERSION = COMPILER_VERSION
BINTRAY_NAME = 'router-compiler'
}

apply from: '../gradle/publish.gradle'
//apply from: 'https://raw.githubusercontent.com/chenenyu/gradle-bintray-plugin/master/publish.gradle'
4 changes: 1 addition & 3 deletions gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ ext {
GROUP = 'com.chenenyu.router'
ARTIFACT = 'gradle-plugin'
VERSION = PLUGIN_VERSION
BINTRAY_NAME = 'router-gradle-plugin'
}

apply from: '../gradle/publish.gradle'
//apply from: 'https://raw.githubusercontent.com/chenenyu/gradle-bintray-plugin/master/publish.gradle'
apply from: '../gradle/publish.gradle'
103 changes: 53 additions & 50 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// https://github.com/chenenyu/gradle-bintray-plugin
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven'
apply plugin: 'signing'

if (!project.ext.has('GROUP') || !project.ext.has('ARTIFACT') || !project.ext.has('VERSION')) {
throw new MissingPropertyException("Extra properties['GROUP', 'ARTIFACT', 'VERSION'] are required.")
Expand Down Expand Up @@ -53,58 +52,62 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
}

project.afterEvaluate {
publishing {
publications {
release(MavenPublication) {
groupId project.ext.GROUP
artifactId project.ext.ARTIFACT
version project.ext.VERSION
artifacts {
if (isJavaModule) {
archives jar
}
archives javadocJar
archives sourcesJar
}

artifact sourcesJar
artifact javadocJar
if (isAndroidModule) {
from components.release
} else if (isJavaModule) {
from components.java
}
signing {
sign configurations.archives
}

// pom {
// if (isAndroidModule) {
// packaging 'aar'
// } else if (isJavaModule) {
// packaging 'jar'
// }
// }
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment ->
signing.signPom(deployment)
}
}
}

Properties properties = new Properties()
if (project.rootProject.file('local.properties').exists()) {
properties.load(project.rootProject.file('local.properties').newDataInputStream())
}
bintray {
user = properties.containsKey('BINTRAY_USER') ? properties.get('BINTRAY_USER') : ""
key = properties.containsKey('BINTRAY_API_KEY') ? properties.get('BINTRAY_API_KEY') : ""
publications = ['release']
publish = project.ext.has('PUBLISH') ? project.ext.PUBLISH : true
override = project.ext.has('OVERRIDE') ? project.ext.OVERRIDE : false
dryRun = project.ext.has('DRYRUN') ? project.ext.DRYRUN : false
pkg {
repo = project.ext.has('BINTRAY_REPO') ? project.ext.BINTRAY_REPO : 'maven'
name = project.ext.has('BINTRAY_NAME') ? project.ext.BINTRAY_NAME : project.ext.ARTIFACT
licenses = project.ext.has('LICENSES') ? project.ext.LICENSES : ['Apache-2.0']
vcsUrl = project.ext.has('VCS_URL') ? project.ext.VCS_URL : ''
if (project.ext.has('USER_ORG')) {
userOrg = project.ext.USER_ORG
repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
publicDownloadNumbers = true

version {
name = project.ext.VERSION
vcsTag = project.ext.VERSION
pom.project {
if (isAndroidModule) {
packaging 'aar'
} else if (isJavaModule) {
packaging 'jar'
}
groupId project.ext.GROUP
artifactId project.ext.ARTIFACT
version project.ext.VERSION
name "${project.ext.GROUP}:${project.ext.ARTIFACT}"
description 'Awesome android router library.'
url 'https://github.com/chenenyu/Router'
scm {
url 'https://github.com/chenenyu/Router'
connection 'scm:[email protected]:chenenyu/Router.git'
developerConnection 'scm:[email protected]:chenenyu/Router.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'chenenyu'
name 'chenenyu'
email '[email protected]'
}
}
}
}
}
}
}
16 changes: 8 additions & 8 deletions release.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# annotation
./gradlew clean pRPTML -p annotation
./gradlew bintrayUpload -p annotation
./gradlew clean -p annotation
./gradlew uploadArchives -p annotation

# compiler
./gradlew clean pRPTML -p compiler
./gradlew bintrayUpload -p compiler
./gradlew clean -p compiler
./gradlew uploadArchives -p compiler

# router
./gradlew clean pRPTML -p router
./gradlew bintrayUpload -p router
./gradlew clean -p router
./gradlew uploadArchives -p router

# gradle-plugin
./gradlew clean pRPTML -p gradle-plugin
./gradlew bintrayUpload -p gradle-plugin
./gradlew clean -p gradle-plugin
./gradlew uploadArchives -p gradle-plugin
2 changes: 0 additions & 2 deletions router/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ ext {
GROUP = 'com.chenenyu.router'
ARTIFACT = 'router'
VERSION = ROUTER_VERSION
BINTRAY_NAME = 'router'
}

apply from: '../gradle/publish.gradle'
//apply from: 'https://raw.githubusercontent.com/chenenyu/gradle-bintray-plugin/master/publish.gradle'
Binary file removed static/e乡北仑.png
Binary file not shown.
Binary file removed static/恒大智能家居.png
Binary file not shown.
Binary file removed static/批车吧.png
Binary file not shown.
Binary file removed static/王者荣耀助手.png
Binary file not shown.
Binary file removed static/硬币自循环.png
Binary file not shown.
Binary file removed static/私享云.png
Binary file not shown.
Binary file removed static/美团轻收银.png
Binary file not shown.

0 comments on commit 2e9528f

Please sign in to comment.