Permalink
Fetching contributors…
Cannot retrieve contributors at this time
88 lines (83 sloc) 1.97 KB
#!/bin/bash
#
#{{IS_NOTE
# Purpose:
# To build java projects
# Description:
# 'build help' for more descriptions
# History:
# Apring 6 18:10 2011, Created by jimmyshiau
#}}IS_NOTE
#
#Copyright (C) 2011 Potix Corporation. All Rights Reserved.
#
#{{IS_RIGHT
# This program is distributed under GPL Version 3.0 in the hope that
# it will be useful, but WITHOUT ANY WARRANTY.
#}}IS_RIGHT
#
cmd=$1
maindir="$(pwd)"
stamp=$(date +%Y%m%d)
parentVer=$(head -1 version)
#-- Prepare $targetList
#Add a project to the target list (the redudant ones won't be added)
if [ ! -f build.projects ] ; then
echo build.projects not found
exit 1
fi
targetListOld="$(cat build.projects | tr '\n' ' ')"
targetListOld="${targetListOld% }"
targetList=
for target in $targetListOld ; do
ver=$(head -1 $target/version)
if [ $parentVer == $ver ] ; then
targetList="$targetList $target"
fi
done
function updateVersion
{
if [ "$1" != "" ] ; then
ver=$(head -1 $1/version)
if [ "$cmd" == "official" ] ; then
verFL=$ver
else
verFL=$ver.FL.$stamp
fi
sed -i "1,/description/s/version>.*<\/version/version>$verFL<\/version/" $maindir/$1/pom.xml
else
ver=$(head -1 version)
if [ "$cmd" == "official" ] ; then
verFL=$parentVer
else
verFL=$parentVer.FL.$stamp
fi
sed -i "1,/version>.*<\/version/s/version>.*<\/version/version>$verFL<\/version/" pom.xml
fi
}
updateVersion ""
echo "targets: ${targetList}"
upTargetList="$targetList zkthemedemo breeze"
for target in $upTargetList ; do
if [ -d $target ] ; then
updateVersion $target
else
echo "Ignore: $target doesn't exist"
fi
done
mvn clean package
mkdir -p dist/maven
rm -f dist/maven/zktheme*.jar
mv -f target/*-bundle.jar dist/maven
for target in $targetList ; do
if [ -d $target ] ; then
rm -f dist/maven/$target*.jar
rm -f dist/$target*.jar
rm -f dist/$target*.zip
mv -f $target/target/*-bundle.jar dist/maven
mv -f $target/target/*.jar dist
mv -f $target/target/*.zip dist
else
echo "Ignore: $target doesn't exist"
fi
done