<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ant &#8211; Alessandro Crugnola &#8211; sephiroth.it</title>
	<atom:link href="https://blog.sephiroth.it/tag/ant/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.sephiroth.it</link>
	<description>programmer by pure chance</description>
	<lastBuildDate>Sat, 09 Oct 2010 14:48:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://blog.sephiroth.it/wp-content/uploads/2019/03/cropped-sepy-big-32x32.png</url>
	<title>ant &#8211; Alessandro Crugnola &#8211; sephiroth.it</title>
	<link>https://blog.sephiroth.it</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Disable asset compression with Android aapt</title>
		<link>https://blog.sephiroth.it/2010/10/09/disable-asset-compression-with-android-aapt/</link>
					<comments>https://blog.sephiroth.it/2010/10/09/disable-asset-compression-with-android-aapt/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Sat, 09 Oct 2010 10:17:40 +0000</pubDate>
				<category><![CDATA[android]]></category>
		<category><![CDATA[aapt]]></category>
		<category><![CDATA[adt]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[eclipse]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=1392</guid>

					<description><![CDATA[Trying to embed all the assets resources into my final apk was not so easy as I tought.. at least using the ADT Eclipse plugin for building project. In fact, using AssetManager.openFd to return to the C++ code a FileDescriptor does not work with compressed sources. When aapt compile the resources into the apk file &#8230; <a href="https://blog.sephiroth.it/2010/10/09/disable-asset-compression-with-android-aapt/" class="more-link">Continue reading <span class="screen-reader-text">Disable asset compression with Android aapt</span></a>]]></description>
										<content:encoded><![CDATA[<p>Trying to embed all the assets resources into my final apk was not so easy as I tought.. at least using the <a href="http://developer.android.com/sdk/eclipse-adt.html" target="_blank">ADT</a> Eclipse plugin for building project.<br />
In fact, using <a href="http://developer.android.com/reference/android/content/res/AssetManager.html#openFd(java.lang.String)">AssetManager.openFd</a> to return to the C++ code a FileDescriptor does not work with compressed sources.<br />
When <a href="http://developer.android.com/guide/developing/tools/aapt.html" target="_blank">aapt</a> compile the resources into the apk file it compress by default all the files which extensions are not recognized and those which recognize as text files.</p>
<p>These are the extensions not compressed:</p>
<p>[cc]<br />
static const char* kNoCompressExt[] = {<br />
&#8220;.jpg&#8221;, &#8220;.jpeg&#8221;, &#8220;.png&#8221;, &#8220;.gif&#8221;,<br />
 &#8220;.wav&#8221;, &#8220;.mp2&#8221;, &#8220;.mp3&#8221;, &#8220;.ogg&#8221;, &#8220;.aac&#8221;,<br />
 &#8220;.mpg&#8221;, &#8220;.mpeg&#8221;, &#8220;.mid&#8221;, &#8220;.midi&#8221;, &#8220;.smf&#8221;, &#8220;.jet&#8221;,<br />
 &#8220;.rtttl&#8221;, &#8220;.imy&#8221;, &#8220;.xmf&#8221;, &#8220;.mp4&#8221;, &#8220;.m4a&#8221;,<br />
 &#8220;.m4v&#8221;, &#8220;.3gp&#8221;, &#8220;.3gpp&#8221;, &#8220;.3g2&#8221;, &#8220;.3gpp2&#8221;,<br />
 &#8220;.amr&#8221;, &#8220;.awb&#8221;, &#8220;.wma&#8221;, &#8220;.wmv&#8221;<br />
};<br />
[/cc]</p>
<p>I was looking into the .project file of my Eclipse project but it seems that changing things inside that file ( like values into the tag ) does not affect the builder.</p>
<p>The first thing I tried was to remap the aapt executable using a shell script ( and renaming the original aapt file into _aapt ):</p>
<p>[cc]<br />
#!/bin/bash</p>
<p>strParams=&#8221;&#8221;<br />
CWD=’dirname $0’</p>
<p>for i in $@; do<br />
	if [ $i = &#8220;-S&#8221; ]; then<br />
		strParams=&#8221;$(echo $strParams) -v -0 \&#8221;\&#8221;&#8221;<br />
	fi<br />
	strParams=&#8221;$(echo $strParams) $i&#8221;<br />
done</p>
<p>tool=&#8221;$CWD/_aapt $strParams&#8221;<br />
$tool 1>&#038;2<br />
[/cc]</p>
<p>In fact, when building the project in eclipse I could see the whole output, but the files are still being compressed, even if I call the same command in a shell the assets aren’t compressed.<br />
I haven’t yet find a solution so for the meantime I decided to use ant to build my project overriding the default “-package-resources” target in this way:</p>
<p>[cce]<br />
    <target name="-package-resources"><br />
        <echo>Packaging resources</echo><br />
		<echo>${asset.absolute.dir}</echo><br />
        <aapt executable="${aapt}"<br />
                command=&#8221;package&#8221;<br />
				verbose=&#8221;${verbose}&#8221;<br />
                versioncode=&#8221;${version.code}&#8221;<br />
                manifest=&#8221;AndroidManifest.xml&#8221;<br />
                assets=&#8221;${asset.absolute.dir}&#8221;<br />
                androidjar=&#8221;${android.jar}&#8221;<br />
                apkfolder=&#8221;${out.absolute.dir}&#8221;<br />
                resourcefilename=&#8221;${resource.package.file.name}&#8221;<br />
                resourcefilter=&#8221;${aapt.resource.filter}&#8221;><br />
            <res path="${resource.absolute.dir}" /><br />
            <nocompress /></target></p>
<p>
[/cce]</p>
<p>In this way the project is being compiled correctly and all my assets are embedded not compressed!</p>
<p>P.S. my claim token is: 7C8AATS7Q5A3</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2010/10/09/disable-asset-compression-with-android-aapt/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Read pdf metadata with purePDF</title>
		<link>https://blog.sephiroth.it/2010/05/28/read-pdf-metadata-with-purepdf/</link>
					<comments>https://blog.sephiroth.it/2010/05/28/read-pdf-metadata-with-purepdf/#respond</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Fri, 28 May 2010 07:14:53 +0000</pubDate>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[purePDF]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[bytearray]]></category>
		<category><![CDATA[metadata]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[reader]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=319</guid>

					<description><![CDATA[In the recent purePDF update I&#8217;ve added the&#160;getInfo method to the PdfReader class, this allows to extract pdf informations once the document has been parsed. Here&#8217;s an example: var pdf: ByteArray = URLLoader( event.target ).data as ByteArray; var reader: PdfReader = new PdfReader( pdf ); reader.addEventListener( Event.COMPLETE, onReadComplete ); reader.readPdf(); function onReadComplete(event:Event):void { var map: &#8230; <a href="https://blog.sephiroth.it/2010/05/28/read-pdf-metadata-with-purepdf/" class="more-link">Continue reading <span class="screen-reader-text">Read pdf metadata with purePDF</span></a>]]></description>
										<content:encoded><![CDATA[<div>In the recent purePDF update I&#8217;ve added the <strong>getInfo</strong> method to the PdfReader class, this allows to extract pdf informations once the document has been parsed.</p>
<div>Here&#8217;s an example:</div>
<div>
<pre name="code" class="js">var pdf: ByteArray = URLLoader( event.target ).data as ByteArray;
var reader: PdfReader = new PdfReader( pdf );
reader.addEventListener( Event.COMPLETE, onReadComplete );
reader.readPdf();

function onReadComplete(event:Event):void
{
	var map: HashMap = reader.getInfo();
	for( var iterator: Iterator = map.keySet().iterator(); iterator.hasNext(); )
	{
		var key: String = iterator.next();
		trace( key + ": " + map.getValue( key ) );
	}
}</pre>
</div>
<div>
</div>
<div>In this way all the document&#8217;s metadata will be traced (Author, Creation Date, Title, Subject, etc..)</div>
<div>In order to extract the field directly simply use:</div>
<div>
<pre name="code" class="js">function onReadComplete(event:Event):void
{
	var map: HashMap = reader.getInfo();
	trace( "Author: " + map.getValue( "Author" ) );
	trace( "Creator: " + map.getValue( "Creator" ) );
	trace( "Title: " + map.getValue( "Title" ) );
}</pre>
</div>
<div>Download the latest <strong>purePDF</strong> <a href="http://code.google.com/p/purepdf/downloads/list">here</a>.</div>
<div><img decoding="async" src="http://img.zemanta.com/pixy.gif?x-id=9614febd-ab17-4368-9cae-6155ac380111" alt="" /></div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2010/05/28/read-pdf-metadata-with-purepdf/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Update your app VERSION using ant</title>
		<link>https://blog.sephiroth.it/2010/01/31/update-your-app-version-using-ant/</link>
					<comments>https://blog.sephiroth.it/2010/01/31/update-your-app-version-using-ant/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Sun, 31 Jan 2010 18:48:41 +0000</pubDate>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[regular expression]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=289</guid>

					<description><![CDATA[This is just a quick tip in case someone needs it. Maybe when you compile your flash application or your swc library you want to automatically update the &#8220;VERSION&#8221; number too without do it manually every time. This is the way I do. In the &#8220;compile&#8221; task I&#8217;ve added a depends link to this ant &#8230; <a href="https://blog.sephiroth.it/2010/01/31/update-your-app-version-using-ant/" class="more-link">Continue reading <span class="screen-reader-text">Update your app VERSION using ant</span></a>]]></description>
										<content:encoded><![CDATA[<p>This is just a quick tip in case someone needs it. Maybe when you compile your flash application or your swc library you want to automatically update the &#8220;<strong>VERSION</strong>&#8221; number too without do it manually every time.</p>
<div>This is the way I do. In the &#8220;compile&#8221; task I&#8217;ve added a depends link to this ant task:</div>
<div>
<div>
<div>
<pre>&lt;target name="update-version"&gt;
&lt;propertyset id="tdate"&gt;&lt;/propertyset&gt;
&lt;tstamp&gt;
&lt;format property="tdate" pattern="yyyyMMdd"/&gt;
&lt;/tstamp&gt;
&lt;buildnumber file="build.number"/&gt;
&lt;echo&gt;updating version to current datetime: ${tdate}&lt;/echo&gt;
&lt;replaceregexp byline="true"&gt;
&lt;regexp pattern="public static const BUILD_DATE: String = \'([0-9]+)'"/&gt;
&lt;substitution expression="public static const BUILD_DATE: String = '${tdate}'"/&gt;
&lt;fileset dir="src/it/sephiroth/somestuff"&gt;
&lt;include name="Library.as"/&gt;
&lt;/fileset&gt;
&lt;/replaceregexp&gt;
&lt;replaceregexp byline="true"&gt;
&lt;regexp pattern="public static const BUILD_NUMBER: String = \'([0-9\.]+)'"/&gt;
&lt;substitution expression="public static const BUILD_NUMBER: String = '${build.number}'"/&gt;
&lt;fileset dir="src/it/sephiroth/somestuff"&gt;
&lt;include name="Library.as"/&gt;
&lt;/fileset&gt;
&lt;/replaceregexp&gt;
&lt;/target&gt;</pre>
</div>
</div>
</div>
<div>The 2 optional tasks I&#8217;ve used are: <a href="http://ant.apache.org/manual/CoreTasks/buildnumber.html">BuildNumber</a> task and <a href="http://ant.apache.org/manual/OptionalTasks/replaceregexp.html">ReplaceRegExp</a> Task. In this way every time I do an ant compile, it will update my build number and modification date.</div>
<div>What this task does is find this 2 lines in my Library.as file:</div>
<div>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco;"><span style="color: #0053ff;">public</span> <span style="color: #0053ff;">static</span> <span style="color: #0053ff;">const</span> BUILD_DATE: String = <span style="color: #ab1500;">&#8216;20100131&#8217;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco;">and</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco;"><span style="color: #0053ff;">public</span> <span style="color: #0053ff;">static</span> <span style="color: #0053ff;">const</span> BUILD_NUMBER: String = <span style="color: #ab1500;">&#8216;5&#8217;</span>;</p>
</div>
<div>then replace the BUILD_DATE const with the current date and the BUILD_NUMBER with an incremental build number. After being executed the first time, ant will also create a new file in your directory called &#8220;build.number&#8221; with the latest build number int.</div>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2010/01/31/update-your-app-version-using-ant/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>mxmlc NullPointerException crash</title>
		<link>https://blog.sephiroth.it/2007/03/18/mxmlc-nullpointerexception-crash/</link>
					<comments>https://blog.sephiroth.it/2007/03/18/mxmlc-nullpointerexception-crash/#comments</comments>
		
		<dc:creator><![CDATA[Alessandro Crugnola]]></dc:creator>
		<pubDate>Mon, 19 Mar 2007 04:44:19 +0000</pubDate>
				<category><![CDATA[flex]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[XMLList]]></category>
		<guid isPermaLink="false">http://blog.sephiroth.it/?p=206</guid>

					<description><![CDATA[Today I was getting crazy to find out why Flex didn't want to compile my application.. Clicking on compile it started suddenly to give me an internal compile error and nothing else. So i tried to compile with the mxmlc from a console just to see the error log and the outpuw was:...
]]></description>
										<content:encoded><![CDATA[<p>Today I was getting crazy to find out why Flex didn&#8217;t want to compile my application.. Clicking on compile it started suddenly to give me an internal compile error and nothing else. So i tried to compile with the mxmlc from a console just to see the error log and the outpuw was:<br />
<code>java.lang.NullPointerException<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:891)<br />
at macromedia.asc.parser.BinaryExpressionNode.evaluate(BinaryExpressionNode.java:38)<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:890)<br />
at macromedia.asc.parser.BinaryExpressionNode.evaluate(BinaryExpressionNode.java:38)<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:891)<br />
at macromedia.asc.parser.BinaryExpressionNode.evaluate(BinaryExpressionNode.java:38)<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:890)<br />
at macromedia.asc.parser.BinaryExpressionNode.evaluate(BinaryExpressionNode.java:38)<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:962)<br />
at macromedia.asc.parser.ListNode.evaluate(ListNode.java:27)<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:5859)<br />
at macromedia.asc.parser.LiteralXMLNode.evaluate(LiteralXMLNode.java:28)<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:3087)<br />
at macromedia.asc.parser.VariableBindingNode.evaluate(VariableBindingNode.java:48)<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:962)<br />
at macromedia.asc.parser.ListNode.evaluate(ListNode.java:27)<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:2897)<br />
at macromedia.asc.parser.VariableDefinitionNode.evaluate(VariableDefinitionNode.java:32)<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:4629)<br />
at macromedia.asc.parser.ClassDefinitionNode.evaluate(ClassDefinitionNode.java:86)<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:938)<br />
at macromedia.asc.parser.ArgumentListNode.evaluate(ArgumentListNode.java:28)<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:750)<br />
at macromedia.asc.parser.SetExpressionNode.evaluate(SetExpressionNode.java:39)<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:580)<br />
at macromedia.asc.parser.MemberExpressionNode.evaluate(MemberExpressionNode.java:31)<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:1273)<br />
at macromedia.asc.parser.ExpressionStatementNode.evaluate(ExpressionStatementNode.java:33)<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:4407)<br />
at macromedia.asc.parser.ClassDefinitionNode.evaluate(ClassDefinitionNode.java:86)<br />
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:2577)<br />
at macromedia.asc.parser.ProgramNode.evaluate(ProgramNode.java:63)<br />
at flex2.compiler.as3.Compiler.analyze2(Compiler.java:436)<br />
at flex2.compiler.mxml.InterfaceCompiler.analyze2(InterfaceCompiler.java:337)<br />
at flex2.compiler.mxml.Compiler.analyze2(Compiler.java:130)<br />
at flex2.compiler.API.analyze(API.java:2360)<br />
at flex2.compiler.API.analyze(API.java:2275)<br />
at flex2.compiler.API.batch2(API.java:337)<br />
at flex2.compiler.API.batch(API.java:1025)<br />
at flex2.compiler.API.compile(API.java:1211)<br />
at flex2.compiler.API.compile(API.java:1114)<br />
at flex2.tools.Compiler.main(Compiler.java:222)</code><br />
Wow!!<br />
So, how can I find the problem? I can&#8217;t find any useful information from this log..<br />
For this reason I had to remove portion of code from my mxml and from all the imported packages.. 2 hours of &#8220;debugging&#8221; gave me the solution!</p>
<p>A syntax error in a declaration of an XMLList was the problem!  Fixed the line also the compiler started to run again with no problems.</p>
<p>This is a portion of mxml code to reproduce the problem:<br />
<code>;</p>
<p>< ![CDATA[
private var uuid:String = "";
private var menubarXML:XMLList =
<><br />
<menuitem data=uuid>
</menuitem>
<>;<br />
]]&gt;</p>
<p></code></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.sephiroth.it/2007/03/18/mxmlc-nullpointerexception-crash/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
