From fa28b59e2572b1a5b38cbf9019f93310e9c41aed Mon Sep 17 00:00:00 2001 From: Tommy-Geenexus Date: Sun, 4 Aug 2024 11:31:51 +0200 Subject: [PATCH] build: don't fail if ks env var is not set --- app/build.gradle.kts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a442d657..28594252 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -37,13 +37,18 @@ fun loadKeyStoreProperties(): Triple { ) } -fun getOrCreateKeyStoreFile(): File { +fun getOrCreateKeyStoreFile(): File? { val keyStore = projectDir.parentFile.listFiles()?.find { file -> file.extension == "jks" } return if (keyStore?.exists() == true) { keyStore } else { - File(projectDir.parentFile, keyStoreFile).apply { - writeBytes(Base64.decode(System.getenv(keyStoreBase64).toByteArray())) + val ks = System.getenv(keyStoreBase64) + if (ks == null) { + null + } else { + File(projectDir.parentFile, keyStoreFile).apply { + writeBytes(Base64.decode(ks.toByteArray())) + } } } }