-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbintray.gradle
100 lines (80 loc) · 3.08 KB
/
bintray.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
apply plugin: 'maven-publish'
def versionCode = findProperty("libVersionCode") ?: ''
if (versionCode.isEmpty()) throw new IllegalStateException("specify version code")
ext {
bintrayRepo = 'mailru'
bintrayName = 'auth-sdk-pub'
publishedGroupId = 'ru.mail'
libraryName = 'MRAuth SDK'
artifact = 'auth-sdk-pub'
libraryDescription = 'Library for OAuth 2.0 authorization to Mail.ru services'
siteUrl = 'https://github.com/mailru/mail-auth-sdk-android'
gitUrl = 'https://github.com/mailru/mail-auth-sdk-android.git'
libraryVersion = versionCode
developerId = 'Mail.ru Group'
developerName = 'Mail.ru Group'
licenseName = 'MIT'
licenseUrl = 'http://opensource.org/licenses/MIT'
allLicenses = ["MIT"]
}
publishing {
publications {
MyPublication(MavenPublication) {
// Define this explicitly if using implementation or api configurations
artifact("$buildDir/outputs/aar/sdk-release.aar")
artifact sourcesJar
artifact javadocJar
groupId publishedGroupId
artifactId artifact
version libraryVersion
pom.withXml {
final dependenciesNode = asNode().getAt('dependencies')[0] ?: asNode().appendNode('dependencies')
ext.addDependency = { dep, String scope ->
if (dep.group == null || dep.version == null || dep.name == null || dep.name == "unspecified")
return // ignore invalid dependencies
final dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', dep.group)
dependencyNode.appendNode('artifactId', dep.name)
dependencyNode.appendNode('version', dep.version)
dependencyNode.appendNode('scope', scope)
}
configurations.api.getDependencies().each { dep -> addDependency(dep, "compile") }
configurations.implementation.getDependencies().each { dep -> addDependency(dep, "runtime") }
}
}
}
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
configurations.implementation.setCanBeResolved(true)
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + configurations.implementation
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
bintray {
user = findProperty('bintray.user')
key = findProperty('bintray.apikey')
publications = ['MyPublication']
pkg {
repo = bintrayRepo
name = bintrayName
desc = libraryDescription
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = allLicenses
dryRun = true
publish = true
publicDownloadNumbers = true
version {
name = libraryVersion
desc = libraryDescription
}
}
}
bintrayUpload.dependsOn assemble