Titanium JIRA Archive
Alloy (ALOY)

[ALOY-351] Only include sync adapters when necessary

GitHub Issuen/a
TypeSub-task
PriorityLow
StatusResolved
ResolutionFixed
Resolution Date2013-08-07T20:59:07.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.3.0
ComponentsModels, Runtime
Labelsn/a
ReporterTony Lukasavage
AssigneeUnknown
Created2012-10-29T18:47:31.000+0000
Updated2018-03-07T22:25:45.000+0000

Description

Currently all Alloy builtin sync adapters are included in built applications. We should inspect the application's models and include only the sync adapters which are necessary to run the app. This will reduce both compile time and the overall size of the app.

Comments

  1. Tony Lukasavage 2012-11-06

    The only reasonable to do this now would be to inspect the model files and look for the adapters used. Unfortunately since models are defined as JS and not JSON, we'd need to parse the file into AST and look for the adapter type that way. That would defeat the purpose of this ticket which is decreasing the amount of JS files processed as AST. We'll defer this ticket until we can come up with a more creative, faster way to determine which adapters to include. One thought would be to add an *adapters* field to the config.json where the developer could specify which adapters the app will use. If the *adapters* field is absent, import all adapters just as we do now.
  2. Tony Lukasavage 2013-08-07

    PR: https://github.com/appcelerator/alloy/pull/213 test app: https://github.com/appcelerator/alloy/tree/master/test/apps/testing/ALOY-351 Functional testing should be confirmed on all supported platform. Follow these steps with the given test app.

    Run the test app

    Inspect the compile log. Make sure that no sync adapters were copied into the project or optimized.

    Add one more sync adapters to the "adapters" array in the config.json file

       {
         "adapters": ["sql","properties"]
       }
       

    Compile the app again. Ensure that only the "sql" and "properties" adapter were copied into the project, and that those were the only adapters optimized.

    Remove "properties" from the config.json

       {
         "adapters": ["sql"]
       }
       

    Ensure that the "properties" adapter was removed from the project, that the "sql" adapter remains in it, and that the "sql" adapter is the only adapter that gets optimized.

JSON Source