Skip to content

Commit

Permalink
Add IssueTracker flavor
Browse files Browse the repository at this point in the history
  • Loading branch information
imknown committed Sep 30, 2022
1 parent 28affe4 commit de278fe
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
25 changes: 23 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension
import org.gradle.configurationcache.extensions.capitalized
import java.io.FileInputStream
import java.util.*

Expand Down Expand Up @@ -79,12 +80,19 @@ android {
}
}

flavorDimensions += IssueTracker::class.simpleName.toString()

productFlavors {
create(IssueTracker.firebase)
create(IssueTracker.none)
}

buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true

signingConfig = signingConfigs.getByName("release")
signingConfig = signingConfigs.getByName(name)

proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
Expand All @@ -102,7 +110,7 @@ android {
isDebuggable = true
isJniDebuggable = true

signingConfig = signingConfigs.getByName("debug")
signingConfig = signingConfigs.getByName(name)

applicationIdSuffix = ".$name"
}
Expand Down Expand Up @@ -135,6 +143,14 @@ android {
}
}

tasks.whenTaskAdded {
val flavorNone = IssueTracker.none.capitalized()
if (name.startsWith("process$flavorNone") && name.endsWith("GoogleServices")) {
println("Task $name disabled.")
enabled = false
}
}

dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))

Expand Down Expand Up @@ -165,4 +181,9 @@ dependencies {
debugImplementation("com.squareup.leakcanary:leakcanary-android:${Versions.ThirdParties.leakCanary}")
// implementation ("com.squareup.leakcanary:plumber-android:${Versions.ThirdParties.leakCanary}")
// endregion [3rd Parties]

val firebaseImplementation = IssueTracker.firebase + "Implementation"
firebaseImplementation(platform("com.google.firebase:firebase-bom:${Versions.Firebase.billOfMaterials}"))
firebaseImplementation("com.google.firebase:firebase-analytics-ktx")
firebaseImplementation("com.google.firebase:firebase-crashlytics-ndk")
}
4 changes: 0 additions & 4 deletions base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,4 @@ dependencies {
api("dev.rikka.shizuku:api:${Versions.ThirdParties.shizuku}")
api("dev.rikka.shizuku:provider:${Versions.ThirdParties.shizuku}")
// endregion [3rd Parties]

api(platform("com.google.firebase:firebase-bom:${Versions.Firebase.billOfMaterials}"))
api("com.google.firebase:firebase-analytics-ktx")
api("com.google.firebase:firebase-crashlytics-ndk")
}
4 changes: 4 additions & 0 deletions buildSrc/src/main/java/Misc.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
object IssueTracker {
const val firebase = "firebase"
const val none = "none"
}

0 comments on commit de278fe

Please sign in to comment.