Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5888] MobileWeb: Build system does not support dynamic filenames in Ti.includes

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2011-11-15T15:54:22.000+0000
Affected Version/sRelease 1.8.0
Fix Version/sSprint 2011-45, Release 1.8.0.1
ComponentsMobileWeb
Labelsstage
ReporterChris Barber
AssigneeChris Barber
Created2011-10-27T12:53:23.000+0000
Updated2017-03-04T00:17:39.000+0000

Description

The build system attempts to scan the user's application code for all Ti.includes, then will serialize the contents of those includes into the compiled titanium.js. The problem is when you try to include a file that is dynamically defined:
Ti.include(path + "somefile.js");
The problem takes place in the expand_ti_includes() function of compiler.py. It's important that the function analyzes the filename and determine if it's a valid filename and that the file exists. If it isn't or doesn't exist, don't error, just return. If it does exist, then add it to self.ti_includes[src]. You'll have to test this by building a dummy app and creating a dynamic include, then building the mobile web app. You will need to run builder.py from the command line to see any errors. You can open the compiled titanium.js file to confirm the includes have been found and inlined properly at the bottom like this:
Ti._5.setLoadedScripts({"shibby.js": "Ti.API.log(\"hi!\");"});

Comments

  1. Chris Barber 2011-11-05

    This mechanism needs to also work with require() calls.
  2. Bryan Hughes 2011-11-11

    Pull request: https://github.com/appcelerator/titanium_mobile/pull/673
  3. Bryan Hughes 2011-11-15

    Updated pull request: https://github.com/appcelerator/titanium_mobile/pull/703 (I accidentally closed the previous pull request while working on TIMOB-6018)
  4. Lee Morris 2017-03-04

    Closing ticket due to MobileWeb no longer being supported.

JSON Source