Last active
March 17, 2024 18:28
-
-
Save gtomek/b56477df158eb49f1bb7eeda95b3e14d to your computer and use it in GitHub Desktop.
build gradle kts read properties file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Properties | |
android { | |
compileSdkVersion(Config.Android.compileSdkVersion) | |
buildToolsVersion = Config.Android.buildToolsVersion | |
defaultConfig { | |
minSdkVersion(Config.Android.minSdkVersion) | |
versionCode = Config.Libs.versionCode | |
versionName = Config.Libs.versionName | |
//https://www.giorgosneokleous.com/2019/12/01/name-your-apk-aab-files/ | |
setProperty("archivesBaseName", "${project.name}-${versionName}(${versionCode})") | |
val projectProperties = readProperties(file("../project.properties")) | |
buildConfigField("String", "STATIC_VECTOR", projectProperties["staticVector1"] as String) | |
} | |
} | |
fun readProperties(propertiesFile: File) = Properties().apply { | |
propertiesFile.inputStream().use { fis -> | |
load(fis) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment