-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload.gradle
More file actions
93 lines (84 loc) · 3 KB
/
Copy pathupload.gradle
File metadata and controls
93 lines (84 loc) · 3 KB
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
apply plugin: "maven-publish"
apply plugin: 'com.jfrog.bintray'
group = "com.sonicers"
version = "0.0.14"
def configFile = 'jcenter.properties'
def gitUrl = 'https://github.com/sonicers/commonlib.git' // project git
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
archiveClassifier.set('sources')
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
failOnError false
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
javadoc {
options {
encoding "UTF-8"
charSet 'UTF-8'
}
}
publishing {
publications {
Production(MavenPublication) {
artifact("$buildDir/outputs/aar/commonlib-release.aar")
artifact sourcesJar
artifact javadocJar
groupId group
artifactId 'commonlib'
version this.version
pom.withXml {
// Define this explicitly if using implementation or api configurations
def dependenciesNode = asNode().getAt('dependencies')[0] ?: asNode().appendNode('dependencies')
// Iterate over the implementation dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.implementation.allDependencies.each {
// Ensure dependencies such as fileTree are not included.
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
bintray {
def customGradle = new File(getProjectDir(), configFile)
if (customGradle.exists()) {
Properties propertyReader = new Properties()
propertyReader.load(new FileInputStream("${projectDir}${File.separator}${configFile}"))
user = propertyReader.bintrayUser.toString()
key = propertyReader.bintrayApiKey.toString()
} else {
logger.lifecycle("not config file!!!!!!!!!!!")
}
publications = ['Production']
configurations = ['archives']
override = true
pkg {
repo = "maven" //跟JCenter创建的Maven仓库名字保持一致
name = "commonlib" //发布到JCenter上的项目名字
description = "Android commonlib for fast develop"
publish = true
publicDownloadNumbers = true
licenses = ["MIT"]
vcsUrl = gitUrl
version {
name = this.version
desc = "commonlib ${this.version}"
released = new Date()
vcsTag = this.version
}
}
}