Skip to content

Commit

Permalink
fix loading secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
DatL4g committed Nov 15, 2023
1 parent 7809efb commit cbaaaed
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import com.arkivanov.essenty.lifecycle.LifecycleRegistry
import dev.datlag.burningseries.common.lifecycle.LocalLifecycleOwner
import dev.datlag.burningseries.model.common.systemProperty
import dev.datlag.burningseries.module.NetworkModule
import dev.datlag.burningseries.shared.SharedRes
import dev.datlag.burningseries.SharedRes
import dev.datlag.burningseries.ui.navigation.NavHostComponent
import dev.datlag.burningseries.window.disposableSingleWindowApplication
import dev.datlag.sekret.NativeLoader
Expand Down
148 changes: 75 additions & 73 deletions app/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ aboutLibraries {
}

val createNativeLib = tasks.create("createNativeLib") {
dependsOn("sekret:assemble")
dependsOn(tasks.generateSekret, "sekret:assemble")

fun getBinPath(target: String): String? {
val buildDir = project("sekret").layout.buildDirectory.asFile.get()
Expand All @@ -158,97 +158,99 @@ val createNativeLib = tasks.create("createNativeLib") {
}
}

val androidArm32 = getBinPath("androidNativeArm32")
val androidArm64 = getBinPath("androidNativeArm64")
val androidX64 = getBinPath("androidNativeX64")
val androidX86 = getBinPath("androidNativeX86")
doLast {
val androidArm32 = getBinPath("androidNativeArm32")
val androidArm64 = getBinPath("androidNativeArm64")
val androidX64 = getBinPath("androidNativeX64")
val androidX86 = getBinPath("androidNativeX86")

if (androidArm32 != null) {
copy {
from(androidArm32) {
exclude("*.h")
exclude("*.def")
if (androidArm32 != null) {
copy {
from(androidArm32) {
exclude("*.h")
exclude("*.def")
}
into("../android/src/androidMain/jniLibs/armeabi-v7a")
}
into("../android/src/androidMain/jniLibs/armeabi-v7a")
}
}
if (androidArm64 != null) {
copy {
from(androidArm64) {
exclude("*.h")
exclude("*.def")
if (androidArm64 != null) {
copy {
from(androidArm64) {
exclude("*.h")
exclude("*.def")
}
into("../android/src/androidMain/jniLibs/arm64-v8a")
}
into("../android/src/androidMain/jniLibs/arm64-v8a")
}
}
if (androidX64 != null) {
copy {
from(androidX64) {
exclude("*.h")
exclude("*.def")
if (androidX64 != null) {
copy {
from(androidX64) {
exclude("*.h")
exclude("*.def")
}
into("../android/src/androidMain/jniLibs/x86_64")
}
into("../android/src/androidMain/jniLibs/x86_64")
}
}
if (androidX86 != null) {
copy {
from(androidX86) {
exclude("*.h")
exclude("*.def")
if (androidX86 != null) {
copy {
from(androidX86) {
exclude("*.h")
exclude("*.def")
}
into("../android/src/androidMain/jniLibs/x86")
}
into("../android/src/androidMain/jniLibs/x86")
}
}

val linuxArm64 = getBinPath("linuxArm64")
val linuxX64 = getBinPath("linuxX64")
val mingwX64 = getBinPath("mingwX64")
val macosArm64 = getBinPath("macosArm64")
val macosX64 = getBinPath("macosX64")

if (linuxArm64 != null) {
copy {
from(linuxArm64) {
exclude("*.h")
exclude("*.def")
val linuxArm64 = getBinPath("linuxArm64")
val linuxX64 = getBinPath("linuxX64")
val mingwX64 = getBinPath("mingwX64")
val macosArm64 = getBinPath("macosArm64")
val macosX64 = getBinPath("macosX64")

if (linuxArm64 != null) {
copy {
from(linuxArm64) {
exclude("*.h")
exclude("*.def")
}
into("../desktop/resources/linux-arm64")
}
into("../desktop/resources/linux-arm64")
}
}
if (linuxX64 != null) {
copy {
from(linuxX64) {
exclude("*.h")
exclude("*.def")
if (linuxX64 != null) {
copy {
from(linuxX64) {
exclude("*.h")
exclude("*.def")
}
into("../desktop/resources/linux-x64")
}
into("../desktop/resources/linux-x64")
}
}
if (mingwX64 != null) {
copy {
from(mingwX64) {
exclude("*.h")
exclude("*.def")
if (mingwX64 != null) {
copy {
from(mingwX64) {
exclude("*.h")
exclude("*.def")
}
into("../desktop/resources/windows")
}
into("../desktop/resources/windows")
}
}
if (macosArm64 != null) {
copy {
from(macosArm64) {
exclude("*.h")
exclude("*.def")
if (macosArm64 != null) {
copy {
from(macosArm64) {
exclude("*.h")
exclude("*.def")
}
into("../desktop/resources/macos-arm64")
}
into("../desktop/resources/macos-arm64")
}
}
if (macosX64 != null) {
copy {
from(macosX64) {
exclude("*.h")
exclude("*.def")
if (macosX64 != null) {
copy {
from(macosX64) {
exclude("*.h")
exclude("*.def")
}
into("../desktop/resources/macos-x64")
}
into("../desktop/resources/macos-x64")
}
}
}
2 changes: 1 addition & 1 deletion app/shared/sekret/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
api("dev.datlag.sekret:sekret:0.1.0")
api(libs.sekret)
}
}
val jniNativeMain by creating {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package dev.datlag.burningseries
actual fun getPackageName(): String {
val clazz = AppIO::class

return clazz.java.packageName.ifBlank { null } ?: run {
return (clazz.java.packageName.ifBlank { null } ?: run {
var cutPackage = (clazz.qualifiedName ?: clazz.java.canonicalName).substringBeforeLast(clazz.simpleName ?: clazz.java.simpleName)

if (cutPackage.startsWith('.')) {
Expand All @@ -15,5 +15,5 @@ actual fun getPackageName(): String {
}

cutPackage
}
}).trim()
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import dev.datlag.burningseries.common.LocalRestartRequired
import dev.datlag.burningseries.common.header
import dev.datlag.burningseries.other.CEFState
import dev.datlag.burningseries.other.LocalCEFInitialization
import dev.datlag.burningseries.shared.SharedRes
import dev.datlag.burningseries.SharedRes
import dev.datlag.burningseries.window.ApplicationDisposer
import dev.icerock.moko.resources.compose.stringResource

Expand Down
9 changes: 5 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
app = "5.0.0"
aboutlibraries = "10.9.2"
accompanist = "0.32.0"
activity = "1.8.0"
activity = "1.8.1"
android = "8.1.3"
android-core = "1.12.0"
appcompat = "1.6.1"
Expand All @@ -23,7 +23,7 @@ kodein = "7.20.2"
kotlin = "1.9.20"
ksp = "1.9.20-1.0.14"
ktor = "2.3.6"
ktorfit = "1.10.0"
ktorfit = "1.10.1"
ktsoup = "0.3.0"
lang = "3.13.0"
material = "1.10.0"
Expand All @@ -34,8 +34,8 @@ osdetector = "1.7.3"
parcelable = "1.2.0"
protobuf = "0.9.4"
protoc = "3.24.4"
realm = "1.11.0"
sekret = "0.1.0"
realm = "1.12.0"
sekret = "0.1.1"
serialization-json = "1.6.0"
splashscreen = "1.0.1"
sqldelight = "2.0.0"
Expand Down Expand Up @@ -94,6 +94,7 @@ protobuf = { group = "com.google.protobuf", name = "protobuf-kotlin", version.re
protoc = { group = "com.google.protobuf", name = "protoc", version.ref = "protoc" }
realm = { group = "io.realm.kotlin", name = "library-base", version.ref = "realm" }
realm-sync = { group = "io.realm.kotlin", name = "library-sync", version.ref = "realm" }
sekret = { group = "dev.datlag.sekret", name = "sekret", version.ref = "sekret" }
serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serialization-json" }
splashscreen = { group = "androidx.core", name = "core-splashscreen", version.ref = "splashscreen" }
stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" }
Expand Down

0 comments on commit cbaaaed

Please sign in to comment.