|
10
|
1 |
/*
|
|
|
2 |
* Geekdroid is a utility library for development on the Android
|
|
|
3 |
* Platform.
|
|
|
4 |
*
|
|
61
|
5 |
* Copyright (C) 2017-2024 by Frederic-Charles Barthelery.
|
|
10
|
6 |
*
|
|
|
7 |
* This file is part of Geekdroid.
|
|
|
8 |
*
|
|
|
9 |
* Geekdroid is free software: you can redistribute it and/or modify
|
|
|
10 |
* it under the terms of the GNU General Public License as published by
|
|
|
11 |
* the Free Software Foundation, either version 3 of the License, or
|
|
|
12 |
* (at your option) any later version.
|
|
|
13 |
*
|
|
|
14 |
* Geekdroid is distributed in the hope that it will be useful,
|
|
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
17 |
* GNU General Public License for more details.
|
|
|
18 |
*
|
|
|
19 |
* You should have received a copy of the GNU General Public License
|
|
|
20 |
* along with Geekdroid. If not, see <http://www.gnu.org/licenses/>.
|
|
|
21 |
*/
|
|
1
|
22 |
package com.geekorum.build
|
|
|
23 |
|
|
|
24 |
import com.android.build.gradle.AppExtension
|
|
|
25 |
import com.github.triplet.gradle.play.PlayPublisherExtension
|
|
|
26 |
import org.gradle.api.NamedDomainObjectContainer
|
|
|
27 |
import org.gradle.api.Project
|
|
|
28 |
import org.gradle.api.plugins.ExtensionAware
|
|
|
29 |
import org.gradle.kotlin.dsl.apply
|
|
|
30 |
import org.gradle.kotlin.dsl.configure
|
|
|
31 |
import org.gradle.kotlin.dsl.getByType
|
|
|
32 |
import org.gradle.kotlin.dsl.the
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
// Configuration for "com.github.triplet.play" plugin
|
|
|
36 |
// This configuration expects the given properties
|
|
|
37 |
// PLAY_STORE_JSON_KEY_FILE: google play console service credentials json file to use
|
|
|
38 |
// PLAY_STORE_TRACK: track to publish the build, default to internal but can be set to alpha, beta or production
|
|
|
39 |
// PLAY_STORE_FROM_TRACK: track from which to promote a build, default to internal but can be set to alpha, beta or production
|
|
|
40 |
|
|
|
41 |
internal fun Project.configureAndroidPlayStorePublisher(): Unit {
|
|
|
42 |
apply(plugin = "com.github.triplet.play")
|
|
|
43 |
configure<PlayPublisherExtension> {
|
|
19
|
44 |
defaultToAppBundles.set(true)
|
|
|
45 |
track.set(properties.getOrDefault("PLAY_STORE_TRACK", "internal") as String)
|
|
|
46 |
fromTrack.set(properties.getOrDefault("PLAY_STORE_FROM_TRACK", "internal") as String)
|
|
|
47 |
serviceAccountCredentials.set(file(properties["PLAY_STORE_JSON_KEY_FILE"]!!))
|
|
1
|
48 |
}
|
|
|
49 |
|
|
|
50 |
val android = the<AppExtension>() as ExtensionAware
|
|
|
51 |
|
|
|
52 |
tasks.apply {
|
|
|
53 |
register("publishToGooglePlayStore") {
|
|
|
54 |
group = "Continuous Delivery"
|
|
|
55 |
description = "Publish project to Google play store"
|
|
19
|
56 |
dependsOn(named("publishApps"))
|
|
1
|
57 |
}
|
|
|
58 |
|
|
|
59 |
// only there for consistent naming scheme
|
|
|
60 |
register("promoteOnGooglePlayStore") {
|
|
|
61 |
group = "Continuous Delivery"
|
|
|
62 |
description = "Promote project Google play store"
|
|
|
63 |
dependsOn(named("promoteArtifact"))
|
|
|
64 |
}
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
}
|