Skip to content

Commit

Permalink
updated release script
Browse files Browse the repository at this point in the history
  • Loading branch information
christopher-szu committed Jan 15, 2016
1 parent d9105be commit 24e7913
Show file tree
Hide file tree
Showing 9 changed files with 286 additions and 186 deletions.
87 changes: 87 additions & 0 deletions bin/upVer
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash
# upVer
#
#{{IS_NOTE
# Purpose:
#
# Description:
#
# History:
# Fri Oct 23 11:11:09 2015, Created by Christopher
#}}IS_NOTE
#
#Copyright (C) 2015 Potix Corporation. All Rights Reserved.
#
#{{IS_RIGHT
#}}IS_RIGHT
#

if [ ! -d "ckez" ] ; then
echo "cannot locate ckez/ folder"
exit 1
fi
maindir="$(pwd)"
cd $maindir
echo "Working directory $maindir"
stamp=$(date +%Y%m%d)
oldVersion=$1
newVersion=$2
isFL=$3

if [ "$oldVersion" == "" ] || [ "$newVersion" == "" ] ; then
echo "Usage: upVer [ oldVersion ] [ newVersion ] [options]"
echo "Available options: FL"
exit 1
fi

function upVer {
if [ "$isFL" == "FL" ] ; then
sed --in-place='' "/version>/,/<\//s/>$oldVersion.*<\//>$newVersion-SNAPSHOT<\//" $1/pom.xml
echo "$1 pom.xml"
grep -n --color=auto $newVersion"-SNAPSHOT" $1/pom.xml

echo "ckeztest/pom.xml"
find test/addon/ckeztest -name pom.xml -exec sed --in-place='' "/version>/,/<\//s/>$oldVersion.*<\//>$newVersion-SNAPSHOT<\//" {} \;
grep -n --color=auto $newVersion"-SNAPSHOT" test/addon/ckeztest/pom.xml
else
sed --in-place='' "/version>/,/<\//s/>$oldVersion.*<\//>$newVersion<\//" $1/pom.xml
echo "$1 pom.xml"
grep -n --color=auto $newVersion $1/pom.xml

echo "ckeztest/pom.xml"
find test/addon/ckeztest -name pom.xml -exec sed --in-place='' "/version>/,/<\//s/>$oldVersion.*<\//>$newVersion<\//" {} \;
grep -n --color=auto $newVersion test/addon/ckeztest/pom.xml
fi

sed --in-place='' "s/$oldVersion.*/$newVersion/g" $1/version
echo "$1 version"
grep -n --color=auto $newVersion $1/version

echo "$1 config.xml"
find $1/src -name config.xml -exec sed --in-place='' "
/<version/,/\/version>/s/>$oldVersion.*<\//>$newVersion<\//g
" {} \; -exec grep -n --color=auto $newVersion {} \;

echo "$1 lang.xml"
find $1/src -name lang.xml -exec sed --in-place='' "
/<version/,/\/version>/s/>$oldVersion.*<\//>$newVersion<\//g
" {} \; -exec grep -n --color=auto $newVersion {} \;

echo "$1 lang-addon.xml"
find $1/src -name lang-addon.xml -exec sed --in-place='' "
/<version/,/\/version>/s/>$oldVersion.*<\//>$newVersion<\//g
" {} \; -exec grep -n --color=auto $newVersion {} \;

echo "$1 lang-addon.xml javascript"
find $1/src -name lang-addon.xml -exec sed --in-place='' "
s/version=\"$oldVersion.*\"/version=\"$newVersion\"/g
" {} \; -exec grep -n --color=auto $newVersion {} \;

echo "$1 Version.java"
find $1/src -name Version.java -exec sed --in-place='' "
s/UID = \"$oldVersion.*\";/UID = \"$newVersion\";/g
" {} \; -exec grep -n --color=auto $newVersion {} \;
}

upVer ckez
cd $maindir
39 changes: 39 additions & 0 deletions ckez/assembly/bin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.build.directory}/javadoc/${project.artifactId}</directory>
<outputDirectory>/javadoc</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
<source>${project.build.directory}/bin/${project.artifactId}.jar</source>
<destName>${project.artifactId}.jar</destName>
<outputDirectory>/dist/lib</outputDirectory>
</file>
<file>
<source>${project.build.directory}/${project.artifactId}-${version}-sources.jar</source>
<destName>${project.artifactId}-sources.jar</destName>
<outputDirectory>/dist/src</outputDirectory>
</file>
<file>
<source>${project.basedir}/../zkdoc/LGPL</source>
<outputDirectory>/doc</outputDirectory>
</file>
<file>
<source>${project.basedir}/../zkdoc/MPL</source>
<outputDirectory>/doc</outputDirectory>
</file>
<file>
<source>${project.basedir}/../zkdoc/ckez-release-note</source>
<outputDirectory>/doc</outputDirectory>
</file>
</files>
</assembly>
24 changes: 24 additions & 0 deletions ckez/assembly/bundle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bundle</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<files>
<file>
<source>pom.xml</source>
<outputDirectory>/</outputDirectory>
</file>
<file>
<source>${project.build.directory}/bin/${project.artifactId}.jar</source>
<destName>${project.artifactId}-${project.version}.jar</destName>
<outputDirectory>/</outputDirectory>
</file>
<file>
<source>${project.build.directory}/${project.artifactId}-${project.version}-sources.jar</source>
<outputDirectory>/</outputDirectory>
</file>
</files>
</assembly>
16 changes: 16 additions & 0 deletions ckez/assembly/javadoc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>javadoc</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}/javadoc/ckez</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
16 changes: 16 additions & 0 deletions ckez/assembly/sources.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>sources</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}/src/org/zkforge/ckez</directory>
<outputDirectory>ckez/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
41 changes: 41 additions & 0 deletions ckez/assembly/src.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>src</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<excludes>
<exclude>${project.build.directory}/</exclude>
<exclude>${project.basedir}/.settings/</exclude>
<exclude>${project.basedir}/assembly/</exclude>
<exclude>${project.basedir}/.gitignore</exclude>
<exclude>${project.basedir}/version</exclude>
<exclude>${project.basedir}/classpath</exclude>
<exclude>${project.basedir}/codegen</exclude>
<exclude>${project.basedir}/debug</exclude>
<exclude>${project.basedir}/deploy</exclude>
<exclude>${project.basedir}/format</exclude>
</excludes>
<outputDirectory>/${project.artifactId}</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
<source>${project.basedir}/../zkdoc/LGPL</source>
<outputDirectory>/doc</outputDirectory>
</file>
<file>
<source>${project.basedir}/../zkdoc/MPL</source>
<outputDirectory>/doc</outputDirectory>
</file>
<file>
<source>${project.basedir}/../zkdoc/ckez-release-note</source>
<outputDirectory>/doc</outputDirectory>
</file>
</files>
</assembly>
Binary file removed dist/lib/ckez.jar
Binary file not shown.
63 changes: 63 additions & 0 deletions release
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
#
#{{IS_NOTE
# Purpose:
# Description:
# History:
# April 7 17:38:16 2014, Created by jumperchen
#}}IS_NOTE
#
#Copyright (C) 2014 Potix Corporation. All Rights Reserved.
#
#{{IS_RIGHT
#}}IS_RIGHT
#

if [ -d "ckez" ]; then
cd ckez
else
echo "cannot locate ckez/"
exit 1
fi

mainprj="$(pwd)" # prj/zkckeditor/ckez
releasedir=$mainprj/target/release
ver=$(head -1 version)
stamp=$(date +%Y%m%d)
target=$1
if [ "$target" == "official" ] ; then
pver=$ver
mver=$ver
elif [ "$target" == "FL" ] ; then
pver=$ver-FL-$stamp
mver=$pver
else
echo "Usage: release [official|FL]"
exit 1
fi

# update pom version
function upVer {
# replace the 1st occurance of version number, using long hand in-place for compatibility between BSD and GNU sed
sed --in-place='' "1,/version>.*<\/version/s/version>.*<\/version/version>$1<\/version/" $mainprj/pom.xml
}

upVer $mver
mvn -Dmaven.test.skip=true clean install

if [ -d "$releasedir" ]; then
rm -r $releasedir
else
mkdir $releasedir
fi

cp -r $mainprj/target/maven $releasedir/maven
cp -r $mainprj/target/bin $releasedir/bin

if [ "$target" == "FL" ] ; then
# revert back pom.xml, as it is FL release
echo "FL release, revert back version number change"
upVer $ver-SNAPSHOT
fi

echo "All done!!!"
Loading

0 comments on commit 24e7913

Please sign in to comment.