Browse Source

Second patch from 95516 (ant support for -outxml) - patch from Matthew

tags/V1_5_0RC1
aclement 18 years ago
parent
commit
481e39cf09

+ 16
- 0
ajde/testsrc/org/aspectj/ajde/OutxmlTest.java View File

assertTrue(CUSTOM_AOPXML_NAME + " missing",aopxml.exists()); assertTrue(CUSTOM_AOPXML_NAME + " missing",aopxml.exists());
} }


/**
* Aim: Test "-outxml" option produces the correct
* xml entry in outjar file
*
*/
public void testOutxmlToOutjar () {
File outjar = openFile(OUTJAR_NAME);
ideManager.getProjectProperties().setOutJar(outjar.getAbsolutePath());
assertTrue("Build failed",doSynchronousBuild("outxml-to-outjar.lst"));
assertTrue("Build warnings",ideManager.getCompilationSourceLineTasks().isEmpty());
File aopxml = openFile(BIN_DIR + "/" + DEFAULT_AOPXML_NAME);
assertFalse(DEFAULT_AOPXML_NAME + " should not exisit",aopxml.exists());
assertJarContainsEntry(outjar,DEFAULT_AOPXML_NAME);
}

/** /**
* Aim: Test "-outxmlfile filename" option produces the correct * Aim: Test "-outxmlfile filename" option produces the correct
* xml entry in outjar file * xml entry in outjar file

+ 12
- 0
taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java View File

tmpOutjar = null; tmpOutjar = null;
} }


public void setOutxml(boolean outxml) {
cmd.addFlag("-outxml",outxml);
}

public void setOutxmlfile(String name) {
cmd.addFlagged("-outxmlfile", name);
}

public void setDestdir(File dir) { public void setDestdir(File dir) {
if (null != outjar) { if (null != outjar) {
String e = "specifying both output jar (" String e = "specifying both output jar ("
setNoExit(true); setNoExit(true);
} else if ("-outjar".equals(flag)) { } else if ("-outjar".equals(flag)) {
setOutjar(new File(in.next())); setOutjar(new File(in.next()));
} else if ("-outxml".equals(flag)) {
setOutxml(true);
} else if ("-outxmlfile".equals(flag)) {
setOutxmlfile(in.next());
} else if ("-preserveAllLocals".equals(flag)) { } else if ("-preserveAllLocals".equals(flag)) {
setPreserveAllLocals(true); setPreserveAllLocals(true);
} else if ("-proceedOnError".equals(flag)) { } else if ("-proceedOnError".equals(flag)) {

+ 25
- 0
taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java View File

} }
public void testOutxml () {
File destDir = getTempDir();
assertTrue(
"unable to create " + destDir,
destDir.canRead() || destDir.mkdirs());
AjcTask task = getTask("showweaveinfo.lst",destDir);
task.setOutxml(true);
checkRun(task,null);
File outxmlFile = new File(destDir,"META-INF/aop.xml");
assertTrue("META-INF/aop.xml missing",outxmlFile.exists());
}
public void testOutxmlFile () {
String customName = "custom/aop.xml";
File destDir = getTempDir();
assertTrue(
"unable to create " + destDir,
destDir.canRead() || destDir.mkdirs());
AjcTask task = getTask("showweaveinfo.lst",destDir);
task.setOutxmlfile(customName);
checkRun(task,null);
File outxmlFile = new File(destDir,customName);
assertTrue(customName + " missing",outxmlFile.exists());
}

protected void runTest( protected void runTest(
AjcTask task, AjcTask task,
Class exceptionType, Class exceptionType,

Loading…
Cancel
Save