p = (package.get_source_directory()/p).str();
}
+FS::Path Component::get_temp_directory() const
+{
+ return package.get_temp_directory()/name;
+}
+
+string Component::flatten_source_path(const FS::Path &source) const
+{
+ FS::Path temp_dir = get_temp_directory();
+ FS::Path rel_src;
+ if(FS::descendant_depth(source, temp_dir)>=0)
+ rel_src = FS::relative(source, temp_dir);
+ else
+ rel_src = FS::relative(source, package.get_source_directory());
+
+ string fn;
+ for(const string &c: rel_src)
+ if(c!=".")
+ append(fn, "_", c);
+
+ return fn;
+}
+
BuildInfo Component::get_build_info_for_path(const FS::Path &path) const
{
// XXX Cache these and check that the directories actually exist before adding them
/** Prepares any required packages. */
void prepare();
+ Msp::FS::Path get_temp_directory() const;
+ std::string flatten_source_path(const Msp::FS::Path &) const;
+
/** Prepares the build information for building. Pulls build info from the
parent and dependency packages, and adds any component-specific flags. */
virtual void create_build_info();
FS::Path ObjectFile::generate_target_path(const Component &comp, const FS::Path &src)
{
- const SourcePackage &pkg = comp.get_package();
- FS::Path temp_dir = pkg.get_temp_directory();
- FS::Path rel_src;
- if(FS::descendant_depth(src, temp_dir)>=0)
- rel_src = FS::relative(src, temp_dir);
- else
- rel_src = FS::relative(src, pkg.get_source_directory());
- string fn;
- for(const string &c: rel_src)
- {
- if(!fn.empty())
- fn += '_';
- if(c!=".")
- fn += c;
- }
+ string fn = comp.flatten_source_path(src);
const Architecture &arch = comp.get_package().get_builder().get_current_arch();
- return temp_dir/comp.get_name()/arch.create_filename<ObjectFile>(FS::basepart(fn));
+ return comp.get_temp_directory()/arch.create_filename<ObjectFile>(FS::basepart(fn));
}
void ObjectFile::set_used_in_shared_library(bool u)