Skip to content

Commit b7c95f0

Browse files
authored
Merge pull request #161 from chenenyu/dev
Migrate to maven central.
2 parents 3ddd6f5 + 2e9528f commit b7c95f0

File tree

15 files changed

+72
-75
lines changed

15 files changed

+72
-75
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@
1414
buildscript {
1515
repositories {
1616
google()
17-
jcenter()
17+
mavenCentral()
18+
// jcenter() // deprecated
1819
}
1920
dependencies {
2021
classpath 'com.android.tools.build:gradle:+'
21-
classpath "com.chenenyu.router:gradle-plugin:版本号"
22+
classpath "com.chenenyu.router:gradle-plugin:x.y.z"
2223
}
2324
}
2425
```
25-
latest `router-gradle-plugin` version: ![Download](https://api.bintray.com/packages/chenenyu/maven/router-gradle-plugin/images/download.svg)
26+
latest `router-gradle-plugin` version: ![maven](https://img.shields.io/maven-central/v/com.chenenyu.router/gradle-plugin)
2627

2728

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

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

4849

4950
## 基本用法

annotation/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ ext {
77
GROUP = 'com.chenenyu.router'
88
ARTIFACT = 'annotation'
99
VERSION = ANNOTATION_VERSION
10-
BINTRAY_NAME = 'router-annotation'
1110
}
1211

1312
apply from: '../gradle/publish.gradle'
14-
//apply from: 'https://raw.githubusercontent.com/chenenyu/gradle-bintray-plugin/master/publish.gradle'

build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
buildscript {
2-
ext.kotlin_version = '1.4.10'
2+
ext.kotlin_version = '1.4.32'
33
repositories {
4-
maven { url 'repo' }
4+
// maven { url 'repo' }
55
google()
6+
mavenCentral()
67
jcenter()
78
}
89
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.0.0'
10+
classpath 'com.android.tools.build:gradle:4.1.2'
1011
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1112
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5"
1213
if (Boolean.valueOf(applyRemotePlugin)) {

compiler/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ ext {
1818
GROUP = 'com.chenenyu.router'
1919
ARTIFACT = 'compiler'
2020
VERSION = COMPILER_VERSION
21-
BINTRAY_NAME = 'router-compiler'
2221
}
2322

2423
apply from: '../gradle/publish.gradle'
25-
//apply from: 'https://raw.githubusercontent.com/chenenyu/gradle-bintray-plugin/master/publish.gradle'

gradle-plugin/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ ext {
1818
GROUP = 'com.chenenyu.router'
1919
ARTIFACT = 'gradle-plugin'
2020
VERSION = PLUGIN_VERSION
21-
BINTRAY_NAME = 'router-gradle-plugin'
2221
}
2322

24-
apply from: '../gradle/publish.gradle'
25-
//apply from: 'https://raw.githubusercontent.com/chenenyu/gradle-bintray-plugin/master/publish.gradle'
23+
apply from: '../gradle/publish.gradle'

gradle/publish.gradle

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// https://github.com/chenenyu/gradle-bintray-plugin
2-
apply plugin: 'maven-publish'
3-
apply plugin: 'com.jfrog.bintray'
1+
apply plugin: 'maven'
2+
apply plugin: 'signing'
43

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

56-
project.afterEvaluate {
57-
publishing {
58-
publications {
59-
release(MavenPublication) {
60-
groupId project.ext.GROUP
61-
artifactId project.ext.ARTIFACT
62-
version project.ext.VERSION
55+
artifacts {
56+
if (isJavaModule) {
57+
archives jar
58+
}
59+
archives javadocJar
60+
archives sourcesJar
61+
}
6362

64-
artifact sourcesJar
65-
artifact javadocJar
66-
if (isAndroidModule) {
67-
from components.release
68-
} else if (isJavaModule) {
69-
from components.java
70-
}
63+
signing {
64+
sign configurations.archives
65+
}
7166

72-
// pom {
73-
// if (isAndroidModule) {
74-
// packaging 'aar'
75-
// } else if (isJavaModule) {
76-
// packaging 'jar'
77-
// }
78-
// }
67+
uploadArchives {
68+
repositories {
69+
mavenDeployer {
70+
beforeDeployment { MavenDeployment deployment ->
71+
signing.signPom(deployment)
7972
}
80-
}
81-
}
82-
83-
Properties properties = new Properties()
84-
if (project.rootProject.file('local.properties').exists()) {
85-
properties.load(project.rootProject.file('local.properties').newDataInputStream())
86-
}
87-
bintray {
88-
user = properties.containsKey('BINTRAY_USER') ? properties.get('BINTRAY_USER') : ""
89-
key = properties.containsKey('BINTRAY_API_KEY') ? properties.get('BINTRAY_API_KEY') : ""
90-
publications = ['release']
91-
publish = project.ext.has('PUBLISH') ? project.ext.PUBLISH : true
92-
override = project.ext.has('OVERRIDE') ? project.ext.OVERRIDE : false
93-
dryRun = project.ext.has('DRYRUN') ? project.ext.DRYRUN : false
94-
pkg {
95-
repo = project.ext.has('BINTRAY_REPO') ? project.ext.BINTRAY_REPO : 'maven'
96-
name = project.ext.has('BINTRAY_NAME') ? project.ext.BINTRAY_NAME : project.ext.ARTIFACT
97-
licenses = project.ext.has('LICENSES') ? project.ext.LICENSES : ['Apache-2.0']
98-
vcsUrl = project.ext.has('VCS_URL') ? project.ext.VCS_URL : ''
99-
if (project.ext.has('USER_ORG')) {
100-
userOrg = project.ext.USER_ORG
73+
repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
74+
authentication(userName: ossrhUsername, password: ossrhPassword)
75+
}
76+
snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
77+
authentication(userName: ossrhUsername, password: ossrhPassword)
10178
}
102-
publicDownloadNumbers = true
10379

104-
version {
105-
name = project.ext.VERSION
106-
vcsTag = project.ext.VERSION
80+
pom.project {
81+
if (isAndroidModule) {
82+
packaging 'aar'
83+
} else if (isJavaModule) {
84+
packaging 'jar'
85+
}
86+
groupId project.ext.GROUP
87+
artifactId project.ext.ARTIFACT
88+
version project.ext.VERSION
89+
name "${project.ext.GROUP}:${project.ext.ARTIFACT}"
90+
description 'Awesome android router library.'
91+
url 'https://github.com/chenenyu/Router'
92+
scm {
93+
url 'https://github.com/chenenyu/Router'
94+
connection 'scm:git@github.com:chenenyu/Router.git'
95+
developerConnection 'scm:git@github.com:chenenyu/Router.git'
96+
}
97+
licenses {
98+
license {
99+
name 'The Apache Software License, Version 2.0'
100+
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
101+
}
102+
}
103+
developers {
104+
developer {
105+
id 'chenenyu'
106+
name 'chenenyu'
107+
email 'chenenyux@gmail.com'
108+
}
109+
}
107110
}
108111
}
109112
}
110-
}
113+
}

release.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# annotation
2-
./gradlew clean pRPTML -p annotation
3-
./gradlew bintrayUpload -p annotation
2+
./gradlew clean -p annotation
3+
./gradlew uploadArchives -p annotation
44

55
# compiler
6-
./gradlew clean pRPTML -p compiler
7-
./gradlew bintrayUpload -p compiler
6+
./gradlew clean -p compiler
7+
./gradlew uploadArchives -p compiler
88

99
# router
10-
./gradlew clean pRPTML -p router
11-
./gradlew bintrayUpload -p router
10+
./gradlew clean -p router
11+
./gradlew uploadArchives -p router
1212

1313
# gradle-plugin
14-
./gradlew clean pRPTML -p gradle-plugin
15-
./gradlew bintrayUpload -p gradle-plugin
14+
./gradlew clean -p gradle-plugin
15+
./gradlew uploadArchives -p gradle-plugin

router/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ ext {
4343
GROUP = 'com.chenenyu.router'
4444
ARTIFACT = 'router'
4545
VERSION = ROUTER_VERSION
46-
BINTRAY_NAME = 'router'
4746
}
4847

4948
apply from: '../gradle/publish.gradle'
50-
//apply from: 'https://raw.githubusercontent.com/chenenyu/gradle-bintray-plugin/master/publish.gradle'

static/e乡北仑.png

-14.5 KB
Binary file not shown.

static/恒大智能家居.png

-8.21 KB
Binary file not shown.

0 commit comments

Comments
 (0)