@@ -2,17 +2,23 @@ import extensions.AndroidStudioTestExtension
2
2
import tasks.InstallAndroidSdkTask
3
3
import providers.AndroidStudioInstallation
4
4
import providers.AndroidStudioSystemProperties
5
+ import tasks.ExtractAndroidStudioTask
5
6
6
7
repositories {
7
- ivy {
8
- // Url of Android Studio archive
9
- url = uri(" https://redirector.gvt1.com/edgedl/android/studio/ide-zips" )
10
- patternLayout {
11
- artifact(" [revision]/[artifact]-[revision]-[ext]" )
12
- }
13
- metadataSources { artifact() }
14
- content {
15
- includeGroup(" android-studio" )
8
+ listOf (
9
+ // Urls of Android Studio archive
10
+ " https://redirector.gvt1.com/edgedl/android/studio/ide-zips" ,
11
+ " https://redirector.gvt1.com/edgedl/android/studio/install"
12
+ ).forEach {
13
+ ivy {
14
+ url = uri(it)
15
+ patternLayout {
16
+ artifact(" [revision]/[artifact]-[revision]-[ext]" )
17
+ }
18
+ metadataSources { artifact() }
19
+ content {
20
+ includeGroup(" android-studio" )
21
+ }
16
22
}
17
23
}
18
24
}
@@ -35,29 +41,17 @@ val androidStudioRuntime by configurations.creating
35
41
dependencies {
36
42
val fileExtension = when {
37
43
isWindows() -> " windows.zip"
38
- isMacOS() && isIntel() -> " mac.zip "
39
- isMacOS() && ! isIntel() -> " mac_arm.zip "
44
+ isMacOS() && isIntel() -> " mac.dmg "
45
+ isMacOS() && ! isIntel() -> " mac_arm.dmg "
40
46
isLinux() -> " linux.tar.gz"
41
47
else -> throw IllegalStateException (" Unsupported OS: $os " )
42
48
}
43
49
androidStudioRuntime(extension.testAndroidStudioVersion.map { version -> " android-studio:android-studio:$version @$fileExtension " })
44
50
}
45
51
46
- val unpackAndroidStudio = tasks.register<Copy >(" unpackAndroidStudio" ) {
47
- from(Callable {
48
- val singleFile = androidStudioRuntime.singleFile
49
- when {
50
- singleFile.name.endsWith(" .tar.gz" ) -> tarTree(singleFile)
51
- else -> zipTree(singleFile)
52
- }
53
- }) {
54
- eachFile {
55
- // Remove top folder when unzipping, that way we get rid of Android Studio.app folder that can cause issues on Mac
56
- // where MacOS would kill the Android Studio process right after start, issue: https://github.com/gradle/gradle-profiler/issues/469
57
- relativePath = RelativePath (true , * relativePath.segments.drop(1 ).toTypedArray())
58
- }
59
- }
60
- into(layout.buildDirectory.dir(" android-studio" ))
52
+ val unpackAndroidStudio = tasks.register<ExtractAndroidStudioTask >(" unpackAndroidStudio" ) {
53
+ androidStudioLocation = androidStudioRuntime
54
+ outputDir = layout.buildDirectory.dir(" android-studio" )
61
55
}
62
56
63
57
val installAndroidSdk = tasks.register<InstallAndroidSdkTask >(" installAndroidSdk" ) {
@@ -68,7 +62,7 @@ val installAndroidSdk = tasks.register<InstallAndroidSdkTask>("installAndroidSdk
68
62
}
69
63
70
64
val androidStudioInstallation = objects.newInstance<AndroidStudioInstallation >().apply {
71
- studioInstallLocation.fileProvider( unpackAndroidStudio.map { it.destinationDir })
65
+ studioInstallLocation = unpackAndroidStudio.flatMap { it.outputDir }
72
66
}
73
67
74
68
tasks.withType<Test >().configureEach {
0 commit comments