[ALOY-351] Only include sync adapters when necessary
GitHub Issue | n/a |
---|---|
Type | Sub-task |
Priority | Low |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2013-08-07T20:59:07.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.3.0 |
Components | Models, Runtime |
Labels | n/a |
Reporter | Tony Lukasavage |
Assignee | Unknown |
Created | 2012-10-29T18:47:31.000+0000 |
Updated | 2018-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.
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.
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
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
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.