{ "id": "143958", "key": "ALOY-1235", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2015-02-01T14:30:29.000+0000", "priority": null, "labels": [ "Alloy.CFG", "config.json", "theme" ], "versions": [], "issuelinks": [], "assignee": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "updated": "2015-02-09T16:45:30.000+0000", "status": { "description": "This issue was once resolved, but the resolution was deemed incorrect. From here issues are either marked assigned or resolved.", "name": "Reopened", "id": "4", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "13604", "name": "Tooling", "description": "Items related to Alloy tooling and workflow" } ], "description": "Currently, Alloy does a (shallow) merge of the different sections of the app's {{config.json}} and an optional theme {{config.json}} in the following [hard-coded|https://github.com/appcelerator/alloy/blob/master/Alloy/commands/compile/compilerUtils.js#L765-L846] order:\r\n\r\n* global\r\n* env:*\r\n* os:*\r\n* env:* os:*\r\n* os:* env:*\r\n\r\nI'd suggest the following change:\r\n\r\nLoop the {{config.json}} sections in the order in which they appear in the file and merge them when the conditions are met, just like we do with conditions in TSS and JS.\r\n\r\nExample:\r\n\r\n{code}\r\n{\r\n \"global\": {\r\n \"foo\": 1\r\n },\r\n \"env:test os:ios\": {\r\n \"foo\": 2\r\n }\r\n}\r\n{code}\r\n\r\nWould be handles as if you'd do this in a JS file:\r\n\r\n{code}\r\nvar cfg = \r\nif (true) {\r\n _.extend(cfg, { foo: 1 });\r\n}\r\nif (ENV_TEST && OS_IOS) {\r\n _.extend(cfg, { foo: 2 });\r\n}\r\n{code}\r\n\r\nUse case:\r\n\r\nThis is more transparent to the developer to see what the value will be if multiple sections are valid for the target environment and platform. It will also make it easier (less code) to introduce a new condition, as requested in ALOY-1210.", "attachment": [], "flagged": false, "summary": "Alloy: Improve how config.json conditions are handled", "creator": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "master", "comment": { "comments": [ { "id": "341569", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Sorry, I guess this tickets needs to be moved to TC.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-02-01T14:31:35.000+0000", "updated": "2015-02-01T14:31:35.000+0000" }, { "id": "341637", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Original Reporter: Fokke Zandbergen", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2015-02-02T17:00:49.000+0000", "updated": "2015-02-02T17:00:49.000+0000" }, { "id": "342525", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "This is a duplicate of ALOY-1199", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2015-02-09T14:51:17.000+0000", "updated": "2015-02-09T14:51:17.000+0000" }, { "id": "342538", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~skypanther] please not that this ticket is only duplicate to ALOY-1199 in part. Only the second of the 2 suggested changes is. The first one I'd still like to see implemented as well.\r\n\r\nWhat's the correct procedure? Can I just reopen and change the ticket to only be about the first item? Or should you?", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-02-09T16:04:47.000+0000", "updated": "2015-02-09T16:04:47.000+0000" }, { "id": "342540", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Yes, please feel free to reopen tickets that you think were resolved incorrectly. Let me know if you don't have permissions to do so. Sorry I missed that only part of this was covered by ALOY-1199.", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2015-02-09T16:07:42.000+0000", "updated": "2015-02-09T16:07:42.000+0000" }, { "id": "342542", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Reopening because only part of the ticket duplicates by ALOY-1199.\r\n\r\nI'll edit and take out the duplicate part.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-02-09T16:36:55.000+0000", "updated": "2015-02-09T16:36:55.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }