Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

Commit

Permalink
added build rules for language handler aliases so that lang-scm.js in…
Browse files Browse the repository at this point in the history
… the loader works even though there is only a source for lang-lisp.js which registers a handler for lang-scm
  • Loading branch information
[email protected] committed Mar 4, 2013
1 parent abb06d9 commit b193e34
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ distrib.tstamp: src/prettify.js src/run_prettify.js src/*.js src/*.css
done
@touch distrib.tstamp

lang-aliases : lang-aliases.tstamp
lang-aliases.tstamp : distrib.tstamp
@tools/lang-handler-aliases.sh \
distrib/sources/google-code-prettify/src \
| perl -ne 'system("cp $$1 $$2") if m/^(\S+) (\S+)$$/ && ! -e $$2' \
&& touch lang-aliases.tstamp

%.tgz: %.tar
@gzip -c -9 $^ > $@

Expand All @@ -101,3 +108,4 @@ distrib/prettify.tar: distrib.tstamp
examples js-modules src styles tests tools \
distrib/sources/google-code-prettify
tar cf distrib/prettify.tar -C distrib/sources google-code-prettify

4 changes: 3 additions & 1 deletion tools/cut-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ fi
# Make the distribution
function build() {
pushd "$VERSION_BASE/trunk" > /dev/null
make distrib distrib/prettify.tar.bz2 distrib/prettify-small.tar.bz2
make clean \
&& make distrib distrib/prettify.tar.bz2 distrib/prettify-small.tar.bz2 \
&& make lang-aliases
local status=$?
popd > /dev/null
(($status))
Expand Down
8 changes: 5 additions & 3 deletions tools/lang-handler-aliases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if [ -n "$*" ] || [ -z "$LANG_DIR" ] || ! (( $HAS_LANG_FILES )); then
echo "Usage: $0 <LANG_DIR>"
echo
echo "Dumps lines of the form"
echo " lang-foo.js : <extension>"
echo " $LANG_DIR/lang-foo.js $LANG_DIR/lang-<extension>.js"
echo "where the first element is a path name under LANG_DIR"
echo "and the second is the name of a language extension for which"
echo "it registers an extension."
Expand Down Expand Up @@ -60,6 +60,8 @@ for JS in "$LANG_DIR"/lang-*.js; do
"$JS" \
< /dev/null \
|| echo "Failed to execute $JS" 1>&2 ) \
| perl -e '$BASE=shift; while (<STDIN>) { s/^(?=\w)/$BASE : /; print; }' \
"$(basename "$JS")"
| perl -e '$JS=shift;' \
-e 'use File::Basename; $DIR=dirname($JS);' \
-e 'while (<STDIN>) { s/^\w+$/$JS $DIR\/lang-$&.js/; print; }' \
"$JS"
done

0 comments on commit b193e34

Please sign in to comment.