-
-
Notifications
You must be signed in to change notification settings - Fork 495
/
gradle-release.gradle
153 lines (133 loc) · 5.23 KB
/
gradle-release.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
@SuppressWarnings(["GroovyUnusedDeclaration", "GrMethodMayBeStatic"])
def isReleaseBuild() {
return !VERSION_NAME.contains("SNAPSHOT")
}
@SuppressWarnings("GroovyUnusedDeclaration")
def getRepositoryUsername() {
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
}
@SuppressWarnings("GroovyUnusedDeclaration")
def getRepositoryPassword() {
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
}
apply plugin: "com.jfrog.bintray"
afterEvaluate { project ->
apply plugin: 'maven-publish'
apply plugin: 'com.github.dcendents.android-maven'
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
task androidJavadocs(type: Javadoc) {
failOnError = false
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
}
bintray {
dryRun = false
publish = true
override = true
user = project.hasProperty('bintray.user') ? project.property('bintray.user') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintray.apikey') ? project.property('bintray.apikey') : System.getenv('BINTRAY_API_KEY')
def gpgkey = project.hasProperty('bintray.gpg.key') ? project.property('bintray.gpg.key') : System.getenv('BINTRAY_GPG_KEY')
def gpgpass = project.hasProperty('bintray.gpg.password') ? project.property('bintray.gpg.password') : System.getenv('BINTRAY_GPG_PASS')
def versionName = project.release.versionName
publications('release')
pkg {
publish = true
repo = "maven"
name = GROUP + ":" + POM_ARTIFACT_ID //the name (= identifier) on bintray
desc = POM_DESCRIPTION
websiteUrl = POM_URL
issueTrackerUrl = POM_SCM_URL_ISSUES
vcsUrl = POM_SCM_URL
githubRepo = POM_GITHUB_REPO
githubReleaseNotesFile = POM_GITHUB_README
publicDownloadNumbers = true
licenses = ["Apache-2.0"]
version {
name = versionName
vcsTag = versionName
released = new Date()
mavenCentralSync {
sync = true
user = getRepositoryUsername()
password = getRepositoryPassword()
close = '1'
}
gpg {
sign = true
passphrase = gpgpass
}
}
}
}
ext.addDependency = { dependencyNode, group, name, version ->
dependencyNode.appendNode('groupId', group)
dependencyNode.appendNode('artifactId', name)
dependencyNode.appendNode('version', version)
dependencyNode.appendNode('scope', "compile")
}
def pomConfig = {
licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}
developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
email 'mikepenz@gmail.com'
}
}
scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}
}
publishing {
publications {
release(MavenPublication) {
groupId GROUP
artifactId POM_ARTIFACT_ID
version project.release.versionName
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
artifact androidSourcesJar
artifact androidJavadocsJar
pom.withXml {
asNode().appendNode('name', POM_NAME);
asNode().appendNode('description', POM_DESCRIPTION);
asNode().appendNode('url', POM_SCM_URL);
def dependenciesNode = asNode().appendNode('dependencies');
configurations.implementation.allDependencies.each {
// Ensure dependencies such as fileTree are not included.
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
if (it.version != "unspecified") {
addDependency(dependencyNode, it.group, it.name, it.version)
} else {
addDependency(dependencyNode, it.getDependencyProject().findProperty("GROUP"), it.getDependencyProject().findProperty("POM_ARTIFACT_ID"), project.release.versionName)
}
}
}
asNode().children().last() + pomConfig
}
}
}
}
}