NPM_INSTALL = 'build/npm-install-timestamp' def report_sizes(t): stringio = StringIO() gzipfile = gzip.GzipFile(t.name, 'w', 9, stringio) with open(t.name, 'rb') as f: shutil.copyfileobj(f, gzipfile) gzipfile.close() rawsize = os.stat(t.name).st_size gzipsize = len(stringio.getvalue()) savings = '{0:.2%}'.format((rawsize - gzipsize)/float(rawsize)) t.info('uncompressed: %8d bytes', rawsize) t.info(' compressed: %8d bytes, (saved %s)', gzipsize, savings) virtual('default', 'build') virtual('ci', 'lint', 'build', 'test', 'build/examples/all.combined.js', 'check-examples', 'apidoc') virtual('build', 'build/ol.css', 'build/ol.js', 'build/ol-debug.js', 'build/ol.js.map') virtual('check', 'lint', 'build/ol.js', 'test') virtual('todo', 'fixme')
NPM_INSTALL = 'build/npm-install-timestamp' def report_sizes(t): stringio = StringIO() gzipfile = gzip.GzipFile(t.name, 'w', 9, stringio) with open(t.name, 'rb') as f: shutil.copyfileobj(f, gzipfile) gzipfile.close() rawsize = os.stat(t.name).st_size gzipsize = len(stringio.getvalue()) savings = '{0:.2%}'.format((rawsize - gzipsize)/float(rawsize)) t.info('uncompressed: %8d bytes', rawsize) t.info(' compressed: %8d bytes, (saved %s)', gzipsize, savings) virtual('default', 'build') virtual('ci', 'lint', 'build', 'test', 'test-rendering', 'build/compiled-examples/all.combined.js', 'check-examples', 'apidoc') virtual('build', 'build/ol.css', 'build/ol.js', 'build/ol-debug.js', 'build/ol.js.map') virtual('check', 'lint', 'build/ol.js', 'test') virtual('todo', 'fixme')
PLOVR_JAR = 'bin/plovr-eba786b34df9.jar' PLOVR_JAR_MD5 = '20eac8ccc4578676511cf7ccbfc65100' def report_sizes(t): t.info('uncompressed: %d bytes', os.stat(t.name).st_size) stringio = StringIO() gzipfile = gzip.GzipFile(t.name, 'w', 9, stringio) with open(t.name) as f: shutil.copyfileobj(f, gzipfile) gzipfile.close() t.info(' compressed: %d bytes', len(stringio.getvalue())) virtual('all', 'build-all', 'build', 'examples') virtual('precommit', 'lint', 'build-all', 'test', 'build', 'build-examples', 'doc') virtual('build', 'build/ol.css', 'build/ol.js') virtual('todo', 'fixme') @target('build/ol.css', 'build/ol.js') def build_ol_css(t): t.touch()
PROJ4JS = 'build/proj4js/lib/proj4js-combined.js' PROJ4JS_ZIP = 'build/proj4js-1.1.0.zip' PROJ4JS_ZIP_MD5 = '17caad64cf6ebc6e6fe62f292b134897' def report_sizes(t): t.info('uncompressed: %d bytes', os.stat(t.name).st_size) stringio = StringIO() gzipfile = gzip.GzipFile(t.name, 'w', 9, stringio) with open(t.name) as f: shutil.copyfileobj(f, gzipfile) gzipfile.close() t.info(' compressed: %d bytes', len(stringio.getvalue())) virtual('default', 'build') virtual('integration-test', 'lint', 'build', 'build-all', 'test', 'build-examples', 'check-examples', 'doc') virtual('build', 'build/ol.css', 'build/ol.js', 'build/ol-simple.js', 'build/ol-whitespace.js') virtual('check', 'lint', 'build/ol.css', 'build/ol.js', 'test') virtual('todo', 'fixme')
#!/usr/bin/env python from pake import Target, main, rule, target, variables, virtual # Variables can be overridden on the command line or with environment # variables. variables.CC = 'gcc' # Normal Python constants can be used SRC = 'hello.c' # Virtual targets are like make's .PHONY targets. virtual('all', 'hello') # Normal targets consist of the target followed by a list of dependencies, # the decorated function is the action to build the target. @target('hello', 'hello.o') def hello(t): t.run('%(CC)s', '-o', t.name, t.dependencies) # Rules match on regular expressions and return a target. The decorated # function receives the target name and the regexp match result and returns a # new target. @rule(r'(?P<filename>.*)\.o\Z') def o(name, match): def action(t): t.run('%(CC)s', '-c', '-o', t.name, t.dependencies) dependencies = '%(filename)s.c' % match.groupdict() return Target(name, action=action, dependencies=dependencies)
# ----------------------------------------------------------------------------- def report_sizes(t): t.info('uncompresses: %d bytes', os.stat(t.name).st_size) stringio = StringIO() gzipfile = gzip.GzipFile(t.name, 'w', 9, stringio) with open(t.name) as f: shutil.copyfileobj(f, gzipfile) gzipfile.close() t.info(' compressed: %d bytes', len(stringio.getvalue())) # ----------------------------------------------------------------------------- # normal build plus doc virtual('build-all', 'build', 'doc') # normal build virtual('build', 'minjs', 'css', 'mincss', 'images', 'replace-build') # dev build virtual('dev', 'js', 'css', 'images', 'replace-dev') # ----------------------------------------------------------------------------- virtual('minjs', 'html/GISPortal.min.js') @target('html/GISPortal.min.js', PLOVR_JAR, 'gisportal_all.js') def build_min_portal_js(t): t.info('Minifying JS') t.output('%(JAVA)s', '-jar', PLOVR_JAR, 'build', 'gisportal_all.js')
htmlf = f_name.replace('.js', '.html'); t.cp('examples/sandbox/' + htmlf, 'build/examples/' + htmlf) example_build = 'build/examples/' + f.replace('build/cfgexamples/', '') @target(example_build, f) def compile_example(mytrgt): """Compile example""" mytrgt.output('%(JAVA)s', '-client', '-XX:+TieredCompilation', '-jar', PLOVR_JAR, 'build', f) tar = targets.get(example_build) tar.build() virtual('tests', 'test') virtual('check', 'test') virtual('test', 'build/test_lib') virtual('testfull', 'relib', 'workers', 'test') virtual('test_doc', 'test_apidoc') virtual('doc', 'userdoc', 'apidoc') virtual('apidoc', os.path.join(APIDOC, 'index.html')) virtual('userdoc', DOC) virtual('lint', 'build/lint-stamp') virtual('fix', 'build/fix-stamp') virtual('workers', 'build/cfgworkers/time_stamp', 'build/workers/time_stamp') virtual('lib', 'fix', 'lint', COMPILED, COMPILED_ADVANCED, COMPILED_SIMPLE) virtual('librigid', 'lint', COMPILED, COMPILED_ADVANCED, COMPILED_SIMPLE, 'workers') virtual('build', 'ol3', 'lib', 'doc', 'buildexamples') virtual('ol3', 'updateBower') virtual('buildexamples', 'build/src/typedefs.js', 'build/cfg/exports.js',
PLOVR_JAR = "bin/plovr-eba786b34df9.jar" PLOVR_JAR_MD5 = "20eac8ccc4578676511cf7ccbfc65100" def report_sizes(t): t.info("uncompressed: %d bytes", os.stat(t.name).st_size) stringio = StringIO() gzipfile = gzip.GzipFile(t.name, "w", 9, stringio) with open(t.name) as f: shutil.copyfileobj(f, gzipfile) gzipfile.close() t.info(" compressed: %d bytes", len(stringio.getvalue())) pake.virtual("all", "build-all", "build", "examples") pake.virtual("precommit", "lint", "build-all", "test", "doc", "build", "build-examples") pake.virtual("build", "build/ol.css", "build/ol.js") @pake.target("build/ol.css", "build/ol.js") def build_ol_css(t): t.touch() @pake.target("build/ol.js", PLOVR_JAR, SRC, EXTERNAL_SRC, "base.json", "build/ol.json") def build_ol_js(t):
CSS = 'html/css/' # css location # ----------------------------------------------------------------------------- def report_sizes(t): t.info('uncompresses: %d bytes', os.stat(t.name).st_size) stringio = StringIO() gzipfile = gzip.GzipFile(t.name, 'w', 9, stringio) with open(t.name) as f: shutil.copyfileobj(f, gzipfile) gzipfile.close() t.info(' compressed: %d bytes', len(stringio.getvalue())) # ----------------------------------------------------------------------------- # normal build plus doc virtual('build-all', 'build', 'doc') # normal build virtual('build', 'minjs', 'css', 'mincss', 'images', 'replace-build') # dev build virtual('dev', 'js', 'css', 'images', 'replace-dev') # ----------------------------------------------------------------------------- virtual('minjs', 'html/GISPortal.min.js') @target('html/GISPortal.min.js', PLOVR_JAR, 'gisportal_all.js') def build_min_portal_js(t): t.info('Minifying JS') t.output('%(JAVA)s', '-jar', PLOVR_JAR, 'build', 'gisportal_all.js') report_sizes(t) t.info('Finished minifying JS')
#!/usr/bin/env python from pake import Target, main, rule, target, variables, virtual # Variables can be overridden on the command line or with environment # variables. variables.CC = 'gcc' # Normal Python constants can be used SRC = 'hello.c' # Virtual targets are like make's .PHONY targets. virtual('all', 'hello') # Normal targets consist of the target followed by a list of dependencies, # the decorated function is the action to build the target. @target('hello', 'hello.o') def hello(t): t.run('%(CC)s', '-o', t.name, t.dependencies) # Rules match on regular expressions and return a target. The decorated # function receives the target name and the regexp match result and returns a # new target. @rule(r'(?P<filename>.*)\.o\Z') def o(name, match): def action(t): t.run('%(CC)s', '-c', '-o', t.name, t.dependencies) dependencies = '%(filename)s.c' % match.groupdict()
PROJ4JS = "build/proj4js/lib/proj4js-combined.js" PROJ4JS_ZIP = "build/proj4js-1.1.0.zip" PROJ4JS_ZIP_MD5 = "17caad64cf6ebc6e6fe62f292b134897" def report_sizes(t): t.info("uncompressed: %d bytes", os.stat(t.name).st_size) stringio = StringIO() gzipfile = gzip.GzipFile(t.name, "w", 9, stringio) with open(t.name) as f: shutil.copyfileobj(f, gzipfile) gzipfile.close() t.info(" compressed: %d bytes", len(stringio.getvalue())) virtual("default", "build") virtual("integration-test", "lint", "build", "build-all", "test", "build-examples", "check-examples", "doc") virtual("build", "build/ol.css", "build/ol.js", "build/ol-simple.js", "build/ol-whitespace.js") virtual("check", "lint", "build/ol.css", "build/ol-all.js", "test") virtual("todo", "fixme") @target("build/ol.css", "build/ol.js")
(f_path, f_name) = os.path.split(f) htmlf = f_name.replace('.js', '.html') t.cp('examples/sandbox/' + htmlf, 'build/examples/' + htmlf) example_build = 'build/examples/' + f.replace('build/cfgexamples/', '') @target(example_build, f) def compile_example(mytrgt): """Compile example""" mytrgt.output('%(JAVA)s', '-client', '-XX:+TieredCompilation', '-jar', PLOVR_JAR, 'build', f) tar = targets.get(example_build) tar.build() virtual('tests', 'test') virtual('check', 'test') virtual('test', 'build/test_lib') virtual('testfull', 'relib', 'workers', 'test') virtual('test_doc', 'test_apidoc') virtual('doc', 'userdoc', 'apidoc') virtual('apidoc', os.path.join(APIDOC, 'index.html')) virtual('userdoc', DOC) virtual('lint', 'build/lint-stamp') virtual('fix', 'build/fix-stamp') virtual('workers', 'build/cfgworkers/time_stamp', 'build/workers/time_stamp') virtual('lib', 'fix', 'lint', COMPILED, COMPILED_ADVANCED, COMPILED_SIMPLE) virtual('librigid', 'lint', COMPILED, COMPILED_ADVANCED, COMPILED_SIMPLE, 'workers') virtual('build', 'ol3', 'lib', 'doc', 'buildexamples') virtual('ol3', 'updateBower')
#!/usr/bin/env python from pake import ifind, main, target, virtual SRC = [path for path in ifind('.') if path.endswith('.py')] virtual('all', 'pep8', 'pyflakes') @target('pep8', SRC, help='runs pep8 on all source files', phony=True) def pep8(t): t.run('pep8', '--ignore=E501', SRC) @target('pyflakes', SRC, help='runs pyflakes on all source files', phony=True) def pyflakes(t): t.run('pyflakes', SRC) if __name__ == '__main__': main()
PROJ4JS = 'build/proj4js/lib/proj4js-combined.js' PROJ4JS_ZIP = 'build/proj4js-1.1.0.zip' PROJ4JS_ZIP_MD5 = '17caad64cf6ebc6e6fe62f292b134897' def report_sizes(t): t.info('uncompressed: %d bytes', os.stat(t.name).st_size) stringio = StringIO() gzipfile = gzip.GzipFile(t.name, 'w', 9, stringio) with open(t.name) as f: shutil.copyfileobj(f, gzipfile) gzipfile.close() t.info(' compressed: %d bytes', len(stringio.getvalue())) virtual('default', 'build') virtual('integration-test', 'lint', 'build', 'build-all', 'test', 'build/examples/all.combined.js', 'check-examples', 'apidoc') virtual('build', 'build/ol.css', 'build/ol.js', 'build/ol-simple.js', 'build/ol-whitespace.js') virtual('check', 'lint', 'build/ol.css', 'build/ol-all.js', 'test') virtual('todo', 'fixme')
PROJ4JS = 'build/proj4js/lib/proj4js-combined.js' PROJ4JS_ZIP = 'build/proj4js-1.1.0.zip' PROJ4JS_ZIP_MD5 = '17caad64cf6ebc6e6fe62f292b134897' def report_sizes(t): t.info('uncompressed: %d bytes', os.stat(t.name).st_size) stringio = StringIO() gzipfile = gzip.GzipFile(t.name, 'w', 9, stringio) with open(t.name) as f: shutil.copyfileobj(f, gzipfile) gzipfile.close() t.info(' compressed: %d bytes', len(stringio.getvalue())) virtual('default', 'build') virtual('integration-test', 'lint', 'build', 'build-all', 'test', 'build-examples', 'check-examples', 'doc') virtual('build', 'build/ol.css', 'build/ol.js', 'build/ol-simple.js', 'build/ol-whitespace.js') virtual('check', 'lint', 'build/ol.css', 'build/ol-all.js', 'test') virtual('todo', 'fixme') @target('build/ol.css', 'build/ol.js') def build_ol_css(t): t.touch()