We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e88334d commit 590846aCopy full SHA for 590846a
plugins/convention-plugins/src/main/kotlin/PropertyOrEnv.kt
@@ -6,6 +6,10 @@ internal fun Project.propertyOrEnv(key: String): String {
6
?: error("Didn't find any value for the key \"$key\" in Project properties or environment variables.")
7
}
8
9
-internal fun Project.propertyOrEnvOrNull(key: String): String? {
10
- return findProperty(key) as String? ?: System.getenv(key)
+internal fun Project.propertyOrEnvOrNull(
+ key: String,
11
+ nullIfEmpty: Boolean = true
12
+): String? {
13
+ return (findProperty(key) as String?)?.takeUnless { nullIfEmpty && it.isEmpty() }
14
+ ?: System.getenv(key)?.takeUnless { nullIfEmpty && it.isEmpty() }
15
0 commit comments