-
Notifications
You must be signed in to change notification settings - Fork 0
/
common-methods.gradle
130 lines (110 loc) · 4.31 KB
/
common-methods.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
// Export methods by turning them into closures
ext {
COMPILE_SDK_VERSION = 31
APPCOMPAT_LIBRARY_VERSION = '1.2.0'
MIN_SDK_VERSION = 14
JAVA_VERSION = JavaVersion.VERSION_1_8
LEANPLUM_GROUP_ID = 'com.leanplum'
LEANPLUM_ARTIFACT_ID = 'leanplum'
LEANPLUM_CORE_ARTIFACT_ID = 'leanplum-core'
LEANPLUM_PUSH_ARTIFACT_ID = 'leanplum-push'
LEANPLUM_FCM_ARTIFACT_ID = 'leanplum-fcm'
LEANPLUM_MIPUSH_ARTIFACT_ID = 'leanplum-mipush'
LEANPLUM_HMS_ARTIFACT_ID = 'leanplum-hms'
LEANPLUM_LOCATION_ARTIFACT_ID = 'leanplum-location'
def sdkVersion = file('../sdk-version.txt').text.replace('\n','')
LEANPLUM_SDK_VERSION = "$sdkVersion"
PROGUARD_FILES = 'proguard-rules.pro'
CONSUMER_PROGUARD_FILES = 'consumer-proguard-rules.pro'
publishing_task = this.&publishing_task
}
def publishing_task(libraryArtifactId) {
task androidJavadocs(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.compile
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
archiveClassifier = 'javadoc'
from androidJavadocs.destinationDir
}
task androidSourcesJar(type: Jar) {
archiveClassifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
afterEvaluate {
publishing {
publications {
aar(MavenPublication) {
groupId LEANPLUM_GROUP_ID
version LEANPLUM_SDK_VERSION
artifactId libraryArtifactId
// Apply the component for the release build variant
from components.release
artifact androidJavadocsJar
artifact androidSourcesJar
// publish jar
artifact("$buildDir/intermediates/aar_main_jar/release/classes.jar")
pom {
packaging = 'aar'
name = libraryArtifactId
description = 'The Leanplum SDK messaging platform'
url = 'https://github.com/Leanplum/Leanplum-Android-SDK'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
name = 'Leanplum'
}
}
scm {
url = 'https://github.com/Leanplum/Leanplum-Android-SDK'
}
}
}
}
repositories {
maven {
name = "sonatype"
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = System.getenv('SONATYPE_OSSRH_USER')
password = System.getenv('SONATYPE_OSSRH_PASSWORD')
}
}
}
}
}
artifactory {
contextUrl = 'https://repo.leanplum.com'
publish {
repository {
repoKey = '/'
username = System.getenv('ARTIFACTORY_USER')
password = System.getenv('ARTIFACTORY_PASSWORD')
}
defaults {
publications('aar')
publishArtifacts = true
properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core']
publishPom = true
}
}
}
signing {
def signingKey = null
def signingKeyBase64 = System.getenv('SIGNING_KEY_BASE64')
if (signingKeyBase64 != null) {
signingKey = new String(Base64.getDecoder().decode((String) signingKeyBase64))
}
def signingPassword = System.getenv('SIGNING_PASSWORD')
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications
}
}