aboutsummaryrefslogtreecommitdiff
path: root/bbot/build-config
blob: d7a07d9a817e70b918a98ee1b1a7de3d70ced06c (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
41
42
43
44
45
46
47
48
49
50
51
52
53
// file      : bbot/build-config -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

#ifndef BBOT_BUILD_CONFIG
#define BBOT_BUILD_CONFIG

#include <string>
#include <vector>
#include <iosfwd>

#include <butl/path>
#include <butl/optional>
#include <butl/tab-parser>
#include <butl/target-triplet>

#include <bbot/export>
#include <bbot/version>

namespace bbot
{
  // Build configuration matching specific machine names. Used by bbot
  // controllers.
  //
  struct build_config
  {
    std::string machine_pattern; // Machine name pattern.
    std::string name;            // Configuration name.

    butl::optional<butl::target_triplet> target;

    std::vector<std::string> vars;
  };

  using build_configs = std::vector<build_config>;

  // Parse buildtab stream or file. Throw tab_parsing on parsing error,
  // ios::failure on the underlying OS error.
  //
  // buildtab consists of lines in the following format:
  //
  // <machine-name-pattern> <config-name> [<target>] [<config-vars>]
  //
  using butl::tab_parsing;

  LIBBBOT_EXPORT build_configs
  parse_buildtab (std::istream&, const std::string& name);

  LIBBBOT_EXPORT build_configs
  parse_buildtab (const butl::path&);
}

#endif // BBOT_BUILD_CONFIG