Skip to content

Instantly share code, notes, and snippets.

@srl295
Created August 18, 2021 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srl295/4b1e625bc91562c8b054ddb94c525df1 to your computer and use it in GitHub Desktop.
Save srl295/4b1e625bc91562c8b054ddb94c525df1 to your computer and use it in GitHub Desktop.
Steven's CLDR Shell Script Snippets
#!/bin/bash
# I have these lines effectively added to my .profile for CLDR work.
##
## ALL OF THESE ASSUME YOU ARE IN THE TOP LEVEL 'cldr' directory (parent of 'common')
##
alias cldr-rebuild='mvn clean compile install -DskipTests=true && mvn --file=tools/pom.xml -pl cldr-apps liberty:create'
alias cldr-dev='mvn --file=tools/pom.xml install -DskipTests=true && mvn --file=tools/pom.xml -pl cldr-apps liberty:stop liberty:deploy liberty:dev'
alias cldr-js='(cd tools/cldr-apps/js && npm i && npm run watch)'
alias cldr-pretty='bash tools/cldr-apps/js-unittest/pretty.sh'
alias cldr-test="mysql < tools/cldr-apps/test-setup.sql && mvn test --file tools/pom.xml '-Dorg.unicode.cldr.unittest.web.jdbcurl=jdbc:mysql://cldrtest:VbrB3LFCr6A!@localhost/cldrtest?useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC' '-Dorg.unicode.cldr.unittest.web.KeepDb=true'"
# Example: 'cldr-check -f dsb'
function cldr-check() {
EXECARGS="-S common,seed -e -z FINAL_TESTING ${@}"
echo cldr-check ${EXECARGS}
env LANG=en_US.UTF-8 mvn -DCLDR_DIR=$(pwd) -DCLDR_GITHUB_ANNOTATIONS=true --file=tools/pom.xml -pl cldr-code \
-Dfile.encoding=utf-8 compile -DskipTests=true exec:java -Dexec.mainClass=org.unicode.cldr.test.ConsoleCheckCLDR \
-Dexec.args="${EXECARGS}"
}
# Run cldr-modify and put the result back into the source tree (overwrite)
# Usage: cldr-modify common/annotations -fQ
# Usage: cldr-modify common/main ''
#
function cldr-modify() {
XDIR=$1
ARGZ=$2
if [[ ! -d "./${XDIR}" ]];
then
echo >&2 "Not a dir: ${XDIR}"
echo >&2 "Usage: cldr-modify <dir> <args>"
elif [[ $# -ne 2 ]];
then
echo >&2 "Usage: cldr-modify <dir> <args>"
else
TMPD=$(mktemp -d)
EXECARGZ="-d${TMPD} -s$(pwd)/${XDIR} ${ARGZ}"
echo -- -Dexec.args="${EXECARGZ}"
env LANG=en_US.UTF-8 mvn -DCLDR_DIR=$(pwd) --file=tools/pom.xml -pl cldr-code \
compile -DskipTests=true -Dfile.encoding=utf-8 exec:java \
-Dexec.mainClass=org.unicode.cldr.tool.CLDRModify \
-Dexec.args="${EXECARGZ}" && (rmdir ${TMPD} || (mv -v ${TMPD}/*.xml ${XDIR}/ && rmdir ${TMPD} ) )
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment