Titanium JIRA Archive
Alloy (ALOY)

[ALOY-765] Alloy: Introduce a compiler hook that runs before assets are copied

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-10-23T20:27:50.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.3.0, 2013 Sprint 22
Componentsn/a
Labelsalloy, compiler, hook, qe-testadded
ReporterFokke Zandbergen
AssigneeTony Lukasavage
Created2013-07-27T18:53:37.000+0000
Updated2013-11-11T22:14:05.000+0000

Description

The first compiler hook is currently pre:compile and runs before compile (duh..), but after libs and assets have been copied. I did an alloy.jmk file that searches for retina @2x images and uses ImageMagick to generate non-retina images if they don't already exist. Now because the pre:compile hooks runs *after* the assets have been copied, I have to search both the app and the Resources folder. I'm sure there are other cases like this, for which a new pre:assets|files|copy hook would be useful. For the above use case, having this hook would also allow me to know the time of the previous compile (by getting the ctime of the Resources/alloy folder) and use this to detect updated retina files as well.

Comments

  1. Tony Lukasavage 2013-07-30

    Oe would it make more sense to just have the pre:compile hook fire earlier in the process, before anything is moved to the Resources folder?
  2. Fokke Zandbergen 2013-07-30

    If that wouldn't mess up how people use it that would be OK of course. The only reason it would is that you want to change the copied files BEFORE compile, but since these files are not affected by compile that wouldn't make sense. So yeah, if you're OK with that... GO :)
  3. Fokke Zandbergen 2013-10-23

    PR: https://github.com/appcelerator/alloy/pull/252
  4. Tony Lukasavage 2013-10-23

    functionality

    The existing *pre:compile* and *post:compile* tasks will execute just as they have in the past, at the same time in the process that they always have. A new task *pre:load* will be executed before any assets or libraries are copied into the alloy project's resources folder.

    testing

    PR: https://github.com/appcelerator/alloy/pull/255 test app: https://github.com/appcelerator/alloy/tree/master/test/apps/advanced/alloy_jmk Functional test:

    Run the test app

    Check the alloy console output to ensure that all 3 hooks fire in this order

    ** pre:load ** pre:compile ** post:compile

    Ensure that the files dummy1.txt, dummy2.txt, dummy3.txt appear in the list of files in the *pre:compile* step, but not the *pre:load* step. *NOTE:* If you perform the compile more than once, the dummy files will appear in both steps.

    Make sure there are no errors

  5. Federico Casali 2013-10-28

    Verified working as expected. TiSDK 3.2.0.v20131028093244 CLI 3.2.0 Alloy 1.3.0 Closing.

JSON Source