aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-11-16 22:14:53 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-11-23 14:08:05 +0300
commit40e4d161fa319a443c2598ddbc74b8ad31220c68 (patch)
treec5f8c20b135c297c386e9e544f303c991e3b40ab
parent5d2f40dbca1ed021eb4586c8f3f5578825e82c57 (diff)
Add support for package-config task manifest value
-rw-r--r--libbbot/build-target-config.cxx (renamed from libbbot/build-config.cxx)34
-rw-r--r--libbbot/build-target-config.hxx (renamed from libbbot/build-config.hxx)22
-rw-r--r--libbbot/manifest.cxx35
-rw-r--r--libbbot/manifest.hxx15
-rw-r--r--tests/buildtab/driver.cxx6
-rw-r--r--tests/buildtab/testscript4
-rw-r--r--tests/manifest/task.testscript31
7 files changed, 99 insertions, 48 deletions
diff --git a/libbbot/build-config.cxx b/libbbot/build-target-config.cxx
index 15061fc..9e04a17 100644
--- a/libbbot/build-config.cxx
+++ b/libbbot/build-target-config.cxx
@@ -1,7 +1,7 @@
-// file : libbbot/build-config.cxx -*- C++ -*-
+// file : libbbot/build-target-config.cxx -*- C++ -*-
// license : MIT; see accompanying LICENSE file
-#include <libbbot/build-config.hxx>
+#include <libbbot/build-target-config.hxx>
#include <map>
#include <string>
@@ -23,10 +23,10 @@ using namespace butl;
namespace bbot
{
- LIBBBOT_EXPORT build_configs
+ LIBBBOT_EXPORT build_target_configs
parse_buildtab (istream& is, const string& name)
{
- build_configs r;
+ build_target_configs r;
tab_parser parser (is, name);
r.classes.push_back ("all");
@@ -56,22 +56,23 @@ namespace bbot
d);
};
- build_config config;
+ build_target_config config;
config.machine_pattern = move (tl[i++].value);
// If the machine pattern is a single dash character, then this is a
// placeholder entry. The only thing we are interested about it is the
// class inheritance information. Note that while all other information
- // is discarded, the configuration name and target must be present (can
- // also be dashes), so the classes field can be determined and parsed.
+ // is discarded, the target configuration name and target must be
+ // present (can also be dashes), so the classes field can be determined
+ // and parsed.
//
bool placeholder (config.machine_pattern == "-");
- // Configuration name, target[/environment] and classes fields are the
- // required ones.
+ // Target configuration name, target[/environment] and classes fields
+ // are the required ones.
//
if (i == n)
- bad_line ("no configuration name found");
+ bad_line ("no target configuration name found");
config.name = move (tl[i].value);
@@ -113,7 +114,7 @@ namespace bbot
for (const auto& c: r)
{
if (c.name == config.name && c.target == config.target)
- bad_line ("duplicate configuration name/target");
+ bad_line ("duplicate target configuration name/target");
}
if (++i == n)
@@ -221,7 +222,7 @@ namespace bbot
task_manifest::validate_regex (re);
config.warning_regexes.emplace_back (move (re));
}
- else // Configuration option or variable.
+ else // Target configuration option or variable.
config.args.emplace_back (move (v));
}
}
@@ -230,13 +231,14 @@ namespace bbot
bad_line (e.what ());
}
- // Save the configuration.
+ // Save the target configuration.
//
r.emplace_back (move (config));
}
// Erase entries for baseless classes (we were collecting them to make
- // sure that the class inheritance is consistent across configurations).
+ // sure that the class inheritance is consistent across target
+ // configurations).
//
for (auto i (r.class_inheritance_map.begin ());
i != r.class_inheritance_map.end (); )
@@ -250,11 +252,11 @@ namespace bbot
return r;
}
- build_configs
+ build_target_configs
parse_buildtab (const path& p)
{
ifdstream ifs (p);
- build_configs r (parse_buildtab (ifs, p.string ()));
+ build_target_configs r (parse_buildtab (ifs, p.string ()));
ifs.close (); // Throws on failure.
return r;
diff --git a/libbbot/build-config.hxx b/libbbot/build-target-config.hxx
index 473e5d8..27b555c 100644
--- a/libbbot/build-config.hxx
+++ b/libbbot/build-target-config.hxx
@@ -1,4 +1,4 @@
-// file : libbbot/build-config.hxx -*- C++ -*-
+// file : libbbot/build-target-config.hxx -*- C++ -*-
// license : MIT; see accompanying LICENSE file
#ifndef LIBBBOT_BUILD_CONFIG_HXX
@@ -19,10 +19,10 @@
namespace bbot
{
- // Build configuration matching specific machine names. Used by bbot
+ // Build target configuration matching specific machine names. Used by bbot
// controllers.
//
- struct build_config
+ struct build_target_config
{
std::string machine_pattern; // Machine name pattern.
std::string name; // Configuration name.
@@ -36,10 +36,10 @@ namespace bbot
std::vector<std::string> warning_regexes;
};
- struct build_configs: std::vector<build_config>
+ struct build_target_configs: std::vector<build_target_config>
{
- // List of all configuration class names. Starts with the all and default
- // classes. The rest follows in the same order as in the buildtab.
+ // List of all target configuration class names. Starts with the all and
+ // default classes. The rest follows in the same order as in the buildtab.
//
std::vector<std::string> classes;
@@ -53,17 +53,17 @@ namespace bbot
//
// buildtab consists of lines in the following format:
//
- // <machine-pattern> <config> <target>[/<environment>] <classes> [<config-arg>]* [<warning-regex>]*
+ // <machine-pattern> <target-config> <target>[/<environment>] <classes> [<tgt-config-arg>]* [<warning-regex>]*
//
- // Note that each <config>/<target> pair is expected to be unique in the
- // buildtab.
+ // Note that each <target-config>/<target> pair is expected to be unique in
+ // the buildtab.
//
using butl::tab_parsing;
- LIBBBOT_EXPORT build_configs
+ LIBBBOT_EXPORT build_target_configs
parse_buildtab (std::istream&, const std::string& name);
- LIBBBOT_EXPORT build_configs
+ LIBBBOT_EXPORT build_target_configs
parse_buildtab (const butl::path&);
}
diff --git a/libbbot/manifest.cxx b/libbbot/manifest.cxx
index 5b9de22..e2534c2 100644
--- a/libbbot/manifest.cxx
+++ b/libbbot/manifest.cxx
@@ -665,15 +665,23 @@ namespace bbot
environment = move (v);
}
- else if (n == "config")
+ else if (n == "config" || // @@ TMP Until toolchain 0.16.0 is released.
+ n == "target-config")
{
- if (!config.empty ())
- bad_name ("task configuration redefinition");
+ if (!target_config.empty ())
+ bad_name ("task target configuration redefinition");
- config = parse_tab (v, [](const string&){}, "configuration");
+ target_config = parse_tab (v, [](const string&){}, "configuration");
- if (config.empty ())
- bad_value ("empty task configuration");
+ if (target_config.empty ())
+ bad_value ("empty task target configuration");
+ }
+ else if (n == "package-config")
+ {
+ if (!package_config.empty ())
+ bad_name ("task package configuration redefinition");
+
+ package_config = move (v);
}
else if (n == "host")
{
@@ -829,7 +837,16 @@ namespace bbot
}
};
- serialize_list ("config", config);
+ // @@ TMP Always use 'target-config' name and always serialize
+ // package_config after toolchain 0.16.0 is released.
+ //
+ if (!package_config.empty ())
+ {
+ serialize_list ("target-config", target_config);
+ s.next ("package-config", package_config);
+ }
+ else
+ serialize_list ("config", target_config);
if (host)
s.next ("host", *host ? "true" : "false");
@@ -846,9 +863,9 @@ namespace bbot
}
strings task_manifest::
- unquoted_config () const
+ unquoted_target_config () const
{
- return string_parser::unquote (config);
+ return string_parser::unquote (target_config);
}
strings task_manifest::
diff --git a/libbbot/manifest.hxx b/libbbot/manifest.hxx
index 7ba53cb..13b1138 100644
--- a/libbbot/manifest.hxx
+++ b/libbbot/manifest.hxx
@@ -183,7 +183,12 @@ namespace bbot
//
// Note: could be quoted.
//
- strings config;
+ strings target_config;
+
+ // Whitespace separated list of potentially double/single-quoted package
+ // configuration arguments for bpkg-pkg-build command.
+ //
+ std::string package_config;
// If true, then this configuration is self-hosted.
//
@@ -200,7 +205,7 @@ namespace bbot
butl::optional<std::string> worker_checksum;
strings
- unquoted_config () const;
+ unquoted_target_config () const;
strings
unquoted_warning_regex () const;
@@ -215,7 +220,8 @@ namespace bbot
std::string mn,
butl::target_triplet tg,
butl::optional<std::string> en,
- strings cf,
+ strings tc,
+ std::string pc,
butl::optional<bool> ht,
strings wr,
butl::optional<std::string> ir,
@@ -230,7 +236,8 @@ namespace bbot
machine (std::move (mn)),
target (std::move (tg)),
environment (std::move (en)),
- config (std::move (cf)),
+ target_config (std::move (tc)),
+ package_config (std::move (pc)),
host (std::move (ht)),
warning_regex (std::move (wr)),
interactive (std::move (ir)),
diff --git a/tests/buildtab/driver.cxx b/tests/buildtab/driver.cxx
index df23dbc..1ea4331 100644
--- a/tests/buildtab/driver.cxx
+++ b/tests/buildtab/driver.cxx
@@ -6,7 +6,7 @@
#include <libbutl/utility.hxx> // operator<<(ostream,exception)
-#include <libbbot/build-config.hxx>
+#include <libbbot/build-target-config.hxx>
#undef NDEBUG
#include <cassert>
@@ -27,9 +27,9 @@ try
cin.exceptions (ios::failbit | ios::badbit);
cout.exceptions (ios::failbit | ios::badbit);
- const build_configs& configs (parse_buildtab (cin, "cin"));
+ const build_target_configs& configs (parse_buildtab (cin, "cin"));
- for (const build_config& c: configs)
+ for (const build_target_config& c: configs)
{
cout << c.machine_pattern << ' ' << c.name << ' ' << c.target;
diff --git a/tests/buildtab/testscript b/tests/buildtab/testscript
index 5631527..6c8b054 100644
--- a/tests/buildtab/testscript
+++ b/tests/buildtab/testscript
@@ -55,12 +55,12 @@
$* <<EOI 2>>EOE == 1
windows*-vc_14*
EOI
- cin:1:16: error: no configuration name found
+ cin:1:16: error: no target configuration name found
EOE
: dup
:
- $* <<EOI 2>'cin:3:31: error: duplicate configuration name/target' == 1
+ $* <<EOI 2>'cin:3:31: error: duplicate target configuration name/target' == 1
windows*-vc_14* windows-vc_14 i686-microsoft-win32-msvc14.0 default
windows*-vc_14* windows-vc_14 x86_64-microsoft-win32-msvc14.0 default
windows*-vc_14* windows-vc_14 i686-microsoft-win32-msvc14.0 default
diff --git a/tests/manifest/task.testscript b/tests/manifest/task.testscript
index bd1a365..d224124 100644
--- a/tests/manifest/task.testscript
+++ b/tests/manifest/task.testscript
@@ -24,6 +24,31 @@ test.options += -t
machine: windows_10-msvc_14
target: x86_64-microsoft-win32-msvc14.0
environment: lld
+ target-config: config.cc.coptions=/Z7 config.cc.loptions=/DEBUG
+ package-config: config.foo.network=true
+ warning-regex: '^warning: ' '^.+: warning: '
+ interactive: error
+ worker-checksum: 1
+ EOF
+
+ # @@ TMP Remove when toolchain 0.16.0 is released.
+ #
+ : no-package-config
+ :
+ $* <<EOF >>EOF
+ : 1
+ name: foo
+ version: 1.0
+ repository-url: http://pkg.example.org/1/math
+ trust: AB:0D:3F:C1:B0:13:E4:0E:AD:4A:08:06:AE:F3:85:DB:E2:27:5F:83:11:47:A2:7\
+ 8:64:3C:73:60:F8:66:3A:A4
+ requires: host
+ tests: foo-tests
+ examples: foo-examples
+ dependency-checksum: 12345
+ machine: windows_10-msvc_14
+ target: x86_64-microsoft-win32-msvc14.0
+ environment: lld
config: config.cc.coptions=/Z7 config.cc.loptions=/DEBUG
warning-regex: '^warning: ' '^.+: warning: '
interactive: error
@@ -233,7 +258,7 @@ test.options += -t
: config
:
- $* <<EOI 2>'stdin:3:1: error: task configuration redefinition' == 1
+ $* <<EOI 2>'stdin:3:1: error: task target configuration redefinition' == 1
: 1
config: config.cc.coptions=/Z7
config: config.cc.loptions=/DEBUG
@@ -341,12 +366,12 @@ test.options += -t
target:
EOI
- : config
+ : target-config
:
{
: empty
:
- $* <<EOI 2>'stdin:2:8: error: empty task configuration' == 1
+ $* <<EOI 2>'stdin:2:8: error: empty task target configuration' == 1
: 1
config:
EOI