|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static void configureInPath(String projectName, File inpath) { |
|
|
public static void configureInPath(String projectName, File inpath) { |
|
|
Set s = new HashSet(); |
|
|
|
|
|
|
|
|
Set<File> s = new HashSet<File>(); |
|
|
s.add(inpath); |
|
|
s.add(inpath); |
|
|
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); |
|
|
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); |
|
|
((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setInpath(s); |
|
|
((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setInpath(s); |
|
|
|
|
|
|
|
|
collectUpFiles(projectBase, projectBase, filesForCompilation); |
|
|
collectUpFiles(projectBase, projectBase, filesForCompilation); |
|
|
boolean changed = false; |
|
|
boolean changed = false; |
|
|
for (int i = 0; i < filesForCompilation.size(); i++) { |
|
|
for (int i = 0; i < filesForCompilation.size(); i++) { |
|
|
if (!currentFiles.contains(filesForCompilation.get(i))) |
|
|
|
|
|
|
|
|
if (!currentFiles.contains(filesForCompilation.get(i))) { |
|
|
changed = true; |
|
|
changed = true; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
for (int i = 0; i < currentFiles.size(); i++) { |
|
|
for (int i = 0; i < currentFiles.size(); i++) { |
|
|
if (!filesForCompilation.contains(currentFiles.get(i))) |
|
|
|
|
|
|
|
|
if (!filesForCompilation.contains(currentFiles.get(i))) { |
|
|
changed = true; |
|
|
changed = true; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
if (changed) { |
|
|
if (changed) { |
|
|
((MultiProjTestCompilerConfiguration) icc).setProjectSourceFiles(filesForCompilation); |
|
|
((MultiProjTestCompilerConfiguration) icc).setProjectSourceFiles(filesForCompilation); |
|
|
|
|
|
|
|
|
collectUpXmlFiles(projectBase, projectBase, collector); |
|
|
collectUpXmlFiles(projectBase, projectBase, collector); |
|
|
boolean changed = false; |
|
|
boolean changed = false; |
|
|
for (int i = 0; i < collector.size(); i++) { |
|
|
for (int i = 0; i < collector.size(); i++) { |
|
|
if (!currentXmlFiles.contains(collector.get(i))) |
|
|
|
|
|
|
|
|
if (!currentXmlFiles.contains(collector.get(i))) { |
|
|
changed = true; |
|
|
changed = true; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
for (int i = 0; i < currentXmlFiles.size(); i++) { |
|
|
for (int i = 0; i < currentXmlFiles.size(); i++) { |
|
|
if (!collector.contains(currentXmlFiles.get(i))) |
|
|
|
|
|
|
|
|
if (!collector.contains(currentXmlFiles.get(i))) { |
|
|
changed = true; |
|
|
changed = true; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
if (changed) { |
|
|
if (changed) { |
|
|
((MultiProjTestCompilerConfiguration) icc).setProjectXmlConfigFiles(collector); |
|
|
((MultiProjTestCompilerConfiguration) icc).setProjectXmlConfigFiles(collector); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void collectUpFiles(File location, File base, List collectionPoint) { |
|
|
private void collectUpFiles(File location, File base, List collectionPoint) { |
|
|
String contents[] = location.list(); |
|
|
String contents[] = location.list(); |
|
|
if (contents == null) |
|
|
|
|
|
|
|
|
if (contents == null) { |
|
|
return; |
|
|
return; |
|
|
|
|
|
} |
|
|
for (int i = 0; i < contents.length; i++) { |
|
|
for (int i = 0; i < contents.length; i++) { |
|
|
String string = contents[i]; |
|
|
String string = contents[i]; |
|
|
File f = new File(location, string); |
|
|
File f = new File(location, string); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void collectUpXmlFiles(File location, File base, List collectionPoint) { |
|
|
private void collectUpXmlFiles(File location, File base, List collectionPoint) { |
|
|
String contents[] = location.list(); |
|
|
String contents[] = location.list(); |
|
|
if (contents == null) |
|
|
|
|
|
|
|
|
if (contents == null) { |
|
|
return; |
|
|
return; |
|
|
|
|
|
} |
|
|
for (int i = 0; i < contents.length; i++) { |
|
|
for (int i = 0; i < contents.length; i++) { |
|
|
String string = contents[i]; |
|
|
String string = contents[i]; |
|
|
File f = new File(location, string); |
|
|
File f = new File(location, string); |
|
|
|
|
|
|
|
|
MultiProjTestMessageHandler handler = (MultiProjTestMessageHandler) compiler.getMessageHandler(); |
|
|
MultiProjTestMessageHandler handler = (MultiProjTestMessageHandler) compiler.getMessageHandler(); |
|
|
if (handler.hasErrorMessages()) { |
|
|
if (handler.hasErrorMessages()) { |
|
|
System.err.println("Build errors:"); |
|
|
System.err.println("Build errors:"); |
|
|
for (Iterator iter = handler.getErrorMessages().iterator(); iter.hasNext();) { |
|
|
|
|
|
IMessage element = (IMessage) iter.next(); |
|
|
|
|
|
|
|
|
for (Iterator<IMessage> iter = handler.getErrorMessages().iterator(); iter.hasNext();) { |
|
|
|
|
|
IMessage element = iter.next(); |
|
|
System.err.println(element); |
|
|
System.err.println(element); |
|
|
} |
|
|
} |
|
|
System.err.println("---------"); |
|
|
System.err.println("---------"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public List getErrorMessages(String projectName) { |
|
|
|
|
|
|
|
|
public List<IMessage> getErrorMessages(String projectName) { |
|
|
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); |
|
|
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); |
|
|
return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getErrorMessages(); |
|
|
return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getErrorMessages(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public List getWarningMessages(String projectName) { |
|
|
|
|
|
|
|
|
public List<IMessage> getWarningMessages(String projectName) { |
|
|
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); |
|
|
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); |
|
|
return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getWarningMessages(); |
|
|
return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getWarningMessages(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public List getWeavingMessages(String projectName) { |
|
|
|
|
|
|
|
|
public List<IMessage> getWeavingMessages(String projectName) { |
|
|
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); |
|
|
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); |
|
|
return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getWeavingMessages(); |
|
|
return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getWeavingMessages(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void checkForError(String projectName, String anError) { |
|
|
public void checkForError(String projectName, String anError) { |
|
|
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); |
|
|
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); |
|
|
List messages = ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getErrorMessages(); |
|
|
|
|
|
for (Iterator iter = messages.iterator(); iter.hasNext();) { |
|
|
|
|
|
IMessage element = (IMessage) iter.next(); |
|
|
|
|
|
if (element.getMessage().indexOf(anError) != -1) |
|
|
|
|
|
|
|
|
List<IMessage> messages = ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getErrorMessages(); |
|
|
|
|
|
for (Iterator<IMessage> iter = messages.iterator(); iter.hasNext();) { |
|
|
|
|
|
IMessage element = iter.next(); |
|
|
|
|
|
if (element.getMessage().indexOf(anError) != -1) { |
|
|
return; |
|
|
return; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
fail("Didn't find the error message:\n'" + anError + "'.\nErrors that occurred:\n" + messages); |
|
|
fail("Didn't find the error message:\n'" + anError + "'.\nErrors that occurred:\n" + messages); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
public String printCompiledAndWovenFiles(String projectName) { |
|
|
public String printCompiledAndWovenFiles(String projectName) { |
|
|
StringBuffer sb = new StringBuffer(); |
|
|
StringBuffer sb = new StringBuffer(); |
|
|
if (getCompiledFiles(projectName).size() == 0 && getWovenClasses(projectName).size() == 0) |
|
|
|
|
|
|
|
|
if (getCompiledFiles(projectName).size() == 0 && getWovenClasses(projectName).size() == 0) { |
|
|
sb.append("No files were compiled or woven\n"); |
|
|
sb.append("No files were compiled or woven\n"); |
|
|
|
|
|
} |
|
|
for (Iterator iter = getCompiledFiles(projectName).iterator(); iter.hasNext();) { |
|
|
for (Iterator iter = getCompiledFiles(projectName).iterator(); iter.hasNext();) { |
|
|
Object element = iter.next(); |
|
|
Object element = iter.next(); |
|
|
sb.append("compiled: " + element + "\n"); |
|
|
sb.append("compiled: " + element + "\n"); |
|
|
|
|
|
|
|
|
for (Iterator iter = woven.iterator(); iter.hasNext();) { |
|
|
for (Iterator iter = woven.iterator(); iter.hasNext();) { |
|
|
System.out.println(" :" + iter.next()); |
|
|
System.out.println(" :" + iter.next()); |
|
|
} |
|
|
} |
|
|
if (wasFullBuild()) |
|
|
|
|
|
|
|
|
if (wasFullBuild()) { |
|
|
System.out.println("It was a batch (full) build"); |
|
|
System.out.println("It was a batch (full) build"); |
|
|
|
|
|
} |
|
|
System.out.println("============================================="); |
|
|
System.out.println("============================================="); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* Check we compiled/wove the right number of files, passing '-1' indicates you don't care about that number. |
|
|
* Check we compiled/wove the right number of files, passing '-1' indicates you don't care about that number. |
|
|
*/ |
|
|
*/ |
|
|
public void checkCompileWeaveCount(String projectName, int expCompile, int expWoven) { |
|
|
public void checkCompileWeaveCount(String projectName, int expCompile, int expWoven) { |
|
|
if (expCompile != -1 && getCompiledFiles(projectName).size() != expCompile) |
|
|
|
|
|
|
|
|
if (expCompile != -1 && getCompiledFiles(projectName).size() != expCompile) { |
|
|
fail("Expected compilation of " + expCompile + " files but compiled " + getCompiledFiles(projectName).size() + "\n" |
|
|
fail("Expected compilation of " + expCompile + " files but compiled " + getCompiledFiles(projectName).size() + "\n" |
|
|
+ printCompiledAndWovenFiles(projectName)); |
|
|
+ printCompiledAndWovenFiles(projectName)); |
|
|
if (expWoven != -1 && getWovenClasses(projectName).size() != expWoven) |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
if (expWoven != -1 && getWovenClasses(projectName).size() != expWoven) { |
|
|
fail("Expected weaving of " + expWoven + " files but wove " + getWovenClasses(projectName).size() + "\n" |
|
|
fail("Expected weaving of " + expWoven + " files but wove " + getWovenClasses(projectName).size() + "\n" |
|
|
+ printCompiledAndWovenFiles(projectName)); |
|
|
+ printCompiledAndWovenFiles(projectName)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void checkWasntFullBuild() { |
|
|
public void checkWasntFullBuild() { |
|
|
|
|
|
|
|
|
return ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getTimeTaken(); |
|
|
return ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getTimeTaken(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public List getCompiledFiles(String projectName) { |
|
|
|
|
|
|
|
|
public List<String> getCompiledFiles(String projectName) { |
|
|
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); |
|
|
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); |
|
|
return ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getCompiledFiles(); |
|
|
return ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getCompiledFiles(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return compiler.getModel(); |
|
|
return compiler.getModel(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public List getWovenClasses(String projectName) { |
|
|
|
|
|
|
|
|
public List<String> getWovenClasses(String projectName) { |
|
|
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); |
|
|
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); |
|
|
return ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getWovenClasses(); |
|
|
return ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getWovenClasses(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Infrastructure below here |
|
|
// Infrastructure below here |
|
|
|
|
|
|
|
|
private static void log(String msg) { |
|
|
private static void log(String msg) { |
|
|
if (VERBOSE) |
|
|
|
|
|
|
|
|
if (VERBOSE) { |
|
|
System.out.println(msg); |
|
|
System.out.println(msg); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private static void lognoln(String msg) { |
|
|
private static void lognoln(String msg) { |
|
|
if (VERBOSE) |
|
|
|
|
|
|
|
|
if (VERBOSE) { |
|
|
System.out.print(msg); |
|
|
System.out.print(msg); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** Return the *full* path to this file which is taken relative to the project dir */ |
|
|
/** Return the *full* path to this file which is taken relative to the project dir */ |
|
|
|
|
|
|
|
|
informedAboutKindOfBuild = false; |
|
|
informedAboutKindOfBuild = false; |
|
|
decisions = new StringBuffer(); |
|
|
decisions = new StringBuffer(); |
|
|
fullBuildOccurred = false; |
|
|
fullBuildOccurred = false; |
|
|
if (detectedDeletions != null) |
|
|
|
|
|
|
|
|
if (detectedDeletions != null) { |
|
|
detectedDeletions.clear(); |
|
|
detectedDeletions.clear(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public boolean pathChange = false; |
|
|
public boolean pathChange = false; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static boolean wasFullBuild() { |
|
|
public static boolean wasFullBuild() { |
|
|
if (!informedAboutKindOfBuild) |
|
|
|
|
|
|
|
|
if (!informedAboutKindOfBuild) { |
|
|
throw new RuntimeException("I never heard about what kind of build it was!!"); |
|
|
throw new RuntimeException("I never heard about what kind of build it was!!"); |
|
|
|
|
|
} |
|
|
return fullBuildOccurred; |
|
|
return fullBuildOccurred; |
|
|
} |
|
|
} |
|
|
|
|
|
|