-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjcenter_push.gradle
175 lines (153 loc) · 5 KB
/
jcenter_push.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'org.jetbrains.dokka-android'
ext {
developerId ='yuyunlongyyl'
developerName ='yuyunlongyyl'
developerEmail ='[email protected]'
// library网站地址
siteUrl ='https://github.com/mengzhidaren/BaseLibaray.git'
// library仓库地址
gitUrl ='https://github.com/mengzhidaren/BaseLibaray.git'
// 开源许可证(这里是Apache 2.0)
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
// 此处对应jcenter上面选择的仓库名称 例如:longyyl/maven/baseAdapter
bintrayRepo = 'maven'
// bintrayName 是你在网页Repository页面能看到的名称 就是maven仓库名
bintrayName = 'baseAdapter'
// library artifact(单个module一般就填写library name)
artifactID = 'baseAdapter'
// library的group id
publishedGroupId = 'com.meicet.adapter'
libraryName = 'baseAdapter'
libraryVersion = project.properties.get("VERSION_NAME")
libraryDescription = '封装一些常用的BaseAdapter 和工具类'
}
version = libraryVersion
//important, if null, will issue: Maven group, artifact or version not match ...
group = publishedGroupId
if (project.hasProperty("kotlin")) { //Kotlin libraries
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
task javadoc(type: Javadoc, dependsOn: dokka) {
}
}else 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
}
//task dokkaJavadoc(type:org.jetbrains.dokka.gradle.DokkaTask) {
// outputFormat = 'javadoc'
// outputDirectory = "$buildDir/documentation"
//}
//解决kotlin javadoc.options抱错
dokka {
outputFormat = 'html'
outputDirectory = "$buildDir/javadoc"
// externalDocumentationLink {
// url = new URL("any url you want, doesn't matter")
// packageListUrl = new URL("file:///${rootDir}/package-list")
// }
}
tasks.named("dokka"){
noStdlibLink = true
noJdkLink = true
noAndroidSdkLink = true
}
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
}
artifacts {
archives javadocJar
archives sourcesJar
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
groupId publishedGroupId
artifactId artifactID
// 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
}
}
}
}
}
// Bintray
Properties properties = new Properties()
properties.load(project.rootProject.file('D:\\googleServerFile\\jcenter.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 {
name = libraryVersion
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'
// }
}
}
}
//使用说明
//第一步:
//gradlew install
//第二步:上传到 jcenter :
//gradle bintrayUpload