summaryrefslogtreecommitdiffhomepage
path: root/Builder.h
blob: 12338f08f57bc475255570b5c98794239939ad2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include <filesystem>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <boost/property_tree/ptree.hpp>

#include "ProcessRunner.h"

class Builder
{
public:
 Builder(const boost::property_tree::ptree& ptree);

 void build();
 void clean();

private:
 std::vector<std::filesystem::path> dependencies_of(const std::filesystem::path& p);
 bool is_outdated(const std::filesystem::path& p);

 void build_file(const std::filesystem::path& p);
 void build_list();

 void cleanup();

 std::filesystem::path _target;
 std::vector<std::filesystem::path> _objects;
 std::vector<std::filesystem::path> _sources;
 std::unordered_map<std::filesystem::path, std::vector<std::filesystem::path>> _dependencies;

 ProcessRunner _runner;

 std::unordered_set<std::filesystem::path> _buildlist; // build done
 std::unordered_set<std::filesystem::path> _activelist; // currently building
 std::unordered_set<std::filesystem::path> _donelist; // build done
};