X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fvssolutiongenerator.cpp;fp=source%2Fvssolutiongenerator.cpp;h=90adc693ebdedd7a51b0cffb41929343aac792be;hb=eabb3f5b9b0d32adda71d4dd7e56796f7ea3bdd2;hp=0000000000000000000000000000000000000000;hpb=a557d2ba9aae4a05e4b15c81ba5262da7caac2a5;p=builder.git diff --git a/source/vssolutiongenerator.cpp b/source/vssolutiongenerator.cpp new file mode 100644 index 0000000..90adc69 --- /dev/null +++ b/source/vssolutiongenerator.cpp @@ -0,0 +1,48 @@ +#include +#include +#include "sourcepackage.h" +#include "vcxprojectfile.h" +#include "vssolutionfile.h" +#include "vssolutiongenerator.h" + +using namespace std; +using namespace Msp; + +VsSolutionGenerator::VsSolutionGenerator(Builder &b): + Tool(b, "VSSG") +{ } + +Target *VsSolutionGenerator::create_target(const list &, const string &) +{ + throw logic_error("Not implemented"); +} + +Task *VsSolutionGenerator::run(const Target &target) const +{ + const VsSolutionFile &solution = dynamic_cast(target); + Worker *worker = new Worker(solution); + return new InternalTask(worker); +} + + +VsSolutionGenerator::Worker::Worker(const VsSolutionFile &t): + target(t) +{ } + +void VsSolutionGenerator::Worker::main() +{ + IO::BufferedFile out(target.get_path().str(), IO::M_WRITE); + IO::print(out, "Microsoft Visual Studio Solution File, Format Version 12.00\n"); + IO::print(out, "MinimumVisualStudioVersion = 10.0.40219.1\n"); + + const Target::Dependencies &deps = target.get_dependencies(); + for(Target::Dependencies::const_iterator i=deps.begin(); i!=deps.end(); ++i) + if(const VcxProjectFile *project = dynamic_cast(*i)) + { + const SourcePackage *pkg = project->get_package(); + IO::print(out, "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"%s\", \"%s\", \"{%s}\"\nEndProject\n", + pkg->get_name(), project->get_path(), project->get_guid()); + } + + status = Task::SUCCESS; +}