Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4764] Tooling: Create script to allow the user to add default platform resources to an existing project

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-05-09T14:00:28.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sRelease 2.1.0, Sprint 2012-10 Core
ComponentsTooling
Labelscore
ReporterIngo Muschenetz
AssigneeBill Dawson
Created2011-07-25T13:05:22.000+0000
Updated2012-07-23T18:38:32.000+0000

Description

Steps to highlight the issue:

Create a new Titanium Mobile Project, choosing "android" as a project deployment target

Later, decide that you wish to additionally target iOS development. At this point, the user must manually copy over the default project resources from the /support/iphone/resources directory. Within Studio, they will also have to tweak the tiapp.xml file.

Re-running builder.py is not possible, as the tiapp.xml file (as well as other files) may have already been modified. Suggest creating a script that allows the user to add these default platform resources to a pre-existing project.

Comments

  1. Ingo Muschenetz 2012-05-01

    I'm being asked to move this into Q2...is that a feasible timeline?
  2. Vishal Duggal 2012-05-04

    This is a blocker for studio for the Q2 plan
  3. Bill Dawson 2012-05-08

    Project.py now accepts a {noformat}-u{noformat} or {noformat}--update-platforms{noformat} command-line option. That first one up there is supposed to be "single dash u". I'm tired of trying to figure out how to get it to display in JIRA.

    Testing Notes

    * Use Titanium Studio to create a project that only targets Android. * Edit tiapp.xml and make some kind of change -- we'll be testing later that whatever you do in this step won't be overwritten/discarded. * Edit app.js and make some changes -- again, we'll be testing later if these changes persist. * Assume you are an app developer who doesn't want the default KS_nav_ui.png and KS_nav_views.png in her project. Delete those files. Later we will test that those files don't magically reappear when we add another platform to the project. * Add any file you want to the Resources/android folder. Later we'll check that it's still there. * Build and launch the Android application. This is simply testing that I didn't break anything. Now you're going to test the new functionality, namely, adding another platform to the project without mucking up everything you've done so far. For this step you have to use the command-line rather than Studio since Studio isn't yet aware of the "-u" flag. * Go to a Terminal window and run project.py manually such as here, substituting the bracketed placeholders of course:
       $ python [path-to-project.py] [project-name] [project-id] [parent-of-project-folder] iphone -u
       
    For my testing, I had created a project named "timob4764" and with id "com.billdawson.timob4764", so my test for adding the iphone platform was...
       $ python "/Library/Application Support/Titanium/mobilesdk/osx/DEV_2.1.X/project.py" timob4764 com.billdawson.timob4764 /Users/bill/projects/ti iphone -u
       
    * After running that, open tiapp.xml and make sure any changes you had previously made are still intact. * Open app.js and also make sure your changes are intact. * Make sure KS_nav_ui.png and KS_nav_views.png are still *not* there. * Make sure whatever file you added to Resources/android is still there. * Have a look in the Resources/iphone directory. Make sure "stuff" is in there. This confirms that the addition of the iphone platform to the project has resulted in the iphone's project setup code being run properly, and all the iphone default files are in there.

    Some Notes

    * The only change to the project.py command line options was the addition of the optional -u. That means everything else should be called in the same old way and in the same old positions. * That means that you could have also added mobileweb to the command line when adding the iphone platform, and then you would have added both iphone and mobileweb. E.g.,
       $ python "/Library/Application Support/Titanium/mobilesdk/osx/DEV_2.1.X/project.py" timob4764 com.billdawson.timob4764 /Users/bill/projects/ti iphone mobileweb -u
       
    * You also could have re-specified android on the command line:
       $ python "/Library/Application Support/Titanium/mobilesdk/osx/DEV_2.1.X/project.py" timob4764 com.billdawson.timob4764 /Users/bill/projects/ti android iphone mobileweb -u
       
    This would *not* have harmed/overwritten any work you've done in the Resources/android folder so far (it only messes with that folder if it doesn't exist.) * This means that Studio can safely run the "-u" variant of project.py with all of the platforms that the user has checked off.
  4. Bill Dawson 2012-05-08

    Pull request ready https://github.com/appcelerator/titanium_mobile/pull/2147
  5. Wilson Luu 2012-06-06

    Closing feature. Following Bill's testing notes, I was able to add back and relaunch the default platforms (Android, iOS, and Mobile Web). Tested on: SDK build: 2.1.0.v20120605190238 Titanium Studio, build: 2.1.0.201206051612 Runtime: v8 xcode: 4.3.2 Devices: droid 1 (2.2.3), Emulator 2.2, iphone 4s verizon (5.0.1), Simulator 5.1, Chrome (Version 19.0.1084.54)

JSON Source