Skip to content

Commit

Permalink
Revert "v2.1 Android - Test app does not need language flavours"
Browse files Browse the repository at this point in the history
This reverts commit 482d48e.
  • Loading branch information
ErisMik committed Dec 5, 2024
1 parent 28972b3 commit 8267f5d
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion binding/android/CheetahTestApp/cheetah-test-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ android {

buildTypes {
debug {
// signingConfig signingConfigs.release
signingConfig signingConfigs.release
}
release {
minifyEnabled false
Expand All @@ -72,6 +72,44 @@ android {
testBuildType("release")
}

def testDataFile = file('../../../../resources/.test/test_data.json')
def parsedJson = new groovy.json.JsonSlurper().parseText(testDataFile.text)
def languages = []
parsedJson.tests.parameters.each { a ->
languages.add(a.language)
}

flavorDimensions "language"
productFlavors {
en {
getIsDefault().set(true)
}

languages.each { language ->
"$language" {
applicationIdSuffix ".$language"

}
}

all { flavor ->
delete fileTree("$projectDir/src/main/assets") {
exclude '**/.gitkeep'
}
String suffix = (flavor.name != "en") ? "_${flavor.name}" : ""
task("${flavor.name}CopyParams", type: Copy) {
from("$projectDir/../../../../lib/common/")
include("cheetah_params${suffix}.pv")
into("$projectDir/src/main/assets/models")
}
task("${flavor.name}CopyAudio", type: Copy) {
description = "Copy ${flavor.name} audio resources"
from("$projectDir/../../../../resources/audio_samples/")
include("test${suffix}.wav")
into("$projectDir/src/main/assets/audio_samples")
}
}
}
sourceSets {
androidTest {
java {
Expand Down Expand Up @@ -118,3 +156,17 @@ dependencies {
})
androidTestImplementation('androidx.test.espresso:espresso-intents:3.5.1')
}

afterEvaluate {
android.productFlavors.all {
flavor ->
tasks."merge${flavor.name.capitalize()}DebugAssets".dependsOn "${flavor.name}CopyParams"
tasks."merge${flavor.name.capitalize()}ReleaseAssets".dependsOn "${flavor.name}CopyParams"
tasks."generate${flavor.name.capitalize()}ReleaseLintVitalReportModel".dependsOn "${flavor.name}CopyParams"
tasks."lintVitalAnalyze${flavor.name.capitalize()}Release".dependsOn "${flavor.name}CopyParams"
tasks."merge${flavor.name.capitalize()}DebugAssets".dependsOn "${flavor.name}CopyAudio"
tasks."merge${flavor.name.capitalize()}ReleaseAssets".dependsOn "${flavor.name}CopyAudio"
tasks."generate${flavor.name.capitalize()}ReleaseLintVitalReportModel".dependsOn "${flavor.name}CopyAudio"
tasks."lintVitalAnalyze${flavor.name.capitalize()}Release".dependsOn "${flavor.name}CopyAudio"
}
}

0 comments on commit 8267f5d

Please sign in to comment.