From 530c3cecf1c997c16a0cf35f06a6a6068123def9 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Fri, 3 May 2013 19:49:12 +0100 Subject: [PATCH] build script - add optional preBuild and postBuild settings, to allow one or more additional commands to be executed as part of a build. could be used to copy builds to a web server, copy additional files (E.g. .htaccess), trigger browser refresh, etc --- build.py | 10 ++++++++++ buildsettings.py | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/build.py b/build.py index 055c2ef8..270acab0 100755 --- a/build.py +++ b/build.py @@ -168,6 +168,11 @@ else: os.makedirs(outDir) +# run any preBuild commands +for cmd in settings.get('preBuild',[]): + os.system ( cmd ) + + # load main.js, parse, and create main total-conversion-build.user.js main = readfile('main.js') @@ -242,4 +247,9 @@ if buildMobile: shutil.copy("mobile/bin/IITC_Mobile-%s.apk" % buildMobile, os.path.join(outDir,"IITC_Mobile-%s.apk" % buildMobile) ) +# run any postBuild commands +for cmd in settings.get('postBuild',[]): + os.system ( cmd ) + + # vim: ai si ts=4 sw=4 sts=4 et diff --git a/buildsettings.py b/buildsettings.py index 9735ea9f..986b44e9 100644 --- a/buildsettings.py +++ b/buildsettings.py @@ -2,6 +2,14 @@ # if you want to have custom builds, copy this file to "localbuildsettings.py" and make changes there. +# possible fields: +# resourceBaseUrl - optional - the URL base for external resources (all resources embedded in standard IITC) +# distUrlBase - optional - the base URL to use for update checks +# buildMobild - optional - if set, mobild builds are built with 'ant'. requires the Android SDK and appropriate mobile/local.properties file configured +# preBuild - optional - an array of strings to run as commands, via os.system, before building the scripts +# postBuild - optional - an array of string to run as commands, via os.system, after all builds are complete + + buildSettings = { # local: use this build if you're not modifying external resources # no external resources allowed - they're not needed any more @@ -40,6 +48,7 @@ buildSettings = { } + # defaultBuild - the name of the default build to use if none is specified on the build.py command line # (in here as an example - it only works in localbuildsettings.py) #defaultBuild = 'local'