From dc56db32c052f669ef60758ceb8454a2500e308e Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Mon, 6 Jun 2016 11:58:11 +0300 Subject: [PATCH] [build scripts] skips JRE update when build server is unreachable --- build/scripts/download_jre.gant | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/build/scripts/download_jre.gant b/build/scripts/download_jre.gant index b909147e689d..227963c90c4e 100644 --- a/build/scripts/download_jre.gant +++ b/build/scripts/download_jre.gant @@ -14,7 +14,6 @@ * limitations under the License. */ - import com.intellij.openapi.util.SystemInfo import java.util.regex.Pattern @@ -29,8 +28,17 @@ target('default': 'Downloads custom JRE build from Teamcity server') { echo "Acceptable architecture (32 or 64 bit) is not defined, JRE download skipped" return } - def buildId = new URL("$jreTeamcityUrl/buildTypes/id:$jreBuildTypeId/builds/tags:$jreBuildTag/id").text - def buildNumber = new URL("$jreTeamcityUrl/builds/id:$buildId/number").text + + String buildId, buildNumber + try { + buildId = new URL("$jreTeamcityUrl/buildTypes/id:$jreBuildTypeId/builds/tags:$jreBuildTag/id").text + buildNumber = new URL("$jreTeamcityUrl/builds/id:$buildId/number").text + } + catch (IOException e) { + echo "Build server connection failed: ${e.message}, JRE download skipped" + return + } + java(jvm: SystemInfo.isMac ? "$workIdeaHome/jre/jdk/Contents/Home/jre/bin/java" : "$workIdeaHome/jre/jre/bin/java", fork: "true", classname: "dummy", outputproperty: "jvmVersionOutput") { jvmarg(value: "-version")