Permalink
Browse files

build: Example build scripts

  • Loading branch information...
1 parent adf782e commit 44a095671446f0a5b26dcb68cc4cc26d437181bc Pavel Shramov committed Jun 23, 2012
Showing with 62 additions and 0 deletions.
  1. +28 −0 build/Makefile
  2. +26 −0 build/deps.py
  3. +2 −0 control/Permalink.Layer.js
  4. +2 −0 control/Permalink.Line.js
  5. +2 −0 control/Permalink.Marker.js
  6. +2 −0 layer/vector/GPX.Speed.js
View
@@ -0,0 +1,28 @@
+JS := $(wildcard ../layer/*/*.js ../layer/*.js ../control/*js)
+#JS += control/Scale.js control/Distance.js
+#JS += control/Permalink.js $(wildcard control/Permalink.*.js)
+JS := $(shell python ./deps.py $(JS))
+
+#JS_EXTRA := $(JS) $(wildcard layer/*.js)
+all: compiled.yui.js compiled.closure.js
+
+compile: $(patsubst %,compiled/%,$(JS))
+
+closure/%: ../%
+ mkdir -p $(dir $@)
+ java -jar /tmp/closure.jar --compilation_level ADVANCED_OPTIMIZATIONS --charset UTF-8 --js $< --js_output_file $@.tmp
+ mv $@.tmp $@
+
+yui/%: ../%
+ mkdir -p $(dir $@)
+ yui-compressor --charset UTF-8 -o $@.tmp $<
+ mv $@.tmp $@
+
+compiled.yui.js: $(patsubst ../%,yui/%,$(JS))
+compiled.closure.js: $(patsubst ../%,closure/%,$(JS))
+
+compiled.%.js:
+ for f in $^; do cat $$f >> $@.tmp; echo >> $@.tmp; done
+ mv $@.tmp $@
+
+.PHONY: all compile
View
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# vim: sts=4 sw=4 et
+
+import os, sys
+
+printed = set()
+
+def includes(f):
+ d = os.path.dirname(f)
+ for l in open(f):
+ if l.startswith('//#include'):
+ yield os.path.join(d, l.strip().split(None, 1)[1].strip(""""'"""))
+
+work = list(sys.argv[1:])
+
+while work:
+ f = work.pop(0)
+ if f in printed:
+ continue
+ i = list(filter(lambda x: x not in printed, includes(f)))
+ if i:
+ work = i + [f] + work
+ continue
+ printed.add(f)
+ print f
+
@@ -1,3 +1,5 @@
+//#include "Permalink.js
+
L.Control.Permalink.include({
/*
options: {
@@ -1,3 +1,5 @@
+//#include "Permalink.js
+
L.Control.Permalink.include({
/*
options: {
@@ -1,3 +1,5 @@
+//#include "Permalink.js
+
L.Control.Permalink.include({
/*
options: {
@@ -1,3 +1,5 @@
+//#include "GPX.js"
+
(function() {
function d2h(d) {

0 comments on commit 44a0956

Please sign in to comment.