]> source.dussan.org Git - aspectj.git/commitdiff
245566: final config interface change
authoraclement <aclement>
Tue, 2 Sep 2008 23:24:19 +0000 (23:24 +0000)
committeraclement <aclement>
Tue, 2 Sep 2008 23:24:19 +0000 (23:24 +0000)
tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java
tests/src/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java

index cf9751915d45c66f922efae8ef0d80ef90091fd0..61eff8711e85271e2cf71dec3002ab7f9887ff28 100644 (file)
@@ -65,6 +65,11 @@ public class AjdeInteractionTestbed extends TestCase {
                ((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);
index 3e4a7a5fdc9c2a023ce8e58a20f15b48625ea21c..05cca27c60f7b51c68d5de047f7504aef7c08738 100644 (file)
@@ -13,6 +13,8 @@ package org.aspectj.systemtest.incremental.tools;
 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.
  * 
@@ -90,9 +92,52 @@ public class IncrementalPerformanceTests extends AbstractMultiProjectIncremental
                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 ---
index 18946cfb1adc792502004a2b83e5e5755132e081..192900ae613325ef1f3dad9976a9146ae5386755 100644 (file)
@@ -39,6 +39,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio
        private String outjar;
        private String nonstandardoptions;
        private List modifiedFiles;
+       private List modifiedDirs;
        private List projectSourceFiles = new ArrayList();
        private String projectPath;
 
@@ -182,6 +183,15 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio
                }
        }
 
+       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;
@@ -204,6 +214,11 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio
        public void configurationRead() {
                changed = NO_CHANGES;
                modifiedFiles = null;
+               modifiedDirs = null;
+       }
+
+       public List getClasspathElementsWithModifiedContents() {
+               return modifiedDirs;
        }
 
 }