Skip to content

Commit

Permalink
Draft for fix and test of #405 (The dependency analyzer extends proje…
Browse files Browse the repository at this point in the history
…cts scope by pulling the dependencies into it)
  • Loading branch information
wenns committed Jan 27, 2015
1 parent f86bc5e commit 6f32c49
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int very_useful_function(int a, int b){
return a * b;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
int very_useful_function(int a, int b);
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sonar.language=c++
sonar.sources=src
sonar.tests=tests/unittests

sonar.cxx.includeDirectories=src
sonar.cxx.includeDirectories=src,3rdparty

# paths to the reports
sonar.cxx.cppcheck.reportPath=build/cppcheck-report.xml
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/testdata/smoketest_project/src/cli/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
CPPFLAGS = -I..
CPPFLAGS = -I.. -I../../3rdparty

OBJECTS = main.o
$(BUILD_DIR)/app: $(OBJECTS)
$(LD) $(LDFLAGS) $(OBJECTS) $(BUILD_DIR)/libcomponents.a -o $@
$(LD) $(LDFLAGS) $(OBJECTS) $(BUILD_DIR)/libcomponents.a -o $@

%.o : %.cc
$(CC) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <iostream>
#include <lib/component1.hh>
#include <extlib.hh>

int main(int argc, char* argv[])
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,20 @@ public void save() {
for (Directory dir : packages) {
//Save dependencies (cross-directories, including cross-directory file dependencies)
for (DirectoryEdge edge : packagesGraph.getOutgoingEdges(dir)) {
Dependency dependency = new Dependency(dir, edge.getTo())
Directory to = edge.getTo();
if(context.isIndexed(to, false)){
Dependency dependency = new Dependency(dir, to)
.setUsage("references")
.setWeight(edge.getWeight())
.setParent(null);
context.saveDependency(dependency);
dependencyIndex.put(edge, dependency);
context.saveDependency(dependency);
dependencyIndex.put(edge, dependency);

for(FileEdge subEdge : edge.getRootEdges()) {
saveFileEdge(subEdge, dependency);
for(FileEdge subEdge : edge.getRootEdges()) {
saveFileEdge(subEdge, dependency);
}
} else {
CxxUtils.LOG.debug("Skipping dependency to directory '{}', because it is'nt part of this project", to.getName());
}
}

Expand Down

0 comments on commit 6f32c49

Please sign in to comment.