Skip to content

Commit

Permalink
Merge pull request #3816 from cb1kenobi/timob-12470_3_0_X
Browse files Browse the repository at this point in the history
[TIMOB-12470] Added support for a node_appc_branch option that forces no...
  • Loading branch information
Max Stepanov committed Jan 29, 2013
2 parents ffb007d + f081cf6 commit 5e77024
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
10 changes: 7 additions & 3 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ if ARGUMENTS.get('force_iphone',0):

if ARGUMENTS.get('COMPILER_FLAGS', 0):
flags = ARGUMENTS.get('COMPILER_FLAGS')


node_appc_branch = False
if ARGUMENTS.get('node-appc-branch', 0):
node_appc_branch = ARGUMENTS.get('node-appc-branch')

env = Environment()
Export("env cwd version")
if build_type in ['full', 'android'] and not only_package:
Expand Down Expand Up @@ -165,9 +169,9 @@ def package_sdk(target, source, env):
print "Packaging MobileSDK (%s)..." % version_tag
packager = package.Packager(build_jsca=build_jsca)
if package_all:
packager.build_all_platforms(os.path.abspath('dist'), version, module_apiversion, android, iphone, ipad, mobileweb, version_tag)
packager.build_all_platforms(os.path.abspath('dist'), version, module_apiversion, android, iphone, ipad, mobileweb, version_tag, node_appc_branch)
else:
packager.build(os.path.abspath('dist'), version, module_apiversion, android, iphone, ipad, mobileweb, version_tag)
packager.build(os.path.abspath('dist'), version, module_apiversion, android, iphone, ipad, mobileweb, version_tag, node_appc_branch)
if install and not clean:
install_mobilesdk(version_tag)

Expand Down
16 changes: 11 additions & 5 deletions site_scons/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def zip_mobileweb(zf, basepath, version):
to_ = from_.replace(dir, os.path.join(basepath,'mobileweb'), 1)
zf.write(from_, to_)

def resolve_npm_deps(dir, version):
def resolve_npm_deps(dir, version, node_appc_branch):
package_json_file = os.path.join(dir, 'package.json')
if os.path.exists(package_json_file):
# ensure fresh npm install for everything EXCEPT titanium-sdk
Expand All @@ -351,6 +351,12 @@ def resolve_npm_deps(dir, version):
}
for key in subs:
package_json_contents = package_json_contents.replace(key, subs[key])

if node_appc_branch:
json = simplejson.loads(package_json_contents)
json['dependencies']['node-appc'] = 'git://github.com/appcelerator/node-appc.git#%s' % node_appc_branch
package_json_contents = simplejson.dumps(json, indent=True)

codecs.open(package_json_file, 'w', 'utf-8').write(package_json_contents)

node_installed = False
Expand Down Expand Up @@ -496,16 +502,16 @@ class Packager(object):
def __init__(self, build_jsca=1):
self.build_jsca = build_jsca

def build(self, dist_dir, version, module_apiversion, android=True, iphone=True, ipad=True, mobileweb=True, version_tag=None):
def build(self, dist_dir, version, module_apiversion, android=True, iphone=True, ipad=True, mobileweb=True, version_tag=None, node_appc_branch=False):
if version_tag == None:
version_tag = version

# get all SDK level npm dependencies
resolve_npm_deps(template_dir, version)()
resolve_npm_deps(template_dir, version, node_appc_branch)()

zip_mobilesdk(dist_dir, os_names[platform.system()], version, module_apiversion, android, iphone, ipad, mobileweb, version_tag, self.build_jsca)

def build_all_platforms(self, dist_dir, version, module_apiversion, android=True, iphone=True, ipad=True, mobileweb=True, version_tag=None):
def build_all_platforms(self, dist_dir, version, module_apiversion, android=True, iphone=True, ipad=True, mobileweb=True, version_tag=None, node_appc_branch=False):
global packaging_all
packaging_all = True

Expand All @@ -515,7 +521,7 @@ def build_all_platforms(self, dist_dir, version, module_apiversion, android=True
remove_existing_zips(dist_dir, version_tag)

# get all SDK level npm dependencies
resolve_npm_deps(template_dir, version)()
resolve_npm_deps(template_dir, version, node_appc_branch)()

for os in os_names.values():
zip_mobilesdk(dist_dir, os, version, module_apiversion, android, iphone, ipad, mobileweb, version_tag, self.build_jsca)
Expand Down

0 comments on commit 5e77024

Please sign in to comment.