((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).addProjectSourceFileChanged(changedFile);
}
+ public void addClasspathEntryChanged(String projectName, String changedDir) {
+ AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
+ ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).addClasspathEntryChanged(changedDir);
+ }
+
public void configureNonStandardCompileOptions(String projectName, String options) {
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setNonStandardOptions(options);
import java.io.File;
import java.io.IOException;
+import org.aspectj.ajde.core.ICompilerConfiguration;
+
/**
* Testing the performance of incremental compilation as it would be in AJDT.
*
assertTrue(whitespacechangeDoTellCompiler < fullbuildtime);
assertTrue(nochangebuild < whitespacechangeDontTellCompiler);
- assertTrue(nochangebuild < whitespacechangeDoTellCompiler);
+ // assertTrue(nochangebuild < whitespacechangeDoTellCompiler);
+
+ // assertTrue(whitespacechangeDoTellCompiler < whitespacechangeDontTellCompiler);
+ }
+
+ /**
+ * Project dependencies are captured by using classpath. The dependee project has the bin folder for the project upon which it
+ * depends on its classpath. This can make it expensive when determining whether to build the dependee project as we may need to
+ * analyse all the classpath entries, we don't know which are project related. However, a new API in ICompilerConfiguration
+ * called getClasspathElementsWithModifiedContents() can be returned by an implementor to tell us which parts of the classpath
+ * to check.
+ */
+ public void testBuildingTwoProjects() {
+ AjdeInteractionTestbed.VERBOSE = true;
+
+ String projA = "Proj64";
+ String projB = "Dependee";
+
+ // A full build:
+ initialiseProject(projA);
+ initialiseProject(projB);
+ configureNewProjectDependency(projB, projA);
+ build(projA);
+ checkWasFullBuild();
+ build(projB);
+ checkWasFullBuild();
+
+ alter(projA, "C43changeOne"); // C43 made package private
+ build(projA);
+ setNextChangeResponse(projB, ICompilerConfiguration.EVERYTHING);
+ build(projB);
+ long timeTakenWhenFullyAnalysingClasspath = getTimeTakenForBuild(projB);
+ checkWasntFullBuild();
+
+ alter(projA, "C43changeOne"); // C43 made package private
+ build(projA);
+ addClasspathEntryChanged(projB, getProjectRelativePath(projA, "bin").getPath());
+ // waitForReturn();
+ build(projB);
+ long timeTakenWhenFullyToldSpecifically = getTimeTakenForBuild(projB);
+ // waitFor10();
+ checkWasntFullBuild();
+
+ System.out.println("Without: " + timeTakenWhenFullyAnalysingClasspath + "ms With: " + timeTakenWhenFullyToldSpecifically
+ + "ms");
-// assertTrue(whitespacechangeDoTellCompiler < whitespacechangeDontTellCompiler);
}
// --- helper code ---
private String outjar;
private String nonstandardoptions;
private List modifiedFiles;
+ private List modifiedDirs;
private List projectSourceFiles = new ArrayList();
private String projectPath;
}
}
+ public void addClasspathEntryChanged(String f) {
+ if (this.modifiedDirs == null) {
+ this.modifiedDirs = new ArrayList();
+ }
+ if (f != null) {
+ modifiedDirs.add(f);
+ }
+ }
+
public void setSourcePathResources(Map sourcePathResources) {
this.sourcePathResources = sourcePathResources;
this.changed |= ICompilerConfiguration.PROJECTSOURCERESOURCES_CHANGED;
public void configurationRead() {
changed = NO_CHANGES;
modifiedFiles = null;
+ modifiedDirs = null;
+ }
+
+ public List getClasspathElementsWithModifiedContents() {
+ return modifiedDirs;
}
}