ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sadaf_Choudhry" <Sadaf_Choud...@infosys.com>
Subject RE: Split build file
Date Thu, 02 Sep 2004 07:21:38 GMT
Yup!
Thanx, it worked :)

Sadaf 

-----Original Message-----
From: Daniels, Doug [mailto:Doug.Daniels@gdc4s.com] 
Sent: Thursday, September 02, 2004 12:34 AM
To: Ant Users List
Subject: RE: Split build file

The problem is the XML entity import, really just copies XML into your
build file, so it can only be ANT code snippets, not full ANT build
files, so your sub_build.xml should look like this:

<target name="printName">
    <echo>
        MyName
    </echo>
</target>

-----Original Message-----
From: Sadaf_Choudhry [mailto:Sadaf_Choudhry@infosys.com]
Sent: Wednesday, September 01, 2004 2:05 PM
To: Ant Users List
Subject: RE: Split build file


Ok,
I tried this..
 I have a build.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- This is a technique used to include define a file to include -->
<!DOCTYPE project [
  <!ENTITY IncludeBuildEnv SYSTEM "sub_build.xml">
  %IncludeBuildEnv;
]>
<project name="YourProj" default="echomyName">
  <!-- includes, common properties, or targets, etc  -->
  &IncludeBuildEnv;
<!-- The rest of your build -->
<target name="echomyName">
    <echo>
        myName
    </echo>
</target>
</project> 

It refers to a sub_build.xml, which is as below:

<?xml version="1.0" encoding="UTF-8"?>
<project name="sub_build">
<target name="printName">
    <echo>
        MyName
    </echo>
</target>
</project>

When I run the first build.xml, I get
$ ant
Buildfile: build.xml

BUILD FAILED
file:d:/testinclude/sub_build.xml:6: Unexpected element "project"

Total time: 0 seconds

What is wrong here??

Sadaf

-----Original Message-----
From: Daniels, Doug [mailto:Doug.Daniels@gdc4s.com]
Sent: Wednesday, September 01, 2004 11:10 PM
To: Ant Users List
Subject: RE: Split build file

The answer is basically yes.

You can use XML entity references to include stuff, like so:

<?xml version="1.0"?>
<!-- This is a technique used to include define a file to include -->
<!DOCTYPE project [
  <!ENTITY IncludeBuildEnv SYSTEM "buildEnv.xml">
  %IncludeBuildEnv;
]>

<project name="YourProj" default="build">

  <!-- includes, common properties, or targets, etc  -->
  &IncludeBuildEnv;

<!-- The rest of your build -->

</project>


~Doug Daniels
-----Original Message-----
From: Sadaf_Choudhry [mailto:Sadaf_Choudhry@infosys.com]
Sent: Wednesday, September 01, 2004 1:19 PM
To: Ant Users List
Subject: RE: Split build file


 Hi,
I am using ant 1.5.3..
Is there something in 1.5.3 that would allow me to do something
similar??

I use the <ant> task myself as of now.. But if I could just somehow
include a sub-build.xml file into my main build.xml files, it would be
simply awesome..

Any way I could do this in ant 1.5.3??

Sadaf

-----Original Message-----
From: Vadim Kazakov [mailto:VadimK@quadrus.com]
Sent: Wednesday, September 01, 2004 8:34 PM
To: Ant Users List
Subject: RE: Split build file

That's interesting I didn't know about this task. I just use the <ant>
task to access other files.

-----Original Message-----
From: Bill Rich [mailto:brich@webmethods.com]
Sent: August 31, 2004 6:36 PM
To: 'Ant Users List'
Subject: RE: Split build file

You can import files to add targets to the available set. I have several
Ant files that I have used to organize my targets because they just got
to much for one file. In my files I do the following:

l10nproj.xml
 <import file="${env.LEVTOOLSDIR}/L10NProcess/L10NProcess.xml"/>

L10NProcess.xml
 <import file="${env.LEVTOOLSDIR}/L10NProcess/L10NProcess-macros.xml"/>
 <import file="${env.LEVTOOLSDIR}/L10NProcess/L10NProcess-tasks.xml"/>

L10NProcess-tasks.xml
 <import
file="${env.LEVTOOLSDIR}/L10NProcess/L10NProcess-toktasks.xml"/>
 <import
file="${env.LEVTOOLSDIR}/L10NProcess/L10NProcess-detoktasks.xml"/>
 <import file="${env.LEVTOOLSDIR}/L10NProcess/L10NProcess-p4tasks.xml"/>


I only copy l10nproj.xml into the directory where the project files are
stored and run it from there. When I run ant on the l10nproj.xml file
all of the targets in all the files that are imported are available as
though they were in the l10nproj.xml file. Of course you must be careful
to have unique names for all the targets so there is no confusion as to
which one you are referring to.

There is no automatic "jumping" into an imported file but you should be
able to figure out a target that will do what you want. You might check
out <for> in antContrib if you want to loop through a bunch of test
cases. Or perhaps, just using depends on a master target will also work.

HTH
Bill 

-----Original Message-----
From: Gera, Prateek [mailto:prateek.gera@hp.com]
Sent: Tuesday, August 31, 2004 4:58 PM
To: Ant Users List
Subject: Split build file

Hi,
 Is it possible to split a build project into multiple files, one main
build file and the rest smaller that do only a part of the full build
task. 
The smaller build files may not be executed independently. 

This will help be freeze my main build file and create smaller xml's to
execute any new tests as and when required.
Only minor changes would be required to main build file.


Something like this -
< project name="buidandtest" default="def"  basedir-"."> ...
...
  <include file="test1.xml"/>
...
...
  <include file="test2.xml"/>
..
</project>


Upon encountering <include> the execution would jump to test1.xml or
test2.xml I have considered using <ant> command in main file but my
smaller build file needs to call back targets in the main file and then
it will get too complicated.


Thanks
prateek

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
commands, e-mail: user-help@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
commands, e-mail: user-help@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
commands, e-mail: user-help@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
commands, e-mail: user-help@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
commands, e-mail: user-help@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
commands, e-mail: user-help@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message