Skip to content

Commit d45f842

Browse files
committed
small fixes
1 parent 2b45842 commit d45f842

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

gradle-plugin/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
66
import util.other.generateSource
77
import kotlin.io.path.Path
88
import kotlin.io.path.absolutePathString
9+
import kotlin.io.path.exists
910
import kotlin.io.path.readLines
1011

1112
plugins {
@@ -109,9 +110,11 @@ generateSource(
109110
val globalRootDir: String by extra
110111

111112
val androidHome = System.getenv("ANDROID_HOME")
113+
?: System.getProperty("ANDROID_SDK_HOME")
112114
?: Path(globalRootDir, "local.properties")
113-
.readLines()
114-
.find { it.startsWith("sdk.dir=") }
115+
.takeIf { it.exists() }
116+
?.readLines()
117+
?.find { it.startsWith("sdk.dir=") }
115118
?.substringAfter("=")
116119
?.trim()
117120
?: error("ANDROID_HOME is not set")

0 commit comments

Comments
 (0)