-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathpublish.gradle
118 lines (107 loc) · 4.62 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'org.jetbrains.dokka'
ext["signing.keyId"] = '' //ID of the GPG key pair, the last eight characters of its fingerprint
ext["signing.password"] = '' //the passphrase of the keypair
ext["signing.secretKeyRingFile"] = '' //location to secring.gpg
ext["sonatypeStagingProfileId"] = '' //sonatype staging profile id
File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
// Read local.properties file first if it exists
Properties p = new Properties()
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
p.each { name, value -> ext[name] = value }
}
task androidSourcesJar(type: Jar) {
getArchiveClassifier().set('sources')
from android.sourceSets.main.java.srcDirs
}
tasks.withType(dokkaHtmlPartial.getClass()).configureEach {
pluginsMapConfiguration.set(
["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""]
)
}
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
archiveClassifier.set('javadoc')
from dokkaJavadoc.outputDirectory
}
publishing {
publications {
maven(MavenPublication) {
groupId project.groupId
version project.repoVersion
artifactId project.artifactId
artifact("$buildDir/outputs/aar/${project.artifactId}-release.aar")
artifact androidSourcesJar
if(project.repoVersion == project.sonatypeVersion) {
artifact javadocJar
}
//generate pom nodes for dependencies
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
configurations.implementation.allDependencies.each { dependency ->
if (dependency.name != 'unspecified' && dependency.version != 'unspecified' && dependency.group != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', dependency.group)
dependencyNode.appendNode('artifactId', dependency.name)
dependencyNode.appendNode('version', dependency.version)
dependencyNode.appendNode('scope', 'compile')
}
}
}
pom {
name = project.artifactId
description = 'Apptentive Android SDK'
url = 'https://github.com/apptentive/apptentive-kit-android'
licenses {
license {
name = 'BSD 3-Clause License'
url = 'https://raw.githubusercontent.com/apptentive/apptentive-kit-android/master/License.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'apptentive'
name = 'Apptentive'
url = "https://www.apptentive.com/"
}
}
scm {
url = 'https://github.com/apptentive/apptentive-kit-android'
connection = 'scm:[email protected]:apptentive/apptentive-kit-android.git'
developerConnection = 'scm:[email protected]:apptentive/apptentive-kit-android.git'
}
}
}
}
}
signing {
sign publishing.publications
}
artifactory {
contextUrl = 'https://apptentive.jfrog.io/artifactory'
publish {
repository {
def artifactoryProperties = new Properties()
if (gradle.rootProject.file('local.properties').exists()) {
artifactoryProperties.load(project.rootProject.file('local.properties').newDataInputStream())
}
def repoUsername = artifactoryProperties['artifactory_username'] ? artifactoryProperties['artifactory_username'] : ""
def repoPassword = artifactoryProperties['artifactory_password'] ? artifactoryProperties['artifactory_password'] : ""
repoKey = project.hasProperty("REPO_KEY") ? project.getProperty("REPO_KEY") : "InternalNewAndroidSDK"
username = repoUsername
password = repoPassword
maven = true
}
defaults {
publications('maven')
publishArtifacts = true
publishPom = true
}
}
clientConfig.setIncludeEnvVars(true)
clientConfig.setEnvVarsExcludePatterns('*password*,*secret*')
clientConfig.setEnvVarsIncludePatterns('*not-secret*')
}