-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgradle-jcenter-push.gradle
139 lines (119 loc) · 4.14 KB
/
gradle-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
/*
* 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: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'signing'
version = VERSION_NAME
group = GROUP
project.archivesBaseName = POM_ARTIFACT_ID
println "~~~~~~" + project.archivesBaseName + "~~~~~~~"
//android {
// libraryVariants.all { variant ->
// variant.outputs.each { output ->
// output.outputFile = new File(
// output.outputFile.parent,
// POM_ARTIFACT_ID + ".aar".toLowerCase())
// }
// }
//}
//configurations.create("jcenter_upload")
install {
repositories.mavenInstaller {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
configuration = configurations.archives
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
}
}
}
}
task androidJavadocs(type: Javadoc) {
options.encoding = "UTF-8"
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
}
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
artifacts {
add("archives", androidSourcesJar)
add("archives", androidJavadocsJar)
}
signing {
sign configurations.archives
}
task printArchives(dependsOn: 'build') {
doFirst {
def configuration = project.configurations.getByName("archives")//获取名字为archives的configuration
def files = configuration?.getArtifacts()?.files?.getFiles()//获取artifacts 发布的文件
System.out.println("archives files length " + files.size())
files.each { file ->
System.out.println("files " + file.getName() + " " + file.getAbsolutePath())
}
}
}
project.archivesBaseName = POM_ARTIFACT_ID
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.key")
configurations = ['archives']
pkg {
repo = "repo"
//这个是在jcenter上建立的仓库名字,其实就是一个组织结构,例如,你可以在自己的账户上建立一个jcenter,然后在这个jcenter上建立这个package。此时这个repo就写jcenter
name = POM_ARTIFACT_ID //发布到Bintray上的项目名字
websiteUrl = POM_URL
vcsUrl = POM_SCM_CONNECTION
licenses = ["Apache-2.0"]
publish = true
}
}