From 5ece40b66af858153db6c3fdfa6130eb05d529d6 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 3 Oct 2010 12:28:57 -0400 Subject: [PATCH] Add version.js and the auto-versioner in build.js. --- build.py | 30 +++++++++++++++++++++++++++++- web_frontend/version.js | 15 +++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 web_frontend/version.js diff --git a/build.py b/build.py index cffd67a..600f033 100755 --- a/build.py +++ b/build.py @@ -9,9 +9,12 @@ # import optparse import os +import re import shutil +import string import subprocess import sys +import time ROOT = os.path.dirname(os.path.realpath(__file__)) SRC_PATH = os.path.join(ROOT, 'src') @@ -24,6 +27,8 @@ 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') + SOURCES = [ 'paths.go', 'server.go', @@ -88,7 +93,7 @@ def Main(): handle.wait() _PullDeps() - + # Copy print '=== Copying Resources ===' fe_resources = os.path.join(PROD_PATH, 'fe') @@ -98,6 +103,29 @@ def Main(): print ' COPY ' + resource shutil.copy(os.path.join(FE_PATH, resource), fe_resources) + # Version + print '=== Marking Version ===' + if os.path.exists(VERSION_FILE): + gitcrement = subprocess.Popen([ 'gitcrement', 'next' ], stdout = subprocess.PIPE, cwd = ROOT) + gitcrement.wait() + build_stamp = gitcrement.stdout.read().strip() + time_stamp = str(int(time.time())) + + fd = open(VERSION_FILE, 'a+') + fd.seek(0) + lines = fd.readlines() + fd.seek(0) + fd.truncate() + for line in lines: + line = re.sub(r'(BUILD =) ([0-9]+)', r'\1 ' + build_stamp, line) + line = re.sub(r'(STAMP =) ([0-9]+)', r'\1 ' + time_stamp, line) + fd.write(line) + fd.close() + print ' BUILD ' + build_stamp + ' @ ' + time_stamp + if options.compile_fe: + shutil.copy(VERSION_FILE, string.replace(VERSION_FILE, '.proto', '')) + print ' COPY version.js.proto -> version.js' + # Compile JS. print '=== Compiling Front End ===' outfile = os.path.join(PROD_PATH, 'fe', PRODUCT_NAME + '.js') diff --git a/web_frontend/version.js b/web_frontend/version.js new file mode 100644 index 0000000..5547c13 --- /dev/null +++ b/web_frontend/version.js @@ -0,0 +1,15 @@ +// +// Armadillo File Manager +// Copyright (c) 2010, Robert Sesek +// +// This program is free software: you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation, either version 3 of the License, or any later version. +// + +goog.provide('armadillo.Version'); + +armadillo.Version.MAJOR = 0; +armadillo.Version.MINOR = 2; +armadillo.Version.BUILD = 0; +armadillo.Version.STAMP = 0; -- 2.43.5