Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIMOB-10336 support setting multiple deploy types on a module when inclu... #3101

Merged
merged 1 commit into from
Oct 5, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion support/android/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def build_modules_info(self, resources_dir, app_bin_dir, include_all_ti_modules=

# discover app modules
detector = ModuleDetector(self.project_dir)
missing, detected_modules = detector.find_app_modules(self.tiapp, 'android')
missing, detected_modules = detector.find_app_modules(self.tiapp, 'android', self.deploy_type)
for missing_module in missing: print '[WARN] Couldn\'t find app module: %s' % missing_module['id']

self.custom_modules = []
Expand Down
2 changes: 1 addition & 1 deletion support/android/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1948,7 +1948,7 @@ def build_and_run(self, install, avd_id, keystore=None, keystore_pass='tirocks',
# We need to know this info in a few places, so the info is saved
# in self.missing_modules and self.modules
detector = ModuleDetector(self.top_dir)
self.missing_modules, self.modules = detector.find_app_modules(self.tiapp, 'android')
self.missing_modules, self.modules = detector.find_app_modules(self.tiapp, 'android', deploy_type)

self.copy_commonjs_modules()
self.copy_project_resources()
Expand Down
2 changes: 1 addition & 1 deletion support/iphone/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ def log(msg):
force_destroy_build = command!='simulator'

detector = ModuleDetector(project_dir)
missing_modules, modules = detector.find_app_modules(ti, 'iphone')
missing_modules, modules = detector.find_app_modules(ti, 'iphone', deploytype)
module_lib_search_path, module_asset_dirs = locate_modules(modules, project_dir, app_dir, log)
common_js_modules = []

Expand Down
2 changes: 1 addition & 1 deletion support/iphone/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def compileProject(self,xcode=False,devicefamily='ios',iphone_version='iphoneos'
from module import ModuleDetector

detector = ModuleDetector(self.project_dir)
missing_modules, modules = detector.find_app_modules(ti, 'iphone')
missing_modules, modules = detector.find_app_modules(ti, 'iphone', self.deploytype)

# we have to copy these even in simulator given the path difference
if os.path.exists(app_dir):
Expand Down
53 changes: 51 additions & 2 deletions support/module/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def get_desc(self, module_dep, property):
return '<any %s>' % property
return module_dep[property]

def find_app_modules(self, tiapp, platform):
def find_app_modules(self, tiapp, platform, app_deploy_type):
missing = []
modules = []
if 'modules' not in tiapp.properties: return missing, modules
Expand All @@ -259,8 +259,57 @@ def find_app_modules(self, tiapp, platform):
if module == None:
print '[WARN] Could not find Titanium Module id: %s, version: %s, platform: %s' % (module_dep['id'], version_desc, platform_desc)
missing.append(module_dep)

else:
modules.append(module)
valid_module_already_exists = 0

for i in range(len(modules)):
stored_module = modules[i]

# find a duplicate instance of the module already stored
if (stored_module.manifest.moduleid == module.manifest.moduleid) and \
(stored_module.manifest.platform == module.manifest.platform):

# does the new module have a "real" deploy type set?
if module_dep['deploy-type']:
# if the stored module has a default deploy type and the new module has a real deploy type
# make sure the stored module is still valid. IE: the default only works for !production
# when other entries for this module have a real deploy type so the stored module must be
# removed
if (stored_module.deploy_type == None) and (app_deploy_type == 'production'):
# remove the stored module from the stored list
del modules[i]

else:
valid_module_already_exists = 1

else:
valid_module_already_exists = 1

break

if valid_module_already_exists == 0:
is_valid_deploy_type = 0

# if the module doesn't have a "real" deploy type set then it is valid for all app
# deploy types
if module_dep['deploy-type']:
# make sure that the specified module deploy type is valid based on the deploy type of the app
if ((app_deploy_type == 'production') and (module_dep['deploy-type'] == 'production')) or \
((app_deploy_type != 'production') and (module_dep['deploy-type'] != 'production')):

is_valid_deploy_type = 1

else:
print '[DEBUG] Not including module as there is no valid module deploy type for the app deploy type: %s' % app_deploy_type

else:
is_valid_deploy_type = 1


if is_valid_deploy_type:
module.deploy_type = module_dep['deploy-type']
modules.append(module)

return missing, modules

Expand Down
5 changes: 4 additions & 1 deletion support/tiapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,15 @@ def __init__(self, file, parse_only=False):
if module.nodeType == 1:
version = module.getAttribute('version')
platform = module.getAttribute('platform')
deploy_type = module.getAttribute('deploy-type')
module_id = getText(module.childNodes)
self.properties['modules'].append({
'id': module_id,
'version': version,
'platform': platform
'platform': platform,
'deploy-type': deploy_type
})

# handle plugins
elif child.nodeName == 'plugins':
for plugin in child.childNodes:
Expand Down