2022-08-15 18:43:50 +03:00
|
|
|
plugins {
|
|
|
|
id("com.android.application")
|
|
|
|
id("org.jetbrains.kotlin.android")
|
|
|
|
id("rustPlugin")
|
|
|
|
{{~#each android-app-plugins}}
|
|
|
|
id("{{this}}"){{/each}}
|
|
|
|
}
|
|
|
|
|
|
|
|
android {
|
2022-08-18 17:31:07 +03:00
|
|
|
compileSdk = 33
|
2022-08-15 18:43:50 +03:00
|
|
|
defaultConfig {
|
2022-08-25 06:19:47 +03:00
|
|
|
manifestPlaceholders["usesCleartextTraffic"] = "false"
|
2022-08-15 18:43:50 +03:00
|
|
|
applicationId = "{{reverse-domain app.domain}}.{{snake-case app.name}}"
|
|
|
|
minSdk = {{android.min-sdk-version}}
|
2022-08-18 17:31:07 +03:00
|
|
|
targetSdk = 33
|
2022-08-15 18:43:50 +03:00
|
|
|
versionCode = 1
|
|
|
|
versionName = "1.0"
|
|
|
|
}
|
|
|
|
sourceSets.getByName("main") {
|
|
|
|
{{#if android.vulkan-validation}}// Vulkan validation layers
|
|
|
|
val ndkHome = System.getenv("NDK_HOME")
|
|
|
|
jniLibs.srcDir("${ndkHome}/sources/third_party/vulkan/src/build-android/jniLibs")
|
|
|
|
{{/if}}
|
|
|
|
}
|
|
|
|
buildTypes {
|
|
|
|
getByName("debug") {
|
2022-08-25 06:19:47 +03:00
|
|
|
manifestPlaceholders["usesCleartextTraffic"] = "true"
|
2022-08-15 18:43:50 +03:00
|
|
|
isDebuggable = true
|
|
|
|
isJniDebuggable = true
|
|
|
|
isMinifyEnabled = false
|
|
|
|
packagingOptions {
|
|
|
|
{{~#each targets}}
|
|
|
|
|
|
|
|
jniLibs.keepDebugSymbols.add("*/{{this.abi}}/*.so")
|
|
|
|
{{/each}}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
getByName("release") {
|
2023-02-13 16:22:03 +03:00
|
|
|
isMinifyEnabled = true
|
|
|
|
val proguards = fileTree(".") {
|
|
|
|
include("*.pro")
|
|
|
|
}
|
|
|
|
proguardFiles(*proguards.toList().toTypedArray())
|
2022-08-15 18:43:50 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
flavorDimensions.add("abi")
|
|
|
|
productFlavors {
|
2022-08-20 22:53:07 +03:00
|
|
|
create("universal") {
|
2022-08-22 18:49:58 +03:00
|
|
|
val abiList = findProperty("abiList") as? String
|
|
|
|
|
2022-08-20 22:53:07 +03:00
|
|
|
dimension = "abi"
|
|
|
|
ndk {
|
2022-08-22 18:49:58 +03:00
|
|
|
abiFilters += abiList?.split(",")?.map { it.trim() } ?: listOf(
|
2022-08-20 22:53:07 +03:00
|
|
|
{{~#each targets}}
|
|
|
|
"{{this.abi}}",{{/each}}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-15 18:43:50 +03:00
|
|
|
{{~#each targets}}
|
|
|
|
|
|
|
|
create("{{this.arch}}") {
|
|
|
|
dimension = "abi"
|
|
|
|
ndk {
|
|
|
|
abiFilters += listOf("{{this.abi}}")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
{{/each}}
|
|
|
|
}
|
|
|
|
|
|
|
|
assetPacks += mutableSetOf({{quote-and-join-colon-prefix asset-packs}})
|
2022-11-21 18:50:41 +03:00
|
|
|
namespace = "{{reverse-domain app.domain}}.{{snake-case app.name}}"
|
2022-08-15 18:43:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
rust {
|
|
|
|
rootDirRel = "{{root-dir-rel}}"
|
|
|
|
targets = listOf({{quote-and-join target-names}})
|
|
|
|
arches = listOf({{quote-and-join arches}})
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
{{~#each android-app-dependencies-platform}}
|
|
|
|
implementation(platform("{{this}}")){{/each}}
|
|
|
|
{{~#each android-app-dependencies}}
|
|
|
|
implementation("{{this}}"){{/each}}
|
2022-11-21 18:50:41 +03:00
|
|
|
implementation("androidx.webkit:webkit:1.5.0")
|
|
|
|
implementation("androidx.appcompat:appcompat:1.5.1")
|
|
|
|
implementation("com.google.android.material:material:1.7.0")
|
2022-08-15 18:43:50 +03:00
|
|
|
testImplementation("junit:junit:4.13.2")
|
2022-11-21 18:50:41 +03:00
|
|
|
androidTestImplementation("androidx.test.ext:junit:1.1.4")
|
|
|
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0")
|
2023-02-06 14:56:00 +03:00
|
|
|
implementation(project(":tauri-android"))
|
2022-08-15 18:43:50 +03:00
|
|
|
}
|
|
|
|
|
2023-02-08 18:52:53 +03:00
|
|
|
apply(from = "tauri.build.gradle.kts")
|
|
|
|
|
2022-08-15 18:43:50 +03:00
|
|
|
afterEvaluate {
|
|
|
|
android.applicationVariants.all {
|
2022-08-20 22:53:07 +03:00
|
|
|
tasks["mergeUniversalReleaseJniLibFolders"].dependsOn(tasks["rustBuildRelease"])
|
|
|
|
tasks["mergeUniversalDebugJniLibFolders"].dependsOn(tasks["rustBuildDebug"])
|
|
|
|
productFlavors.filter{ it.name != "universal" }.forEach { _ ->
|
2022-08-15 18:43:50 +03:00
|
|
|
val archAndBuildType = name.capitalize()
|
|
|
|
tasks["merge${archAndBuildType}JniLibFolders"].dependsOn(tasks["rustBuild${archAndBuildType}"])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|