Titanium

[ALOY-1566] Compile process appears to fail when optimizing files with OS_* declarations

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2017-05-30T18:43:56.000+0000
Affected Version/sAlloy 1.10.0
Fix Version/sCLI Release 6.3.0
Componentsn/a
Labelsregression
ReporterEwan Harris
AssigneeFeon Sua Xin Miao
Created2017-05-26T13:34:28.000+0000
Updated2017-10-10T20:41:26.000+0000

Description

Description

When running alloy compile on the studentfutter app, it will error out with the below, at first glance it appears to be choking on the Ti API usage I think https://github.com/hansemannn/studentenfutter-app/blob/2855926288f8ada820b947336f4d3dbd9f5f0f4e/app/lib/android/actionbar.js
[INFO] ----- OPTIMIZING -----
[INFO] - alloy/moment/lang/de-at.js
[INFO] - alloy/moment/lang/de.js
[INFO] - alloy/moment/lang/en-au.js
[INFO] - alloy/moment/lang/en-ca.js
[INFO] - alloy/moment/lang/en-gb.js
[INFO] - alloy/moment/lang/es.js
[INFO] - alloy/moment/lang/pt-br.js
[INFO] - alloy/moment/lang/pt.js
[INFO] - iphone/actionbar.js
[INFO] - iphone/alloy.js
[INFO] - iphone/api.js
[INFO] - iphone/dateutils.js
[INFO] - iphone/loader.js
[INFO] - iphone/locations.js
[INFO] - iphone/request.js
[INFO] - iphone/utils.js
[INFO] - iphone/alloy/models/Cart.js
[INFO] - iphone/alloy/models/Lunch.js
[INFO] - iphone/alloy/sync/localStorage.js
[INFO] - iphone/alloy/sync/properties.js
[INFO] - iphone/alloy/sync/sql.js
[INFO] - iphone/alloy/widgets/nl.fokkezb.pullToRefresh/styles/widget.js
[ERROR] Error transforming JS file
[ERROR] /Users/eharris/Documents/git/testing_apps/studentenfutter-app/Resources/iphone/actionbar.js: Property id of VariableDeclarator expected node to be of a type ["LVal"] but instead got "BooleanLiteral"

Steps to reproduce

Download studenfutter https://github.com/hansemannn/studentenfutter-app

Run alloy compile --config platform=ios

Actual

Compile process will error out with the above

Expected

Compile process should not error out

Comments

  1. Ewan Harris 2017-05-26 I dont think this is because of Ti API usage Uncommenting the platforms optimization gets rid of this error https://github.com/appcelerator/alloy/blob/master/Alloy/commands/compile/ast/optimizer-plugin.js#L28-L30 https://github.com/appcelerator/alloy/blob/18ec7eae9b2447cc8affad0909f1ed92a893e184/Alloy/commands/compile/ast/optimizer-plugin.js#L64-L66
       if (this.defines.hasOwnProperty(path.node.name)) {
       					if (path.parent.type !== 'VariableDeclarator') {
       						path.replaceWith(types.booleanLiteral(this.defines[path.node.name]));
       					}
       				}
       
  2. Feon Sua Xin Miao 2017-05-30 PR: https://github.com/appcelerator/alloy/pull/828
  3. Abir Mukherjee 2017-10-10 Validated with the environment: Node Version: 6.10.3 NPM Version: 3.10.10 Mac OS: 10.13 Appc CLI: 6.3.0-master.7 Appc CLI NPM: 4.2.9 Titanium SDK version: 6.1.2 The app compiled with no errors and the fix is validated.. One side note is that the test app needs to be updated by moving DefaultIcon.png to app/

JSON Source