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

[bugfix] BazelDeps in the build context #16025

Merged

Conversation

ErniGH
Copy link
Contributor

@ErniGH ErniGH commented Apr 4, 2024

Changelog: Bugfix: BazelDeps now uses the requirement.build property instead of dependency.context one.
Docs: Omit
Closes: #15764

Based on the tests that were done in the issue: #15763

@ErniGH ErniGH requested a review from franramirez688 April 4, 2024 22:16
Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it seems that BazelDeps is already doing the right thing:

    for require, dep in list(host_req.items()) + list(build_req.items()) + list(test_req.items()):
        # Require is not used at the moment, but its information could be used,
        # and will be used in Conan 2.0
        # Filter the build_requires not activated with self.build_context_activated
        if require.build and dep.ref.name not in build_context_activated:
            continue
        yield require, dep

@memsharded memsharded added this to the 2.3.0 milestone Apr 4, 2024
Copy link
Contributor

@franramirez688 franramirez688 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ErniGH Tests looks great 👏 I'd like to clarify doubts before merging this.

tc.build_context_activated = ["wayland", "dep"]
tc.generate()
def build(self):
context = "build-" if self.context == "build" else ""
Copy link
Contributor

@franramirez688 franramirez688 Apr 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@memsharded The context is always build (just checked putting an assert in this build step). Is that expected? I guess YES because the graph calculated looks like this:

======== Computing dependency graph ========
Graph root
    conanfile.py: /private/var/folders/s8/zgn806y90xq7bdh64hhfw9th0000gr/T/tmpy1s2giudconans/path with spaces/app/conanfile.py
Build requirements
    dep/1.0#3a30dfa1bc966c78af6678a6375744ac - Cache
    tool/1.0#3e589dc662831acefe3409d0cada984a - Cache
    wayland/1.0#7d0d2121157a6bacdeb022a5f85214dc - Cache

======== Computing necessary packages ========
Build requirements
    dep/1.0#3a30dfa1bc966c78af6678a6375744ac:da39a3ee5e6b4b0d3255bfef95601890afd80709 - Build
    tool/1.0#3e589dc662831acefe3409d0cada984a:6e8233b34cdad3c0e85d07cf9e18ae9291726bd1 - Build
    wayland/1.0#7d0d2121157a6bacdeb022a5f85214dc:abfcc78fa8242cabcd1e3d92896aa24808c789a3 - Build

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might be a copy&paste from other test in which it is also a host requirement

@franramirez688 franramirez688 merged commit 06297af into conan-io:develop2 Apr 5, 2024
2 checks passed
@franramirez688 franramirez688 changed the title Test for BazelDeps in the build context [bugfix] BazelDeps in the build context Apr 8, 2024
memsharded pushed a commit to memsharded/conan that referenced this pull request Apr 9, 2024
* feat add test to bazeldeps

* Fixed several bugs. Improved tests coverage

* Reverted

* Better name

---------

Co-authored-by: Francisco Ramirez de Anton <franchuti688@gmail.com>
czoido pushed a commit that referenced this pull request Jun 4, 2024
* wip

* wip

* wip

* Test for BazelDeps in the build context (#16025)

* feat add test to bazeldeps

* Fixed several bugs. Improved tests coverage

* Reverted

* Better name

---------

Co-authored-by: Francisco Ramirez de Anton <franchuti688@gmail.com>

* copy only if different (#16031)

* allow conf in exports-sources and export (#16034)

* refactor apple_min_version_flag() (#16017)

* refactor apple_min_version_flag()

* Refactored all the apple module and where it was being used (AutotoolsToolchain and MesonToolchain for now)

* Fixed bad return

* Fixing tests

* Keeping legacy behavior in apple_min_version_flag function

* Preventing possible breaking change

---------

Co-authored-by: Francisco Ramirez de Anton <franchuti688@gmail.com>

* Allow to unhide git url (#16038)

* Add hide_url tests for git scm tool

* Add hide_url flag to clone and fetch_commit.

Resolves #15684

* Update conans/test/functional/tools/scm/test_git.py

* Update conans/test/functional/tools/scm/test_git.py

---------

Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>

* wip

* wip

* wip

* fix

* Update conan/tools/build/cstd.py

Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>

* Update conan/tools/build/cstd.py

Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>

* Update conan/tools/build/cstd.py

Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>

---------

Co-authored-by: Ernesto de Gracia Herranz <vivalaburocracia@hotmail.com>
Co-authored-by: Francisco Ramirez de Anton <franchuti688@gmail.com>
Co-authored-by: Sebastian Höffner <info@sebastian-hoeffner.de>
Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>
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

Successfully merging this pull request may close these issues.

Fix BazelDeps in the build context
3 participants