libpdfviewer/app/build.gradle.kts

105 lines
2.8 KiB
Plaintext
Raw Normal View History

import org.apache.tools.ant.taskdefs.condition.Os
2021-11-21 21:10:47 +01:00
import java.util.Properties
import java.io.FileInputStream
val keystorePropertiesFile = rootProject.file("keystore.properties")
val useKeystoreProperties = keystorePropertiesFile.canRead()
val keystoreProperties = Properties()
if (useKeystoreProperties) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}
plugins {
2022-02-18 15:03:53 +01:00
id("com.android.library")
2021-11-22 16:18:59 +01:00
id("kotlin-android")
2021-11-21 21:10:47 +01:00
}
2023-02-02 03:43:25 +01:00
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
2023-02-02 03:43:25 +01:00
}
}
2021-11-21 21:10:47 +01:00
android {
if (useKeystoreProperties) {
signingConfigs {
create("release") {
storeFile = rootProject.file(keystoreProperties["storeFile"]!!)
storePassword = keystoreProperties["storePassword"] as String
keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
}
create("play") {
storeFile = rootProject.file(keystoreProperties["storeFile"]!!)
storePassword = keystoreProperties["storePassword"] as String
keyAlias = keystoreProperties["uploadKeyAlias"] as String
keyPassword = keystoreProperties["uploadKeyPassword"] as String
}
2021-11-21 21:10:47 +01:00
}
}
2023-08-26 00:31:25 +02:00
compileSdk = 34
2023-07-30 19:21:32 +02:00
buildToolsVersion = "34.0.0"
2021-11-21 21:10:47 +01:00
namespace = "app.grapheneos.pdfviewer"
2021-11-21 21:10:47 +01:00
defaultConfig {
2022-02-18 15:03:53 +01:00
minSdk = 21
resourceConfigurations.add("en")
2021-11-21 21:10:47 +01:00
}
buildTypes {
getByName("release") {
if (useKeystoreProperties) {
signingConfig = signingConfigs.getByName("release")
}
}
create("play") {
initWith(getByName("release"))
if (useKeystoreProperties) {
signingConfig = signingConfigs.getByName("play")
}
}
buildFeatures {
viewBinding = true
buildConfig = true
}
2021-11-21 21:10:47 +01:00
}
}
dependencies {
implementation("androidx.appcompat:appcompat:1.6.1")
2024-05-02 21:18:59 +02:00
implementation("androidx.core:core:1.13.1")
implementation("com.google.android.material:material:1.12.0")
2021-11-21 21:10:47 +01:00
}
fun getCommand(command: String, winExt: String = "cmd"): String {
return if (Os.isFamily(Os.FAMILY_WINDOWS)) "$command.$winExt" else command
}
val npmSetup = tasks.register("npmSetup", Exec::class) {
2024-06-06 13:43:13 +02:00
workingDir = projectDir
commandLine(getCommand("npm"), "ci", "--ignore-scripts")
}
val processStatic = tasks.register("processStatic", Exec::class) {
2024-06-06 13:43:13 +02:00
workingDir = projectDir.parentFile
dependsOn(npmSetup)
commandLine(getCommand("node", "exe"), "process_static.js")
}
val cleanStatic = tasks.register("cleanStatic", Delete::class) {
delete("src/main/assets/viewer", "src/debug/assets/viewer")
}
tasks.preBuild {
dependsOn(processStatic)
}
tasks.clean {
dependsOn(cleanStatic)
2021-11-21 21:10:47 +01:00
}