Skip to content

Commit 463932b

Browse files
committed
feat: update build gradle to publish plugins as aar
1 parent cc7d1e1 commit 463932b

File tree

8 files changed

+513
-56
lines changed

8 files changed

+513
-56
lines changed

Adjust/sdk-plugin-criteo/build.gradle

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,28 @@ artifacts {
7474
afterEvaluate {
7575
publishing {
7676
publications {
77-
mavenAndroidCriteo(MavenPublication) {
78-
customizePom(pom)
77+
/*
78+
mavenAndroidCriteoJar(MavenPublication) {
79+
customizePomForJar(pom)
7980
groupId rootProject.ext.adjustGroupId
8081
artifactId 'adjust-android-criteo'
8182
version rootProject.ext.coreVersionName
8283
8384
artifact adjustCriteoAndroidJar
8485
artifact adjustCriteoAndroidSourcesJar
8586
}
87+
*/
88+
mavenAndroidCriteoAar(MavenPublication) {
89+
customizePomForAar(pom)
90+
groupId rootProject.ext.adjustGroupId
91+
artifactId 'adjust-android-criteo'
92+
version rootProject.ext.coreVersionName
93+
94+
artifact("$buildDir/outputs/aar/sdk-plugin-criteo-release.aar") {
95+
builtBy tasks.getByPath("adjustCriteoAndroidAar")
96+
}
97+
artifact adjustCriteoAndroidSourcesJar
98+
}
8699
}
87100

88101
repositories {
@@ -98,11 +111,12 @@ afterEvaluate {
98111
}
99112
}
100113
signing {
101-
sign publishing.publications.mavenAndroidCriteo
114+
// sign publishing.publications.mavenAndroidCriteoJar
115+
sign publishing.publications.mavenAndroidCriteoAar
102116
}
103117
}
104118

105-
def customizePom(pom) {
119+
def customizePomForJar(pom) {
106120
pom.withXml {
107121
def root = asNode()
108122

@@ -142,10 +156,50 @@ def customizePom(pom) {
142156
}
143157
}
144158

145-
model {
146-
tasks.generatePomFileForMavenAndroidCriteoPublication {
147-
destination = file("${project.buildDir}/generated-pom.xml")
159+
def customizePomForAar(pom) {
160+
pom.withXml {
161+
def root = asNode()
162+
163+
// Add all items necessary for maven central publication
164+
root.children().last() + {
165+
resolveStrategy = Closure.DELEGATE_FIRST
166+
description 'The Criteo plugin for Adjust SDK for Android'
167+
name 'Adjust Android SDK Criteo plugin'
168+
url 'https://github.com/adjust/android_sdk'
169+
170+
organization {
171+
name 'adjust GmbH'
172+
url 'http://www.adjust.com'
173+
}
174+
licenses {
175+
license {
176+
name 'MIT License'
177+
url 'http://www.opensource.org/licenses/mit-license.php'
178+
}
179+
}
180+
scm {
181+
url '[email protected]:adjust/android_sdk.git'
182+
connection 'scm:git:[email protected]:adjust/android_sdk.git'
183+
developerConnection 'scm:git:[email protected]:adjust/android_sdk.git'
184+
}
185+
developers {
186+
developer {
187+
name 'Pedro Silva'
188+
189+
}
190+
developer {
191+
name 'Ugljesa Erceg'
192+
193+
}
194+
}
195+
}
148196
}
197+
}
198+
199+
model {
200+
// tasks.generatePomFileForMavenAndroidCriteoJarPublication {
201+
// destination = file("${project.buildDir}/generated-pom.xml")
202+
// }
149203
/* TODO check if/how to replace this tasks
150204
tasks.publishMavenAndroidCriteoPublicationToMavenLocal {
151205
dependsOn project.tasks.signArchives
@@ -154,6 +208,9 @@ model {
154208
dependsOn project.tasks.signArchives
155209
}
156210
*/
211+
tasks.generatePomFileForMavenAndroidCriteoAarPublication {
212+
destination = file("${project.buildDir}/generated-pom.xml")
213+
}
157214
}
158215

159216

Adjust/sdk-plugin-imei/build.gradle

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,28 @@ artifacts {
8080
afterEvaluate {
8181
publishing {
8282
publications {
83-
mavenAndroidImei(MavenPublication) {
84-
customizePom(pom)
83+
/*
84+
mavenAndroidImeiJar(MavenPublication) {
85+
customizePomForJar(pom)
8586
groupId rootProject.ext.adjustGroupId
8687
artifactId 'adjust-android-imei'
8788
version rootProject.ext.coreVersionName
8889
8990
artifact adjustImeiAndroidJar
9091
artifact adjustImeiAndroidSourcesJar
9192
}
93+
*/
94+
mavenAndroidImeiAar(MavenPublication) {
95+
customizePomForAar(pom)
96+
groupId rootProject.ext.adjustGroupId
97+
artifactId 'adjust-android-imei'
98+
version rootProject.ext.coreVersionName
99+
100+
artifact("$buildDir/outputs/aar/sdk-plugin-imei-release.aar") {
101+
builtBy tasks.getByPath("adjustImeiAndroidAar")
102+
}
103+
artifact adjustImeiAndroidSourcesJar
104+
}
92105
}
93106

94107
repositories {
@@ -104,11 +117,12 @@ afterEvaluate {
104117
}
105118
}
106119
signing {
107-
sign publishing.publications.mavenAndroidImei
120+
// sign publishing.publications.mavenAndroidImeiJar
121+
sign publishing.publications.mavenAndroidImeiAar
108122
}
109123
}
110124

111-
def customizePom(pom) {
125+
def customizePomForJar(pom) {
112126
pom.withXml {
113127
def root = asNode()
114128

@@ -148,10 +162,50 @@ def customizePom(pom) {
148162
}
149163
}
150164

151-
model {
152-
tasks.generatePomFileForMavenAndroidImeiPublication {
153-
destination = file("${project.buildDir}/generated-pom.xml")
165+
def customizePomForAar(pom) {
166+
pom.withXml {
167+
def root = asNode()
168+
169+
// Add all items necessary for maven central publication.
170+
root.children().last() + {
171+
resolveStrategy = Closure.DELEGATE_FIRST
172+
description 'The Imei plugin for Adjust SDK for Android'
173+
name 'Adjust Android SDK Imei plugin'
174+
url 'https://github.com/adjust/android_sdk'
175+
176+
organization {
177+
name 'adjust GmbH'
178+
url 'http://www.adjust.com'
179+
}
180+
licenses {
181+
license {
182+
name 'MIT License'
183+
url 'http://www.opensource.org/licenses/mit-license.php'
184+
}
185+
}
186+
scm {
187+
url '[email protected]:adjust/android_sdk.git'
188+
connection 'scm:git:[email protected]:adjust/android_sdk.git'
189+
developerConnection 'scm:git:[email protected]:adjust/android_sdk.git'
190+
}
191+
developers {
192+
developer {
193+
name 'Pedro Silva'
194+
195+
}
196+
developer {
197+
name 'Ugljesa Erceg'
198+
199+
}
200+
}
201+
}
154202
}
203+
}
204+
205+
model {
206+
// tasks.generatePomFileForMavenAndroidImeiJarPublication {
207+
// destination = file("${project.buildDir}/generated-pom.xml")
208+
// }
155209
/* TODO check if/how to replace this tasks
156210
tasks.publishMavenAndroidImeiPublicationToMavenLocal {
157211
dependsOn project.tasks.signArchives
@@ -160,5 +214,8 @@ model {
160214
dependsOn project.tasks.signArchives
161215
}
162216
*/
217+
tasks.generatePomFileForMavenAndroidImeiAarPublication {
218+
destination = file("${project.buildDir}/generated-pom.xml")
219+
}
163220
}
164221

Adjust/sdk-plugin-oaid/build.gradle

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,28 @@ artifacts {
8484
afterEvaluate {
8585
publishing {
8686
publications {
87-
mavenAndroidOaid(MavenPublication) {
88-
customizePom(pom)
87+
/*
88+
mavenAndroidOaidJar(MavenPublication) {
89+
customizePomForJar(pom)
8990
groupId rootProject.ext.adjustGroupId
9091
artifactId 'adjust-android-oaid'
9192
version rootProject.ext.coreVersionName
9293
9394
artifact adjustOaidAndroidJar
9495
artifact adjustOaidAndroidSourcesJar
9596
}
97+
*/
98+
mavenAndroidOaidAar(MavenPublication) {
99+
customizePomForAar(pom)
100+
groupId rootProject.ext.adjustGroupId
101+
artifactId 'adjust-android-oaid'
102+
version rootProject.ext.coreVersionName
103+
104+
artifact("$buildDir/outputs/aar/sdk-plugin-oaid-release.aar") {
105+
builtBy tasks.getByPath("adjustOaidAndroidAar")
106+
}
107+
artifact adjustOaidAndroidSourcesJar
108+
}
96109
}
97110

98111
repositories {
@@ -108,11 +121,12 @@ afterEvaluate {
108121
}
109122
}
110123
signing {
111-
sign publishing.publications.mavenAndroidOaid
124+
// sign publishing.publications.mavenAndroidOaidJar
125+
sign publishing.publications.mavenAndroidOaidAar
112126
}
113127
}
114128

115-
def customizePom(pom) {
129+
def customizePomForJar(pom) {
116130
pom.withXml {
117131
def root = asNode()
118132

@@ -152,10 +166,50 @@ def customizePom(pom) {
152166
}
153167
}
154168

155-
model {
156-
tasks.generatePomFileForMavenAndroidOaidPublication {
157-
destination = file("${project.buildDir}/generated-pom.xml")
169+
def customizePomForAar(pom) {
170+
pom.withXml {
171+
def root = asNode()
172+
173+
// Add all items necessary for maven central publication.
174+
root.children().last() + {
175+
resolveStrategy = Closure.DELEGATE_FIRST
176+
description 'The Oaid plugin for Adjust SDK for Android'
177+
name 'Adjust Android SDK Oaid plugin'
178+
url 'https://github.com/adjust/android_sdk'
179+
180+
organization {
181+
name 'adjust GmbH'
182+
url 'http://www.adjust.com'
183+
}
184+
licenses {
185+
license {
186+
name 'MIT License'
187+
url 'http://www.opensource.org/licenses/mit-license.php'
188+
}
189+
}
190+
scm {
191+
url '[email protected]:adjust/android_sdk.git'
192+
connection 'scm:git:[email protected]:adjust/android_sdk.git'
193+
developerConnection 'scm:git:[email protected]:adjust/android_sdk.git'
194+
}
195+
developers {
196+
developer {
197+
name 'Pedro Silva'
198+
199+
}
200+
developer {
201+
name 'Ugljesa Erceg'
202+
203+
}
204+
}
205+
}
158206
}
207+
}
208+
209+
model {
210+
// tasks.generatePomFileForMavenAndroidOaidJarPublication {
211+
// destination = file("${project.buildDir}/generated-pom.xml")
212+
// }
159213
/* TODO check if/how to replace this tasks
160214
tasks.publishMavenAndroidOaidPublicationToMavenLocal {
161215
dependsOn project.tasks.signArchives
@@ -164,6 +218,9 @@ model {
164218
dependsOn project.tasks.signArchives
165219
}
166220
*/
221+
tasks.generatePomFileForMavenAndroidOaidAarPublication {
222+
destination = file("${project.buildDir}/generated-pom.xml")
223+
}
167224
}
168225

169226

0 commit comments

Comments
 (0)