[Project] Cleaned up build scripts

This commit is contained in:
Robert von Burg 2016-07-05 09:50:54 +02:00
parent b78df77e07
commit 78d7ae97ba
21 changed files with 121 additions and 891 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
.settings
.project
.idea/
/target/

88
createBundle.sh Executable file
View File

@ -0,0 +1,88 @@
#!/bin/bash
if [ $# != 1 ] ; then
echo "Usage: ${0} <version>"
exit 1
fi
projectName=strolch_bundle
projectVersion=${1}
bundle_name="${projectName}-${projectVersion}"
DIST_STROLCH="/var/www/eitch/strolch.li/dist/snapshot"
DEPLOY_SERVER="hosting.eitchnet.ch"
ROOT="${PWD}"
workDir="${ROOT}/target/${bundle_name}"
# Create all needed packages
#echo "INFO: Building projects..."
#if ! mvn -DskipTests clean package ; then
# echo "ERROR: Failed to build packages!"
# exit 1
#fi
# Make sure the work directory exists
if [ -d "${workDir}" ] ; then
if ! rm -rf "${workDir}" ; then
echo "ERROR: Failed to clean work dir ${workDir}."
exit 1
fi
fi
if ! mkdir -p "${workDir}" ; then
echo "ERROR: Failed to create work dir ${workDir}."
exit 1
fi
echo "INFO: Copying bundles..."
cd ${ROOT}
for project in ls * ; do
if [ ! -d ${project} ] ; then
continue
fi
if [ ${project} == "dev" ] || [ ${project} == "target" ] ; then
continue
fi
echo "INFO: Copying ${project} packages..."
if ls ${project}/target/*.jar 2>/dev/null ; then
if ! cp ${project}/target/*.jar "${workDir}" ; then
echo "ERROR: Failed to copy package for project ${project}."
exit 1
fi
fi
if ls ${project}/target/*.war 2>/dev/null ; then
if ! cp ${project}/target/*.war "${workDir}" ; then
echo "ERROR: Failed to copy wars for project ${project}."
exit 1
fi
fi
if ls ${project}/target/*.tar.gz 2>/dev/null ; then
if ! cp ${project}/target/*.tar.gz "${workDir}" ; then
echo "ERROR: Failed to copy tarballs for project ${project}."
exit 1
fi
fi
done
echo "INFO: Creating tarball..."
cd ${workDir}/..
if ! tar -cvzf ${bundle_name}.tar.gz ${bundle_name} ; then
echo "ERROR: Failed to make bundle."
exit 1
fi
if [ "$(hostname -f)" == "${DEPLOY_SERVER}" ] ; then
echo "INFO: Publishing..."
if ! cp ${workDir}/* "${DIST_STROLCH}" ; then
echo "ERROR: Failed to publish packages."
exit 1
fi
if ! mv ${bundle_name}.tar.gz "${DIST_STROLCH}" ; then
echo "ERROR: Failed to publish bundle."
exit 1
fi
fi
echo "Done."
exit 0

View File

@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,4 +0,0 @@
li.strolch.dev
=================
Dev module build for li.strolch projects

View File

@ -1,35 +0,0 @@
#!/bin/bash
VERVEINE="/data/programs/verveinej/verveinej.sh"
DIST_STROLCH="/var/www/eitch/www.strolch.li/dist/snapshot"
## Prepare the environment
echo "INFO: Copying dependencies"
cd ..
mvn -DskipTests=true clean dependency:copy-dependencies
echo "INFO Running verveinej..."
if ! ${VERVEINE} -- -autocp . . ; then
echo "ERROR: Failed to run verveinej!"
exit 1
fi
mv output.mse Strolch.mse
echo "INFO Cleaning sources..."
if ! mvn clean ; then
echo "ERROR: Failed to run mvn clean!"
exit 1
fi
echo "INFO Packaging..."
if ! tar --exclude="*/target" --exclude="*/.git*" -cvzf strolch_mse.tar.gz * ; then
echo "ERROR: Failed to build package!"
exit 1
fi
if ! mv strolch_mse.tar.gz ${DIST_STROLCH}/strolch_mse.tar.gz ; then
echo "ERROR: Failed to publish MSE file!"
exit 1
fi
exit 0

View File

@ -1,98 +0,0 @@
#!/bin/bash
projectName=strolch_bundle
projectVersion=1.2.0-SNAPSHOT
bundle_name="${projectName}-${projectVersion}"
DIST_STROLCH="/var/www/eitch/strolch.li/dist/snapshot"
DEPLOY_SERVER="hosting.eitchnet.ch"
ROOT="${PWD}"
workDir="${ROOT}/target/${bundle_name}"
projectsFile="${ROOT}/projects_all.lst"
# first we create all needed packages
cd ..
if ! mvn -DskipTests clean package ; then
echo "ERROR: Failed to build packages!"
exit 1
fi
# Make sure the work directory exists
if [ -d "${workDir}" ] ; then
if ! rm -rf "${workDir}" ; then
echo "ERROR: Failed to clean work dir ${workDir}."
exit 1
fi
fi
if ! mkdir -p "${workDir}" ; then
echo "ERROR: Failed to create work dir ${workDir}."
exit 1
fi
echo "INFO: Bundling projects..."
# Now copy those packages to our work dir
while read project; do
if [ "${project}" == "" ] ; then
continue;
fi
array=(${project//:/ })
name="${array[0]}"
tag="${array[1]}"
if [ "${name}" == "" ] || [ "${tag}" == "" ] ; then
echo -e "ERROR: Invalid project: ${project}! Must have form <git_name:tag>"
exit 1
fi
if [ "${name}" == "li.strolch.dev" ] ; then
continue;
fi
if ! cd "${ROOT}/../${name}" ; then
echo "ERROR: Could not switch to directory ${name}"
exit 1
fi
echo "INFO: Copying ${name} packages..."
if ls target/*.jar 2>/dev/null ; then
if ! cp target/*.jar "${workDir}" ; then
echo "ERROR: Failed to copy package for project ${name}."
exit 1
fi
fi
if ls target/*.war 2>/dev/null ; then
if ! cp target/*.war "${workDir}" ; then
echo "ERROR: Failed to copy wars for project ${name}."
exit 1
fi
fi
if ls target/*.tar.gz 2>/dev/null ; then
if ! cp target/*.tar.gz "${workDir}" ; then
echo "ERROR: Failed to copy tarballs for project ${name}."
exit 1
fi
fi
done < ${projectsFile}
cd ${workDir}/..
if ! tar -cvzf ${bundle_name}.tar.gz ${bundle_name} ; then
echo "ERROR: Failed to make bundle."
exit 1
fi
if [ "$(hostname -f)" == "${DEPLOY_SERVER}" ] ; then
if ! cp ${workDir}/* "${DIST_STROLCH}" ; then
echo "ERROR: Failed to publish packages."
exit 1
fi
if ! mv ${bundle_name}.tar.gz "${DIST_STROLCH}" ; then
echo "ERROR: Failed to publish bundle."
exit 1
fi
fi
echo "Done."
exit 0

View File

@ -1,18 +0,0 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>li.strolch</groupId>
<artifactId>li.strolch</artifactId>
<version>1.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>li.strolch.dev</artifactId>
<packaging>pom</packaging>
<name>li.strolch.dev</name>
<description>Project used to develop strolch modules. Contains scripts for bootstrapping development, etc.</description>
</project>

View File

@ -1,15 +0,0 @@
li.strolch.utils:develop
li.strolch.privilege:develop
li.strolch.xmlpers:develop
li.strolch.dev:develop
li.strolch.bom:develop
li.strolch.model:develop
li.strolch.testbase:develop
li.strolch.agent:develop
li.strolch.service:develop
li.strolch.rest:develop
li.strolch.persistence.xml:develop
li.strolch.persistence.postgresql:develop
li.strolch.tutorialapp:develop
li.strolch.tutorialwebapp:develop
li.strolch.website:develop

View File

@ -1,26 +0,0 @@
#!/bin/bash
function fail() {
echo -e "\nERROR: Failed to pull from upstream"
exit 1
}
current_branch="$(git branch --quiet | grep "*" | cut -d ' ' -f 2)"
if [ "${current_branch}" == "" ] ; then
echo -e "\nERROR: No local branch found!"
fail
fi
cd ..
echo "INFO: Pulling Strolch..."
if ! git pull origin "${current_branch}:${current_branch}" ; then
fail
fi
echo "INFO: Pulling submodules..."
if ! git submodule foreach git pull origin "${current_branch}:${current_branch}" ; then
fail
fi
echo -e "\nINFO: Pulled all Strolch projects."
exit 0

View File

@ -1,26 +0,0 @@
#!/bin/bash
function fail() {
echo -e "\nERROR: Failed to push to upstream"
exit 1
}
current_branch="$(git branch --quiet | grep "*" | cut -d ' ' -f 2)"
if [ "${current_branch}" == "" ] ; then
echo -e "\nERROR: No local branch found!"
fail
fi
cd ..
echo "INFO: Pushing Strolch..."
if ! git push origin "${current_branch}:${current_branch}" ; then
fail
fi
echo "INFO: Pushing submodules..."
if ! git submodule foreach git push origin "${current_branch}:${current_branch}" ; then
fail
fi
echo -e "\nINFO: Pushed all Strolch projects."
exit 0

View File

@ -1,281 +0,0 @@
#!/bin/bash
declare SCRIPT_NAME="${0##*/}"
declare SCRIPT_DIR="$(cd ${0%/*} ; pwd)"
root="$(cd ${SCRIPT_DIR}/.. ; pwd)"
if [ ! $(which xmlstarlet) ] ; then
echo "ERROR: xmlstarlet is missing!"s
exit 1
fi
function usage() {
echo "Usage: $0 [-c] [-p] [-r <release_branch>] [-b <branch>] [-o <old_version>] [-n <new_version>]" 1>&2;
echo " -c create release branch"
echo " -p push tags"
echo " -r <release_branch> release branch to create or using for tagging and checkout"
echo " -b <branch> branch to checkout from (important when creating the release_branch)"
echo " -o <old_version> version from which to release from e.g. 1.0.0-SNAPSHOT"
echo " -n <new_version> release version e.g. 1.0.0-RC3"
echo ""
exit 1;
}
# get arguments
while getopts ":b:o:n:r:cp" arg; do
case "${arg}" in
c)
c="true"
;;
p)
p="true"
;;
r)
r=${OPTARG}
;;
b)
b=${OPTARG}
;;
o)
o=${OPTARG}
;;
n)
n=${OPTARG}
;;
*)
echo "ERROR: Unknown arg ${arg}"
usage
;;
esac
done
shift $((OPTIND-1))
# validate arguments
if [ -z "${r}" ] || [ -z "${b}" ] || [ -z "${o}" ] || [ -z "${n}" ] ; then
echo "ERROR: Missing an argument!"
usage
fi
# validate no uncommitted changes
if [ "$(git status --short)" != "" ] ; then
echo -e "ERROR: You have uncommitted changes! Please commit them before continuing."
exit 1
fi
# First make sure we use SSH for pushing
if find .git/modules -type f -name config | xargs grep "https://github.com" ; then
echo -e "ERROR: There is at least one submodule which has its remote set to https://github.com"
echo -e "ERROR: Please change this before your continuing, using the following command:"
echo -e " find .git/modules -type f -name config | xargs sed -i .bck \"s|https://github.com/|git@github.com:|g\""
exit 1
fi
# set vars
create_release_branch="${c}"
release_branch="${r}"
branch="${b}"
old_version="${o}"
new_version="${n}"
push="${p}"
# log what we are doing
echo "INFO: root=${root}"
echo "INFO: old_version=${old_version}"
echo "INFO: new_version=${new_version}"
echo "INFO: branch=${branch}"
echo "INFO: release_branch=${release_branch}"
if [ -n "${create_release_branch}" ] ; then
echo "INFO: Creating release branch."
else
echo "INFO: NOT creating release branch."
fi
if [ -n "${push}" ] ; then
echo "INFO: Pushing to origin."
else
echo "INFO: NOT pushing to origin."
fi
echo ""
function fail() {
echo -e "\nWARN: Cleaning up after fail..."
git submodule foreach git reset --hard origin/${branch}
git submodule foreach git checkout ${branch}
if [ -n "${create_release_branch}" ] ; then
git submodule foreach git branch -D ${release_branch}
fi
git submodule foreach git tag -d ${new_version}
git checkout ${branch}
git reset --hard origin/${branch}
if [ -n "${create_release_branch}" ] ; then
git branch -D ${release_branch}
fi
git tag -d ${new_version}
echo -e "\nERROR: Failed to release version ${new_version}"
exit 1
}
function build() {
cd ${root}
if mvn clean package -DskipTests 1> /dev/null ; then
echo "INFO: Build OK"
return 0;
else
echo "ERROR: Build failed!"
echo "INFO: Run mvn clean package -DskipTests to see the build problems!"
return 1;
fi
}
function createBundle() {
cd "${root}/li.strolch.dev"
if ./createBundle.sh 1> /dev/null ; then
echo "INFO: Bundle creation OK"
return 0;
else
echo "ERROR: Bundle creation failed!"
echo "INFO: Run ${root}/li.strolch.dev/createBundle.sh to see the bundle creation problems!"
return 1;
fi
}
# create release branch
if [ -n "${create_release_branch}" ] ; then
echo -e "\nINFO: Creating release branch..."
if ! git branch ${release_branch} ${branch} ; then
fail
fi
if ! git submodule foreach git branch ${release_branch} ${branch} ; then
fail
fi
fi
# checkout release branch
echo -e "\nINFO: Checking out release branch..."
if ! git checkout ${release_branch} ; then
fail
fi
echo -e "\nINFO: Checking out submodules..."
if ! git submodule foreach git checkout ${release_branch} ; then
fail
fi
# build with old version
echo "INFO: Building current version ${old_version}..."
if ! build ; then
fail
fi
# bump version
echo -e "\nINFO: Bumping versions..."
${root}/li.strolch.dev/setVersion.sh ${old_version} ${new_version}
if [ $? -ne 0 ] ; then
fail
fi
# show status
echo -e "\nINFO: Git Status:"
if ! git status --short ; then
fail
fi
if ! git submodule foreach git status --short ; then
fail
fi
# build with new version
echo -e "\nINFO: Building new version ${new_version}..."
if ! build ; then
fail
fi
# commit and tag submodules
echo -e "\nINFO: Committing and tagging submodules..."
if ! git submodule foreach git add . ; then
fail
fi
if ! git submodule foreach git commit -m "[Project] bumped version from ${old_version} to ${new_version}" ; then
fail
fi
if ! git submodule foreach git tag ${new_version} ; then
fail
fi
# commit and tag including ref to submodules
echo -e "\nINFO: Synching submodules..."
if ! git submodule sync ; then
fail
fi
echo -e "\nINFO: Committing and tagging..."
if ! git add . ; then
fail
fi
if ! git commit -m "[Project] Bumped version from ${old_version} to ${new_version}" ; then
fail
fi
if ! git tag ${new_version} ; then
fail
fi
# create bundle for new version
echo -e "\nINFO: Creating bundle for version ${new_version}..."
if ! createBundle ; then
fail
fi
# update local working directory to original branch
echo -e "\nINFO: Updating local work directory..."
if ! git submodule foreach git checkout ${branch} ; then
fail
fi
if [ -n "${create_release_branch}" ] ; then
echo -e "\nINFO: Removing submodule release branches..."
if ! git submodule foreach git branch -D ${release_branch} ; then
fail
fi
fi
echo -e "\nINFO: Checking out branch..."
if ! git checkout ${branch} ; then
fail
fi
echo -e "\nINFO: Removing release branch..."
if [ -n "${create_release_branch}" ] ; then
if ! git branch -D ${release_branch} ; then
fail
fi
fi
echo -e "\nINFO: Updating submodules..."
if ! git submodule update ; then
fail
fi
# push to origin
if [ -n "${push}" ] ; then
echo -e "\nINFO: Pushing ${new_version} to origin..."
git submodule foreach git push origin ${new_version}
git push origin ${new_version}
else
echo -e "\nINFO: To push tags perform the following:"
echo -e " git push origin ${new_version}"
echo -e " git submodule foreach git push origin ${new_version}"
echo -e "\nINFO: Or to delete the tags:"
echo -e " git submodule foreach git tag -d ${new_version}"
echo -e " git tag -d ${new_version}"
fi
echo -e "\nINFO: Released version ${new_version}"
exit 0

View File

@ -1,152 +0,0 @@
#!/bin/bash
if [ ! $(which xmlstarlet) ] ; then
echo "ERROR: xmlstarlet is missing!"
exit 1
fi
function usage() {
echo "Usage: $0 [-c] [-p] [-o <old_version>] [-n <new_version>]" 1>&2;
echo " -c commit"
echo " -p push to origin"
echo " -o <old_version> old version e.g. 1.0.0-SNAPSHOT"
echo " -n <new_version> new version e.g. 1.0.0-RC3"
echo ""
exit 1;
}
# get arguments
while getopts ":b:o:n:r:cp" arg; do
case "${arg}" in
c)
c="true"
;;
p)
p="true"
;;
o)
o=${OPTARG}
;;
n)
n=${OPTARG}
;;
*)
echo "ERROR: Unknown arg ${arg}"
usage
;;
esac
done
shift $((OPTIND-1))
# validate arguments
if [ -z "${o}" ] || [ -z "${n}" ] ; then
echo "ERROR: Missing an argument!"
usage
fi
old_version="${o}"
new_version="${n}"
commit="${c}"
push="${p}"
declare SCRIPT_NAME="${0##*/}"
declare SCRIPT_DIR="$(cd ${0%/*} ; pwd)"
root="$(cd ${SCRIPT_DIR}/.. ; pwd)"
echo "old_version=${old_version}"
echo "new_version=${new_version}"
echo "root=${root}"
function fail() {
echo -e "\nERROR: Failed to set version of $1"
exit 1
}
function setVersion() {
if [ "$#" != 2 ] ; then
echo -e "ERROR: Missing version and/or file name"
exit 1
fi
version="$1"
file="$2"
if ! [ -f "${file}" ] ; then
echo -e "ERROR: The file does not exist: ${file}"
exit 1
fi
i=0
if xmlstarlet ed --ps -L -N my=http://maven.apache.org/POM/4.0.0 -u "/my:project/my:version" -v ${version} "${file}" 2>/dev/null ; then
i=$((i+1))
fi
if xmlstarlet ed --ps -L -N my=http://maven.apache.org/POM/4.0.0 -u "/my:project/my:parent/my:version" -v ${version} "${file}" 2>/dev/null ; then
i=$((i+1))
fi
if xmlstarlet ed --ps -L -N my=http://maven.apache.org/POM/4.0.0 -u "/my:project/my:properties/my:strolch.version/my:version" -v ${version} "${file}" 2>/dev/null ; then
i=$((i+1))
fi
if xmlstarlet ed --ps -L -N my=http://maven.apache.org/POM/4.0.0 -u "/my:project/my:properties/my:strolch.version" -v ${version} "${file}" 2>/dev/null ; then
i=$((i+1))
fi
if xmlstarlet ed --ps -L -N my=http://maven.apache.org/POM/4.0.0 -u "/my:project/my:properties/my:eitchnet.xmlpers.version" -v ${version} "${file}" 2>/dev/null ; then
i=$((i+1))
fi
if xmlstarlet ed --ps -L -N my=http://maven.apache.org/POM/4.0.0 -u "/my:project/my:properties/my:eitchnet.utils.version" -v ${version} "${file}" 2>/dev/null ; then
i=$((i+1))
fi
if xmlstarlet ed --ps -L -N my=http://maven.apache.org/POM/4.0.0 -u "/my:project/my:properties/my:eitchnet.privilege.version" -v ${version} "${file}" 2>/dev/null ; then
i=$((i+1))
fi
if [ $i -eq 0 ] ; then
echo -e "ERROR: Not one version was change for file ${file}"
exit 1
fi
return 0
}
cd "${root}"
setVersion "${new_version}" "${root}/pom.xml"
for project in li.* ; do
setVersion "${new_version}" "${root}/${project}/pom.xml"
done
for project in ch.* ; do
setVersion "${new_version}" "${root}/${project}/pom.xml"
done
cd "${root}"
create_script="li.strolch.dev/createBundle.sh"
if ! sed -i.bck "s/${old_version}/${new_version}/" "${create_script}" 2>/dev/null ; then
fail "${root}/${create_script}"
fi
rm -f "${create_script}.bck"
# Commit new version
if [ -n "${commit}" ] ; then
echo "INFO: Committing new version ${new_version}"
git submodule foreach git add .
git submodule foreach git commit -m "[Project] Bumped version from ${old_version} to ${new_version}"
if [ -n "${push}" ] ; then
echo "INFO: Pushing submodules to origin..."
git submodule foreach git push origin
fi
git add .
git commit -m "[Project] Bumped version from ${old_version} to ${new_version}"
if [ -n "${push}" ] ; then
echo "INFO: Pushing to origin..."
git push origin
fi
else
echo "INFO: NOT committing new version"
fi
echo -e "\nINFO: Bumped version from ${old_version} to ${new_version}"
exit 0

View File

@ -1,11 +0,0 @@
#!/bin/bash
projectsFile="${PWD}/projects.lst"
cd ..
git status
git submodule foreach git status
echo "Done."
exit 0

View File

@ -65,7 +65,6 @@
<module>li.strolch.privilege</module>
<module>li.strolch.utils</module>
<module>li.strolch.xmlpers</module>
<module>li.strolch.dev</module>
<module>li.strolch.bom</module>
<module>li.strolch.model</module>
<module>li.strolch.testbase</module>
@ -78,6 +77,7 @@
<module>li.strolch.tutorialapp</module>
<module>li.strolch.tutorialwebapp</module>
<module>li.strolch.planningwebapp</module>
<module>li.strolch.website</module>
<module>strolch_minimal</module>
<module>strolch_minimal_rest</module>
</modules>

12
setVersion.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
if [ $# != 1 ] ; then
echo "Usage: ${0} <version>"
exit 1
fi
projectVersion=${1}
mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${projectVersion}
exit 0

View File

@ -1,11 +1,15 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>li.strolch</groupId>
<parent>
<groupId>li.strolch</groupId>
<artifactId>li.strolch</artifactId>
<version>1.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>strolch_minimal</artifactId>
<version>1.2.0-SNAPSHOT</version>
<name>strolch_minimal</name>
<description>Strolch app with minimal runtime</description>
<inceptionYear>2014</inceptionYear>
@ -32,7 +36,7 @@
<groupId>li.strolch</groupId>
<artifactId>li.strolch.bom</artifactId>
<type>pom</type>
<version>${strolch.version}</version>
<version>${project.version}</version>
<scope>import</scope>
</dependency>
</dependencies>
@ -79,7 +83,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<phase>validate</phase>
@ -96,7 +99,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadJavadocs>true</downloadJavadocs>
<downloadSources>true</downloadSources>
@ -105,7 +107,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
@ -117,7 +118,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
@ -131,7 +131,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
@ -150,7 +149,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptor>src/assembly/bin.xml</descriptor>
<finalName>${finalName}-${project.version}</finalName>

View File

@ -1,11 +1,15 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>li.strolch</groupId>
<parent>
<groupId>li.strolch</groupId>
<artifactId>li.strolch</artifactId>
<version>1.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>strolch_minimal_rest</artifactId>
<packaging>war</packaging>
<version>1.2.0-SNAPSHOT</version>
<inceptionYear>2014</inceptionYear>
<name>strolch_minimal_rest</name>
<url>http://www.strolch.li</url>
@ -20,7 +24,6 @@
<java-version>1.8</java-version>
<strolch.version>${project.version}</strolch.version>
<jersey.version>2.11</jersey.version>
<jaxrs.api.version>2.0</jaxrs.api.version>
@ -35,7 +38,7 @@
<groupId>li.strolch</groupId>
<artifactId>li.strolch.bom</artifactId>
<type>pom</type>
<version>${strolch.version}</version>
<version>${project.version}</version>
<scope>import</scope>
</dependency>
<dependency>
@ -111,7 +114,7 @@
<artifactId>jersey-container-grizzly2-http</artifactId>
<scope>test</scope>
</dependency>
<!-- uncomment this to get JSON support: <dependency> <groupId>org.glassfish.jersey.media</groupId> <artifactId>jersey-media-moxy</artifactId>
<!-- uncomment this to get JSON support: <dependency> <groupId>org.glassfish.jersey.media</groupId> <artifactId>jersey-media-moxy</artifactId>
</dependency> -->
<dependency>
<groupId>com.google.code.gson</groupId>
@ -158,7 +161,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
@ -167,7 +169,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadJavadocs>true</downloadJavadocs>
<downloadSources>true</downloadSources>
@ -177,7 +178,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${warFinalName}</warName>
@ -197,7 +197,6 @@
<!-- Publish to Tomcat7: mvn tomcat7:redeploy -->
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>${tomcat7Url}</url>
<server>${tomcat7ServerId}</server>