Examples json and combined.js files in build dir
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -16,9 +16,9 @@
|
|||||||
/build/proj4js
|
/build/proj4js
|
||||||
/build/proj4js-*.zip
|
/build/proj4js-*.zip
|
||||||
/build/src
|
/build/src
|
||||||
/examples/*.combined.js
|
/build/examples/*.combined.js
|
||||||
/examples/*.html.png
|
/examples/*.html.png
|
||||||
/examples/*.json
|
/build/examples/*.json
|
||||||
/examples/example-list.js
|
/examples/example-list.js
|
||||||
/examples/example-list.xml
|
/examples/example-list.xml
|
||||||
/test/requireall.js
|
/test/requireall.js
|
||||||
|
|||||||
25
build.py
25
build.py
@@ -55,9 +55,6 @@ EXAMPLES = [path
|
|||||||
if path.endswith('.html')
|
if path.endswith('.html')
|
||||||
if path != 'examples/index.html']
|
if path != 'examples/index.html']
|
||||||
|
|
||||||
EXAMPLES_JSON = [example.replace('.html', '.json')
|
|
||||||
for example in EXAMPLES]
|
|
||||||
|
|
||||||
EXAMPLES_SRC = [path
|
EXAMPLES_SRC = [path
|
||||||
for path in ifind('examples')
|
for path in ifind('examples')
|
||||||
if path.endswith('.js')
|
if path.endswith('.js')
|
||||||
@@ -68,6 +65,12 @@ EXAMPLES_SRC = [path
|
|||||||
if path != 'examples/jquery.min.js'
|
if path != 'examples/jquery.min.js'
|
||||||
if path != 'examples/example-list.js']
|
if path != 'examples/example-list.js']
|
||||||
|
|
||||||
|
EXAMPLES_JSON = ['build/' + example.replace('.html', '.json')
|
||||||
|
for example in EXAMPLES]
|
||||||
|
|
||||||
|
EXAMPLES_COMBINED = ['build/' + example.replace('.html', '.combined.js')
|
||||||
|
for example in EXAMPLES]
|
||||||
|
|
||||||
INTERNAL_SRC = [
|
INTERNAL_SRC = [
|
||||||
'build/src/internal/src/requireall.js',
|
'build/src/internal/src/requireall.js',
|
||||||
'build/src/internal/src/types.js']
|
'build/src/internal/src/types.js']
|
||||||
@@ -222,12 +225,10 @@ def build_src_internal_types_js(t):
|
|||||||
'--typedef', 'src/objectliterals.exports')
|
'--typedef', 'src/objectliterals.exports')
|
||||||
|
|
||||||
|
|
||||||
virtual('build-examples', 'examples', (path.replace(
|
virtual('build-examples', 'examples', EXAMPLES_COMBINED)
|
||||||
'.html', '.combined.js') for path in EXAMPLES))
|
|
||||||
|
|
||||||
|
|
||||||
virtual('examples', 'examples/example-list.xml', (
|
virtual('examples', 'examples/example-list.xml', EXAMPLES_JSON)
|
||||||
path.replace('.html', '.json') for path in EXAMPLES))
|
|
||||||
|
|
||||||
|
|
||||||
@target('examples/example-list.xml', 'examples/example-list.js')
|
@target('examples/example-list.xml', 'examples/example-list.js')
|
||||||
@@ -240,12 +241,12 @@ def examples_examples_list_js(t):
|
|||||||
t.run('%(PYTHON)s', 'bin/exampleparser.py', 'examples', 'examples')
|
t.run('%(PYTHON)s', 'bin/exampleparser.py', 'examples', 'examples')
|
||||||
|
|
||||||
|
|
||||||
@rule(r'\Aexamples/(?P<id>.*).json\Z')
|
@rule(r'\Abuild/examples/(?P<id>.*).json\Z')
|
||||||
def examples_star_json(name, match):
|
def examples_star_json(name, match):
|
||||||
def action(t):
|
def action(t):
|
||||||
content = json.dumps({
|
content = json.dumps({
|
||||||
'id': match.group('id'),
|
'id': match.group('id'),
|
||||||
'inherits': '../base.json',
|
'inherits': '../../base.json',
|
||||||
'inputs': [
|
'inputs': [
|
||||||
'examples/%(id)s.js' % match.groupdict(),
|
'examples/%(id)s.js' % match.groupdict(),
|
||||||
'build/src/internal/src/types.js',
|
'build/src/internal/src/types.js',
|
||||||
@@ -266,15 +267,15 @@ def examples_star_json(name, match):
|
|||||||
return Target(name, action=action, dependencies=dependencies)
|
return Target(name, action=action, dependencies=dependencies)
|
||||||
|
|
||||||
|
|
||||||
@rule(r'\Aexamples/(?P<id>.*).combined.js\Z')
|
@rule(r'\Abuild/examples/(?P<id>.*).combined.js\Z')
|
||||||
def examples_star_combined_js(name, match):
|
def examples_star_combined_js(name, match):
|
||||||
def action(t):
|
def action(t):
|
||||||
t.output('%(JAVA)s', '-jar', PLOVR_JAR, 'build',
|
t.output('%(JAVA)s', '-jar', PLOVR_JAR, 'build',
|
||||||
'examples/%(id)s.json' % match.groupdict())
|
'build/examples/%(id)s.json' % match.groupdict())
|
||||||
report_sizes(t)
|
report_sizes(t)
|
||||||
dependencies = [PLOVR_JAR, SRC, INTERNAL_SRC, SHADER_SRC, 'base.json',
|
dependencies = [PLOVR_JAR, SRC, INTERNAL_SRC, SHADER_SRC, 'base.json',
|
||||||
'examples/%(id)s.js' % match.groupdict(),
|
'examples/%(id)s.js' % match.groupdict(),
|
||||||
'examples/%(id)s.json' % match.groupdict()]
|
'build/examples/%(id)s.json' % match.groupdict()]
|
||||||
return Target(name, action=action, dependencies=dependencies)
|
return Target(name, action=action, dependencies=dependencies)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user