Open sandeshhardikar opened 8 months ago
Hi @sandeshhardikar
Thanks for reporting the issue.
Are you consuming the package recipe as a normal requirement or a tool requirement? This mechanism only takes effect over tool requirements (you can check this piece of documentation).
A simple example having a tool requirement and a recipe acting as a consumer:
tool_a.py
class myToolRecipe(ConanFile):
name = "tool_a"
version = "1.0.0"
# ...
def package_info(self):
# ....
self.conf_info.append("tools.google.bazel:bazelrc_path", bazel_toolchain_file_path)
Consumer recipe conanfile.py:
class ConsumerConan(ConanFile):
# ....
def build_requirements(self):
self.tool_requires("tool_a/1.0.0")
def build(self):
bazel = Bazel(self)
bazel.build()
Executing the build()
step now, you'll be able to see something like:
consumer/1.0: RUN: bazel --bazelrc=/Users/xxxxx/.conan2/p/b/xxxxxxx/b/conan/conan_bzl.rc --bazelrc=[bazel_toolchain_file_path] build --config=conan-config //...
Let me know if it works also on your side
Hi @franramirez688 ,
Thanks for answering.
I have tried it before on conan 2.x and it works petty fine 😊 . As you can see in the environment details the problem I face is with Conan 1.63.0 .
@sandeshhardikar But is it failing with Conan 1.63.0 on your side? I mean, my little example works with both Conan 1.x and 2.x, is it not your case?
@franramirez688 : No , it doesnt work on conan 1.63.0
when running using conan install + conan build
conan create
conan install + conan build
Also i never get this build command output consumer/1.0: RUN: bazel --bazelrc=/Users/xxxxx/.conan2/p/b/xxxxxxx/b/conan/conan_bzl.rc --bazelrc=[bazel_toolchain_file_path] build --config=conan-config //...
in conan 1.63.0
Let me know if you have further questions
Hi @sandeshhardikar
I'd need to know how looks your dependency and consumer recipes to understand what's happening there. Do you have a simple example to reproduce it on my side?
@franramirez688
I used the same recipes given by you in the comment .
I just built it using conan install + conan build
# `.` is the path to ConsumerConan recipe
conan install . -if build
cd build
conan build ..
Hi @sandeshhardikar
Yes, but it's still working as expected 😓
In Conan 1.x, the conan build
command does not have the conf
information due to some implementation details and certain limitations. The conan create
one is calling the generate()
, build()
, etc., but this one is correctly propagating all that conf
information.
This behaviour changed in Conan 2.x, and the conan build
now has all that context, so that's why works for both.
Hi @franramirez688 ,
Thanks for looking into this again
In Conan 1.x, the conan build command does not have the conf information due to some implementation details and certain limitations.
Are there plans to fix this ?
Environment details
Steps to reproduce
package_info
method (self.conf_info.append("tools.google.bazel:bazelrc_path", bazel_toolchain_file_path)
)From the comments I understand that you intend to use only 1 toolchain , but the user toolchain should have precedence over toolchain generated ?
Logs
No response