JAL-3289 Ehancements to ARCHIVE building and script to show how to batch build and...
authorBen Soares <bsoares@dundee.ac.uk>
Tue, 25 Jun 2019 15:16:13 +0000 (16:16 +0100)
committerBen Soares <bsoares@dundee.ac.uk>
Tue, 25 Jun 2019 15:16:13 +0000 (16:16 +0100)
build.gradle
gradle.properties
utils/archive_building.sh [new file with mode: 0644]

index 026ee8f..2183543 100644 (file)
@@ -55,11 +55,13 @@ ext {
        getdownDir = ""
        reportRsyncCmd = false
         buildDist = true
+        buildProperties = buildPropertiesFile
         switch (CHANNEL) {
 
                case "BUILD":
                // TODO: get bamboo build artifact URL for getdown artifacts
                getdown_app_dir = getdown_app_dir_alt
+                buildProperties = jalviewDir + "/" + classesDir +"/" + buildPropertiesFile
                break
 
                case "RELEASE":
@@ -67,6 +69,7 @@ ext {
                getdownDir = getdown_channel_name + "/" + JAVA_VERSION
                getdown_app_base = getdown_channel_base + "/" + getdownDir
                getdown_app_dir = getdown_app_dir_release
+                buildProperties = jalviewDir + "/" + classesDir +"/" + buildPropertiesFile
                reportRsyncCommand = true
                break
 
@@ -75,27 +78,28 @@ ext {
                getdownDir = getdown_channel_name + "/" + JAVA_VERSION
                getdown_app_base = getdown_channel_base + "/" + getdownDir
                getdown_app_dir = getdown_app_dir_alt
-                if (!file(ARCHIVEDIST).exists()) {
-                  print "Must provide an ARCHIVEDIST value to produce an archive distribution"
-                  exit(2)
+                if (!file(ARCHIVEDIR+"/"+packageDir).exists()) {
+                  print "Must provide an ARCHIVEDIR value to produce an archive distribution"
+                  exit
                 } else {
-                  packageDir = ARCHIVEDIST
+                  packageDir = ARCHIVEDIR + "/" + packageDir
+                  buildProperties = ARCHIVEDIR +"/" + classesDir + "/" + buildPropertiesFile
                   buildDist = false
                 }
                reportRsyncCommand = true
                break
     
                case "ARCHIVELOCAL":
-               getdown_channel_name = CHANNEL.toLowerCase()+"/"+JALVIEW_VERSION
+               getdown_channel_name = "archive" + "/" + JALVIEW_VERSION
                getdownDir = getdown_channel_name + "/" + JAVA_VERSION
-               //getdown_app_base = getdown_channel_base + "/" + getdownDir
                getdown_app_base = file(getdownWebsiteDir).toURI().toString()
                getdown_app_dir = getdown_app_dir_alt
-                if (!file(ARCHIVEDIST).exists()) {
-                  print "Must provide an ARCHIVEDIST value to produce an archive distribution"
-                  exit(2)
+                if (!file(ARCHIVEDIR+"/"+packageDir).exists()) {
+                  print "Must provide an ARCHIVEDIR value to produce an archive distribution"
+                  exit
                 } else {
-                  packageDir = ARCHIVEDIST
+                  packageDir = ARCHIVEDIR + "/" + packageDir
+                  buildProperties = ARCHIVEDIR +"/" + classesDir + "/" + buildPropertiesFile
                   buildDist = false
                 }
                reportRsyncCommand = true
@@ -106,6 +110,7 @@ ext {
                getdownDir = getdown_channel_name + "/" + JAVA_VERSION
                getdown_app_base = getdown_channel_base + "/" + getdownDir
                getdown_app_dir = getdown_app_dir_alt
+                buildProperties = jalviewDir + "/" + classesDir +"/" + buildPropertiesFile
                reportRsyncCommand = true
                break
 
@@ -114,6 +119,7 @@ ext {
                getdownDir = getdown_channel_name + "/" + JAVA_VERSION
                getdown_app_base = getdown_channel_base + "/" + getdownDir
                getdown_app_dir = getdown_app_dir_alt
+                buildProperties = jalviewDir + "/" + classesDir +"/" + buildPropertiesFile
                reportRsyncCommand = true
                break
                
@@ -122,17 +128,19 @@ ext {
                getdownDir = getdown_channel_name + "/" + JAVA_VERSION
                getdown_app_base = getdown_channel_base + "/" + getdownDir
                getdown_app_dir = getdown_app_dir_alt
+                buildProperties = jalviewDir + "/" + classesDir +"/" + buildPropertiesFile
                reportRsyncCommand = true
                break
                
                case "LOCAL":
                getdown_app_base = file(getdownWebsiteDir).toURI().toString()
                getdown_app_dir = getdown_app_dir_alt
+                buildProperties = jalviewDir + "/" + classesDir +"/" + buildPropertiesFile
                break
                
                default: // something wrong specified
                print("CHANNEL must be one of BUILD, RELEASE, ARCHIVE, DEVELOP, TEST-RELEASE, SCRATCH-..., LOCAL [default]")
-               exit(1)
+               exit
                break
 
        }
@@ -549,7 +557,7 @@ task createBuildProperties(type: WriteProperties) {
        inputs.dir("$jalviewDir/$sourceDir")
        inputs.dir("$classes")
        inputs.dir("$jalviewDir/$resourceDir")
-       outputFile "$classes/$buildPropertiesFile"
+       outputFile (buildProperties)
        // taking time specific comment out to allow better incremental builds
        comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd HH:mm:ss")
        //comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd")
@@ -818,7 +826,7 @@ task getdownWebsite() {
 
        doFirst {
                copy {
-                       from "$classes/$buildPropertiesFile"
+                       from buildProperties
                        rename(buildPropertiesFile, getdown_build_properties)
                        into project.ext.getdownWebsiteDir
                }
@@ -928,7 +936,7 @@ task getdownWebsite() {
                        into project.ext.getdownWebsiteDir
                }
                 
-                if (CHANNEL != "ARCHIVE" && CHANNEL != "DEVELOP") {
+                if (! (CHANNEL.startsWith("ARCHIVE") || CHANNEL.startsWith("DEVELOP"))) {
                   copy {
                           from getdown_txt
                           from getdownLauncher
@@ -985,8 +993,17 @@ task getdown() {
        doLast {
                if (reportRsyncCommand) {
                        def fromDir = getdownWebsiteDir + (getdownWebsiteDir.endsWith("/")?"":"/")
-                       def toDir = getdown_smb_mount + "/" + getdownDir + (getdownDir.endsWith("/")?"":"/")
-                       println "LIKELY RSYNC COMMAND:\nrsync -avh --delete '$fromDir' '$toDir'"
+                       def toDir = getdown_rsync_dest + "/" + getdownDir + (getdownDir.endsWith("/")?"":"/")
+                       println "LIKELY RSYNC COMMAND:"
+                        println "rsync -avh --delete '$fromDir' '$toDir'"
+                        if (RUNRSYNC == "true") {
+                          exec {
+                                  commandLine "mkdir", "-p", toDir
+                          }
+                          exec {
+                                  commandLine "rsync", "-avh", "--delete", fromDir, toDir
+                          }
+                        }
                }
        }
 }
index 8f9b851..27959a9 100644 (file)
@@ -30,7 +30,7 @@ use_clover = false
 cloverClassesDir = clover-classes
 cloverSourcesInstrDir = sources-instr
 packageDir = dist
-ARCHIVEDIST =
+ARCHIVEDIR =
 outputJar = jalview.jar
 
 testSourceDir = test
@@ -124,5 +124,6 @@ getdown_channel_name = SCRATCH-DEFAULT
 getdown_app_dir_release = release
 getdown_install_dir = install
 getdown_app_dir_alt = alt
-getdown_smb_mount = /Volumes/jalview/docroot/getdown
-reportRsyncCommand =
\ No newline at end of file
+getdown_rsync_dest = /Volumes/jalview/docroot/getdown
+reportRsyncCommand =
+RUNRSYNC=false
diff --git a/utils/archive_building.sh b/utils/archive_building.sh
new file mode 100644 (file)
index 0000000..c29d824
--- /dev/null
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+
+J8HOME=/path/to/java8/jdk
+J11HOME=/path/to/java11/jdk
+OLDBUILDDIR=/path/to/old/build/root
+JALVIEWDIR=/path/to/recent/jalview
+LOCALARCHIVEDIR=/path/to/where/to/store/archive/locally
+WEBSITEDOCROOTMOUNT=/path/to/mounted/website/docroot
+
+
+cd OLDBUILDDIR
+mkdir tar
+cd tar
+wget http://www.jalview.org/source/jalview_2_08b.tar.gz  http://www.jalview.org/source/jalview_2_2_1.tar.gz  http://www.jalview.org/source/jalview_2_3_buildfix.tar.gz http://www.jalview.org/source/jalview_2_4_0b2.tar.gz http://www.jalview.org/source/jalview_2_5_1.tar.gz http://www.jalview.org/source/jalview_2_6_1.tar.gz http://www.jalview.org/source/jalview_2_7.tar.gz http://www.jalview.org/source/jalview_2_8_2b1.tar.gz http://www.jalview.org/source/jalview_2_9_0b1.tar.gz http://www.jalview.org/source/jalview_2_10_5.tar.gz
+cd -
+
+export JAVA_HOME=J8HOME
+export PATH=$JAVA_HOME/bin:$PATH
+
+for x in tar/jalview_*.tar.gz
+do
+       V=${x#*jalview_}
+       V=${V%.tar.gz}
+       echo $V
+       tar --one-top-level -xvf $x
+       cd jalview_$V/jalview
+       ant makedist -DJALVIEW_VERSION="$V"
+       cd -
+done
+
+export JAVA_HOME=J11HOME
+export PATH=$JAVA_HOME/bin:$PATH
+
+cd $JALVIEWDIR
+for x in $OLDBUILDDIR/jalview_*/jalview
+do
+       V=${x##*jalview_}
+       V=${V%/jalview}
+       echo $V
+       [ -e getdown/website ] && /bin/rm -r getdown/website
+       [ -e getdown/files ] && /bin/rm -r getdown/website
+       gradle getdown -PCHANNEL=ARCHIVE -PJALVIEW_VERSION="$V" -PJAVA_VERSION=1.8 -PARCHIVEDIR=$x -Pgetdown_rsync_dest=$LOCALARCHIVEDIR -PRUNRSYNC=true
+done
+
+
+cd $LOCALARCHIVEDIR
+rsync -avh --delete $LOCALARCHIVEDIR/archive/ $WEBSITEDOCROOTMOUNT/getdown/archive/
+