Apache Ant build.xml parsing — XML structure, target extraction, import/include resolution, property substitution, dual parser strategy (Java + XML regex). Use when modifying the parser or working with build.xml files.
AntParserService.parseWithXml())AntParser.java)<?xml version="1.0" encoding="UTF-8"?>
<project name="myproject" default="build" basedir=".">
<description>Project description</description>
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<target name="clean" description="Clean build directory">
<delete dir="${build.dir}"/>
</target>
<target name="compile" depends="clean" description="Compile sources">
<javac srcdir="${src.dir}" destdir="${build.dir}"/>
</target>
<target name="build" depends="compile" description="Build project">
<jar destfile="output.jar" basedir="${build.dir}"/>
</target>
</project>
<!-- Import: targets can override -->
<import file="common-build.xml"/>
<!-- Include: targets are prefixed with filename -->
<include file="shared/testing.xml"/>
| Attribute | Purpose |
|---|---|
name | Required. Unique target identifier |
description | Optional. Shown in UI for documented targets |
depends | Comma-separated list of prerequisite targets |
if | Only execute if property is set |
unless | Only execute if property is NOT set |
AntParserService.parseWithXml()<import> and <include> elements up to importDepth limit${prop.name} stays as-is)AntParser.javainterface AntBuildInfo {
projectName: string;
defaultTarget: string;
baseDir: string;
description: string | null;
buildFile: string;
targets: AntTarget[];
}
parseXmlFile() within AntParserService.tsAntParser.java to extract the new data from Ant APIAntBuildInfo or AntTarget in BOTH TypeScript and Java