[ALOY-765] Alloy: Introduce a compiler hook that runs before assets are copied
|Fix Version/s||Alloy 1.3.0, 2013 Sprint 22|
|Labels||alloy, compiler, hook, qe-testadded|
DescriptionThe first compiler hook is currently
pre:compileand runs before compile (duh..), but after libs and assets have been copied. I did an
alloy.jmkfile that searches for retina
@2ximages and uses ImageMagick to generate non-retina images if they don't already exist. Now because the
pre:compilehooks runs *after* the assets have been copied, I have to search both the
Resourcesfolder. I'm sure there are other cases like this, for which a new
pre:assets|files|copyhook 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/alloyfolder) and use this to detect updated retina files as well.
- 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?
- 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 :)
- Fokke Zandbergen 2013-10-23 PR: https://github.com/appcelerator/alloy/pull/252
- Tony Lukasavage 2013-10-23
functionalityThe 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.
testingPR: 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.txtappear 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
- Federico Casali 2013-10-28 Verified working as expected. TiSDK 3.2.0.v20131028093244 CLI 3.2.0 Alloy 1.3.0 Closing.