From 8f86761736cfe707301c655d9efb5526b503d9cc Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 26 Dec 2011 18:41:03 -0500 Subject: [PATCH] Remove closure library dependency from build.py --- build.py | 45 ++++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/build.py b/build.py index 7a98258..38b1bf3 100755 --- a/build.py +++ b/build.py @@ -22,11 +22,7 @@ SRC_PATH = os.path.join(ROOT, 'src') PROD_PATH = os.path.join(ROOT, 'out') FE_PATH = os.path.join(ROOT, 'web_frontend') -CLOSURE_SVN = 'http://closure-library.googlecode.com/svn/trunk/' -CLOSURE_REV = '886' -CLOSURE_DEST = os.path.join(ROOT, 'closure') CLOSURE_COMPILER = os.path.join(ROOT, 'closure-compiler.jar') -CLOSURE_CALCDEPS = os.path.join(CLOSURE_DEST, 'closure', 'bin', 'calcdeps.py') VERSION_FILE = os.path.join(FE_PATH, 'version.js.proto') @@ -61,20 +57,6 @@ COMPILER = '6g' LINKER = '6l' O_EXTENSION = '6' -def _PullDeps(): - print '=== Pulling Dependencies ===' - if os.path.exists(CLOSURE_DEST): - handle = subprocess.Popen([ 'svn', 'info', CLOSURE_DEST ], stdout = subprocess.PIPE) - handle.wait() - for line in handle.stdout: - if line.startswith('Revision'): - if not line.strip().endswith(CLOSURE_REV): - subprocess.Popen([ 'svn', 'update', '-r', CLOSURE_REV, CLOSURE_DEST ]).wait() - else: - print ' Closure @ ' + CLOSURE_REV - else: - subprocess.Popen([ 'svn', 'checkout', '-r', CLOSURE_REV, CLOSURE_SVN, CLOSURE_DEST ]).wait() - def _CompileBackEnd(): for gofile in SOURCES: gofile = os.path.join(SRC_PATH, gofile) @@ -120,8 +102,6 @@ def _StampVersion(options): stderr = sys.stderr).wait() def _CompileFrontEnd(options): - _PullDeps() - # Copy print '=== Copying Resources ===' fe_resources = os.path.join(PROD_PATH, 'fe') @@ -137,16 +117,23 @@ def _CompileFrontEnd(options): # Compile JS. print '=== Compiling Front End ===' outfile = os.path.join(PROD_PATH, 'fe', PRODUCT_NAME + '.js') - fe_sources = map(lambda f: '-i' + os.path.join(FE_PATH, f), SOURCES_FE) - args = [ CLOSURE_CALCDEPS ] - args.extend(fe_sources) - output = "script" if options.compile_fe: - output = "compiled" - args.extend([ '-o', output, '-c', CLOSURE_COMPILER, '--output_file', outfile ]) - print ' ' + ' '.join(args) - handle = subprocess.Popen(args, stdout = sys.stdout, stderr = sys.stderr) - handle.wait() + fe_sources = map(lambda f: '--js ' + os.path.join(FE_PATH, f), SOURCES_FE) + args = [ 'java', '-jar', CLOSURE_COMPILER ] + args.extend(fe_sources) + args.extend(['--js_output_file', outfile]) + print ' ' + ' '.join(args) + handle = subprocess.Popen(args, stdout = sys.stdout, stderr = sys.stderr) + handle.wait() + else: + fd = open(outfile, 'w+') + for fe_source in SOURCES_FE: + fd2 = open(os.path.join(FE_PATH, fe_source), 'r') + fd.write('// === ' + fe_source + '\n') + fd.write(fd2.read()) + fd2.close() + fd.close() + print ' DONE' def Main(): -- 2.43.5