tauri/tooling/cli/templates/mobile/android/app/build.gradle.kts
Amr Bashir 31444ac196
chore(deps): update wry to 0.28 (#6725)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2023-04-23 16:59:39 -03:00

104 lines
3.4 KiB
Plaintext

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("rustPlugin")
{{~#each android-app-plugins}}
id("{{this}}"){{/each}}
}
android {
compileSdk = 33
defaultConfig {
manifestPlaceholders["usesCleartextTraffic"] = "false"
applicationId = "{{reverse-domain app.domain}}.{{snake-case app.name}}"
minSdk = {{android.min-sdk-version}}
targetSdk = 33
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") {
manifestPlaceholders["usesCleartextTraffic"] = "true"
isDebuggable = true
isJniDebuggable = true
isMinifyEnabled = false
packagingOptions {
{{~#each targets}}
jniLibs.keepDebugSymbols.add("*/{{this.abi}}/*.so")
{{/each}}
}
}
getByName("release") {
isMinifyEnabled = true
val proguards = fileTree(".") {
include("**/*.pro")
}
proguardFiles(*proguards.toList().toTypedArray())
}
}
flavorDimensions.add("abi")
productFlavors {
create("universal") {
dimension = "abi"
ndk {
abiFilters += (findProperty("abiList") as? String)?.split(",") ?: listOf(
{{~#each targets}}
"{{this.abi}}",{{/each}}
)
}
}
{{~#each targets}}
create("{{this.arch}}") {
dimension = "abi"
ndk {
abiFilters += listOf("{{this.abi}}")
}
}
{{/each}}
}
assetPacks += mutableSetOf({{quote-and-join-colon-prefix asset-packs}})
namespace = "{{reverse-domain app.domain}}.{{snake-case app.name}}"
}
rust {
rootDirRel = "{{root-dir-rel}}"
targets = (findProperty("targetList") as? String)?.split(",") ?: listOf({{quote-and-join target-names}})
arches = (findProperty("archList") as? String)?.split(",") ?: listOf({{quote-and-join arches}})
}
dependencies {
{{~#each android-app-dependencies-platform}}
implementation(platform("{{this}}")){{/each}}
{{~#each android-app-dependencies}}
implementation("{{this}}"){{/each}}
implementation("androidx.webkit:webkit:1.5.0")
implementation("androidx.appcompat:appcompat:1.5.1")
implementation("com.google.android.material:material:1.7.0")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.4")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0")
}
apply(from = "tauri.build.gradle.kts")
afterEvaluate {
android.applicationVariants.all {
tasks["mergeUniversalReleaseJniLibFolders"].dependsOn(tasks["rustBuildRelease"])
tasks["mergeUniversalDebugJniLibFolders"].dependsOn(tasks["rustBuildDebug"])
if (findProperty("targetList") == null) {
productFlavors.filter{ it.name != "universal" }.forEach { _ ->
val archAndBuildType = name.capitalize()
tasks["merge${archAndBuildType}JniLibFolders"].dependsOn(tasks["rustBuild${archAndBuildType}"])
}
}
}
}