|
1
|
1 |
package com.geekorum.build
|
|
|
2 |
|
|
|
3 |
import com.android.build.gradle.AppExtension
|
|
|
4 |
import com.github.triplet.gradle.play.PlayPublisherExtension
|
|
|
5 |
import org.gradle.api.NamedDomainObjectContainer
|
|
|
6 |
import org.gradle.api.Project
|
|
|
7 |
import org.gradle.api.plugins.ExtensionAware
|
|
|
8 |
import org.gradle.kotlin.dsl.apply
|
|
|
9 |
import org.gradle.kotlin.dsl.configure
|
|
|
10 |
import org.gradle.kotlin.dsl.getByType
|
|
|
11 |
import org.gradle.kotlin.dsl.the
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
// Configuration for "com.github.triplet.play" plugin
|
|
|
15 |
// This configuration expects the given properties
|
|
|
16 |
// PLAY_STORE_JSON_KEY_FILE: google play console service credentials json file to use
|
|
|
17 |
// PLAY_STORE_TRACK: track to publish the build, default to internal but can be set to alpha, beta or production
|
|
|
18 |
// PLAY_STORE_FROM_TRACK: track from which to promote a build, default to internal but can be set to alpha, beta or production
|
|
|
19 |
|
|
|
20 |
internal fun Project.configureAndroidPlayStorePublisher(): Unit {
|
|
|
21 |
apply(plugin = "com.github.triplet.play")
|
|
|
22 |
configure<PlayPublisherExtension> {
|
|
|
23 |
defaultToAppBundles = true
|
|
|
24 |
serviceAccountCredentials = file(properties["PLAY_STORE_JSON_KEY_FILE"]!!)
|
|
|
25 |
track = properties.getOrDefault("PLAY_STORE_TRACK", "internal") as String
|
|
|
26 |
fromTrack = properties.getOrDefault("PLAY_STORE_FROM_TRACK", "internal") as String
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
val android = the<AppExtension>() as ExtensionAware
|
|
|
30 |
|
|
|
31 |
tasks.apply {
|
|
|
32 |
register("publishToGooglePlayStore") {
|
|
|
33 |
group = "Continuous Delivery"
|
|
|
34 |
description = "Publish project to Google play store"
|
|
|
35 |
dependsOn(named("publish"))
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
// only there for consistent naming scheme
|
|
|
39 |
register("promoteOnGooglePlayStore") {
|
|
|
40 |
group = "Continuous Delivery"
|
|
|
41 |
description = "Promote project Google play store"
|
|
|
42 |
dependsOn(named("promoteArtifact"))
|
|
|
43 |
}
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
}
|