]> git.tdb.fi Git - builder.git/blob - source/datacollection.cpp
Fix DataCollection dependencies
[builder.git] / source / datacollection.cpp
1 #include <msp/fs/utils.h>
2 #include "component.h"
3 #include "datacollection.h"
4 #include "datatransform.h"
5 #include "sourcepackage.h"
6
7 using namespace Msp;
8
9 DataCollection::DataCollection(Builder &b, const Component &c, DataTransform &s):
10         FileTarget(b, c.get_package(), generate_target_path(c, s.get_path())),
11         source(s)
12 {
13         component = &c;
14         add_dependency(source);
15 }
16
17 Msp::FS::Path DataCollection::generate_target_path(const Component &comp, const Msp::FS::Path &src)
18 {
19         return comp.get_package().get_temp_directory()/comp.get_name()/(FS::basepart(FS::basename(src))+".mdc");
20 }
21
22 void DataCollection::find_dependencies()
23 {
24         source.prepare();
25         const Target::Dependencies &tdeps = source.get_transitive_dependencies();
26         for(Target::Dependencies::const_iterator i=tdeps.begin(); i!=tdeps.end(); ++i)
27                 add_dependency(**i);
28 }