GitHub Issue | n/a |
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-06-14T20:50:13.000+0000 |
Affected Version/s | Release 3.1.0 |
Fix Version/s | 2013 Sprint 10 JS, 2013 Sprint 10, 2013 Sprint 12 JS, Release 3.1.1, Release 3.2.0 |
Components | Code Processor |
Labels | code-analyzer, qe-closed-3.1.1, qe-testadded |
Reporter | Bryan Hughes |
Assignee | Bryan Hughes |
Created | 2013-05-10T19:05:38.000+0000 |
Updated | 2013-09-24T09:17:53.000+0000 |
The code processor analysis the generated code from Alloy projects, not the original source. To prevent developer heartache, the code processor should have alloy generate new code each time. This can be accomplished via a hook since the code processor is now a CLI command
PR: https://github.com/appcelerator/alloy/pull/129 1_1_X PR: https://github.com/appcelerator/alloy/pull/130
Testing instructions:
Run in a terminal: npm install -g https://github.com/appcelerator/titanium-code-processor
Run in a terminal: titanium config paths.commands --append /usr/local/lib/node_modules/titanium-code-processor/commands (I'm assuming not-Windows here :)).
This step will be unecessary once TIMOB-13831 is complete
Take an alloy project (any alloy project) and remove the generated code if it exists
Note: you have to have an app.js in a folder called Resources, or else the core CLI will throw an error. I recommend creating an empty app.js file
Run in a terminal: titanium analyze -p iphone -A
With this fix, you will see results corresponding to the generated Alloy code, not the empty app.js file.
Alternatively you can look in the Resources folder to see if the files were generated
Code Processor repo: PR: https://github.com/appcelerator/titanium-code-processor/pull/174 1_0_X PR: https://github.com/appcelerator/titanium-code-processor/pull/175
Tested directly from ticket branch via:
Alloy now compiles prior to any invocation of the analyzer from the CLI. All existing Alloy functionality remains intact. This was tested both on a new and an existing project, both with populated and empty (except for app.js) Resources folders.
Verified as working as expected. Appcelerator Studio 3.1.1.201305282349 Titanium SDK 3.1.1.v20130524180421 Alloy 1.1.3-alpha Titanium-Code-Processor 1.1.3-alpha3 Closing.
When I run the code processor on an Alloy project with a deleted Resources directory, there is a runtime error indicating the Resources directory is missing. This happens with the Field Services App by default because it does not have a Resources directory. Appcelerator Studio 3.1.1.201306101955: Mountain Lion 10.8.4 Code Processor: 1.0.1-cr4 Node.js: 0.8.22 Titanium SDK: 3.1.1.v20130609163050 Titanium CLI: 3.1.1-cr Titanium Alloy: 1.1.3-cr Error:
I believe this is a known limitation (known to me anyways) with the CLI itself. If the resources directory doesn't exist, it just quits. Can you try running "ti build" on the project with the deleted resources directory? If it also fails, then it's a CLI bug, otherwise, it's (probably) a code processor bug
Testing environment: SDK:3.1.1.v20130611153550 Appcelerator Studio: 3.1.1.201306101955 OS: OSX 10.7.5 As per the testing instructions, 1. Installed Titanium-code-processor version 1.0.1-cr4 2. Ran in terminal: titanium config paths.commands --append /usr/local/lib/node_modules/titanium-code-processor/commands 3. Created a default alloy project and emptied app.'s file from resources folder. 4.Ran in terminal: titanium analyze -p iphone -A Output: Alloy code generated and app.js file is no longer empty.
Used the Alloy (v1.1.3-cr) and Code Processor (v1.0.1-cr4) to verify this issue.
Tested with: Appcelerator Studio, build: 3.1.1.201306112353 Titanium SDK, build: 3.1.1.v20130611153550 code processor 1.0.1-cr4 2. Imported the Field Service App. It does not have a Resources folder. Ran Run > Code Analysis > Run Selected Platforms (iPad, Android) Actual result: Could not find source directory (see the attachment)
PR: https://github.com/appcelerator/titanium-code-processor/pull/222 1_0_X PR: https://github.com/appcelerator/titanium-code-processor/pull/223
Functional and code review passed. Tested with an existing alloy app under 2 conditions:
The *Resources* folder was deleted
The *Resources* folder was present, but *Resources/app.js* was deleted
using the following command:Using a version of the code processor before the above 2 PRs, executing the command would result in an error that stated I was not analyzing a valid Titanium app. When testing both PRs, the code analyzer would run as expected generating a report under both conditions.
Verified as fixed. Environment: Titanium SDK 3.1.1.v20130613185544 Appcelerator Studio 3.1.1.201306121633 CLI 3.1.1-cr Code Processor 1.0.1-cr5 Alloy 1.1.3-cr Node 0.8.22 LiveView 1.0.0.201306121409 Closing.