Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkitlo2019-02-20 05:29:29 +0000
committerkitlo2019-02-20 06:38:58 +0000
commit674a8ecaab5f5f8a2d9b11dca526bab5fa455675 (patch)
treeeefd9e6ce1078fde7cec45f40bb3edd02003f163 /cje-production/scripts
parent102dbdc88ce856a4ec854d640e64f8fb75e73e64 (diff)
downloadeclipse.platform.releng.aggregator-674a8ecaab5f5f8a2d9b11dca526bab5fa455675.tar.gz
eclipse.platform.releng.aggregator-674a8ecaab5f5f8a2d9b11dca526bab5fa455675.tar.xz
eclipse.platform.releng.aggregator-674a8ecaab5f5f8a2d9b11dca526bab5fa455675.zip
Bug 544603 - Create new scripts for Maven operations
Change-Id: I7fb6cd8e3631aacfa5d8e435ac8906e4119578ea Signed-off-by: kitlo <kitlo@us.ibm.com>
Diffstat (limited to 'cje-production/scripts')
-rwxr-xr-xcje-production/scripts/common-functions.shsource59
1 files changed, 59 insertions, 0 deletions
diff --git a/cje-production/scripts/common-functions.shsource b/cje-production/scripts/common-functions.shsource
new file mode 100755
index 000000000..7207e4b87
--- /dev/null
+++ b/cje-production/scripts/common-functions.shsource
@@ -0,0 +1,59 @@
+#!/bin/bash
+#*******************************************************************************
+# Copyright (c) 2019 IBM Corporation and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# Sravan Kumar Lakkimsetti - initial API and implementation
+#*******************************************************************************
+
+# USAGE: fn-write-property VAR_NAME
+# VAR_NAME: Variable name to write as "variable=value" form
+# This script assumes the following variables have been defined and are pointing
+# to an appropriate file (see master-build.sh):
+# BUILD_ENV_FILE=${buildDirectory}/buildproperties.shsource
+# BUILD_ENV_FILE_PHP=${buildDirectory}/buildproperties.php
+# BUILD_ENV_FILE_PROP=${buildDirectory}/buildproperties.properties
+
+# Note we always append to file, assuming if doesn't exist yet and will be
+# created, and for each build, it won't exist, so will be written fresh for
+# each build.
+
+fn-write-property ()
+{
+ checkNArgs $# 1
+ if [[ $? != 0 ]]; then return 1; fi
+ VAR_NAME=$1
+ if [[ -z "${VAR_NAME}" ]]
+ then
+ echo "VAR_NAME must be passed to this script, $0."
+ return 1
+ fi
+
+ # bash scripts (export may be overkill ... but, just in case needed)
+ echo "export ${VAR_NAME}=\"${!VAR_NAME//\"/\\\"}\"" >> $BUILD_ENV_FILE
+ # PHP, suitable for direct "include"
+ echo "\$${VAR_NAME} = \"${!VAR_NAME//\"/\\\"}\";" >> $BUILD_ENV_FILE_PHP
+ # standard properties file
+ echo "${VAR_NAME} = \"${!VAR_NAME//\"/\\\"}\"" >> $BUILD_ENV_FILE_PROP
+
+}
+
+# this function executes command passed as command line parameter and
+# if that command fails it exit with the same error code as the failed command
+fn-run-command ()
+{
+ $*
+ returnCode=$?
+ if [ $returnCode != 0 ]
+ then
+ echo "Execution of \"$*\" failed with return code : $returnCode"
+ exit $returnCode
+ fi
+} \ No newline at end of file

Back to the top