01.02.2013 Views

Software Development Cross Solution - Index of - Free

Software Development Cross Solution - Index of - Free

Software Development Cross Solution - Index of - Free

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Projects, properties, targets, tasks<br />

An Ant build file is broken into four basic chunks:<br />

1<br />

Everything<br />

in Ant is<br />

represented<br />

by an XML<br />

element tag.<br />

2<br />

A property<br />

has a name<br />

and a value.<br />

3<br />

A target has<br />

a bunch <strong>of</strong><br />

tasks nested<br />

within it.<br />

4<br />

This makes<br />

a new<br />

directory,<br />

using the<br />

value <strong>of</strong> the<br />

src property.<br />

Projects<br />

Everything in your build file is part <strong>of</strong> a single project:<br />

<br />

Your project should have a name and a default target to run when<br />

the script is run.<br />

Properties<br />

Ant properties are a lot like constants. They let you refer to values in the<br />

script, but you can change those values in a single place:<br />

In this case, Ant will run<br />

the dist target when the<br />

script is run.<br />

<br />

<br />

<br />

You can use location instead <strong>of</strong> value<br />

if you’re dealing with paths.<br />

Targets<br />

You can group different actions into a target, which is just a set <strong>of</strong> work.<br />

For example, you might have a compile target for compilation, and an<br />

init target for setting up your project’s directory structure.<br />

<br />

Tasks<br />

Tasks are the work horses <strong>of</strong> your build script. A task in Ant usually maps<br />

to a specific command, like javac, mkdir, or even javadoc:<br />

<br />

<br />

building your code<br />

You can use properties with<br />

${property-name}, like this.<br />

A target has a name, and<br />

optionally a list <strong>of</strong> targets that<br />

must be run before it.<br />

Each Ant task has different<br />

parameters, depending on what<br />

the task does and is used for.<br />

The syntax here is particular to Ant, but the<br />

principles work with all build tools, in any language.<br />

Ant is great for Java, but not everyone uses Java. For now,<br />

though, focus on what a good build tool gives you: a way to<br />

manage projects, constants, and specific tasks. In a few pages, we’ll talk about<br />

build tools that work with other languages, like PHP, Ruby, and C#.<br />

Download at WoweBook.Com<br />

Everything else in the build<br />

file is nested inside the<br />

project tag.<br />

you are here 4 223

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!