{ "id": "141852", "key": "ALOY-1210", "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": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-09-30T20:08:25.000+0000", "created": "2014-12-18T09:27:55.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "config.json" ], "versions": [], "issuelinks": [ { "id": "48777", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "150677", "key": "AC-318", "fields": { "summary": "Support AdHoc vs. Production keys in config.json file", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } } ], "assignee": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "updated": "2015-10-09T00:24:06.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "12329", "name": "Runtime", "description": "Generic bucket for uncategorized runtime issues" } ], "description": "Recently, in Alloy 1.4.0 {{DIST_ADHOC}} and {{DIST_STORE}} were added the options for [conditional code in controllers|http://docs.appcelerator.com/titanium/latest/#!/guide/Alloy_Controllers-section-34636384_AlloyControllers-ConditionalCode].\r\n\r\nI'd like to also have support the same conditions in {{config.json}}.\r\n\r\nThe use case would be to have different endpoints, keys or other configuration variables for production ad-hoc builds and production store-builds.\r\n\r\nExample:\r\n\r\n{code}\r\n{\r\n \"global\": {\"foo\":1},\r\n \"env:development\": {\"foo\":2},\r\n \"env:test\":{\"foo\":3},\r\n \"env:production\":{\"foo\":4},\r\n \"os:ios env:production\": {\"foo\":5},\r\n \"os:ios env:development\": {\"foo\":6},\r\n \"os:ios env:test\": {\"foo\":7},\r\n \"os:android\":{\"foo\":8},\r\n \"os:mobileweb\":{\"foo\":9},\r\n \"os:ios dist:adhoc\": {\"foo\":10},\r\n \"os:ios dist:store\": {\"foo\":10},\r\n \"dependencies\": {\r\n \"com.foo.widget\":\"1.0\"\r\n }\r\n} \r\n{code}", "attachment": [], "flagged": false, "summary": "Alloy: Add support for DIST in the Project Configuration File", "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", "closedSprints": [ { "id": 502, "state": "closed", "name": "2015 Sprint 20 Tooling", "startDate": "2015-09-28T16:01:48.429Z", "endDate": "2015-10-10T01:01:00.000Z", "completeDate": "2015-10-12T21:13:39.920Z", "originBoardId": 121 } ], "comment": { "comments": [ { "id": "361110", "author": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "body": "We use different endpoints for AdHoc builds (Installr/TestFlight beta builds) vs our production releases. Currently, we have to manually copy & paste the contents of the config.json file to support such builds. This has resulted in mistakes. While we can use external tooling, like a grunt script, to manipulate the files, it would be best if Alloy itself supported something like:\r\n\r\n{code}\r\n{\r\n \"env:development\": {\"url\":\"https://dev.example.com\"},\r\n \"env:test\":{\"url\":\"https://test.example.com\"},\r\n \"env:production\":{\"url\":\"https://production.example.com\"},\r\n \"dist:adhoc\":{\"url\":\"https://adhoc.example.com\"},\r\n \"dist:store\":{\"url\":\"https://production.example.com\"},\r\n}\r\n{code}\r\n\r\nGiven that we need this support for both iOS and Android, the key can't be {{env:adhoc}} or something iOS-specific. In the above proposal, {{dist:adhoc}} and {{dist:store}} would need to override {{env:production}}. \r\n\r\nAnd yes, I realize that natively Android doesn't have a notion of \"adhoc\" builds. But, I need a signed APK (with our company certificate) that points to our testing endpoints for Installr beta releases...that's exactly what I need for iOS (for Testflight/Installr builds). \r\n", "updateAuthor": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "created": "2015-08-25T13:29:17.000+0000", "updated": "2015-08-25T13:32:36.000+0000" }, { "id": "362233", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "https://github.com/appcelerator/alloy/pull/721\r\n\r\n{{config.json}} now supports {{dist:adhoc}} & {{dist:store}} key. \r\n{code}\r\n{\r\n \"env:development\": {\"url\":\"https://dev.example.com\"},\r\n \"env:test\":{\"url\":\"https://test.example.com\"},\r\n \"env:production\":{\"url\":\"https://production.example.com\"},\r\n \"dist:adhoc\":{\"url\":\"https://adhoc.example.com\"},\r\n \"dist:store\":{\"url\":\"https://production.example.com\"},\r\n}\r\n{code}", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2015-09-03T23:16:27.000+0000", "updated": "2015-09-03T23:16:27.000+0000" }, { "id": "365464", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "PR merged.", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2015-09-30T20:08:25.000+0000", "updated": "2015-09-30T20:08:25.000+0000" }, { "id": "365573", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~fmiao] Looking at https://github.com/appcelerator/alloy/blob/8d32fa1aa0629473ec0eb7ea5c0ca0be32da58da/Alloy/commands/compile/compilerUtils.js#L867-L868 it will only work for {{os:ios dist:adhoc}} and not {{dist:adhoc os:ios}}. And {{env}} is not involved at all. We might have to refactor {{parseConfig()}} this way:\r\n\r\n* Loop through the {{config.json}} keys\r\n* Split on space\r\n* When all {{:}} conditions are true, extend the config object with it\r\n\r\nThis means that the order of the keys in {{config.json}} determine what overwrites what instead of our code. This makes perfect sense I think, although we might want to force {{global}} to always come first.\r\n\r\nLet me know if you need new ticket or can change this PR still.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-10-01T19:33:02.000+0000", "updated": "2015-10-01T19:33:02.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }