aboutsummaryrefslogtreecommitdiff
path: root/bdep/config.hxx
blob: 3c66b72452de40caa682742c89609469fb316c49 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// file      : bdep/config.hxx -*- C++ -*-
// license   : MIT; see accompanying LICENSE file

#ifndef BDEP_CONFIG_HXX
#define BDEP_CONFIG_HXX

#include <bdep/types.hxx>
#include <bdep/utility.hxx>

#include <bdep/project.hxx>
#include <bdep/config-options.hxx>

namespace bdep
{
  // If type is nullopt, then assume that an existing configuration is being
  // added. If that's the case, query the bpkg configuration type and links
  // and warn the user if any host or build2 configurations are linked, unless
  // they are already associated with the project.
  //
  shared_ptr<configuration>
  cmd_config_add (const common_options&,
                  const configuration_add_options&,
                  const dir_path&           prj,
                  const package_locations&,
                  database&,
                  dir_path                  path,
                  optional<string>          name,
                  optional<string>          type,
                  optional<uint64_t>        id = nullopt,
                  const char*               what = "added");

  // Configuration directory should exist and its path should be absolute and
  // normalized.
  //
  shared_ptr<configuration>
  cmd_config_add (const dir_path&         prj,
                  transaction&,
                  const dir_path&         path,
                  const optional<string>& name,
                  string                  type,
                  bool                    default_ = true,
                  bool                    forward = true,
                  bool                    auto_sync = true,
                  optional<uint64_t>      id = nullopt);

  void
  cmd_config_add_print (diag_record&,
                        const dir_path&         prj,
                        const dir_path&,
                        const optional<string>& name,
                        bool                    default_ = true,
                        bool                    forward = true,
                        bool                    auto_sync = true);

  shared_ptr<configuration>
  cmd_config_create (const common_options&,
                     const configuration_add_options&,
                     const dir_path&           prj,
                     const package_locations&,
                     database&,
                     dir_path                  path,
                     const strings&            args,
                     optional<string>          name,
                     string                    type,
                     optional<uint64_t>        id = nullopt);

  // Configuration directory path should be absolute and normalized.
  //
  shared_ptr<configuration>
  cmd_config_create (const common_options&,
                     const dir_path&         prj,
                     transaction&,
                     const dir_path&         path,
                     const optional<string>& name,
                     string                  type,
                     bool                    default_ = true,
                     bool                    forward = true,
                     bool                    auto_sync = true,
                     bool                    existing = false,
                     bool                    wipe = false,
                     const strings&          args = {},
                     optional<uint64_t>      id = nullopt);

  void
  cmd_config_create_print (diag_record&,
                           const dir_path&         prj,
                           const dir_path&,
                           const optional<string>& name,
                           const string&           type,
                           bool                    default_ = true,
                           bool                    forward = true,
                           bool                    auto_sync = true,
                           const strings&          args = {});

  void
  cmd_config_link (const common_options&,
                   const shared_ptr<configuration>&,
                   const shared_ptr<configuration>&);

  int
  cmd_config (cmd_config_options&&, cli::scanner& args);

  // Validate returning one of the options or NULL if none specified.
  //
  const char*
  cmd_config_validate_add (const configuration_add_options&);

  // Validate setting configuration name and/or id if specified.
  //
  void
  cmd_config_validate_add (const configuration_name_options&,
                           const char* what,
                           optional<string>& name,
                           optional<uint64_t>& id);

  default_options_files
  options_files (const char* cmd,
                 const cmd_config_options&,
                 const strings& args);

  cmd_config_options
  merge_options (const default_options<cmd_config_options>&,
                 const cmd_config_options&);
}

#endif // BDEP_CONFIG_HXX