From 2b3a173331100d8f6967a05fd2c81ebeeb3c7836 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Thu, 5 Mar 2015 12:23:30 +0100 Subject: [PATCH] Dependencies should be persisted early to have proper id in the DSM --- .../src/main/java/org/sonar/batch/design/DsmDecorator.java | 1 - .../src/main/java/org/sonar/batch/index/DefaultIndex.java | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/sonar-batch/src/main/java/org/sonar/batch/design/DsmDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/design/DsmDecorator.java index 0fdae1a037b..8dafbe0cbd0 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/design/DsmDecorator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/design/DsmDecorator.java @@ -74,7 +74,6 @@ public abstract class DsmDecorator implements Decorator { return; } Dsm dsm = getDsm(children, feedbackEdges); - // Optimization, don't save DSM if there is no dependency at all saveDsm(context, dsm); } } diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java index 393e8968ad9..0bec73c2c3e 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java @@ -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 projectDependencies = getDependenciesBetweenProjects(); dependencies.clear(); @@ -290,6 +285,7 @@ public class DefaultIndex extends SonarIndex { addDependency(parentDependency); } registerDependency(dependency); + dependencyPersister.saveDependency(currentProject, dependency); return dependency; } -- 2.39.5