Skip to content

Conversation

memsharded
Copy link
Member

@memsharded memsharded commented Mar 10, 2021

Changelog: Feature: New conan install <ref> --build-require and conan create <path> --build-require (when not using test_package) arguments to explicitly define that the installed or created package has to be a build-require, receiving the build profile instead of the host one.
Docs: omit

This follows #8787 that added support for the test_package.
To discuss: Should we use --build-require always for conan create, even if it is defined in test_package/conanfile.py with test_type = "build_requires"?

#tags: slow

@@ -576,7 +577,10 @@ def _propagate_info(self, node, using_build_profile):

for n in node_order:
if n not in transitive:
conan_file.output.info("Applying build-requirement: %s" % str(n.ref))
try:
conan_file.output.info("Applying build-requirement: %s" % str(n.ref))
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Member Author

Choose a reason for hiding this comment

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

The printing of virtual consumers is disabled, because it was very confusing to users, seeing something like (virtual): Applying build-requirement.... So conanfile.output.info or any other printing command will raise for RECIPE_VIRTUAL recipe.

@@ -290,11 +304,11 @@ def _recurse_build_requires(self, graph, builder, check_updates,
for node in graph.ordered_iterate(nodes_subset):
# Virtual conanfiles doesn't have output, but conanfile.py and conanfile.txt do
# FIXME: To be improved and build a explicit model for this
if node.recipe == RECIPE_VIRTUAL:
continue
#if node.recipe == RECIPE_VIRTUAL:
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Member Author

Choose a reason for hiding this comment

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

Virtual recipes couldn't have build_requires so far, only regular requires. This is opening the door for this possibility.

@@ -306,8 +306,11 @@ def load_virtual(self, references, profile_host, scope_options=True,
conanfile.conf = profile_host.conf.get_conanfile_conf(None)
conanfile.settings = profile_host.processed_settings.copy_values()

for reference in references:
conanfile.requires.add_ref(reference)
if is_build_require:
Copy link
Contributor

@SSE4 SSE4 Mar 11, 2021

Choose a reason for hiding this comment

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

may they have the same interface? e.g.

        if is_build_require:
            for reference in references:
                conanfile.build_requires.add_ref(reference)
        else:
            for reference in references:
                conanfile.requires.add_ref(reference)

cmd = ". ./activate.sh && mycmake.sh" if platform.system() != "Windows" else \
"activate.bat && mycmake.bat"
client.run_command(cmd)
system = {"Darwin": "Macos"}.get(platform.system(), platform.system())
Copy link
Contributor

Choose a reason for hiding this comment

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

why this pattern is repeating and needed?

@memsharded memsharded added this to the 1.37 milestone May 9, 2021
@memsharded memsharded requested review from lasote and czoido May 9, 2021 15:02
@memsharded memsharded marked this pull request as ready for review May 24, 2021 10:23
@memsharded memsharded merged commit 99640b2 into conan-io:develop May 27, 2021
@memsharded memsharded deleted the feature/test_br branch May 27, 2021 11:40
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.

4 participants