-
Notifications
You must be signed in to change notification settings - Fork 992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] Introduce exception raised in 'configure' that will propagate only if 'build' #6952
Conversation
…agated if the conanfile is going to be built
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering, and thinking that it would be good to see an effect in the package_id too:
- configure raise
ConanIWontBuild
- package_id computes an "INVALID-ID" for this binary (still able to fall back to other compatible package_ids)
- if build() tries to build an INVALID-ID, it raises.
I am not sure, but if you need to throw an exception only of package is being build, why not just throw it from the |
This has been one of the best answers so far and it has taken me more than a week to think about why yes/not to do this. 🙌 (Maybe this is a symptom of a bad workflow in CCI, but) we need to know if the recipe will build for a given settings without running the So this kind of exception should be known by Conan without running the build and it cannot be raised and propagated from the These are more or less the constraints. The exception as it works in this PR is valid for a solo-developer, in my machine it is ok if it raises in the |
yes, for me it sounds definitely as CI or jenkins workflow design limitation, which you are trying to solve in the conan client. I'd probably better re-design workflow, if possible, so it just discards builds raising in the |
The question would be, (regarding CCI), can we run For the I think we need to imagine a valid use-case or this will reach a dead-end |
reviewed this. I think this is a new mode/behavior we need to build around the existing
|
Not exactly related to this exception, but I think it has something to do with the strategy of falling back to available binaries when build is not required. Talking about tools, we agree that some of them belong to a package that also contains libraries ( In some scenarios, we could think that providing a really short profile for the build context could be enough: profile:build
if I only want a binary that runs, I don't care about other settings, I'd prefer static, Release, x64,... but if another binary is available just use it instead of failing and force me to build. From the package_id perspective, it looks like the compatible packages feature is enough, but this profile will fail to assign settings because There are two paths: one for the generation of packages and one for the consumption. |
I think this has been superseded by #8053 |
Changelog: Feature: Add
ConanIWontBuild
exception: this exception is being raised from theconfigure()
method but it will trigger a failure only ifbuild()
method is executed.Docs: https://github.com/conan-io/docs/pull/XXXX
On top of refactor in #6951
Introduces a
ConanIWontBuild
exception (please, suggest a proper name) that the user can raise from theconfigure()
method, but it will be propagated only if Conan invokes the build method.This can be useful for scenarios with
compatible_packages
where one configuration won't build, but there is a compatible package that can be used (see test in this PR).Find a better name for the exception
It's up to the user to raise this function after any other
ConanInvalidConfiguration
Conan will fail with the same code error as
ConanInvalidConfiguration
, is it ok?