From: Ben Soares Date: Fri, 11 Mar 2022 09:31:57 +0000 (+0000) Subject: JAL-3973 This fixes the gradle build when not in a git repo. (Part 1 of the issue) X-Git-Tag: Release_2_11_2_1~13^2~1 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=d6837e738b809051f0c389936a20e5750cb73554 JAL-3973 This fixes the gradle build when not in a git repo. (Part 1 of the issue) --- diff --git a/build.gradle b/build.gradle index 9b1eb69..bdfcfdf 100644 --- a/build.gradle +++ b/build.gradle @@ -42,7 +42,7 @@ plugins { id 'com.github.johnrengelman.shadow' version '4.0.3' id 'com.install4j.gradle' version '9.0.6' id 'com.dorongold.task-tree' version '1.5' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree - id 'com.palantir.git-version' version '0.12.3' + id 'com.palantir.git-version' version '0.13.0' apply false } repositories { @@ -383,9 +383,19 @@ ext { modules_compileClasspath = fileTree(dir: "${jalviewDir}/${j11modDir}", include: ["*.jar"]) modules_runtimeClasspath = modules_compileClasspath */ - def details = versionDetails() - gitHash = details.gitHash - gitBranch = details.branchName + + gitHash = "SOURCE" + gitBranch = "Source" + try { + apply plugin: "com.palantir.git-version" + def details = versionDetails() + gitHash = details.gitHash + gitBranch = details.branchName + } catch(org.gradle.api.internal.plugins.PluginApplicationException e) { + println("Not in a git repository") + } catch(java.lang.RuntimeException e1) { + throw new GradleException("Error with git-version plugin. Directory '.git' exists but versionDetails() cannot be found.") + } println("Using a ${CHANNEL} profile.")