[ALOY-765] Alloy: Introduce a compiler hook that runs before assets are copied
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-10-23T20:27:50.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.3.0, 2013 Sprint 22 |
Components | n/a |
Labels | alloy, compiler, hook, qe-testadded |
Reporter | Fokke Zandbergen |
Assignee | Tony Lukasavage |
Created | 2013-07-27T18:53:37.000+0000 |
Updated | 2013-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.
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?
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 :)
PR: https://github.com/appcelerator/alloy/pull/252
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:compileEnsure 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
Verified working as expected. TiSDK 3.2.0.v20131028093244 CLI 3.2.0 Alloy 1.3.0 Closing.