Skip to content

Commit

Permalink
Initial public commit
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Berestovskyy <[email protected]>
  • Loading branch information
berestovskyy committed May 30, 2018
0 parents commit f595770
Show file tree
Hide file tree
Showing 33 changed files with 14,831 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "i18n"]
path = i18n
url = https://github.com/WMEValidator/i18n.git
12 changes: 12 additions & 0 deletions 00.config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Path to Closure Compiler
COMPILER=${HOME}/bin/compiler.jar

EXT_NAME=WV
EXT_FILE_NAME="WME_Validator"

EXT_VER="1.1.20"
CUR_VER="git"

SRC_DIR="."
DST_DIR="build"
TMP_DIR="build/tmp"
7 changes: 7 additions & 0 deletions 10.release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

. ./00.config.sh

EXTRA_PARAMS="--compilation_level ADVANCED_OPTIMIZATIONS"

. ./99.build.sh
9 changes: 9 additions & 0 deletions 20.debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

. ./00.config.sh

EXTRA_PARAMS="--define DEF_DEBUG=true \
--compilation_level SIMPLE_OPTIMIZATIONS \
--formatting PRETTY_PRINT"

. ./99.build.sh
71 changes: 71 additions & 0 deletions 99.build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/sh

if [ -z "${SRC_DIR}" ]; then
echo "No config found"
exit 1
fi

mkdir -p "${TMP_DIR}"

LOC_FILE="${TMP_DIR}/gen-i18n.js"
rm -f "${LOC_FILE}"

## Generate localization file
cat "${SRC_DIR}/meta/i18n-begin.js" > "${LOC_FILE}"
printf "Localizations:"
for FILE in $(ls -r ${SRC_DIR}/i18n/*.js); do
CODE="${FILE##*/}"
CODE="${CODE%%.js}"
if [ "${CODE}" = "default" ]; then
CODE="EN"
fi
printf " ${CODE}"
echo "\"${CODE}\": {" >> "${LOC_FILE}"
echo "\".codeISO\": \"${CODE}\"," >> "${LOC_FILE}"
cat "${FILE}" >> "${LOC_FILE}"
echo "}, // ${CODE}" >> "${LOC_FILE}"
done
echo
cat "${SRC_DIR}/meta/i18n-end.js" >> "${LOC_FILE}"

java -jar "${COMPILER}" \
--language_in ECMASCRIPT5 \
--js "${SRC_DIR}/src/release.js" \
--js "${LOC_FILE}" \
--js "${SRC_DIR}/src/enc.js" \
--js "${SRC_DIR}/src/helpers.js" \
--js "${SRC_DIR}/src/data.js" \
--js "${SRC_DIR}/src/basic.js" \
--js "${SRC_DIR}/src/report.js" \
--js "${SRC_DIR}/src/validate.js" \
--js "${SRC_DIR}/src/login.js" \
--js "${SRC_DIR}/src/encrypted.js" \
--js "${SRC_DIR}/src/lib/i18n.js" \
--js "${SRC_DIR}/src/lib/audio.js" \
--js "${SRC_DIR}/src/lib/thui.js" \
--js "${SRC_DIR}/src/lib/compressor.js" \
--js "${SRC_DIR}/src/ext/tea-block.js" \
--js "${SRC_DIR}/src/ext/base64.js" \
--js "${SRC_DIR}/src/ext/utf8.js" \
--js "${SRC_DIR}/src/ext/sha256.js" \
--externs "${SRC_DIR}/meta/wme-externs.js" \
--externs "${SRC_DIR}/meta/jquery-1.9.js" \
--js_output_file "${TMP_DIR}/gen-${EXT_NAME}-compiled.js" \
--use_types_for_optimization \
--warning_level=VERBOSE \
--jscomp_warning=checkTypes \
--jscomp_warning=missingProperties \
--jscomp_off es5Strict \
--process_jquery_primitives \
${EXTRA_PARAMS}

if [ $? != 0 ]; then
read -p "Stop on error. Press enter to exit..."
exit 1
fi

mkdir -p "${DST_DIR}"
cat "${SRC_DIR}/meta/meta-begin.js" \
"${TMP_DIR}/gen-${EXT_NAME}-compiled.js" \
"${SRC_DIR}/meta/meta-end.js" \
> "${DST_DIR}/${EXT_FILE_NAME}.user.js"
Loading

0 comments on commit f595770

Please sign in to comment.