Posts Tagged perforce
The Flex compiler doesn’t like the Unicode filetype for assets under Perforce
We’re using Perforce as our version control system. In one of our Flex – Java projects, our team recently encountered an unexpected issue with a couple of assets when compiling the Flex application on Windows machines.
A Flex developer working on a Mac commited a new asset in the assets folder and then referenced it in a MXML file. He compiled the application, tested, then committed the new code on the Perforce system. Soon after, our Hudson instance doing continuous integration on the project reported a build failure on the Flex application. The failure message was huge, as it seemed that the Flex compiler was not able to resolve any of the application assets. The error message was basically a list of assets reported as missing. Here’s an excerpt :
...
[java] D:\hudson_home\jobs\project\workspace\project-client\src\assets\stylesheets\common.css(144): Error: Invalid Embed directive in stylesheet - can't resolve source 'Embed(source = "/assets/chrome/BackgroundChrome.png", scaleGridLeft = "5", scaleGridTop = "5", scaleGridRight = "965", scaleGridBottom = "685")'.
[java] scaleGridLeft="5", scaleGridTop="5", scaleGridRight="965", scaleGridBottom="685");
[java] D:\hudson_home\jobs\project\workspace\project-client\src\assets\stylesheets\common.css(150): Error: Invalid Embed directive in stylesheet - can't resolve source 'Embed(source = "/assets/chrome/BackgroundBorderChrome.png", scaleGridLeft = "5", scaleGridTop = "5", scaleGridRight = "965", scaleGridBottom = "685")'.
[java] scaleGridLeft="5", scaleGridTop="5", scaleGridRight="965", scaleGridBottom="685");
...
It seemed like all of the assets were missing. I quickly checked the Perforce system and all of the assets were there. After taking a good look at the failure message, a specific part caught my attention :
Error: exception during transcoding: Failed to grab pixels for image D:\hudson_home\jobs\project\workspace\project-client\src\assets\icons\profil_icon.png
[java] [Embed(source="/assets/icons/profil_icon.png")]
[java] D:\hudson_home\jobs\project\workspace\project-client\src\com\project\user\presentation\view\renderers\UserListItemRenderer.mxml(16): Error: Unable to transcode /assets/icons/profil_icon.png.
[java] [Embed(source="/assets/icons/profil_icon.png")]
So one of the assets, a PNG file, was generating a different exception than the other resources. As I soon found out from this post, if one [Embed] directive is failing then all of the other [Embed] tags are reported as failing as well. So I just had to find out why the PNG resource was failing.
One thing caught my eye : the PNG file was marked in Perforce as of type Unicode, while the other resources were marked as binary, as it should have been. While this was just fine on Mac machines, on Windows machines this lead to the Flex compiler being unable to transcode the image. So what I had to do is simply change the Perforce filetype of that specific PNG file from Unicode to Binary. After doing this, the Flex compiler managed to finish its job properly and the build succeeded.