@@ -9,6 +9,8 @@
|
|||||||
/build/ol.js
|
/build/ol.js
|
||||||
/build/ol-all.js
|
/build/ol-all.js
|
||||||
/build/src
|
/build/src
|
||||||
|
/build/phantomjs-*-windows
|
||||||
|
/build/phantomjs-*-windows.zip
|
||||||
/examples/*.json
|
/examples/*.json
|
||||||
/examples/*.combined.js
|
/examples/*.combined.js
|
||||||
/examples/example-list.js
|
/examples/example-list.js
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
@echo off
|
||||||
|
%SystemDrive%\Python27\python.exe build.py %*
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
import glob
|
|
||||||
import gzip
|
import gzip
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import os.path
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
@@ -13,19 +13,23 @@ from pake import Target, ifind, main, output, rule, target, variables, virtual
|
|||||||
|
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
variables.GIT = 'C:/Program Files/Git/bin/git.exe'
|
ProgramFiles = os.environ.get('ProgramFiles', 'C:\\Program Files')
|
||||||
variables.GJSLINT = 'gjslint' # FIXME
|
ProgramFiles_X86 = os.environ.get('ProgramFiles(X86)', 'C:\\Program Files')
|
||||||
variables.JAVA = 'C:/Program Files/Java/jre7/bin/java.exe'
|
Python27 = os.environ.get('SystemDrive', 'C:') + '\\Python27'
|
||||||
|
variables.GIT = os.path.join(ProgramFiles_X86, 'Git', 'bin', 'git.exe')
|
||||||
|
variables.GJSLINT = os.path.join(Python27, 'Scripts', 'gjslint.exe')
|
||||||
|
variables.JAVA = os.path.join(ProgramFiles, 'Java', 'jre7', 'bin', 'java.exe')
|
||||||
variables.JSDOC = 'jsdoc' # FIXME
|
variables.JSDOC = 'jsdoc' # FIXME
|
||||||
variables.PHANTOMJS = 'phantomjs' # FIXME
|
variables.PYTHON = os.path.join(Python27, 'python.exe')
|
||||||
variables.PYTHON = 'C:/Python27/python.exe'
|
PHANTOMJS_WINDOWS_ZIP = 'build/phantomjs-1.8.1-windows.zip'
|
||||||
|
PHANTOMJS = 'build/phantomjs-1.8.1-windows/phantomjs.exe'
|
||||||
else:
|
else:
|
||||||
variables.GIT = 'git'
|
variables.GIT = 'git'
|
||||||
variables.GJSLINT = 'gjslint'
|
variables.GJSLINT = 'gjslint'
|
||||||
variables.JAVA = 'java'
|
variables.JAVA = 'java'
|
||||||
variables.JSDOC = 'jsdoc'
|
variables.JSDOC = 'jsdoc'
|
||||||
variables.PHANTOMJS = 'phantomjs'
|
|
||||||
variables.PYTHON = 'python'
|
variables.PYTHON = 'python'
|
||||||
|
PHANTOMJS = 'phantomjs'
|
||||||
|
|
||||||
variables.BRANCH = output('%(GIT)s', 'rev-parse', '--abbrev-ref', 'HEAD').strip()
|
variables.BRANCH = output('%(GIT)s', 'rev-parse', '--abbrev-ref', 'HEAD').strip()
|
||||||
|
|
||||||
@@ -40,9 +44,14 @@ EXTERNAL_SRC = [
|
|||||||
'build/src/external/src/types.js']
|
'build/src/external/src/types.js']
|
||||||
|
|
||||||
EXAMPLES = [path
|
EXAMPLES = [path
|
||||||
for path in glob.glob('examples/*.html')
|
for path in ifind('examples')
|
||||||
|
if not path.startswith('examples/standalone/')
|
||||||
|
if path.endswith('.html')
|
||||||
if path != 'examples/example-list.html']
|
if path != 'examples/example-list.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')
|
||||||
@@ -193,7 +202,7 @@ def examples_star_combined_js(name, match):
|
|||||||
|
|
||||||
@target('serve', PLOVR_JAR, INTERNAL_SRC, 'test/requireall.js', 'examples')
|
@target('serve', PLOVR_JAR, INTERNAL_SRC, 'test/requireall.js', 'examples')
|
||||||
def serve(t):
|
def serve(t):
|
||||||
t.run('%(JAVA)s', '-jar', PLOVR_JAR, 'serve', glob.glob('build/*.json'), glob.glob('examples/*.json'), glob.glob('test/*.json'))
|
t.run('%(JAVA)s', '-jar', PLOVR_JAR, 'serve', 'build/ol.json', 'build/ol-all.json', EXAMPLES_JSON, 'test/test.json')
|
||||||
|
|
||||||
|
|
||||||
@target('serve-precommit', PLOVR_JAR, INTERNAL_SRC)
|
@target('serve-precommit', PLOVR_JAR, INTERNAL_SRC)
|
||||||
@@ -326,9 +335,23 @@ def hostexamples(t):
|
|||||||
t.cp('examples/example-list.js', 'examples/example-list.xml', 'examples/Jugl.js', 'build/gh-pages/%(BRANCH)s/examples/')
|
t.cp('examples/example-list.js', 'examples/example-list.xml', 'examples/Jugl.js', 'build/gh-pages/%(BRANCH)s/examples/')
|
||||||
|
|
||||||
|
|
||||||
@target('test', INTERNAL_SRC, 'test/requireall.js', phony=True)
|
@target('test', PHANTOMJS, INTERNAL_SRC, 'test/requireall.js', phony=True)
|
||||||
def test(t):
|
def test(t):
|
||||||
t.run('%(PHANTOMJS)s', 'test/phantom-jasmine/run_jasmine_test.coffee', 'test/ol.html')
|
t.run(PHANTOMJS, 'test/phantom-jasmine/run_jasmine_test.coffee', 'test/ol.html')
|
||||||
|
|
||||||
|
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
@target(PHANTOMJS, PHANTOMJS_WINDOWS_ZIP, clean=False)
|
||||||
|
def phantom_js(t):
|
||||||
|
from zipfile import ZipFile
|
||||||
|
ZipFile(PHANTOMJS_WINDOWS_ZIP).extractall('build')
|
||||||
|
|
||||||
|
@target(PHANTOMJS_WINDOWS_ZIP, clean=False)
|
||||||
|
def phantomjs_windows_zip(t):
|
||||||
|
t.download('http://phantomjs.googlecode.com/files/' + os.path.basename(t.name))
|
||||||
|
|
||||||
|
else:
|
||||||
|
virtual(PHANTOMJS)
|
||||||
|
|
||||||
|
|
||||||
@target('fixme', phony=True)
|
@target('fixme', phony=True)
|
||||||
|
|||||||
@@ -288,7 +288,10 @@ def ifind(*paths):
|
|||||||
for path in paths:
|
for path in paths:
|
||||||
for dirpath, dirnames, names in os.walk(path):
|
for dirpath, dirnames, names in os.walk(path):
|
||||||
for name in names:
|
for name in names:
|
||||||
yield os.path.join(dirpath, name)
|
if sys.platform == 'win32':
|
||||||
|
yield '/'.join(dirpath.split('\\') + [name])
|
||||||
|
else:
|
||||||
|
yield os.path.join(dirpath, name)
|
||||||
|
|
||||||
|
|
||||||
def main(argv=sys.argv):
|
def main(argv=sys.argv):
|
||||||
|
|||||||
@@ -13,12 +13,16 @@ Run build.py:
|
|||||||
|
|
||||||
$ ./build.py
|
$ ./build.py
|
||||||
|
|
||||||
|
Windows users should run `build` instead.
|
||||||
|
|
||||||
## Run examples locally
|
## Run examples locally
|
||||||
|
|
||||||
Run the [Plovr](http://plovr.com/) web server with:
|
Run the [Plovr](http://plovr.com/) web server with:
|
||||||
|
|
||||||
$ ./build.py serve
|
$ ./build.py serve
|
||||||
|
|
||||||
|
Windows users should run `build serve` instead.
|
||||||
|
|
||||||
Then, either open one of the example html files from the `examples` directory directly in your browser, or start a simple webserver, for example:
|
Then, either open one of the example html files from the `examples` directory directly in your browser, or start a simple webserver, for example:
|
||||||
|
|
||||||
$ python -mSimpleHTTPServer
|
$ python -mSimpleHTTPServer
|
||||||
|
|||||||
Reference in New Issue
Block a user