{ "id": "129309", "key": "ALOY-999", "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": "2014-04-20T17:07:48.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [ { "id": "15759", "description": "Alloy 1.3.1", "name": "Alloy 1.3.1", "archived": false, "released": true, "releaseDate": "2014-02-10" } ], "issuelinks": [], "assignee": null, "updated": "2018-03-07T22:25:52.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [], "description": "In most build environments constants can be defined at build time. E.g. -D for make. This allows us to define a string such as the Git revision of the build or the build time. It would be great if alloy had this ability.\r\n\r\nI tried doing it via manipulation of config.json in alloy.jmk, but pre-compile is invoked further into the compile process.\r\n\r\nA hook where I could do this would be great:\r\n\r\n{code}\r\ntask(\"pre:true-precompile\",function(event,logger){\r\n var now = new Date();\r\n\r\n // Either this ....\r\n event.alloyConfig.buildDate = now.toUTCString();\r\n\r\n // ... or this\r\n var fs = require('fs');\r\n fs.readFile(event.dir.project + '/app/config.json', function(err, data) {\r\n \tvar config = JSON.parse( data );\r\n\r\n \tconfig.global.buildDate = now.toUTCString();\r\n\r\n \tvar newConfig = JSON.stringify( config, null, 4);\r\n\r\n \tfs.writeFile(event.dir.project + '/app/config.json', newConfig, function (err) {\r\n\t\t if (err) throw err;\r\n\t\t logger.info('New config.json saved.');\r\n\t\t}); \r\n\t});\r\n\r\n});\r\n{code}", "attachment": [], "flagged": false, "summary": "Alloy: Add Compile time defines functionality", "creator": { "name": "ndastur", "key": "ndastur", "displayName": "Neville Dastur", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "ndastur", "key": "ndastur", "displayName": "Neville Dastur", "active": true, "timeZone": "Europe/London" }, "environment": "Mobile apps", "comment": { "comments": [ { "id": "303017", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Moving this improvement request to engineering for further evaluation and prioritization.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-04-30T06:10:13.000+0000", "updated": "2014-04-30T06:10:13.000+0000" }, { "id": "354071", "author": { "name": "ndastur", "key": "ndastur", "displayName": "Neville Dastur", "active": true, "timeZone": "Europe/London" }, "body": "Having passed 1st year anniversary I thought I would ask if it was for consideration? Thanks ;)", "updateAuthor": { "name": "ndastur", "key": "ndastur", "displayName": "Neville Dastur", "active": true, "timeZone": "Europe/London" }, "created": "2015-06-02T10:04:24.000+0000", "updated": "2015-06-02T10:04:24.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }