Hi Ray,
yes that looks useful! Too bad the echo task doesn't support the
filterchain, otherwise we could skip writing a temp file just for this
purpose.
The ${pkg.path} + / would then be the package path to the main class for
MTASC.
One problem remains with this however: If no package is used, we end up with
an invalid path name like ${pkg.path}/.
----- Original Message -----
From: "Ray Chuan" <[EMAIL PROTECTED]>
To: "Open Source Flash Mailing List" <[email protected]>
Sent: Thursday, March 16, 2006 5:15 PM
Subject: Re: [osflash] Package Property for use with MTASC in Ant buildfile?
> Hi,
> if I'm not wrong here's what you want to do:
>
> net.pkg.utils.foo
>
> to
>
> net/pkg/utils/foo
>
> I've not seen any replace tasks except for those meant for handling
> files. You could do something like this:
>
> <target name="replace-class-with-path">
> <property name="pkg.full" value="net.pkg.utils.foo"/>
> <property name="temp" value=".temp"/>
>
> <echo file="${temp}" message="${pkg.full}"/>
> <loadfile property="pkg.path" srcfile="${temp}">
> <filterchain>
> <replacestring from="." to="/"/>
> </filterchain>
> </loadfile>
> <delete file="${temp}"/>
> <echo message="${pkg.path}"/>
> </target>
>
> which is lame, because a file is created just for it to work. You
> could, on the other hand, write your own task, and remove the need for
> using files.
>
> On 3/16/06, Sascha Balkau <[EMAIL PROTECTED]> wrote:
>> Hi folks,
>>
>> What is a good way to use the package namespace for the main class in an
>> Ant
>> build file so that it works properly with MTASC?
>>
>> Currently when starting a new project in Eclipse, I'm setting up a
>> property
>> in the build file that has the filesystem path to the package in that the
>> main class resides ...
>>
>> ...
>> <property name="mainclass" value="Main.as"/>
>> <property name="mainpackage" value="somepackage/nestedpackage/"/>
>> ...
>> <property name="source" location="src"/>
>> ...
>>
>> Later in the build file I'm using a target to compile with MTASC which
>> has
>> an argument like this ...
>>
>> <arg value="-main"/>
>> <arg value="${source}/${mainpackage}${mainclass}"/>
>>
>> This is of course pretty unpractical. It works but I have to enter the
>> package name with slashes which is a disadvantage when I want to use the
>> package name for example to create a class file on-the-fly.
>>
>> So I was wondering what approach others use to define the package name in
>> their build files?
>> I'm just starting to use as2ant so I'm not sure how the situation works
>> there.
>>
>>
>> Sascha
>>
>>
>> _______________________________________________
>> osflash mailing list
>> [email protected]
>> http://osflash.org/mailman/listinfo/osflash_osflash.org
>>
>
>
> --
> Ray Chuan
>
> _______________________________________________
> osflash mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/osflash_osflash.org
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org