{ "id": "141553", "key": "ALOY-1206", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "16692", "name": "Alloy 1.7.0", "archived": false, "released": true, "releaseDate": "2015-07-22" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-01-13T08:09:27.000+0000", "created": "2014-12-12T22:04:41.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "compiler", "optimalization" ], "versions": [ { "id": "16595", "name": "Alloy 1.5.1", "archived": false, "released": true, "releaseDate": "2014-10-01" } ], "issuelinks": [], "assignee": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "updated": "2015-01-13T08:09:27.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": "13604", "name": "Tooling", "description": "Items related to Alloy tooling and workflow" } ], "description": "When building for a different target environment (development, test or production) conditional code in {{app/alloy.js}} is not updated in {{Resources/\\[platform\\]/app.js}}. This can cause serious errors when relying on the conditions for particular behaviour in ad-hoc and app store builds.\r\n\r\nh1. Test case\r\n\r\n1. Create a project: {{ti create -t app -p ios -n conditions --id test.conditions -d .}}\r\n2. Make it Alloy: {{cd conditions && alloy new}}\r\n3. Insert the following snippet in both {{app/alloy.js}} and {{app/controllers/index.js}}:\r\n\r\n{code:javascript}\r\nif (ENV_PRODUCTION) console.debug('if (ENV_PRODUCTION)');\r\nif (ENV_TEST) console.debug('if (ENV_TEST)');\r\nif (ENV_DEV) console.debug('if (ENV_DEVELOPMENT)');\r\n{code}\r\n\r\n4. Build the production for Simulator: {{ti build -p ios -b}}\r\n5. Confirm that both {{Resources/iphone/app.js}} and {{Resources/iphone/alloy/controllers/index.js}} only have {{console.debug(\"if (ENV_DEVELOPMENT)\");}} which is correct\r\n6. Build for ad-hoc or to device: {{ti build -p ios --target dist-adhoc}}\r\n7. Confirm that {{Resources/iphone/app.js}} still has {{console.debug(\"if (ENV_DEVELOPMENT)\");}} while {{Resources/iphone/alloy/controllers/index.js}} is correctly updated to have {{console.debug(\"if (ENV_PRODUCTION)\");}}", "attachment": [], "flagged": false, "summary": "Alloy compiler doesn't regenerate controllers if only change is made to the distribution target", "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": "Alloy 1.5.1", "closedSprints": [ { "id": 302, "state": "closed", "name": "2015 Sprint 01 Tooling", "startDate": "2015-01-03T17:30:00.000Z", "endDate": "2015-01-17T01:00:00.000Z", "completeDate": "2015-01-17T00:48:12.296Z", "originBoardId": 121 } ], "comment": { "comments": [ { "id": "336783", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Alloy's compilation process attempts to speed the operation by skipping some portions of the process if files are reasonably expected to be unchanged. The algorithm does not currently consider build target changes, though it appears it should.\r\n\r\nAs a workaround, update one or more JS files in your app so that the app's controllers are regenerated with the updated values.", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-12-17T16:35:16.000+0000", "updated": "2014-12-17T16:35:16.000+0000" }, { "id": "336985", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "That workaround doesn't work... it's about the {{alloy.js}}.\r\n\r\nThe related code is at:\r\nhttps://github.com/appcelerator/alloy/blob/master/Alloy/commands/compile/index.js#L349-L352", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2014-12-18T08:53:24.000+0000", "updated": "2014-12-18T08:53:24.000+0000" }, { "id": "337608", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "PR https://github.com/appcelerator/alloy/pull/646 \r\n\r\nWhat I've done is update the Orphanage / controller-reuse logic to always regenerate app.js & controllers/index.js when building for something other than a development target (test, dist-adhoc, dist-appstore, etc.). \r\n\r\nFunctional test using Fokke's steps above. Additionally, you can/should check that controllers are regenerated with {{ti build -p ios -T device}}", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-12-29T21:59:35.000+0000", "updated": "2014-12-29T21:59:35.000+0000" }, { "id": "338846", "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-01-13T08:09:17.000+0000", "updated": "2015-01-13T08:09:17.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }