From 72d07f0f95486d82c888f708f4552c3c7460da1f Mon Sep 17 00:00:00 2001 From: Carlos Munoz Date: Wed, 13 Apr 2016 09:57:52 +1000 Subject: [PATCH] chore: add scripts and docs for common dev tasks (#1134) Add another script to build zanata.war and document any useful scripts which developers might use to get started or do development with Zanata. --- README.md | 33 +++++++++++++++++++++++++++++++ etc/scripts/quickbuild.sh | 41 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100755 etc/scripts/quickbuild.sh diff --git a/README.md b/README.md index 612919a0e3..569a713c78 100644 --- a/README.md +++ b/README.md @@ -24,3 +24,36 @@ translators in seconds. Zanata is Free software, licensed under the [LGPL][]. [LGPL]: http://www.gnu.org/licenses/lgpl-2.1.html + +Developers +---------- + +### Prerequisites + +You will need: +- Java SDK 8 (OpenJDK recommended) +- npm +- Mysql or MariaDB +- JBoss EAP 6 or Wildfly + +### Building + +#### Quickly build a .war file + +[`etc/scripts/quickbuild.sh`](etc/scripts/quickbuild.sh) - Builds the project +as quickly as possible, targeting both Firefox and Chrome when building GWT +components, and skipping all checks and verifications (i.e. tests, checkstyle, etc) + +If you wish to build GWT components for chrome or firefox only, you can specify the +`-c` and `-f` arguments respectively. + +The `-h` argument prints the script's help. + +#### Build and run a server for testing + +[`etc/scripts/cargowait.sh`](etc/scripts/cargowait.sh) - Builds the Zanata artifact +and starts a JBoss server using the cargo plugin. This script is particularly +useful for starting a Zanata instance with the aim of running functional tests +from an IDE. + +The `-h` argument prints the script's help. diff --git a/etc/scripts/quickbuild.sh b/etc/scripts/quickbuild.sh new file mode 100755 index 0000000000..857d9d52a4 --- /dev/null +++ b/etc/scripts/quickbuild.sh @@ -0,0 +1,41 @@ +#!/bin/bash +#set -x + +function usage { + echo ">> Run this script to quickly build the Zanata web archive" >&2 + echo ">>>> -c Only build GWT components for Chrome (incompatible with -f)" >&2 + echo ">>>> -f Only build GWT components for Firefox (incompatible with -c)" >&2 + echo ">>>> Default GWT build is both Chrome and Firefox" >&2 + exit 0; +} + +gwtMode="-Dchromefirefox" +while getopts "cfh" opt; do + case ${opt} in + c) + if [ $gwtMode == "-Dfirefox" ] + then usage + fi + gwtMode="-Dchrome" + echo ">> Building GWT for Google Chrome" + ;; + f) + if [ $gwtMode == "-Dchrome" ] + then usage + fi + gwtMode="-Dfirefox" + echo ">> Building GWT for Mozilla Firefox" + ;; + h) + usage + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + exit 1; + ;; + esac +done + +DIR="$( cd -P "$( dirname "$0" )" && pwd )" +cd $DIR/../.. +mvn -DskipArqTests -DskipUnitTests -Danimal.sniffer.skip $gwtMode -am -pl zanata-war package