Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9524] iOS: Support multiple JS files per module

GitHub Issuen/a
TypeSub-task
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-09-16T23:06:32.000+0000
Affected Version/sRelease 2.1.0, Release 2.1.4, Release 3.1.1, Release 3.1.2
Fix Version/sSprint 2012-14 Core, Release 3.0.0
ComponentsiOS
Labelscore
ReporterStephen Tramer
AssigneeStephen Tramer
Created2012-06-13T16:02:18.000+0000
Updated2016-05-16T17:42:24.000+0000

Description

See umbrella bug for description. MobileWeb has already implemented this; see the ticket for the full details, but the general structure is: * require('module.id') requires the main module JS * require('module.id/sub-lib') requires the JS file 'sub-lib.js' which is loaded in the module Introducing this may require some significant changes in iOS' module-loading infrastructure.

Attachments

FileDateSize
assets.tar.gz2012-06-15T18:23:18.000+0000882
test.zip2013-08-21T10:56:04.000+0000116297
testone.zip2013-08-21T10:56:04.000+0000107267
timob9524.tar.gz2012-07-12T17:12:37.000+00002315040

Comments

  1. Stephen Tramer 2012-06-15

    TESTING

    ----

    Module build

    Create a new module project for iOS with the id com.foo.bar - only the ID matters. This module MUST be created with 2.1.0 SDK being tested with.

    Download the attached assets.tar.gz

    untar assets.tar.gz in the directory of the new module project

    run the module's build.py

    *PASS*:

    The module has built correctly

    The module's ComFooBarModuleAssets file contains:

    #* A nontrivial moduleAsset method #* A nontrivial resolveModuleAsset: method which contains the hash keys: #** com_foo_bar_js #** test1_js #** subdir/test2_js Once the module build passes testing, install it in ~/Library/Application Support/Titanium in the usual way.

    Project (2.1.0)

    Download the attached timob9524.tar.gz and untar it

    Import the resulting directory into TiStudio

    Run project

    *PASS:* The console output from the app will include the following:
       [INFO] foo.foo:
       [INFO] bar
       [INFO] foo.dorp:
       [INFO] dorp
       [INFO] mod.test:
       [INFO] hellz yes
       [INFO] woo :)
       [INFO] Fold Goggold Jeff Goldgate Jeff Jeffgold Foldgold Blumgold Cool Jeffjeff Gatecool Game Coolcold Blum Gateblum Coolgold Goldjeff Game Gamegame Gate Oldgold Jeff Goldblast Jeff Gotgamesgold. Cool cool cool game.
       [INFO] woo.woo:
       [INFO] woo :)
       [INFO] jeff.gamegold:
       [INFO] Fold Goggold Jeff Goldgate Jeff Jeffgold Foldgold Blumgold Cool Jeffjeff Gatecool Game Coolcold Blum Gateblum Coolgold Goldjeff Game Gamegame Gate Oldgold Jeff Goldblast Jeff Gotgamesgold. Cool cool cool game.
       
    This looks redundant but tests ALL of the following features: * Relative pathing outside modules * Relative pathing inside modules * Absolute pathing outside modules * Absolute pathing inside modules * Loading module resource before module * Loading module as module.id/module.id *IMPORTANT*: These modules are NOT compatible with any earlier versions of the SDK; this is both because of symbol loading errors, and because any module which loads resources outside of its main asset file will generate an exception.
  2. Stephen Tramer 2012-06-15

    Module assets and timob project for testing.
  3. Blain Hamon 2012-07-13

    Pull#2414 merged.
  4. Martin Guillon 2013-03-24

    I just tried to do that and my "resolveModuleAsset" does not get filled with my modules js files I cant find where that method gets filled in the build process. Any help? THanks
  5. Martin Guillon 2013-03-24

    Got it working, it was jspacker which wasnt liking some of my js files. Running from inside xcode you dont see the error from jspacker. Have to do it from the commandline
  6. Jonathan Beebe 2013-05-20

    Following the described steps in SDK 3.1.0.GA , this doesn't seem to be working. I think the culprit may be changes to the build.py script.
  7. Ashish Nigam 2013-08-21

    Issue remains open for new SDK, tested on 2.1.4.GA and 3.1.2.GA SDK.
  8. Ashish Nigam 2013-08-21

    I tested the attached module zip (test(3.1.2.GA SDK) and testone(2.1.4.GA SDK)) using 3.1.2.GA and 2.1.4.GA SDK and issue is still reproducible using them.
  9. Varun Joshi 2013-09-12

    This problem was fixed if I required all the files under the native module like this: var woo = require('/test1'); var jeff = require('/subdir/test2'); Requiring the files without specifying the module name will not work. This ticket can be closed.
  10. Eric Merriman 2013-09-16

    Closing based on Varun's comment.
  11. ralph valeriote 2013-09-27

    I am not able to get this to work. I've tried the posted solution without luck. Can someone post a working example? Varun?
  12. Varun Joshi 2013-09-27

    Ralph, Did you try with the suggestion posted? Here is a working module https://www.dropbox.com/s/ui2j55dgi455q7q/TestModule.zip To test, you can just use the sample app provided in this ticket.

JSON Source