Skip to content

Commit

Permalink
Merge pull request #410 from gradle/wolfs/lazy-dependency
Browse files Browse the repository at this point in the history
Simplify Android Studio download
  • Loading branch information
wolfs committed Mar 16, 2022
2 parents 42d243b + 4ee0ffd commit 52cd3cd
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,14 @@ val extension = extensions.create<AndroidStudioTestExtension>("androidStudioTest
val androidStudioRuntime by configurations.creating

dependencies {
val extension = when {
val fileExtension = when {
isWindows() -> "windows.zip"
isMacOS() && isIntel() -> "mac.zip"
isMacOS() && !isIntel() -> "mac_arm.zip"
isLinux() -> "linux.tar.gz"
else -> throw IllegalStateException("Unsupported OS: $os")
}
androidStudioRuntime("android-studio:android-studio@$extension")
}
androidStudioRuntime.withDependencies {
this.forEach { dependency ->
if (dependency is ExternalDependency && dependency.version == null) {
dependency.version { require(extension.testAndroidStudioVersion.get()) }
}
}
androidStudioRuntime(extension.testAndroidStudioVersion.map { version -> "android-studio:android-studio:$version@$fileExtension" })
}

val unpackAndroidStudio = tasks.register<Copy>("unpackAndroidStudio") {
Expand Down

0 comments on commit 52cd3cd

Please sign in to comment.