Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5358] titanium.py script doesn't exit with non-zero exit code when failing to create module project

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2011-10-05T10:20:40.000+0000
Affected Version/sRelease 1.7.2
Fix Version/sSprint 2011-40, Release 1.8.0
ComponentsTooling
Labelsmodule, module.py, modules
ReporterChristopher Williams
AssigneeBill Dawson
Created2011-09-26T08:28:47.000+0000
Updated2011-12-21T15:28:35.000+0000

Description

I'm trying to work on module tooling in Titanium Studio and while testing generation of an Android mobile module project I ended up with an empty directory. After debugging, I see that the underlying process is returning a 0 exit code, but is actually failing. We typically use the exit code as an indicator of success or failure for native processes, and bubble up the failure based on that. In this case we got a 0 so we assumed success and never notified the user of the root cause. Here's what I saw as the output of the process in the debugger:
Traceback (most recent call last):
File "/Library/Application Support/Titanium/mobilesdk/osx/1.7.2/module/module.py", line 319, in <module>
main(sys.argv)
File "/Library/Application Support/Titanium/mobilesdk/osx/1.7.2/module/module.py", line 316, in main
module = ModuleProject(config['platform'],project_dir,config)
File "/Library/Application Support/Titanium/mobilesdk/osx/1.7.2/module/module.py", line 63, in __init__
self.platform_delegate = ModulePlatform.create_platform(platform, project_dir, config, self)
File "/Library/Application Support/Titanium/mobilesdk/osx/1.7.2/module/module.py", line 34, in create_platform
return platform_module_class(project_dir, config, module)
File "/Library/Application Support/Titanium/mobilesdk/osx/1.7.2/module/android/android.py", line 26, in __init__
print "[ERROR] Couldn't find the Google APIs r%s add-on directory" % self.sdk.DEFAULT_API_LEVEL
AttributeError: AndroidSDK instance has no attribute 'DEFAULT_API_LEVEL'
Created android module project null

Comments

  1. Bill Dawson 2011-10-04

    To test: * In your Android SDK folders, rename the add-ons/addon_google_apis_google_inc_7 folder so that it can't be found by the scripts. I.e., rename it to anything you want. * run this command in your terminal (if you're running OSX, if not please adjust the command intelligently :) -- and if your android sdk is not in /opt/android-sdk-mac_x86, you'll need to change that too in this command. Also you need to either make sure titanium is aliased to the titanium.py file in your installed 1.8.0 mobilesdk or otherwise give a complete path to it.):
       titanium create --type=module --platform=android --android=/opt/android-sdk-mac_86 --name=testmod --id=ti.testmod
       
    You should see an error similar to what Chris describes in the Description field of this JIRA ticket. * run echo $? to check the return value, and you'll see in the failcase that it is 0. When testing the fix, it should be 1. * Don't forget to put your add-ons/addon_google_apis_google_inc_7 folder back where it belongs when you're done testing. :)
  2. Bill Dawson 2011-10-04

    Pull request ready: https://github.com/appcelerator/titanium_mobile/pull/527
  3. Natalie Huynh 2011-12-21

    Tested with 1.8.0.1.v20111220190134 when build fails echo $? returns 1 and when it passes it will return 0

JSON Source