Browse Source

124460: allows .xml files mixed in with source files on command line

tags/pre268419
aclement 15 years ago
parent
commit
e2b4f22f7b

+ 5
- 0
org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java View File

@@ -144,6 +144,9 @@ public class BuildArgParser extends Main {

boolean incrementalMode = buildConfig.isIncrementalMode() || buildConfig.isIncrementalFileMode();

List xmlfileList = new ArrayList();
xmlfileList.addAll(parser.getXmlFiles());

List fileList = new ArrayList();
List files = parser.getFiles();
if (!LangUtil.isEmpty(files)) {
@@ -179,6 +182,8 @@ public class BuildArgParser extends Main {
}
}

buildConfig.setXmlFiles(xmlfileList);

buildConfig.setFiles(fileList);
if (destinationPath != null) { // XXX ?? unparsed but set?
buildConfig.setOutputDir(new File(destinationPath));

+ 23
- 2
org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/ConfigParser.java View File

@@ -18,6 +18,7 @@ import java.io.File;
import java.io.FileFilter;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

@@ -25,6 +26,7 @@ public class ConfigParser {
Location location;
protected File relativeDirectory = null;
protected List files = new LinkedList();
protected List xmlfiles = new ArrayList();
private boolean fileParsed = false;
protected static String CONFIG_MSG = "build config error: ";

@@ -32,6 +34,10 @@ public class ConfigParser {
return files;
}

public List getXmlFiles() {
return xmlfiles;
}

public void parseCommandLine(String[] argsArray) throws ParseException {
location = new CommandLineLocation();
LinkedList args = new LinkedList();
@@ -100,7 +106,7 @@ public class ConfigParser {
s = stripSingleLineComment(s, "#");
s = s.trim();
if (s.startsWith("\"") && s.endsWith("\"")) {
if (s.length()==1) {
if (s.length() == 1) {
return "";
} else {
s = s.substring(1, s.length() - 1);
@@ -116,10 +122,16 @@ public class ConfigParser {
if (!sourceFile.isFile()) {
showError("source file does not exist: " + sourceFile.getPath());
}

files.add(sourceFile);
}

protected void addXmlFile(File xmlFile) {
if (!xmlFile.isFile()) {
showError("XML file does not exist: " + xmlFile.getPath());
}
xmlfiles.add(xmlFile);
}

void addFileOrPattern(File sourceFile) {
if (sourceFile.getName().charAt(0) == '*') {
if (sourceFile.getName().equals("*.java")) {
@@ -197,6 +209,13 @@ public class ConfigParser {
return arg.getValue();
}

/**
* aop.xml configuration files can be passed on the command line.
*/
boolean isXml(String s) {
return s.endsWith(".xml");
}

boolean isSourceFileName(String s) {
if (s.endsWith(".java"))
return true;
@@ -219,6 +238,8 @@ public class ConfigParser {
parseConfigFileHelper(makeFile(removeArg(args).getValue()));
} else if (isSourceFileName(v)) {
addFileOrPattern(makeFile(v));
} else if (isXml(v)) {
addXmlFile(makeFile(v));
} else {
parseOption(arg.getValue(), args);
}

Loading…
Cancel
Save