]> source.dussan.org Git - sonarqube.git/commitdiff
Dependencies should be persisted early to have proper id in the DSM
authorJulien HENRY <julien.henry@sonarsource.com>
Thu, 5 Mar 2015 11:23:30 +0000 (12:23 +0100)
committerJulien HENRY <julien.henry@sonarsource.com>
Thu, 5 Mar 2015 11:24:11 +0000 (12:24 +0100)
sonar-batch/src/main/java/org/sonar/batch/design/DsmDecorator.java
sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java

index 0fdae1a037ba717d38d3b51eb53471c9c8008002..8dafbe0cbd0bedefcf88e0d6325180e5aa4723ff 100644 (file)
@@ -74,7 +74,6 @@ public abstract class DsmDecorator implements Decorator {
         return;
       }
       Dsm<Resource> dsm = getDsm(children, feedbackEdges);
-      // Optimization, don't save DSM if there is no dependency at all
       saveDsm(context, dsm);
     }
   }
index 393e8968ad976d0d4992520850ae1d7134e0390b..0bec73c2c3e03a842e83bb66f97a88ca0c42f4e8 100644 (file)
@@ -188,11 +188,6 @@ public class DefaultIndex extends SonarIndex {
       }
     }
 
-    // store dependencies
-    for (Dependency dep : dependencies) {
-      dependencyPersister.saveDependency(currentProject, dep);
-    }
-
     // Keep only inter module dependencies
     Set<Dependency> projectDependencies = getDependenciesBetweenProjects();
     dependencies.clear();
@@ -290,6 +285,7 @@ public class DefaultIndex extends SonarIndex {
       addDependency(parentDependency);
     }
     registerDependency(dependency);
+    dependencyPersister.saveDependency(currentProject, dependency);
     return dependency;
   }