Upload via GUI (7592 Dateien)
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
plugins {
|
||||
id("com.android.application") version "8.4.2"
|
||||
id("org.jetbrains.kotlin.android") version "1.9.24"
|
||||
}
|
||||
|
||||
extra["author"] = "M_Viper"
|
||||
extra["productName"] = "deskhub"
|
||||
|
||||
val releaseStoreFile = providers.environmentVariable("DESKHUB_RELEASE_STORE_FILE").orNull
|
||||
val releaseStorePassword = providers.environmentVariable("DESKHUB_RELEASE_STORE_PASSWORD").orNull
|
||||
val releaseKeyAlias = providers.environmentVariable("DESKHUB_RELEASE_KEY_ALIAS").orNull
|
||||
val releaseKeyPassword = providers.environmentVariable("DESKHUB_RELEASE_KEY_PASSWORD").orNull
|
||||
val releaseSigningConfigured = listOf(
|
||||
releaseStoreFile,
|
||||
releaseStorePassword,
|
||||
releaseKeyAlias,
|
||||
releaseKeyPassword,
|
||||
).all { !it.isNullOrBlank() }
|
||||
|
||||
android {
|
||||
namespace = "de.deskhub.staff"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "de.deskhub.staff"
|
||||
minSdk = 26
|
||||
targetSdk = 34
|
||||
// WICHTIG: Bei jedem neuen Debug-Build erhöhen. Android erkennt eine APK mit
|
||||
// unverändertem versionCode (+ gleicher Signatur) auf manchen Geräten nicht
|
||||
// zuverlässig als Update, wodurch eine Neuinstallation still fehlschlagen kann.
|
||||
versionCode = 19
|
||||
versionName = "2.1.0"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
compose = true
|
||||
buildConfig = true
|
||||
}
|
||||
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = "1.5.14"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
if (releaseSigningConfigured) {
|
||||
create("release") {
|
||||
storeFile = file(requireNotNull(releaseStoreFile))
|
||||
storePassword = requireNotNull(releaseStorePassword)
|
||||
keyAlias = requireNotNull(releaseKeyAlias)
|
||||
keyPassword = requireNotNull(releaseKeyPassword)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
if (releaseSigningConfigured) {
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
}
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests.isIncludeAndroidResources = true
|
||||
}
|
||||
|
||||
packaging {
|
||||
resources.excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
val composeBom = platform("androidx.compose:compose-bom:2024.09.00")
|
||||
implementation(composeBom)
|
||||
androidTestImplementation(composeBom)
|
||||
|
||||
implementation("androidx.activity:activity-compose:1.9.2")
|
||||
implementation("androidx.compose.ui:ui")
|
||||
implementation("androidx.compose.ui:ui-tooling-preview")
|
||||
implementation("androidx.compose.material3:material3")
|
||||
implementation("androidx.compose.material:material-icons-extended")
|
||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.3")
|
||||
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.3")
|
||||
implementation("androidx.navigation:navigation-compose:2.7.7")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0")
|
||||
implementation("com.squareup.okhttp3:okhttp:4.12.0")
|
||||
implementation("com.google.code.gson:gson:2.11.0")
|
||||
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
testImplementation("org.robolectric:robolectric:4.13")
|
||||
testImplementation(composeBom)
|
||||
testImplementation("androidx.compose.ui:ui-test-junit4")
|
||||
testImplementation("androidx.test.ext:junit:1.2.1")
|
||||
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.2.1")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
|
||||
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
|
||||
debugImplementation("androidx.compose.ui:ui-tooling")
|
||||
debugImplementation("androidx.compose.ui:ui-test-manifest")
|
||||
}
|
||||
|
||||
val verifyBranding by tasks.registering {
|
||||
doLast {
|
||||
val strings = layout.projectDirectory
|
||||
.file("src/main/res/values/strings.xml")
|
||||
.asFile
|
||||
.readText()
|
||||
check("<string name=\"app_name\">deskhub</string>" in strings) {
|
||||
"app_name muss exakt deskhub lauten."
|
||||
}
|
||||
val readme = layout.projectDirectory.file("README.md").asFile.readText()
|
||||
check("Ersteller: M_Viper" in readme) {
|
||||
"README.md muss das Feld Ersteller: M_Viper enthalten."
|
||||
}
|
||||
check(project.extra["author"] == "M_Viper") {
|
||||
"Gradle-Projektmetadatum author muss M_Viper sein."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val exportDebugApk by tasks.registering {
|
||||
doLast {
|
||||
val source = layout.buildDirectory.file("outputs/apk/debug/DeskHubMobile-debug.apk").get().asFile
|
||||
check(source.isFile) { "Debug-APK wurde nicht erzeugt: $source" }
|
||||
val target = layout.projectDirectory.file("artifacts/deskhub-employee-debug.apk").asFile
|
||||
target.parentFile.mkdirs()
|
||||
source.copyTo(target, overwrite = true)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.configureEach {
|
||||
if (name == "preBuild") {
|
||||
dependsOn(verifyBranding)
|
||||
}
|
||||
if (name == "assembleDebug") {
|
||||
finalizedBy(exportDebugApk)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user