diff --git a/build-coatjava.sh b/build-coatjava.sh index a7e7341b5b..6860bbd8a4 100755 --- a/build-coatjava.sh +++ b/build-coatjava.sh @@ -4,10 +4,11 @@ set -e set -u set -o pipefail -usage='''build-coatjava.sh [-h] [--help] [--quiet] [--spotbugs] [--nomaps] [--unittests] +usage='''build-coatjava.sh [-h] [--help] [--quiet] [--clean] [--spotbugs] [--nomaps] [--unittests] - all other arguments will be passed to `mvn`, e.g., -T4 will build with 4 parallel threads''' quiet="no" +cleanBuild="no" runSpotBugs="no" downloadMaps="yes" runUnitTests="no" @@ -20,6 +21,7 @@ do --nomaps) downloadMaps="no" ;; --unittests) runUnitTests="yes" ;; --quiet) quiet="yes" ;; + --clean) cleanBuild="yes" ;; -h|--help) echo "$usage" exit 2 @@ -28,14 +30,18 @@ do esac done -top="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" +src_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" +prefix_dir=$src_dir/coatjava + +# working directory should be the source code directory +cd $src_dir wget='wget' -mvn="mvn --settings $top/maven-settings.xml" +mvn="mvn --settings $src_dir/maven-settings.xml" if [ "$quiet" == "yes" ] then wget='wget --progress=dot:mega' - mvn="mvn -q -B --settings $top/maven-settings.xml" + mvn="mvn -q -B --settings $src_dir/maven-settings.xml" fi mvn+=" ${mvnArgs[*]:-}" @@ -63,7 +69,7 @@ download () { # download the default field maps, as defined in libexec/env.sh: # (and duplicated in etc/services/reconstruction.yaml): -source `dirname $0`/libexec/env.sh +source libexec/env.sh if [ $downloadMaps == "yes" ]; then echo 'Retrieving field maps ...' webDir=https://clasweb.jlab.org/clas12offline/magfield @@ -83,24 +89,32 @@ if [ $downloadMaps == "yes" ]; then cd - fi -rm -rf coatjava -mkdir -p coatjava -cp -r bin coatjava/ -cp -r etc coatjava/ -cp -r libexec coatjava/ +# always clean the installation prefix +rm -rf $prefix_dir + +# clean up any cache copies +if [ $cleanBuild == "yes" ]; then + $mvn clean + echo '''DONE CLEANING. + Now re-run without `--clean` to build.''' + exit +fi + +# start new installation tree +mkdir -p $prefix_dir +cp -r bin $prefix_dir/ +cp -r etc $prefix_dir/ +cp -r libexec $prefix_dir/ # create schema directories for partial reconstruction outputs which python3 >& /dev/null && python=python3 || python=python -$python etc/bankdefs/util/bankSplit.py coatjava/etc/bankdefs/hipo4 || exit 1 -mkdir -p coatjava/lib/clas -mkdir -p coatjava/lib/utils -mkdir -p coatjava/lib/services +$python etc/bankdefs/util/bankSplit.py $prefix_dir/etc/bankdefs/hipo4 || exit 1 +mkdir -p $prefix_dir/lib/clas +mkdir -p $prefix_dir/lib/utils +mkdir -p $prefix_dir/lib/services # FIXME: this is still needed by one of the tests -cp external-dependencies/jclara-4.3-SNAPSHOT.jar coatjava/lib/utils - -### clean up any cache copies ### -cd common-tools/coat-lib; $mvn clean; cd - +cp external-dependencies/jclara-4.3-SNAPSHOT.jar $prefix_dir/lib/utils unset CLAS12DIR if [ $runUnitTests == "yes" ]; then @@ -119,12 +133,7 @@ if [ $runSpotBugs == "yes" ]; then if [ $? != 0 ] ; then echo "spotbugs failure" ; exit 1 ; fi fi -cd common-tools/coat-lib -$mvn package -if [ $? != 0 ] ; then echo "mvn package failure" ; exit 1 ; fi -cd - - -cp common-tools/coat-lib/target/coat-libs-*-SNAPSHOT.jar coatjava/lib/clas/ -cp reconstruction/*/target/clas12detector-*-SNAPSHOT*.jar coatjava/lib/services/ +cp common-tools/coat-lib/target/coat-libs-*-SNAPSHOT.jar $prefix_dir/lib/clas/ +cp reconstruction/*/target/clas12detector-*-SNAPSHOT*.jar $prefix_dir/lib/services/ echo "COATJAVA SUCCESSFULLY BUILT !" diff --git a/common-tools/README.md b/common-tools/README.md deleted file mode 100644 index 026ca55ff7..0000000000 --- a/common-tools/README.md +++ /dev/null @@ -1 +0,0 @@ -To build the Javadocs, do `./build.sh -d`. To publish the Javadocs, copy the created `javadoc` directory to the `/docs` directory in the top level of the repository. diff --git a/common-tools/build.sh b/common-tools/build.sh deleted file mode 100755 index 013062727f..0000000000 --- a/common-tools/build.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -#================================================================= -# BUILDING SCRIPT for COATJAVA PROJECT (first maven build) -# then the documentatoin is build from the sources and commited -# to the documents page -#================================================================= -# Maven Build - -while getopts dm name -do - case $name in - d) dopt=1;; # -d option is for generating Javadoc - m) mopt=1;; # -s option is for compiling the code - *) echo "Invalid arg : "; echo "\t use : build.sh -m -d" ; echo "" ;exit; - esac -done - -if [[ ! -z $mopt ]] -then - mvn install - cd coat-lib - mvn package - #cp target/coat-libs-3.0-SNAPSHOT.jar $COATJAVA/lib/clas/ - ls -lthr target/coat-libs-* - cd .. -fi -#================================================================= -# Documentation build -if [[ ! -z $dopt ]] -then - echo "---> Building documentation ...." - javadoc -d javadoc/clas-io -sourcepath clas-io/src/main/java/ -subpackages org - javadoc -d javadoc/clas-geometry -sourcepath clas-geometry/src/main/java/ -subpackages org - javadoc -d javadoc/clas-io -sourcepath clas-io/src/main/java/ -subpackages org - javadoc -d javadoc/clas-physics -sourcepath clas-physics/src/main/java/ -subpackages org - javadoc -d javadoc/clas-detector -sourcepath clas-detector/src/main/java/ -subpackages org - javadoc -d javadoc/clas-utils -sourcepath clas-utils/src/main/java/ -subpackages org - #scp -r javadoc clas12@ifarm65:/group/clas/www/clasweb/html/clas12offline/docs/. -fi - -#================================================================= -# Finishing touches -echo "" -echo "--> Done building....." -echo "" -echo " \t Usage : build.sh -d -m" -echo "" - - diff --git a/common-tools/clas-reco/pom.xml b/common-tools/clas-reco/pom.xml index a192b87817..9eae5de691 100644 --- a/common-tools/clas-reco/pom.xml +++ b/common-tools/clas-reco/pom.xml @@ -24,19 +24,19 @@ cnuphys magfield - 2.0-SNAPSHOT + 12.0.6t-SNAPSHOT cnuphys swimmer - 2.0-SNAPSHOT + 12.0.6t-SNAPSHOT cnuphys snr - 2.0-SNAPSHOT + 12.0.6t-SNAPSHOT diff --git a/common-tools/cnuphys/magfield/pom.xml b/common-tools/cnuphys/magfield/pom.xml index 1775d908f7..6e8b7e3e36 100644 --- a/common-tools/cnuphys/magfield/pom.xml +++ b/common-tools/cnuphys/magfield/pom.xml @@ -3,7 +3,7 @@ 4.0.0 cnuphys magfield - 2.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/common-tools/cnuphys/pom.xml b/common-tools/cnuphys/pom.xml index 4266839e60..4ab3867d93 100644 --- a/common-tools/cnuphys/pom.xml +++ b/common-tools/cnuphys/pom.xml @@ -2,7 +2,7 @@ 4.0.0 cnuphys clas12 - 2.0-SNAPSHOT + 12.0.6t-SNAPSHOT pom cnuphys diff --git a/common-tools/cnuphys/snr/pom.xml b/common-tools/cnuphys/snr/pom.xml index 1271408026..814dd29bd3 100644 --- a/common-tools/cnuphys/snr/pom.xml +++ b/common-tools/cnuphys/snr/pom.xml @@ -3,7 +3,7 @@ 4.0.0 cnuphys snr - 2.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/common-tools/cnuphys/splot/pom.xml b/common-tools/cnuphys/splot/pom.xml index 6e9e00cbd6..f8d5d37a02 100644 --- a/common-tools/cnuphys/splot/pom.xml +++ b/common-tools/cnuphys/splot/pom.xml @@ -3,7 +3,7 @@ 4.0.0 cnuphys splot - 2.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/common-tools/cnuphys/swimmer/pom.xml b/common-tools/cnuphys/swimmer/pom.xml index 833df583c3..b8a49c2f13 100644 --- a/common-tools/cnuphys/swimmer/pom.xml +++ b/common-tools/cnuphys/swimmer/pom.xml @@ -3,7 +3,7 @@ 4.0.0 cnuphys swimmer - 2.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar @@ -17,13 +17,13 @@ cnuphys magfield - 2.0-SNAPSHOT + 12.0.6t-SNAPSHOT cnuphys splot - 2.0-SNAPSHOT + 12.0.6t-SNAPSHOT diff --git a/common-tools/coat-lib/pom.xml b/common-tools/coat-lib/pom.xml index d7a2270cf6..7226921587 100644 --- a/common-tools/coat-lib/pom.xml +++ b/common-tools/coat-lib/pom.xml @@ -6,20 +6,19 @@ 12.0.6t-SNAPSHOT pom + + org.jlab.clas + clas12rec + ../../parent/pom.xml + 12.0.6t-SNAPSHOT + + - local-build - https://clasweb.jlab.org/.clas12maven + freehep-repo-public + https://clasweb.jlab.org/.clas12maven/ + - - jnp-build - https://clasweb.jlab.org/.jhep/maven - - - freehep-repo-public - https://clasweb.jlab.org/.clas12maven/ - - @@ -72,7 +71,7 @@ j4ml-clas12 0.9-SNAPSHOT - + org.jama jamapack diff --git a/common-tools/parent/pom.xml b/common-tools/parent/pom.xml deleted file mode 100644 index 5981c34caa..0000000000 --- a/common-tools/parent/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - 4.0.0 - - org.jlab.clas - common-tools - 12.0.6t-SNAPSHOT - pom - - - - - clas12maven - https://clasweb.jlab.org/.clas12maven - - - jnp-maven - https://clasweb.jlab.org/.jhep/maven - - - - - - - org.apache.maven.wagon - wagon-ssh-external - 2.8 - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 17 - - - - - - diff --git a/common-tools/pom.xml b/common-tools/pom.xml index af174eeb56..5ad5ec289e 100644 --- a/common-tools/pom.xml +++ b/common-tools/pom.xml @@ -21,12 +21,13 @@ clas-jcsg clas-detector cnuphys - clas-reco + clas-reco swim-tools - clas-analysis + clas-analysis clas-math clara-io clas-tracking + coat-lib diff --git a/install-clara b/install-clara index bd29ae04ce..9c5a068dde 100755 --- a/install-clara +++ b/install-clara @@ -3,7 +3,7 @@ # Default versions: grapes=2.17 clara=5.0.2 -coatjava=11.1.1 +coatjava=12.0.6t # Abort on any non-zero exit codes: set -e @@ -105,7 +105,7 @@ if compgen -G "$coatjava/lib/clas/coat-libs-*.jar" > /dev/null then coatjava=$(cd $coatjava && pwd) echo -e "\nUsing local COATJAVA installation:\n\t$coatjava" -elif ! [[ "$coatjava" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] +elif ! [[ "$coatjava" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)t?$ ]] # must be semver, or semver+"t" then echo -e "\n\nWARNING: COATJAVA doesn't look like a local installation nor version number: $coatjava" fi diff --git a/reconstruction/alert/pom.xml b/reconstruction/alert/pom.xml index 1f6ebc0267..61b9abe2c2 100644 --- a/reconstruction/alert/pom.xml +++ b/reconstruction/alert/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-alert - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/band/pom.xml b/reconstruction/band/pom.xml index 01da9e29d3..b04b747e7c 100644 --- a/reconstruction/band/pom.xml +++ b/reconstruction/band/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-band - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/bg/pom.xml b/reconstruction/bg/pom.xml index 4a4962f80c..df931bfa30 100644 --- a/reconstruction/bg/pom.xml +++ b/reconstruction/bg/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-bg - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/cnd/pom.xml b/reconstruction/cnd/pom.xml index 9bacf780e8..f6b048e7d4 100644 --- a/reconstruction/cnd/pom.xml +++ b/reconstruction/cnd/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-cnd - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar @@ -20,7 +18,7 @@ org.jlab.clas12.detector clas12detector-cvt - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT diff --git a/reconstruction/cvt/pom.xml b/reconstruction/cvt/pom.xml index dfc710a64e..6422e82425 100644 --- a/reconstruction/cvt/pom.xml +++ b/reconstruction/cvt/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-cvt - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar @@ -27,7 +25,7 @@ org.jlab.clas12.detector clas12detector-eb - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT test jar @@ -35,7 +33,7 @@ cnuphys swimmer - 2.0-SNAPSHOT + 12.0.6t-SNAPSHOT diff --git a/reconstruction/dc/pom.xml b/reconstruction/dc/pom.xml index 6d3abd820d..22a4a95b6d 100644 --- a/reconstruction/dc/pom.xml +++ b/reconstruction/dc/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-dc - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar @@ -22,7 +20,7 @@ org.jlab.clas12.detector clas12detector-urwell - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT @@ -52,19 +50,19 @@ cnuphys swimmer - 2.0-SNAPSHOT + 12.0.6t-SNAPSHOT cnuphys snr - 2.0-SNAPSHOT + 12.0.6t-SNAPSHOT cnuphys splot - 2.0-SNAPSHOT + 12.0.6t-SNAPSHOT diff --git a/reconstruction/eb/pom.xml b/reconstruction/eb/pom.xml index fa1d4bbd07..766afb1cb5 100644 --- a/reconstruction/eb/pom.xml +++ b/reconstruction/eb/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-eb - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar @@ -45,31 +43,31 @@ org.jlab.clas12.detector clas12detector-dc - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT org.jlab.clas12.detector clas12detector-ec - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT org.jlab.clas12.detector clas12detector-tof - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT org.jlab.clas12.detector clas12detector-htcc - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT org.jlab.clas12.detector clas12detector-ltcc - 1.1-SNAPSHOT + 12.0.6t-SNAPSHOT diff --git a/reconstruction/ec/pom.xml b/reconstruction/ec/pom.xml index 947416d323..89c2380ab1 100644 --- a/reconstruction/ec/pom.xml +++ b/reconstruction/ec/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-ec - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/fmt/pom.xml b/reconstruction/fmt/pom.xml index a39d197662..1a499c39dc 100644 --- a/reconstruction/fmt/pom.xml +++ b/reconstruction/fmt/pom.xml @@ -1,13 +1,11 @@ - + 4.0.0 clas12detector-fmt org.jlab.clas12.detector clas12detector-fmt - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/ft/pom.xml b/reconstruction/ft/pom.xml index f5dadf1b6c..fd98ec80eb 100644 --- a/reconstruction/ft/pom.xml +++ b/reconstruction/ft/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-ft - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/htcc/pom.xml b/reconstruction/htcc/pom.xml index a05b7d2d66..7346644f39 100644 --- a/reconstruction/htcc/pom.xml +++ b/reconstruction/htcc/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-htcc - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/ltcc/pom.xml b/reconstruction/ltcc/pom.xml index a629cf13a0..4e7915abe6 100644 --- a/reconstruction/ltcc/pom.xml +++ b/reconstruction/ltcc/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-ltcc - 1.1-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/mc/pom.xml b/reconstruction/mc/pom.xml index 448a1e0c63..236d9a8276 100644 --- a/reconstruction/mc/pom.xml +++ b/reconstruction/mc/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-mc - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/mltn/pom.xml b/reconstruction/mltn/pom.xml index c8c42ad60f..b954569941 100644 --- a/reconstruction/mltn/pom.xml +++ b/reconstruction/mltn/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-mltn - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/postproc/pom.xml b/reconstruction/postproc/pom.xml index 95dc95887d..046653a26b 100644 --- a/reconstruction/postproc/pom.xml +++ b/reconstruction/postproc/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-postproc - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/raster/pom.xml b/reconstruction/raster/pom.xml index b8a0bc018e..99f22e55cd 100644 --- a/reconstruction/raster/pom.xml +++ b/reconstruction/raster/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-raster - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/rich/pom.xml b/reconstruction/rich/pom.xml index 3f96607402..64ec446670 100644 --- a/reconstruction/rich/pom.xml +++ b/reconstruction/rich/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-rich - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/rtpc/pom.xml b/reconstruction/rtpc/pom.xml index e805b1381b..4ee60f309c 100644 --- a/reconstruction/rtpc/pom.xml +++ b/reconstruction/rtpc/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-rtpc - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/swaps/pom.xml b/reconstruction/swaps/pom.xml index fe8a73ed4a..d3452b1e7a 100644 --- a/reconstruction/swaps/pom.xml +++ b/reconstruction/swaps/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-swaps - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/tof/pom.xml b/reconstruction/tof/pom.xml index 96c967791a..feadabaaa2 100644 --- a/reconstruction/tof/pom.xml +++ b/reconstruction/tof/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-tof - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar @@ -27,7 +25,7 @@ org.jlab.clas12.detector clas12detector-dc - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT diff --git a/reconstruction/urwell/pom.xml b/reconstruction/urwell/pom.xml index 96c5920e89..ec271f6683 100644 --- a/reconstruction/urwell/pom.xml +++ b/reconstruction/urwell/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-urwell - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/reconstruction/vtx/pom.xml b/reconstruction/vtx/pom.xml index 6d822fa6d9..45df81cfac 100644 --- a/reconstruction/vtx/pom.xml +++ b/reconstruction/vtx/pom.xml @@ -1,12 +1,10 @@ - + 4.0.0 org.jlab.clas12.detector clas12detector-vtx - 1.0-SNAPSHOT + 12.0.6t-SNAPSHOT jar diff --git a/version-bump.sh b/version-bump.sh index 186fb703f5..106bdea6c3 100755 --- a/version-bump.sh +++ b/version-bump.sh @@ -1,20 +1,76 @@ -#!/bin/bash +#!/usr/bin/env bash +set -euo pipefail -if [ -z $2 ] -then - echo Usage: bump-version.sh oldversion newversion - exit +main_branch=development + +if [ $# -lt 1 ]; then + echo """USAGE: $0 [NEW_VERSION_NUMBER] + + BEFORE RUNNING: + - [ ] be on branch '$main_branch' before doing this, and it should + be up-to-date with the remote (run 'git pull') + - [ ] make sure you don't have any changes (run 'git status') + + EFFECT: + - a new git branch for this version bump will be created, and a commit will be added + - at the end, all you have to do is run 'git push' and open a pull request + + OPTION: if you want to just run the version bump without involving 'git' in any way, + add the argument '--no-git'; this will ONLY bump the version numbers + """ + exit 2 fi +ver_arg=$1 +[ $# -ge 2 -a "${2-}" = "--no-git" ] && use_git=false || use_git=true -old=$1 -new=$2 +# parse version number argument +ver_num=$(echo $ver_arg|sed 's/-SNAPSHOT//g') # remove '-SNAPSHOT', if the user included it +ver_pom=$ver_num-SNAPSHOT # append '-SNAPSHOT' for POM files -if [[ "$OSTYPE" == "darwin"* ]]; then - find . -type f -name pom.xml -exec sed -i '' -e "s/$old-SNAPSHOT/$new-SNAPSHOT/" "{}" \; - find . -type f -name deployDistribution.sh -exec sed -i '' -e "s/$old/$new/" "{}" \; -else - find . -type f -name pom.xml -exec sed -i -e "s/$old-SNAPSHOT/$new-SNAPSHOT/" "{}" \; - find . -type f -name deployDistribution.sh -exec sed -i -e "s/$old/$new/" "{}" \; +# print arguments +echo """>>>>> +ver_num: $ver_num +ver_pom: $ver_pom +use_git: $use_git +<<<<<""" + +# if using git, make a new branch +new_branch=version/$ver_num +if $use_git; then + # verify user is on the main branch + current_branch=$(git rev-parse --abbrev-ref HEAD) + if [ "$current_branch" != "$main_branch" ]; then + echo """ERROR: you are currently on branch '$current_branch', but you should be on branch '$main_branch'. + Please switch to branch '$main_branch' and (preferrably) run 'git pull'.""" >&2 + exit 1 + fi + # switch to a new branch for this new version + git switch -c $new_branch fi +# bump the POM project version +mvn versions:set -DnewVersion=$ver_pom -DprocessAllModules +mvn versions:commit -DprocessAllModules +# bump `deployDistribution.sh`'s version +sed -i "s/^VERSION=.*/VERSION=$ver_num/g" common-tools/coat-lib/deployDistribution.sh + +# bump `install-clara`'s version +sed -i "s/^coatjava=.*/coatjava=$ver_num/g" install-clara + +# commit to git (or not) +if $use_git; then + echo """ + ============================================""" + git commit -am "build: bump version number to $ver_num" + echo """Done. + Currently on branch $new_branch + Now run your usual 'git push' command, which is probably: + + git push -u origin $new_branch + + ============================================ + """ +else + echo "Done bumping version number; no git commit was created" +fi