{ "id": "121319", "key": "ALOY-850", "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": [], "resolution": { "id": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2013-10-18T18:01:50.000+0000", "created": "2013-10-17T13:55:11.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "alloy", "compiler", "platform" ], "versions": [], "issuelinks": [], "assignee": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-06-22T13:23:13.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "13604", "name": "Tooling", "description": "Items related to Alloy tooling and workflow" } ], "description": "I'm all for using {{[platform=ios]}} and so, but I wonder if the Alloy compiler could take away the need to do that for the very simple and very common case where in TSS, but also in JS/XML you would use platform specific constants that don't exist if you don't build for that platform.\r\n\r\nh1. Example code\r\n\r\n1. Create a new project: {{titanium create -p android,ios -n ns --id ti.ns -d .}}\r\n2. Initialize Alloy: {{cd ns && alloy new}}\r\n3. Replace the contents of {{index.tss}} with:\r\n {code:css}\r\n \".container\": {\r\n statusBarStyle: Titanium.UI.iPhone.statusBarStyle.LIGHT_CONTENT\r\n }\r\n {code}\r\n4. Build for Android: {{titanium build -p android -T device}}\r\n5. The app will crash with:\r\n {code:bash}\r\n 10-17 15:39:40.420: E/TiExceptionHandler(12559): (main) [152,152] ----- Titanium Javascript Runtime Error -----\r\n 10-17 15:39:40.425: E/TiExceptionHandler(12559): (main) [0,152] - In alloy/controllers/index.js:15,58\r\n 10-17 15:39:40.425: E/TiExceptionHandler(12559): (main) [1,153] - Message: Uncaught TypeError: Cannot read property 'LIGHT_CONTENT' of undefined\r\n 10-17 15:39:40.425: E/TiExceptionHandler(12559): (main) [0,153] - Source: statusBarStyle: Titanium.UI.iPhone.statusBarStyle.LIGHT_CONTENT,\r\n 10-17 15:39:40.450: W/ResourceType(12559): Failure getting entry for 0x010802c0 (t=7 e=704) in package 0 (error -75)\r\n 10-17 15:39:40.455: E/V8Exception(12559): Exception occurred at alloy/controllers/index.js:15: Uncaught TypeError: Cannot read property 'LIGHT_CONTENT' of undefined\r\n {code}\r\n\r\nh1. Possible solutions\r\nThe TSS/XML/JS parsers could check for references to these platform specific constants and then just replace them with {{null}} (or {{undefined}}?) when that specific platform is not targeted.", "attachment": [], "flagged": false, "summary": "Alloy: Automatically remove constants for platforms not targeted on compile", "creator": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "environment": "Alloy 1.2.2", "comment": { "comments": [ { "id": "275687", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I don't see a reason to do this, particularly when it will increase compile time, when the device query is already readily available. ", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-18T18:01:50.000+0000", "updated": "2013-10-18T18:01:50.000+0000" }, { "id": "275842", "author": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "body": "@Tony - this is a very annoying issue that I have come across myself more than once even though I take care in the code I am creating.\r\n\r\nWhilst it will increase the time to compile - that time must surely be measured in the milliseconds in total. By forcing a code based exception surely there is more code to check against for the compiler - so I would imagine one would cancel the other out.\r\n\r\nAt the most basic level this could be nothing more than \"if constant includes ios/iphone/ipad ignore for others\" and so on.\r\n\r\nI would greatly value this clean-up method being automatic, Alloy is not meant to do our work for us, but it should be able to handle something I find such an obvious feature requirement.\r\n\r\nI vote this is re-opened.", "updateAuthor": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "created": "2013-10-19T10:11:50.000+0000", "updated": "2013-10-19T10:11:50.000+0000" }, { "id": "275845", "author": { "name": "sfeather", "key": "sfeather", "displayName": "Stephen Feather", "active": true, "timeZone": "America/New_York" }, "body": "What is the true time increase on compile?\r\n\r\nWhat is the cost to implement?\r\n\r\nWhat is the cost savings across 1 developer?\r\n\r\nWhat is the cost savings across all developers?", "updateAuthor": { "name": "sfeather", "key": "sfeather", "displayName": "Stephen Feather", "active": true, "timeZone": "America/New_York" }, "created": "2013-10-19T15:00:17.000+0000", "updated": "2013-10-19T15:00:17.000+0000" }, { "id": "275846", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "From your standpoint and role to keep Alloy lean and mean I understand you don't like to add this Tony. However, from a developer stand point this is just another way in which Alloy saves us time and code to write. So I hope you can take a more pragmatic standpoint and allow me to do a PR including test and benchmark.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2013-10-19T15:35:48.000+0000", "updated": "2013-10-19T15:35:48.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }