Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9086] Android: Tooling: project name not respected when creating new module

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-09-04T16:49:23.000+0000
Affected Version/sRelease 2.0.2, Release 2.0.1
Fix Version/sRelease 2.1.0, Sprint 2012-12 Core, Sprint 2012-18 Core
ComponentsTooling
Labelscore, qe-and040912
ReporterDustin Hyde
AssigneeBill Dawson
Created2012-05-09T17:16:51.000+0000
Updated2017-03-06T22:34:58.000+0000

Description

When creating a new module from either the command line or studio, the specified name is not respected. It is replaced by "titanium-". However, the project is initially created with a correct project directory name. Steps to Reproduce: 1. Create an android module (remove it from the project explorer if created in studio). 2. Import the module into studio (note: the module may have to be removed from the workspace directory first). Expected Result: The project name should be the one specified during creation (and the module directory name). Actual Result: The project name is "titanium-".

Attachments

FileDateSize
import android module from workspace.png2012-05-09T17:49:12.000+0000190146
project name not respected.png2012-05-09T17:16:51.000+000028628

Comments

  1. Dustin Hyde 2012-05-09

    This also creates problems when a module is created in studio and saved to the workspace, then reimported from the workspace. The import will fail due to the name conflict, screenshot attached.
  2. Bill Dawson 2012-06-07

    for latest status see also linked issue (TISTUD-1648)
  3. Bill Dawson 2012-06-07

    for latest status see also linked issue (TISTUD-1648)
  4. Bill Dawson 2012-06-08

    Pull request ready: https://github.com/appcelerator/titanium_mobile/pull/2355
  5. Dustin Hyde 2012-08-24

    Reopening, this is not completely fixed. If a new android module is created with uppercase characters, only lowercase characters exist in the module directory and project name. Titanium Studio: 2.1.2.201208201549 Titanium SDK: 2.1.2.v20120821160113 OS: Mountain Lion 10.8.1 Xcode: 4.4 Android SDK: r20.0.3 Android NDK: r8b Browser: Safari 6.0 This is both a parity and usability issue with related consequences.
  6. Chris Barber 2012-08-25

    Just ran across this today in fact. The reason is because module.py (which is called from titanium.py) says:
       self.project_name = config['name'].lower()
       
    So, it would seem this was done by design.
  7. Bill Dawson 2012-08-27

    TIMOB-8056 forced lower-case for android. Any fix for this item will need to test the fail case in TIMOB-8056.
  8. Bill Dawson 2012-08-29

    Testing Notes

    *IMPORTANT NOTE*: Make sure you use the titanium.py in the PR branch! (Some people have titanium.py aliased in their shell (e.g., BASH) -- just make sure you're really using mine when you test.) The command-line invocations in these instructions specify just "titanium.py". If that's not in your PATH (or not aliased somehow) you'll need to adjust the command-line appropriately so that you run the titanium.py in the PR branch.

    Module Creation and Build on Command Line

    iOS

    * Enter the following in a terminal window:
       titanium.py create --type=module --platform=iphone --name=IphoneModule --id=ti.test
       
    * Make sure no errors occur when you enter that. * Make sure the created module directory is named IphoneModule. * Go into the module directory and run python build.py. * There should be no errors and the file ti.test-iphone-0.1.zip should appear in the directory.

    Android

    *NOTE*: Must test on OSX, Linux, Windows!! * Enter the following in a terminal window / command-prompt:
       titanium.py create --type=module --platform=android --name=AndroidModule --id=ti.test
       
    * Make sure no errors occur when you enter that. * Make sure the created module directory is named AndroidModule. * Go into the module directory and run ant. * It should end with "BUILD SUCCESSFUL" and in the dist/ directory you should see androidmodule.jar and ti.test-android-0.1.zip.

    MobileWeb

    *NOTE*: Must test on OSX, Linux, Windows!! * Enter the following in a terminal window / command-prompt:
       titanium.py create --type=module --platform=mobileweb --name=MobileWebModule --id=ti.test
       
    * Make sure no errors occur when you enter that. * Make sure the created module directory is named MobileWebModule. * Go into the module directory and run python build.py. * You should get no errors, and the file ti.test-mobileweb-0.1.zip should be created.

    Module Project Import into Titanium Studio

    iOS

    * In Titanium Studio import the IphoneModule project you created above and accept the default project name it suggests to you. * The project name should be "IphoneModule". * Use Studio's Package menu (in the App Explorer view) to re-package the module. * When it finishes, you should end up with a ti.test-iphone-0.1.zip in whichever directory you told Studio to put it.

    Android

    *NOTE*: Must test on OSX, Linux, Windows!! * In Titanium Studio import the AndroidModule project you created above and accept the default project name it suggests to you. * The project name should be "AndroidModule". * Use Studio's Package menu (in the App Explorer view) to re-package the module. * When it finishes, you should end up with a ti.test-android-0.1.zip in whichever directory you told Studio to put it.

    MobileWeb

    *NOTE*: Must test on OSX, Linux, Windows!! * In Titanium Studio import the MobileWebModule project you created above and accept the default project name it suggests to you. * The project name should be "MobileWebModule". * Use Studio's Package menu (in the App Explorer view) to re-package the module. * When it finishes, you should end up with a ti.test-mobileweb-0.1.zip in whichever directory you told Studio to put it.

    Creation and Build of Module Project in Titanium Studio

    iOS

    * In Studio, create a Titanium Mobile Module Project. * Enter "NewIphoneModule" as the project name and "ti.test2" as the id. * Be sure "iOS" is selected as the deployment target. * Be sure "Titanium SDK Version" points to the build and release of my branch (i.e., be sure you're testing my changes.) * When you're finished, the project name as it appears in the App Explorer (or Project Explorer) should indeed be "NewIphoneModule". * Use Studio's Package menu (in the App Explorer view) to package the module. * When it finishes, you should end up with a ti.test2-iphone-0.1.zip in whichever directory you told Studio to put it.

    Android

    *NOTE*: Must test on OSX, Linux, Windows!! * In Studio, create a Titanium Mobile Module Project. * Enter "NewAndroidModule" as the project name and "ti.test2" as the id. * Be sure "Android" is selected as the deployment target. * Be sure "Titanium SDK Version" points to the build and release of my branch (i.e., be sure you're testing my changes.) * When you're finished, the project name as it appears in the App Explorer (or Project Explorer) should indeed be "NewAndroidModule". * Use Studio's Package menu (in the App Explorer view) to package the module. * When it finishes, you should end up with a ti.test2-android-0.1.zip in whichever directory you told Studio to put it.

    MobileWeb

    *NOTE*: Must test on OSX, Linux, Windows!! * In Studio, create a Titanium Mobile Module Project. * Enter "NewMobileWebModule" as the project name and "ti.test2" as the id. * Be sure "Mobile Web" is selected as the deployment target. * Be sure "Titanium SDK Version" points to the build and release of my branch (i.e., be sure you're testing my changes.) * When you're finished, the project name as it appears in the App Explorer (or Project Explorer) should indeed be "NewMobileWebModule". * Use Studio's Package menu (in the App Explorer view) to package the module. * When it finishes, you should end up with a ti.test2-mobileweb-0.1.zip in whichever directory you told Studio to put it.

    Testing All the Built Modules

    *NOTE* Must test on OSX, Linux and Windows!! * Install all 6 of the module zips you built above as you normally would any module zip. (I.e., on OS X, copy up to /Library/Application Support/Titanium and unzip). When testing on Linux and Windows it will be only 4 zips, of course. * Create a new Titanium Mobile application project in Titanium Studio. Be sure to target the SDK built from the pull request. * Change the tiapp.xml to include the modules. Use either the GUI interface in Studio for it or edit tiapp.xml manually like this:
       <modules>
       	<module platform="iphone" version="0.1">ti.test</module>
       	<module platform="iphone" version="0.1">ti.test2</module>
       	<module platform="android" version="0.1">ti.test</module>
       	<module platform="android" version="0.1">ti.test2</module>
       	<module platform="mobileweb" version="0.1">ti.test</module>
       	<module platform="mobileweb" version="0.1">ti.test2</module>
       </modules>
       
    (Remove the iphone lines on Windows and Linux, of course.) * Replace app.js with this:
       Titanium.UI.setBackgroundColor('#444');
       var win = Titanium.UI.createWindow({  
           title:'Test',
           backgroundColor:'#444',
       	exitOnClose: true
       });
       
       var logLabel;
       
       win.add(logLabel = Ti.UI.createLabel({
       	 backgroundColor: "#444", text: "",
       	 left: 16, right: 16, top: 16, bottom: 16,
       	 verticalAlign: Ti.UI.TEXT_VERTICAL_ALIGNMENT_TOP
       }));
       
       var log = function(s) {
       	Ti.API.info(s);
       	logLabel.text += s + "\n";
       };
       
       var testMod = function(id) {
       	log("From " + id + ": " + require(id).example());
       };
       
       testMod("ti.test");
       testMod("ti.test2");
       
       win.open();
       
    * Run the app on iOS, Android and MobileWeb (when testing on Windows and Linux, of course you don't need to run on iOS). You should get output that looks like:
       From ti.test: hello world
       From ti.test2: hello world
       
  9. Bill Dawson 2012-09-04

    Pull request https://github.com/appcelerator/titanium_mobile/pull/2854
  10. Lee Morris 2017-03-06

    Closing ticket due to time passed.

JSON Source