aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bdep/ci.cli16
-rw-r--r--bdep/ci.cxx34
-rw-r--r--tests/ci.testscript39
3 files changed, 82 insertions, 7 deletions
diff --git a/bdep/ci.cli b/bdep/ci.cli
index 832f01a..c3f8825 100644
--- a/bdep/ci.cli
+++ b/bdep/ci.cli
@@ -65,9 +65,16 @@ namespace bdep
\
$ bdep ci --builds gcc
+ $ bdep ci --builds network/gcc
$ bdep ci --target-config 'linux*-gcc*'
$ bdep ci --package-config network
$ bdep ci --build-config 'network/linux*-gcc*'
+
+ $ bdep ci --override \
+ 'default-build-config: config.foo.cache=true config.foo.buffer=16'
+
+ $ bdep ci --override 'mytest-build-config: config.foo.cache=true' \
+ --package-config mytest
\
Manifest overrides override the entire value group that they belong
@@ -79,8 +86,17 @@ namespace bdep
build-email build-{warning,error}-email
builds build-{include,exclude}
*-builds *-build-{include,exclude}
+ *-build-config
\
+ For the package configuration-specific build constraint overrides the
+ corresponding configuration must exist in the package manifest. In
+ contrast, the package configuration override (\cb{*-build-config}) adds a
+ new configuration if it doesn't exist and updates the arguments of the
+ existing configuration otherwise. In the former case, all the potential
+ build constraint overrides for such a newly added configuration must
+ follow the corresponding \cb{*-build-config} override.
+
Note that the build constraints group values (both common and build
package configuration-specific) are overridden hierarchically so that the
\c{[\b{*-}]\b{build-}{\b{include},\b{exclude}\}} overrides don't affect
diff --git a/bdep/ci.cxx b/bdep/ci.cxx
index 5f93872..e6acf98 100644
--- a/bdep/ci.cxx
+++ b/bdep/ci.cxx
@@ -221,7 +221,8 @@ namespace bdep
// --build-email, and --builds which are all handled by
// cli::parser<cmd_ci_override>. But first verify that they don't clash
// with the other build constraints-related options. Also detect if any of
- // these overrides are build package configuration-specific.
+ // them are build package configuration-specific build constraint
+ // overrides.
//
bool pkg_config_ovr (o.build_config_specified () ||
o.package_config_specified () ||
@@ -616,22 +617,41 @@ namespace bdep
const small_vector<build_package_config, 1>& cs (m.build_configs);
+ // Fail if the specified build configuration is not found, unless
+ // there is a corresponding *-build-config override which means that
+ // this configuration will be created. Note that no configuration-
+ // specific build constraint overrides have been specified for it,
+ // since we would fail earlier in that case (they would clash with
+ // *-package-config). Thus, we will just override this being created
+ // build configuration with the common build constraints.
+ //
+ const build_package_config* c (nullptr);
+
auto i (find_if (cs.begin (), cs.end (),
[&pc] (const build_package_config& c)
{return c.name == pc;}));
if (i == cs.end ())
- fail << "invalid --package-config option value: package " << m.name
- << " has no build configuration '" << pc << '\'';
+ {
+ string v (pc + "-build-config");
+
+ if(find_if (overrides.begin (), overrides.end (),
+ [&v] (const manifest_name_value& nv)
+ {return nv.name == v;}) == overrides.end ())
+ {
+ fail << "invalid --package-config option value: package "
+ << m.name << " has no build configuration '" << pc << '\'';
+ }
+ }
+ else
+ c = &*i;
// Override the package configuration with it's current build
// constraints, if present, and with the common build constraints
// otherwise.
//
- const build_package_config& bc (*i);
-
- if (!bc.builds.empty () || !bc.constraints.empty ())
- override_builds (bc.builds, bc.constraints);
+ if (c != nullptr && (!c->builds.empty () || !c->constraints.empty ()))
+ override_builds (c->builds, c->constraints);
else if (!m.builds.empty () || !m.build_constraints.empty ())
override_builds (m.builds, m.build_constraints);
else
diff --git a/tests/ci.testscript b/tests/ci.testscript
index 7cb6245..cff198b 100644
--- a/tests/ci.testscript
+++ b/tests/ci.testscript
@@ -28,6 +28,7 @@ end
+cat <<EOI >+prj/build/root.build
config [bool] config.prj.network ?= false
+ config [bool] config.prj.cache ?= false
EOI
+cat <<EOI >+prj/manifest
@@ -187,6 +188,44 @@ windows = ($cxx.target.class == 'windows')
EOE
}
+ : build-configs
+ :
+ {
+ $clone_prj;
+
+ $* --override 'mytest-build-config: config.prj.network=true config.prj.cache=true' \
+ --override 'default-build-config: config.prj.network=true' 2>>~%EOE%
+ %CI request is queued.*%
+ %reference: .+%
+ EOE
+ }
+
+ : build-configs-constraints
+ :
+ {
+ $clone_prj;
+
+ $* --override 'mytest-build-config: config.prj.network=true config.prj.cache=true' \
+ --build-config 'mytest/linux*-gcc*' \
+ --override 'default-build-config: config.prj.network=true' \
+ --build-config 'default/macos*-gcc*' 2>>~%EOE%
+ %CI request is queued.*%
+ %reference: .+%
+ EOE
+ }
+
+ : build-configs-package-config
+ :
+ {
+ $clone_prj;
+
+ $* --override 'mytest-build-config: config.prj.network=true config.prj.cache=true' \
+ --package-config 'mytest' 2>>~%EOE%
+ %CI request is queued.*%
+ %reference: .+%
+ EOE
+ }
+
: common-package-build-constraints
:
{