With NAnt script, I'm looking for solution to remove all folder named .svn recursively in a given folder.
Using delete task just delete one file/folder but not recursively.
Please help if you know how to.
This should work:
<delete>
<fileset defaultexcludes="false" >
<include name="**/.svn/**" />
</fileset>
</delete>
Related
I'm working on an Ant script to help with a Wordpress deployment (I know...). The idea here is to:
delete the entire vendor directory.
delete the entire public_html/wp directory.
delete everything from public_html/content/plugins except for the one PHP file: public_html/content/plugins/w3tc-wp-loader.php.
This is what I've tried (along many variations):
<delete failonerror="false" quiet="false" includeEmptyDirs="true">
<fileset dir="vendor" />
<fileset dir="public_html/wp" />
<fileset dir="public_html/content/plugins">
<exclude name="w3tc-wp-loader.php" />
</fileset>
</delete>
This kinda works:
it deletes the contents of the vendor directory except for a few .gitignore files that exist in subdirs, so those files and their parent dirs still exist (i.e. vendor/composer/installers/.gitignore).
public_html/wp is deleted, as expected.
public_html/content/plugins is left containing a bunch of subdirectories, each of which is empty (except one has a .gitignore file). The excluded file noted in the Ant script is left, as expected.
Any idea why a) the empty dirs aren't removed and b) .gitignore files seem to stay as well (as well as their parent dirs)? What am I doing wrong?
What about this way:
<delete failonerror="false" quiet="false" includeemptydirs="true">
<fileset dir="${root}" defaultexcludes="false">
<include name="vendor/**" />
<include name="public_html/wp/**" />
<include name="public_html/content/plugins/**" />
<exclude name="public_html/content/plugins/w3tc-wp-loader.php" />
</fileset>
</delete>
where ${root} is the parent directory for vendor and public_html.
defaultexcludes="false" will make sure your .gitignores will be deleted as well.
Your .gitignore files are excluded by default http://ant.apache.org/manual/dirtasks.html#defaultexcludes. To delete them add defaultexcludes="false" to fileset
When i set the output folder in FDT, this is always REALTIVE to the project folder, even if it has a forward slash...
ex: /Users/paolo/deploy will create the folder in /User/paolo/my_project/Users/paolo/deploy
first.... WHY?????
second: is there a way to set this folder as ABSOLUTE?
many thanx
The reason is to enable multiple developers to develop on the same project. The path is saved in the project. If you share the project via CVS/SVN other developers would need to have the same path. Absolute paths are a bad idea when developing in a team.
I don't know if there is a way to force an absolute path, but I doubt it.
Edit:
I remember there was the possibility to attach an ant script to an run configuration to be executed each time the project is build. You might be able to write the ant script such that it copies the output files to an absolute directory.
In your launch configuration there is a tab for Ant tasks. Add a post-compile ant script, here's an example:
<project name="copy files">
<property name="from" value="../bin"/>
<property name="to" value="/Users/username/deploy>
<target name="Copy All">
<copy todir="${to}" >
<fileset dir="${from}">
<exclude name="Test.swf"/>
</fileset>
</copy>
</target>
</project>
I'm attempting to compile a Flex application from an ANT script, inside of Eclipse (CFBuilder, based on Eclipse), and I've run into this error:
Could not load definitions from resource flexTasks.tasks. It could not be found.
I haven't been able to find anything that gives directions on where this file (flexTasks.tasks) should be copied to, if it's needed at all. Some places indicate that it should be part of the flexTasks.jar file. I've tried two different things:
Copy the jar file into the ant/plugins/lib folder (and restart my CF Builder instance)
Specify the path to the jar in the classpath attribute, as suggested by the comment on this page
Neither helps me get past this error.
Here's my build script, for reference:
<project name="Tagging" default="compile-tagging" basedir=".">
<!-- setup flex compilation capability -->
<taskdef resource="flexTasks.tasks" />
<property name="flex.src" value="./src" />
<property name="flex.bin" value="./bin"/>
<target name="compile-tagging">
<mxmlc
file="${flex.src}/main.mxml"
output="${flex.bin}/main.swf"
keep-generated-actionscript="true">
<source-path path-element="${FLEX_HOME}/frameworks" />
</mxmlc>
</target>
</project>
Adam, I believe you need to tell taskdef where to look for the file. try keeping flextasks.jar in the same directory as your ant file (for now... you can move it later after you get it working).
then, you can do something like this:
<taskdef name="mxmlc" classname="WhateverTheTaskIsNamed" classpath="flexTAsks.jar" />
While not ideal, this code is working for me at the moment:
<project name="IOLTagging" default="go" basedir=".">
<!-- setup flex compilation capability -->
<property name="FLEX_HOME" value="C:/program files (x86)/Adobe/Adobe Flash Builder Beta 2/sdks/3.4.1/" />
<taskdef name="mxmlc" classname="flex.ant.MxmlcTask" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<taskdef name="html-wrapper" classname="flex.ant.HtmlWrapperTask" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<property name="flex.src" value="./src" />
<property name="flex.bin" value="./bin"/>
<property name="swf.name" value="main" />
<target name="go" depends="compile-flex" />
<target name="compile-flex">
<mxmlc
file="${flex.src}/main.mxml"
output="${flex.bin}/${swf.name}.swf"
debug="false"
keep-generated-actionscript="false">
<source-path path-element="${FLEX_HOME}/frameworks" />
<compiler.library-path dir="${basedir}/libs" append="true">
<include name="*.swc" />
</compiler.library-path>
</mxmlc>
</target>
</project>
I had the same problem, and the reason was in lack of permissions to acces $FLEX_HOME/ant.
You can also put the flexTasks.jar in ~/.ant/lib directory
If you run ant -diagnostics you should see the jar in USER_HOME/.ant/lib jar listing
I think you should have solved this problem. just trying flexmonkey today and also got the same problem.
"Could not load definitions from resource flexTasks.tasks. It could not be found."
solution is to make sure the flexTasks.jar is included in the dir lib of your project workplace.
when I copied flexTasks.jar from flashbuild folder \ant\lib and built it again. the problem is fixed.
I've created an AIR application, but it uses an external SWF for extra functionality. I want that SWF to be included in the install, but currently it's not. Is there anyway I can get FlexBuilder or any other tool to include this extra file in the installer? I've tried manually adding the file (as a .air file is just a zip file in disguise), but there must be hash checks inside the file.
If you place the SWF file in your application's src directory it will give you the option to include in the installer (previously I tried putting it in the application's root folder).
If you are working in Flash, go to File>Adobe AIR 2.0 Settings. At the bottom of the dialgoue box is a list of included files. Add your SWF to that list.
What if you wanted to add a text file instead to the installer using Flex Builder? I tried to add it using the export release build wizard, but I don't see the text file generated in the application directory...any ideas?
I would add a custom builder, under project -> properties -> builders
I use something like the following for one of my projects that I want to package some mxml and as files with so that the compiler doesn't try to compile them on export. Save the xml below as something like copy_files.xml and add a new Ant Builder to your project. Under the targets tab of the builder I have mine set to run the copy-files target on every clean.
<?xml version="1.0" encoding="UTF-8"?>
<project name="SampleProject">
<target name="copy-files" description="Copy Source Files">
<copy todir="bin-debug/sources">
<fileset dir="sources" >
<include name="**/*.*" />
</fileset>
</copy>
<copy todir="bin-release/sources">
<fileset dir="sources" >
<include name="**/*.*" />
</fileset>
</copy>
</target>
</project>
I am using Flex and I am tired of having to manually place files in the right folders whenever I want to do a publish. I'd like to do a publish when the build suceeds.
Is there a quick way, using Nant (not my current build tool of choice), to automate this? I have a virtual directory on my PC which is my hosting directory.
Thanks
NAnt has a copy task that will let you do this. Just specify the files and folders you want to copy and the target folder.
If you also build your Flex app with NAnt, you could automatically do the build and the file/folder copy.
An example:
<copy todir="${build.dir}">
<fileset basedir="bin">
<include name="*.dll" />
</fileset>
</copy>
http://nant.sourceforge.net/release/latest/help/tasks/copy.html