Skip to content
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

[question] Hardlocked options and diamonds #6408

Closed
Minimonium opened this issue Jan 23, 2020 · 1 comment
Closed

[question] Hardlocked options and diamonds #6408

Minimonium opened this issue Jan 23, 2020 · 1 comment

Comments

@Minimonium
Copy link
Contributor

Related to #3524, #5530

It's explicitly allowed to hardcode dependencies' options in the documentation.

Alternatively, it's encouraged to use default_options. But it becomes a problem comically fast as this test shows:
https://github.com/conan-io/conan/blob/develop/conans/test/unittests/model/transitive_reqs_test.py#L1063

@Morwenn has provided us in the Slack with a great minimal example of a conflict of hardlocked options in subgraphs:

from conans import ConanFile

class LibFirstConan(ConanFile):
    name = "zero"
    version = "1.0.0"
    description = "Zero library"
from conans import ConanFile

class LibFirstConan(ConanFile):
    name = "first"
    version = "1.0.0"
    description = "First library"

    options = {"with_zero": [True, False]}
    default_options = {"with_zero": True}

    def requirements(self):
        if self.options.with_zero:
            self.requires("zero/1.0.0@")
from conans import ConanFile

class LibSecondConan(ConanFile):
    name = "second"
    version = "1.0.0"
    description = "Second library"

    options = {"with_first": [True, False]}
    default_options = {"with_first": False}

    def configure(self):
        if self.options.with_first:
            self.options["first"].with_zero = False

    def requirements(self):
        if self.options.with_first:
            self.requires("first/1.0.0@")
from conans import ConanFile

class LibThirdConan(ConanFile):
    name = "third"
    version = "1.0.0"
    description = "Third library"

    def configure(self):
        self.options["second"].with_first = True

    def requirements(self):
        self.requires("first/1.0.0@")
        self.requires("second/1.0.0@")
conan export zero
conan export first
conan export second
conan create third

Depending on the order of requirements in the third/1.0.0@ we get the diamond error, although in the whole graph we do have only one set of hardlocked options, which in this case was unexpected for the user.

It highlights issues with the runtime graph construction and in-recipe external configuration modifications and preferences (not only settings but external options too). It's practically impossible to dynamically alter other subgraphs from a parallel subgraph and in a sequential solution, we'd have an unreliable build.

The question is - what should we do with recommendations for that in the documentation?

@memsharded
Copy link
Member

Sorry this was not responded back then @Minimonium

I am closing this as outdated, Conan 2 already changed how options are managed, including new important! options definitions, not conflicting by default, etc.

Please open new tickets if necessary, thanks for the feedback!

@memsharded memsharded closed this as not planned Won't fix, can't repro, duplicate, stale Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants