Skip to content

Commit bdc14a6

Browse files
committed
release to mavenCentral
1 parent dff790b commit bdc14a6

File tree

6 files changed

+495
-115
lines changed

6 files changed

+495
-115
lines changed

jimu-core/build-gradle/build.gradle

Lines changed: 104 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
1-
apply plugin: 'groovy'
2-
1+
plugins {
2+
id 'groovy'
3+
id 'signing'
4+
id 'maven-publish'
5+
}
36

47
def MAVEN_LOCAL_PATH = uri('../../local_repo')
5-
def ARTIFACT_ID = 'build-gradle'
8+
def GROUP_ID = 'io.github.leobert-lan'
9+
def ARTIFACT_ID = 'jimu-build-gradle'
610
def VERSION_NAME = '1.3.5'
7-
def GROUP_ID = 'com.github.jimu'
8-
def changeLog ="支持 kotlin-1.4.x 等支持Java语法的内容"
9-
10-
ext {
11-
bintrayRepo = 'maven'
12-
bintrayName = ARTIFACT_ID
13-
artifact = ARTIFACT_ID
14-
libraryName = ARTIFACT_ID
15-
libraryVersion = VERSION_NAME
16-
libraryDescription = 'gradle plugin for buid component'
17-
licenseName = 'The Apache Software License, Version 2.0'
18-
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
19-
allLicenses = ["Apache-2.0"]
20-
}
21-
apply from: '../bintrayv1.gradle'
11+
def changeLog = "支持 kotlin-1.4.x 等支持Java语法的内容"
2212

2313
dependencies {
2414
implementation 'com.android.tools.build:gradle:4.1.1'
@@ -31,8 +21,103 @@ dependencies {
3121

3222
}
3323

24+
Properties properties = new Properties()
25+
InputStream inputStream = project.rootProject.file('local.properties').newDataInputStream()
26+
properties.load(inputStream)
27+
def ACCOUNT = properties.get("nexus_user", "")
28+
def PASSWORD = properties.get("nexus_pwd", "")
29+
30+
//apply plugin: 'maven'
31+
32+
task sourcesJar(type: Jar, dependsOn: classes) {
33+
classifier = 'sources'
34+
from sourceSets.main.allSource
35+
}
36+
37+
//task javadoc(type: Javadoc) {
38+
// source = sourceSets.main.java.srcDirs
39+
// classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
40+
//// exclude 'osp/leobert/android/uibinding/**'
41+
//}
42+
43+
44+
task javadocJar(type: Jar, dependsOn: javadoc) {
45+
classifier = 'javadoc'
46+
from javadoc.destinationDir
47+
}
48+
49+
tasks.withType(Javadoc) {
50+
options.addStringOption('Xdoclint:none', '-quiet')
51+
options.addStringOption('encoding', 'UTF-8')
52+
options.addStringOption('charSet', 'UTF-8')
53+
}
54+
55+
artifacts {
56+
archives sourcesJar
57+
archives javadocJar
58+
}
59+
afterEvaluate {
60+
publishing {
61+
publications {
62+
mavenAndroid(MavenPublication) {
63+
groupId GROUP_ID
64+
artifactId ARTIFACT_ID
65+
version VERSION_NAME
66+
artifact sourcesJar
67+
artifact javadocJar
68+
artifact('build/libs/build-gradle.jar')
69+
// 配置 pom 文件格式
70+
pom {
71+
72+
groupId = GROUP_ID
73+
artifactId = ARTIFACT_ID
74+
version = VERSION_NAME
75+
76+
packaging = 'jar'
77+
name = ARTIFACT_ID
78+
description = ARTIFACT_ID
79+
url = siteUrl
80+
licenses {
81+
license {
82+
name = 'The Apache Software License, Version 2.0'
83+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
84+
}
85+
}
86+
developers {
87+
developer {
88+
id = 'mqzhang,leobert'
89+
name = 'mqzhang,leobert'
90+
91+
}
92+
}
93+
scm {
94+
connection = siteUrl
95+
developerConnection = gitUrl
96+
url = siteUrl
97+
}
98+
}
99+
}
100+
}
101+
// 配置远程仓库
102+
repositories {
103+
maven {
104+
// 发布地址,新申请的项目发布地址为:https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
105+
// url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
106+
url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
107+
credentials {
108+
username ACCOUNT
109+
password PASSWORD
110+
}
111+
}
112+
}
113+
}
114+
115+
signing {
116+
sign publishing.publications.mavenAndroid
117+
}
118+
}
119+
34120

35-
apply from: '../installv1.gradle' //注意,发布到jcenter是需要切换插件,否则groupID会切换,没细看原因
36121
//apply plugin: 'maven'
37122
//uploadArchives() {
38123
// repositories {

jimu-core/build.gradle

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,41 +57,48 @@ buildscript {
5757

5858
jimu : [
5959
'componentLib' : 'com.github.jimu:componentlib:1.3.1',
60-
'router_anno' : 'com.github.jimu:router-annotation:1.0.1',
61-
'router_anno_compiler': 'com.github.jimu:router-anno-compiler:1.0.1',
60+
'router_anno' : 'io.github.leobert-lan:jimu-router-annotation:1.0.1',
61+
'router_anno_compiler': 'io.github.leobert-lan:jimu-router-anno-compiler:1.0.1',
6262
],
6363

6464
gson : 'com.google.code.gson:gson:2.8.2',
6565

66-
report : [
67-
'anno' : 'osp.leobert.android:ReportNotation:1.0.0',
68-
'compiler':'osp.leobert.android:report-anno-compiler:1.0.0'
66+
report : [
67+
'anno' : 'osp.leobert.android:ReportNotation:1.0.0',
68+
'compiler': 'osp.leobert.android:report-anno-compiler:1.0.0'
6969
]
7070
]
7171

7272

73-
7473
repositories {
74+
mavenCentral()
75+
maven { url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" }
76+
maven { url "https://s01.oss.sonatype.org/content/repositories/releases/" }
7577
jcenter()
76-
maven { url "https://jitpack.io" }
77-
maven {
78-
url 'https://dl.bintray.com/leobert-lan-oss/maven/'
79-
}
78+
// deprecated
79+
// maven { url "https://jitpack.io" }
80+
// maven {
81+
// url 'https://dl.bintray.com/leobert-lan-oss/maven/'
82+
// }
8083
google()
8184
}
8285
dependencies {
8386
classpath deps.android.gradlePlugin
84-
classpath deps.publish.jcenter
85-
classpath deps.publish.maven
87+
// classpath deps.publish.jcenter
88+
// classpath deps.publish.maven
8689
classpath deps.kotlin
8790
}
8891
}
8992

9093
allprojects {
9194
repositories {
95+
mavenCentral()
96+
maven { url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" }
97+
maven { url "https://s01.oss.sonatype.org/content/repositories/releases/" }
98+
9299
jcenter()
93100
google()
94-
maven { url 'https://jitpack.io' }
101+
// maven { url 'https://jitpack.io' }
95102
maven {
96103
url 'https://dl.bintray.com/leobert-lan-oss/maven/'
97104
}

jimu-core/componentlib/build.gradle

Lines changed: 126 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
1-
apply plugin: 'com.android.library'
1+
plugins {
2+
id 'com.android.library'
3+
id 'signing'
4+
id 'maven-publish'
5+
}
26

37
sourceCompatibility = "1.7"
48
targetCompatibility = "1.7"
59

610

711

812
def MAVEN_LOCAL_PATH = uri('../../local_repo')
9-
def ARTIFACT_ID = 'componentlib'
13+
def ARTIFACT_ID = 'jimu-componentlib'
1014
def VERSION_NAME = '1.3.3'
11-
def GROUP_ID = 'com.github.jimu'
12-
13-
ext {
14-
bintrayName = ARTIFACT_ID
15-
artifact = ARTIFACT_ID
16-
libraryName = ARTIFACT_ID
17-
libraryDescription = 'component build lib '
18-
libraryVersion = VERSION_NAME
19-
licenseName = 'The Apache Software License, Version 2.0'
20-
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
21-
allLicenses = ["Apache-2.0"]
22-
}
15+
def GROUP_ID = 'io.github.leobert-lan'
16+
17+
//ext {
18+
// bintrayName = ARTIFACT_ID
19+
// artifact = ARTIFACT_ID
20+
// libraryName = ARTIFACT_ID
21+
// libraryDescription = 'component build lib '
22+
// libraryVersion = VERSION_NAME
23+
// licenseName = 'The Apache Software License, Version 2.0'
24+
// licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
25+
// allLicenses = ["Apache-2.0"]
26+
//}
2327

2428
android {
2529
compileSdkVersion versions.compileSdk
@@ -47,39 +51,131 @@ android {
4751
}
4852

4953
dependencies {
50-
compile fileTree(include: ['*.jar'], dir: 'libs')
54+
// compile fileTree(include: ['*.jar'], dir: 'libs')
5155
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
5256
exclude group: 'com.android.support', module: 'support-annotations'
5357
})
5458
testCompile deps.junit
55-
compile deps.support.v7.appcompat
59+
api deps.support.v7.appcompat
5660

5761
// compile project(':router-annotation')
58-
compile deps.jimu.router_anno
59-
compile deps.gson
62+
api deps.jimu.router_anno
63+
api deps.gson
64+
65+
compileOnly deps.report.anno
66+
//remove reporter
67+
// annotationProcessor deps.report.compiler
68+
// compile 'org.apache.commons:commons-lang3:3.4'
69+
// compile 'org.apache.commons:commons-collections4:4.1'
70+
}
6071

61-
compile deps.report.anno
62-
annotationProcessor deps.report.compiler
6372

73+
//apply from: '../installv1.gradle'
74+
//apply from: '../bintrayv1.gradle'
75+
//
76+
//uploadArchives() {
77+
// repositories {
78+
// mavenDeployer {
79+
// repository(url: MAVEN_LOCAL_PATH)
80+
// pom.project {
81+
// groupId GROUP_ID
82+
// artifactId ARTIFACT_ID
83+
// version VERSION_NAME
84+
// packaging 'aar'
85+
// }
86+
// }
87+
// }
88+
//}
89+
90+
91+
Properties properties = new Properties()
92+
InputStream inputStream = project.rootProject.file('local.properties').newDataInputStream()
93+
properties.load(inputStream)
94+
def ACCOUNT = properties.get("nexus_user", "")
95+
def PASSWORD = properties.get("nexus_pwd", "")
96+
97+
98+
task sourcesJar(type: Jar) {
99+
classifier = 'sources'
100+
from android.sourceSets.main.java.srcDirs
101+
}
64102

65-
compile 'org.apache.commons:commons-lang3:3.4'
66-
compile 'org.apache.commons:commons-collections4:4.1'
103+
task javadoc(type: Javadoc) {
104+
source = android.sourceSets.main.java.srcDirs
105+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
106+
// exclude 'osp/leobert/android/uibinding/**'
107+
}
108+
task javadocJar(type: Jar, dependsOn: javadoc) {
109+
classifier = 'javadoc'
110+
from javadoc.destinationDir
67111
}
68112

113+
tasks.withType(Javadoc) {
114+
options.addStringOption('Xdoclint:none', '-quiet')
115+
options.addStringOption('encoding', 'UTF-8')
116+
options.addStringOption('charSet', 'UTF-8')
117+
}
69118

70-
apply from: '../installv1.gradle'
71-
apply from: '../bintrayv1.gradle'
119+
artifacts {
120+
archives sourcesJar
121+
archives javadocJar
122+
}
72123

73-
uploadArchives() {
74-
repositories {
75-
mavenDeployer {
76-
repository(url: MAVEN_LOCAL_PATH)
77-
pom.project {
124+
afterEvaluate {
125+
publishing {
126+
publications {
127+
mavenAndroid(MavenPublication) {
78128
groupId GROUP_ID
79129
artifactId ARTIFACT_ID
80130
version VERSION_NAME
81-
packaging 'aar'
131+
artifact sourcesJar
132+
artifact javadocJar
133+
artifact('build/outputs/aar/componentlib-release.aar')
134+
// 配置 pom 文件格式
135+
pom {
136+
137+
groupId = GROUP_ID
138+
artifactId = ARTIFACT_ID
139+
version = VERSION_NAME
140+
141+
packaging = 'aar'
142+
name = ARTIFACT_ID
143+
description = ARTIFACT_ID
144+
url = siteUrl
145+
licenses {
146+
license {
147+
name = 'The Apache Software License, Version 2.0'
148+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
149+
}
150+
}
151+
developers {
152+
developer {
153+
id = 'leobert'
154+
name = 'leobert'
155+
156+
}
157+
}
158+
scm {
159+
connection = siteUrl
160+
developerConnection = gitUrl
161+
url = siteUrl
162+
}
163+
}
164+
}
165+
}
166+
// 配置远程仓库
167+
repositories {
168+
maven {
169+
url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
170+
credentials {
171+
username ACCOUNT
172+
password PASSWORD
173+
}
82174
}
83175
}
84176
}
177+
178+
signing {
179+
sign publishing.publications.mavenAndroid
180+
}
85181
}

0 commit comments

Comments
 (0)