-
Notifications
You must be signed in to change notification settings - Fork 7
/
deployBintray.gradle
100 lines (90 loc) · 3.16 KB
/
deployBintray.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
//打包 上传需在命令行执行 gradlew :tinyritro-compiler:bintrayUpload, 点击任务执行会报错
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
Properties properties = new Properties()
File projectPropertiesFile = rootProject.file('project.properties')
properties.load(projectPropertiesFile.newDataInputStream())
def keystoreProperties = new Properties()
try {
def keystorePropertiesFile = rootProject.file("local.properties");
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
} catch (Exception e) {
println("local.properties not exits, return")
return
}
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging properties.getProperty("project.packaging")
// Add your description here
name properties.getProperty("project.name")
url properties.getProperty("project.siteUrl")
licenses {
license {
name properties.getProperty("license.name")
url properties.getProperty("license.url")
}
}
developers {
developer {
id properties.getProperty("developer.id")
name properties.getProperty("developer.name")
email properties.getProperty("developer.email")
}
}
scm {
connection properties.getProperty("project.gitUrl")
developerConnection properties.getProperty("project.gitUrl")
url properties.getProperty("project.siteUrl")
}
}
}
}
}
/*--------------------------------*/
if (project.hasProperty("android")) {
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
}
artifacts {
archives javadocJar
archives sourcesJar
}
bintray {
user = keystoreProperties['bintray.user']
key = keystoreProperties['bintray.key']
configurations = ['archives']
pkg {
repo = properties.getProperty("project.repo")
name = properties.getProperty("project.name")
websiteUrl = properties.getProperty("project.siteUrl")
vcsUrl = properties.getProperty("project.gitUrl")
licenses = ["Apache-2.0"]
//publish = true
}
}
javadoc { //javadoc 采用 utf-8 编码否则会报“GBK的不可映射字符”错误
options {
failOnError false
encoding "UTF-8"
charSet "UTF-8"
addStringOption('Xdoclint:none', '-quiet')
}
}