-
Notifications
You must be signed in to change notification settings - Fork 8
/
publish.gradle
99 lines (88 loc) · 3.23 KB
/
publish.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
apply plugin: 'maven-publish'
apply plugin: 'signing'
// Create variables with empty default values
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}
task androidJavadocsJar(type: Jar, dependsOn: dokkaJavadoc) {
archiveClassifier.set('javadoc')
from "$buildDir/dokka"
}
artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
groupId GROUP
artifactId POM_ARTIFACT_ID
version VERSION
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
artifact androidSourcesJar
artifact androidJavadocsJar
pom {
if (System.getenv('OSSRH_USERNAME') != null){
signing {
sign publishing.publications.release
sign configurations.archives
}
}
name = POM_NAME
description = POM_DESCRIPTION
url = POM_URL
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
}
}
developers {
developer {
id = 'aroux'
name = 'Anthony Roux'
email = 'anthony.roux@amadeus.com'
}
developer {
id = 'pietrini'
name = 'Nicolas Pietri'
email = 'nico.pietri@gmail.com'
}
}
scm {
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
url = POM_SCM_URL
}
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
project.configurations.implementation.allDependencies.each {
if (it.group == null || it.version == null || it.name == null || it.name == "unspecified")
return
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
repositories {
maven {
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
mavenContent {
releasesOnly()
}
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}
}