Buildconfig testing

This commit is contained in:
CranberrySoup 2024-04-03 01:26:07 +02:00
parent 53ffcd0228
commit 6940e0d224
6 changed files with 20 additions and 22 deletions

View file

@ -13,6 +13,7 @@ plugins {
val tmpFilePath = System.getProperty("user.home") + "/work/_temp/keystore/"
val prereleaseStoreFile: File? = File(tmpFilePath).listFiles()?.first()
var isLibraryDebug = false
fun String.execute() = ByteArrayOutputStream().use { baot ->
if (project.exec {
@ -103,6 +104,7 @@ android {
)
}
debug {
isLibraryDebug = true
isDebuggable = true
applicationIdSuffix = ".debug"
proguardFiles(
@ -233,7 +235,9 @@ dependencies {
implementation("androidx.work:work-runtime-ktx:2.9.0")
implementation("com.github.Blatzar:NiceHttp:0.4.11") // HTTP Lib
implementation(project(":library"))
implementation(project(":library") {
this.extra.set("isDebug", isLibraryDebug)
})
}
tasks.register("androidSourcesJar", Jar::class) {

View file

@ -9,6 +9,8 @@ buildscript {
classpath("com.android.tools.build:gradle:8.2.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.9.10")
// Universal build config
classpath("com.codingfeline.buildkonfig:buildkonfig-gradle-plugin:0.15.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle.kts files

View file

@ -1,7 +1,10 @@
import com.codingfeline.buildkonfig.compiler.FieldSpec
plugins {
kotlin("multiplatform")
id("maven-publish")
id("com.android.library")
id("com.codingfeline.buildkonfig")
}
kotlin {
@ -28,6 +31,16 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8.toString()
}
buildkonfig {
packageName = "com.lagradost.api"
exposeObjectWithName = "BuildConfig"
defaultConfigs {
val isDebug = kotlin.runCatching { extra.get("isDebug") }.getOrNull() == true
buildConfigField(FieldSpec.Type.BOOLEAN, "DEBUG", isDebug.toString())
}
}
android {
compileSdk = 34
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")

View file

@ -1,7 +0,0 @@
package com.lagradost.api
actual class BuildConfig {
actual companion object {
actual val DEBUG = true
}
}

View file

@ -1,7 +0,0 @@
package com.lagradost.api
expect class BuildConfig {
companion object {
val DEBUG: Boolean
}
}

View file

@ -1,7 +0,0 @@
package com.lagradost.api
actual class BuildConfig {
actual companion object {
actual val DEBUG = true
}
}