Skip to content

Commit

Permalink
Fix test release build (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
valentunn authored Sep 29, 2022
1 parent 358995a commit a728fec
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 19 deletions.
42 changes: 23 additions & 19 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ android {
matchingFallbacks = ['release']
signingConfig signingConfigs.debug

versionNameSuffix '-test'
applicationIdSuffix '.test'
versionNameSuffix '-releaseTest'
applicationIdSuffix '.releaseTest'
}
releaseMarket {
initWith buildTypes.release
Expand Down Expand Up @@ -98,6 +98,9 @@ android {
releaseMarket {
res.srcDirs = ['src/release/res']
}
releaseTest {
res.srcDirs = ['src/release/res']
}
}

bundle {
Expand All @@ -112,29 +115,30 @@ android {
}

kotlinOptions {


jvmTarget = '1.8'
}
}

task bindReleaseGithubGoogleServicesToRelease(type: Copy) {
description = 'Switches to RELEASE google-services.json for GitHub'
from "src/release"
include "google-services.json"
into "src/releaseGithub"
applicationVariants.all { variant ->
String name = variant.buildType.name
if (name != "release" && name.startsWith("release")) {
createBindReleaseFileTask(variant.buildType.name)
}
}
}

task bindReleaseMarketGoogleServicesToRelease(type: Copy) {
description = 'Switches to RELEASE google-services.json for Market'
from "src/release"
include "google-services.json"
into "src/releaseMarket"
}
void createBindReleaseFileTask(String destination) {
String taskName = "bind${destination.capitalize()}GithubGoogleServicesToRelease"

afterEvaluate {
processReleaseGithubGoogleServices.dependsOn bindReleaseGithubGoogleServicesToRelease
processReleaseMarketGoogleServices.dependsOn bindReleaseMarketGoogleServicesToRelease
Task task = task(taskName, type: Copy) {
description = "Switches to RELEASE google-services.json for ${destination}"
from "src/release"
include "google-services.json"
into "src/${destination}"
}

afterEvaluate {
tasks.getByName("process${destination.capitalize()}GoogleServices").dependsOn task
}
}

play {
Expand Down
29 changes: 29 additions & 0 deletions app/src/release/google-services.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,35 @@
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:802342409053:android:67b2b7e7e96c0a76378eb4",
"android_client_info": {
"package_name": "io.novafoundation.nova.releaseTest"
}
},
"oauth_client": [
{
"client_id": "802342409053-rgoughr36c138jfjle5k8glafpkbagli.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDV0jNUiEGmb4tOn65m2EAyGV5eJpxhZY0"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "802342409053-rgoughr36c138jfjle5k8glafpkbagli.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
Expand Down

0 comments on commit a728fec

Please sign in to comment.