X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=build.gradle;h=4cc8a53f15d19c715c49568407b68b1cea81c90b;hb=refs%2Fheads%2Fimprovement%2FJAL-3847_add_dependencies_reported_by_gradle_7;hp=cf96abf89ec1de31400c2cc6a2587ed25c8bf2a3;hpb=a2cfb59f6bdfeec1fc4484af8ed473b69426e072;p=jalview.git diff --git a/build.gradle b/build.gradle index cf96abf..4cc8a53 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 { @@ -115,7 +115,7 @@ ext { // Import releaseProps from the RELEASE file // or a file specified via JALVIEW_RELEASE_FILE if defined // Expect jalview.version and target release branch in jalview.release - def releaseProps = new Properties(); + releaseProps = new Properties(); def releasePropFile = findProperty("JALVIEW_RELEASE_FILE"); def defaultReleasePropFile = "${jalviewDirAbsolutePath}/RELEASE"; try { @@ -383,9 +383,21 @@ 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. Using git values from RELEASE properties file.") + gitHash = releaseProps.getProperty("git.hash") + gitBranch = releaseProps.getProperty("git.branch") + } 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.") @@ -1245,7 +1257,7 @@ task copyChannelResources(type: Copy) { } task createBuildProperties(type: WriteProperties) { - dependsOn copyResources + dependsOn copyChannelResources group = "build" description = "Create the ${buildProperties} file" @@ -1299,7 +1311,7 @@ task prepare { dependsOn buildIndices } - +processResources.dependsOn prepare compileJava.dependsOn prepare run.dependsOn compileJava //run.dependsOn prepare @@ -1348,13 +1360,15 @@ test { task compileLinkCheck(type: JavaCompile) { + dependsOn convertMdFiles + dependsOn copyChannelResources options.fork = true classpath = files("${jalviewDir}/${utils_dir}") destinationDir = file("${jalviewDir}/${utils_dir}") source = fileTree(dir: "${jalviewDir}/${utils_dir}", include: ["HelpLinksChecker.java", "BufferedLineReader.java"]) inputs.file("${jalviewDir}/${utils_dir}/HelpLinksChecker.java") - inputs.file("${jalviewDir}/${utils_dir}/HelpLinksChecker.java") + inputs.file("${jalviewDir}/${utils_dir}/BufferedLineReader.java") outputs.file("${jalviewDir}/${utils_dir}/HelpLinksChecker.class") outputs.file("${jalviewDir}/${utils_dir}/BufferedLineReader.class") } @@ -1607,7 +1621,9 @@ task getdownWebsite() { codeFiles += f } } - codeFiles.sort().each{f -> + def jalviewJar = jar.archiveFileName.getOrNull() + // put jalview.jar first for CLASSPATH and .properties files reasons + codeFiles.sort{a, b -> ( a.getName() == jalviewJar ? -1 : ( b.getName() == jalviewJar ? 1 : a <=> b ) ) }.each{f -> def name = f.getName() def line = "code = ${getdownAppDistDir}/${name}\n" getdownTextString += line @@ -1818,7 +1834,8 @@ task copyInstall4jTemplate { // disable install screen for OSX dmg (for 2.11.2.0) install4jConfigXml.'**'.macosArchive.each { macosArchive -> - macosArchive.'@executeSetupApp' = "false" + macosArchive.attributes().remove('executeSetupApp') + macosArchive.attributes().remove('setupAppId') } // turn off checksum creation for LOCAL channel @@ -2001,6 +2018,22 @@ spotless { } } +task createSourceReleaseProperties(type: WriteProperties) { + group = "distribution" + description = "Create the source RELEASE properties file" + + def sourceTarBuildDir = "${buildDir}/sourceTar" + def sourceReleasePropertiesFile = "${sourceTarBuildDir}/RELEASE" + outputFile (sourceReleasePropertiesFile) + + doFirst { + releaseProps.each{ key, val -> property key, val } + property "git.branch", gitBranch + property "git.hash", gitHash + } + + outputs.file(outputFile) +} task sourceDist(type: Tar) { group "distribution" @@ -2008,6 +2041,9 @@ task sourceDist(type: Tar) { dependsOn createBuildProperties dependsOn convertMdFiles + dependsOn eclipseAllPreferences + dependsOn createSourceReleaseProperties + def VERSION_UNDERSCORES = JALVIEW_VERSION.replaceAll("\\.", "_") def outputFileName = "${project.name}_${VERSION_UNDERSCORES}.tar.gz" @@ -2032,6 +2068,7 @@ task sourceDist(type: Tar) { "*locales/**", "utils/InstallAnywhere", "**/*.log", + "RELEASE", ] def PROCESS_FILES=[ "AUTHORS", @@ -2041,7 +2078,6 @@ task sourceDist(type: Tar) { "FEATURETODO", "LICENSE", "**/README", - "RELEASE", "THIRDPARTYLIBS", "TESTNG", "build.gradle", @@ -2056,7 +2092,9 @@ task sourceDist(type: Tar) { "**/*.sh", ] def INCLUDE_FILES=[ - ".settings/org.eclipse.jdt.core.jalview.prefs", + ".classpath", + ".settings/org.eclipse.buildship.core.prefs", + ".settings/org.eclipse.jdt.core.prefs" ] from(jalviewDir) { @@ -2103,6 +2141,10 @@ task sourceDist(type: Tar) { }) } + def sourceTarBuildDir = "${buildDir}/sourceTar" + from(sourceTarBuildDir) { + // this includes the appended RELEASE properties file + } }