Skip to content

Commit 32be9fc

Browse files
authored
Improve error messages in the build.gradle.kts (#8645)
Improve error messages for network-related failures during Android Studio download and IDEA path resolution in build.gradle.kts
1 parent 0ce5355 commit 32be9fc

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

build.gradle.kts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,14 @@ dependencies {
194194
// Documentation on the default target platform methods:
195195
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#default-target-platforms
196196
// Android Studio versions can be found at: https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html
197-
androidStudio(ideaVersion)
197+
try {
198+
androidStudio(ideaVersion)
199+
} catch (e: Exception) {
200+
throw GradleException(
201+
"Failed to resolve Android Studio / IDEA download URL. This is likely due to a network issue blocking the download URL. Please check your internet connection or VPN.",
202+
e
203+
)
204+
}
198205
testFramework(TestFrameworkType.Platform)
199206
testFramework(TestFrameworkType.Starter, configurationName = "integrationImplementation")
200207
testFramework(TestFrameworkType.JUnit5, configurationName = "integrationImplementation")
@@ -344,7 +351,16 @@ tasks {
344351
maxHeapSize = "4g"
345352

346353
systemProperty("path.to.build.plugin", buildPlugin.get().archiveFile.get().asFile.absolutePath)
347-
systemProperty("idea.home.path", prepareTestSandbox.get().getDestinationDir().parentFile.absolutePath)
354+
systemProperty("idea.home.path", providers.provider {
355+
try {
356+
prepareTestSandbox.get().destinationDir.parentFile.absolutePath
357+
} catch (e: Exception) {
358+
throw GradleException(
359+
"Failed to resolve Android Studio/ IDEA path. This is likely due to a network issue blocking the download URL. Please check your internet connection or VPN.",
360+
e
361+
)
362+
}
363+
})
348364
systemProperty(
349365
"allure.results.directory", project.layout.buildDirectory.get().asFile.absolutePath + "/allure-results"
350366
)

0 commit comments

Comments
 (0)