build system updates, for mobile builds
- main build.py will optionally build mobile. removed now obsolete mobile build scripts and symbolic links - external resource URL is now optional - it's no longer needed by the regular builds
This commit is contained in:
parent
270905c83a
commit
60444c9169
37
build.py
37
build.py
@ -8,6 +8,7 @@ import base64
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
# load settings file
|
# load settings file
|
||||||
@ -49,9 +50,9 @@ buildDate = time.strftime('%Y-%m-%d-%H%M%S',utcTime)
|
|||||||
dateTimeVersion = time.strftime('%Y%m%d.%H%M%S',utcTime)
|
dateTimeVersion = time.strftime('%Y%m%d.%H%M%S',utcTime)
|
||||||
|
|
||||||
# extract required values from the settings entry
|
# extract required values from the settings entry
|
||||||
resourceUrlBase = settings['resourceUrlBase']
|
resourceUrlBase = settings.get('resourceUrlBase')
|
||||||
distUrlBase = settings['distUrlBase']
|
distUrlBase = settings.get('distUrlBase')
|
||||||
|
buildMobile = settings.get('buildMobile')
|
||||||
|
|
||||||
|
|
||||||
def readfile(fn):
|
def readfile(fn):
|
||||||
@ -90,7 +91,13 @@ def doReplacements(script,updateUrl,downloadUrl):
|
|||||||
|
|
||||||
script = script.replace('@@BUILDDATE@@', buildDate)
|
script = script.replace('@@BUILDDATE@@', buildDate)
|
||||||
script = script.replace('@@DATETIMEVERSION@@', dateTimeVersion)
|
script = script.replace('@@DATETIMEVERSION@@', dateTimeVersion)
|
||||||
|
|
||||||
|
if resourceUrlBase:
|
||||||
script = script.replace('@@RESOURCEURLBASE@@', resourceUrlBase)
|
script = script.replace('@@RESOURCEURLBASE@@', resourceUrlBase)
|
||||||
|
else:
|
||||||
|
if '@@RESOURCEURLBASE@@' in script:
|
||||||
|
raise Exception("Error: '@@RESOURCEURLBASE@@' found in script, but no replacement defined")
|
||||||
|
|
||||||
script = script.replace('@@BUILDNAME@@', buildName)
|
script = script.replace('@@BUILDNAME@@', buildName)
|
||||||
|
|
||||||
script = script.replace('@@UPDATEURL@@', updateUrl)
|
script = script.replace('@@UPDATEURL@@', updateUrl)
|
||||||
@ -151,4 +158,28 @@ for fn in glob.glob("plugins/*.user.js"):
|
|||||||
saveScriptAndMeta(script, os.path.join(outDir,fn), os.path.join(outDir,metafn))
|
saveScriptAndMeta(script, os.path.join(outDir,fn), os.path.join(outDir,metafn))
|
||||||
|
|
||||||
|
|
||||||
|
# if we're building mobile too
|
||||||
|
if buildMobile:
|
||||||
|
if buildMobile not in ['debug','release']:
|
||||||
|
raise Exception("Error: buildMobile must be 'debug' or 'release'")
|
||||||
|
|
||||||
|
# first, copy the IITC script into the mobile folder. create the folder if needed
|
||||||
|
try:
|
||||||
|
os.makedirs("mobile/assets")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
shutil.copy(os.path.join(outDir,"total-conversion-build.user.js"), "mobile/assets/iitc.js")
|
||||||
|
|
||||||
|
# TODO? also copy plugins - once the mobile app supports plugins, that is
|
||||||
|
|
||||||
|
|
||||||
|
# now launch 'ant' to build the mobile project
|
||||||
|
retcode = subprocess.call(["ant", "-buildfile", "mobile/build.xml", buildMobile])
|
||||||
|
|
||||||
|
if retcode != 0:
|
||||||
|
print ("Error: mobile app failed to build. ant returned %d" % retcode)
|
||||||
|
else:
|
||||||
|
shutil.copy("mobile/bin/IITC_Mobile-%s.apk" % buildMobile, os.path.join(outDir,"IITC_Mobile-%s.apk" % buildMobile) )
|
||||||
|
|
||||||
|
|
||||||
# vim: ai si ts=4 sw=4 sts=4 et
|
# vim: ai si ts=4 sw=4 sts=4 et
|
||||||
|
@ -4,19 +4,29 @@
|
|||||||
|
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
# local: use this build if you're not modifying external resources
|
# local: use this build if you're not modifying external resources
|
||||||
# external resources will be loaded from the public live release
|
# no external resources allowed - they're not needed any more
|
||||||
'local': {
|
'local': {
|
||||||
'resourceUrlBase': 'http://iitc.jonatkins.com/release',
|
'resourceUrlBase': None,
|
||||||
'distUrlBase': None,
|
'distUrlBase': None,
|
||||||
},
|
},
|
||||||
|
|
||||||
# local8000: if you need to modify external resources, this build will load them from
|
# local8000: if you need to modify external resources, this build will load them from
|
||||||
# the web server at http://0.0.0.0:8000/dist
|
# the web server at http://0.0.0.0:8000/dist
|
||||||
|
# (This shouldn't be required any more - all resources are embedded. but, it remains just in case some new feature
|
||||||
|
# needs external resources)
|
||||||
'local8000': {
|
'local8000': {
|
||||||
'resourceUrlBase': 'http://0.0.0.0:8000/dist',
|
'resourceUrlBase': 'http://0.0.0.0:8000/dist',
|
||||||
'distUrlBase': None,
|
'distUrlBase': None,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# mobile: default entry that also builds the mobile .apk
|
||||||
|
# you will need to have the android-sdk installed, and the file mobile/local.properties created as required
|
||||||
|
'mobile': {
|
||||||
|
'resourceUrlBase': None,
|
||||||
|
'distUrlBase': None,
|
||||||
|
'buildMobile': 'debug',
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
# if you want to publish your own fork of the project, and host it on your own web site
|
# if you want to publish your own fork of the project, and host it on your own web site
|
||||||
# create a localbuildsettings.py file containing something similar to this
|
# create a localbuildsettings.py file containing something similar to this
|
||||||
|
1
mobile/.gitignore
vendored
1
mobile/.gitignore
vendored
@ -6,3 +6,4 @@ gen/
|
|||||||
libs/
|
libs/
|
||||||
proguard-project.txt
|
proguard-project.txt
|
||||||
local.properties
|
local.properties
|
||||||
|
assets/iitc.js
|
||||||
|
@ -1 +0,0 @@
|
|||||||
../../build/local8000/total-conversion-build.user.js
|
|
@ -1,10 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
cd `dirname "$0"`
|
|
||||||
cd ..
|
|
||||||
./build.py local8000
|
|
||||||
cd build/local8000
|
|
||||||
cd ../../mobile
|
|
||||||
ant debug
|
|
Loading…
x
Reference in New Issue
Block a user