<commit_before># This makefile is called two times by SBT;
# Once to compile_javascript to Java bytecode.
# And once to combine_and_gzip_javascript.

DESTDIR=target/scala-2.9.1/classes/
CLASSDIR=${DESTDIR}compiledjs/
HTML_SANITIZER_JS=app/assets/res/html-sanitizer-bundle.js
SHOWDOWN_JS=public/res/wmd/showdown.js
RHINOJAR=/mnt/data/dev/play/github/repository/local/rhino/js/1.7R2/jars/js.jar

help:
	@echo Open the Makefile and read it.

# Compile Javascript to Java bytecode, using Mozilla Rhino.
# There're some duplicated rules unfortunately.

compile_javascript: \
		${CLASSDIR}HtmlSanitizerJsImpl.class \
		${CLASSDIR}ShowdownJsImpl.class

${CLASSDIR}HtmlSanitizerJsImpl.class: ${CLASSDIR}HtmlSanitizerJs.class ${RHINOJAR} ${HTML_SANITIZER_JS}
	java -cp ${RHINOJAR}:${DESTDIR} \
	  org.mozilla.javascript.tools.jsc.Main \
	  -opt 9 \
	  -implements compiledjs.HtmlSanitizerJs \
	  -package compiledjs \
	  -d ${DESTDIR} \
	  -o HtmlSanitizerJsImpl \
	  ${HTML_SANITIZER_JS}

${CLASSDIR}ShowdownJsImpl.class: ${CLASSDIR}ShowdownJs.class ${RHINOJAR} ${SHOWDOWN_JS}
	java -cp ${RHINOJAR}:${DESTDIR} \
	  org.mozilla.javascript.tools.jsc.Main \
	  -opt 9 \
	  -implements compiledjs.ShowdownJs \
	  -package compiledjs \
	  -d ${DESTDIR} \
	  -o ShowdownJsImpl \
	  ${SHOWDOWN_JS}

${RHINOJAR}:
	echo 'No Rhino jar, please run `play update`.'
	exit 1

HtmlSanitizerJs: ${CLASSDIR}HtmlSanitizerJs.class
${CLASSDIR}HtmlSanitizerJs.class: app/compiledjs/HtmlSanitizerJs.java
	mkdir -p ${DESTDIR}
	javac $< -d ${DESTDIR}

ShowdownJs: ${CLASSDIR}ShowdownJs.class
${CLASSDIR}ShowdownJs.class: app/compiledjs/ShowdownJs.java
	mkdir -p ${DESTDIR}
	javac $< -d ${DESTDIR}


cleanjs:
	rm -f ${CLASSDIR}ShowdownJs.class ${CLASSDIR}HtmlSanitizerJs.class
	rm -f ${CLASSDIR}ShowdownJsImpl.class ${CLASSDIR}HtmlSanitizerJsImpl.class
	rm -f ${CLASSDIR}ShowdownJsImpl1.class ${CLASSDIR}HtmlSanitizerJsImpl1.class


# Combine some Javascript files, and gzip the resulting files, so Play will serve them
# gzip compressed.

PUBLIC_JS_DIR=target/scala-2.9.1/classes/public/res/

JS_DESKTOP_MIN_JS=${PUBLIC_JS_DIR}combined-debiki-desktop.min.js
JS_TOUCH_MIN_JS=${PUBLIC_JS_DIR}combined-debiki-touch.min.js
JS_LOGIN_MIN_JS=${PUBLIC_JS_DIR}combined-debiki-login.min.js

JS_DESKTOP_MIN_JS_GZ=${JS_DESKTOP_MIN_JS}.gz
JS_TOUCH_MIN_JS_GZ=${JS_TOUCH_MIN_JS}.gz
JS_LOGIN_MIN_JS_GZ=${JS_LOGIN_MIN_JS}.gz

DEBIKI_JS=${PUBLIC_JS_DIR}debiki.js
DEBIKI_MIN_JS=${PUBLIC_JS_DIR}debiki.min.js

${DEBIKI_MIN_JS}: ${DEBIKI_JS}
	# no: uglifyjs $^ > $@    because results in corrupt Javascript
	java -jar scratch/yuicompressor-2.4.6.jar --line-break 280 --charset utf8 -o $@ $^

# This file: ${PUBLIC_JS_DIR}html-sanitizer-bundle.min.js is included in debiki.min.js
# by Play or Google Closure Compiler or something.

JS_COMMON_SRC = \
  ${PUBLIC_JS_DIR}diff_match_patch.js \
  ${PUBLIC_JS_DIR}jquery-cookie.js \
  ${PUBLIC_JS_DIR}javascript-yaml-parser.js \
  ${PUBLIC_JS_DIR}debiki-util.js \
  ${PUBLIC_JS_DIR}debiki-scroll-into-view.js \
  ${PUBLIC_JS_DIR}debiki-merge-changes.min.js \
  ${PUBLIC_JS_DIR}debiki-arrows-png.js \
  ${PUBLIC_JS_DIR}debiki-arrows-svg.js

# Depends on stuff in ${DEBIKI_MIN_JS}. (tagdog.js depends on html-sanitizer-bundle.js.)
JS_COMMON_SRC_2 = \
  ${PUBLIC_JS_DIR}tagdog.js

JS_TOUCH_ONLY_SRC = \
  ${PUBLIC_JS_DIR}android-zoom-bug-workaround.min.js

JS_DESKTOP_ONLY_SRC = \
  ${PUBLIC_JS_DIR}jquery-scrollable.js \
  ${PUBLIC_JS_DIR}debiki-utterscroll.js \
  ${PUBLIC_JS_DIR}debiki-keyboard-shortcuts.js \
  ${PUBLIC_JS_DIR}bootstrap-tooltip.js

JS_LOGIN_SRC = \
  ${PUBLIC_JS_DIR}popuplib.js \
  ${PUBLIC_JS_DIR}openid-selector/js/openid-jquery.js \<commit_msg>Use minified Javascript files in prod bundles.<commit_after># This makefile is called two times by SBT;
# Once to compile_javascript to Java bytecode.
# And once to combine_and_gzip_javascript.

DESTDIR=target/scala-2.9.1/classes/
CLASSDIR=${DESTDIR}compiledjs/
HTML_SANITIZER_JS=app/assets/res/html-sanitizer-bundle.js
SHOWDOWN_JS=public/res/wmd/showdown.js
RHINOJAR=/mnt/data/dev/play/github/repository/local/rhino/js/1.7R2/jars/js.jar

help:
	@echo Open the Makefile and read it.

# Compile Javascript to Java bytecode, using Mozilla Rhino.
# There're some duplicated rules unfortunately.

compile_javascript: \
		${CLASSDIR}HtmlSanitizerJsImpl.class \
		${CLASSDIR}ShowdownJsImpl.class

${CLASSDIR}HtmlSanitizerJsImpl.class: ${CLASSDIR}HtmlSanitizerJs.class ${RHINOJAR} ${HTML_SANITIZER_JS}
	java -cp ${RHINOJAR}:${DESTDIR} \
	  org.mozilla.javascript.tools.jsc.Main \
	  -opt 9 \
	  -implements compiledjs.HtmlSanitizerJs \
	  -package compiledjs \
	  -d ${DESTDIR} \
	  -o HtmlSanitizerJsImpl \
	  ${HTML_SANITIZER_JS}

${CLASSDIR}ShowdownJsImpl.class: ${CLASSDIR}ShowdownJs.class ${RHINOJAR} ${SHOWDOWN_JS}
	java -cp ${RHINOJAR}:${DESTDIR} \
	  org.mozilla.javascript.tools.jsc.Main \
	  -opt 9 \
	  -implements compiledjs.ShowdownJs \
	  -package compiledjs \
	  -d ${DESTDIR} \
	  -o ShowdownJsImpl \
	  ${SHOWDOWN_JS}

${RHINOJAR}:
	echo 'No Rhino jar, please run `play update`.'
	exit 1

HtmlSanitizerJs: ${CLASSDIR}HtmlSanitizerJs.class
${CLASSDIR}HtmlSanitizerJs.class: app/compiledjs/HtmlSanitizerJs.java
	mkdir -p ${DESTDIR}
	javac $< -d ${DESTDIR}

ShowdownJs: ${CLASSDIR}ShowdownJs.class
${CLASSDIR}ShowdownJs.class: app/compiledjs/ShowdownJs.java
	mkdir -p ${DESTDIR}
	javac $< -d ${DESTDIR}


cleanjs:
	rm -f ${CLASSDIR}ShowdownJs.class ${CLASSDIR}HtmlSanitizerJs.class
	rm -f ${CLASSDIR}ShowdownJsImpl.class ${CLASSDIR}HtmlSanitizerJsImpl.class
	rm -f ${CLASSDIR}ShowdownJsImpl1.class ${CLASSDIR}HtmlSanitizerJsImpl1.class


# Combine some Javascript files, and gzip the resulting files, so Play will serve them
# gzip compressed.

PUBLIC_JS_DIR=target/scala-2.9.1/classes/public/res/

JS_DESKTOP_MIN_JS=${PUBLIC_JS_DIR}combined-debiki-desktop.min.js
JS_TOUCH_MIN_JS=${PUBLIC_JS_DIR}combined-debiki-touch.min.js
JS_LOGIN_MIN_JS=${PUBLIC_JS_DIR}combined-debiki-login.min.js

JS_DESKTOP_MIN_JS_GZ=${JS_DESKTOP_MIN_JS}.gz
JS_TOUCH_MIN_JS_GZ=${JS_TOUCH_MIN_JS}.gz
JS_LOGIN_MIN_JS_GZ=${JS_LOGIN_MIN_JS}.gz

DEBIKI_JS=${PUBLIC_JS_DIR}debiki.js
DEBIKI_MIN_JS=${PUBLIC_JS_DIR}debiki.min.js

${DEBIKI_MIN_JS}: ${DEBIKI_JS}
	# no: uglifyjs $^ > $@    because results in corrupt Javascript
	java -jar scratch/yuicompressor-2.4.6.jar --line-break 280 --charset utf8 -o $@ $^

# This file: ${PUBLIC_JS_DIR}html-sanitizer-bundle.min.js is included in debiki.min.js
# by Play or Google Closure Compiler or something.

JS_COMMON_SRC = \
  ${PUBLIC_JS_DIR}diff_match_patch.js \
  ${PUBLIC_JS_DIR}jquery-cookie.js \
  ${PUBLIC_JS_DIR}javascript-yaml-parser.js \
  ${PUBLIC_JS_DIR}debiki-util.min.js \
  ${PUBLIC_JS_DIR}debiki-scroll-into-view.min.js \
  ${PUBLIC_JS_DIR}debiki-merge-changes.min.js \
  ${PUBLIC_JS_DIR}debiki-arrows-png.min.js \
  ${PUBLIC_JS_DIR}debiki-arrows-svg.min.js

# Depends on stuff in ${DEBIKI_MIN_JS}. (tagdog.js depends on html-sanitizer-bundle.js.)
JS_COMMON_SRC_2 = \
  ${PUBLIC_JS_DIR}tagdog.js

JS_TOUCH_ONLY_SRC = \
  ${PUBLIC_JS_DIR}android-zoom-bug-workaround.min.js

JS_DESKTOP_ONLY_SRC = \
  ${PUBLIC_JS_DIR}jquery-scrollable.js \
  ${PUBLIC_JS_DIR}debiki-utterscroll.min.js \
  ${PUBLIC_JS_DIR}debiki-keyboard-shortcuts.min.js \
  ${PUBLIC_JS_DIR}bootstrap-tooltip.js

JS_LOGIN_SRC = \
  ${PUBLIC_JS_DIR}popuplib.js \
  ${PUBLIC_JS_DIR}openid-selector/js/openid-jquery.js \
{'fraction_non_alphanumeric': 0.13068258922513232, 'fraction_numerical': 0.0059709594246166375, 'mean_word_length': 4.991869918699187, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3964585', 'n_tokens_mistral': 3209, 'n_tokens_neox': 3052, 'n_words': 440}