From 842c55bbf1fe733aed598663b13a68cf2bb01b8d Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Wed, 19 Oct 2022 10:05:35 -0700 Subject: [PATCH] (#13490) docs: v2 migration guidence for `conf_info` * docs: v2 migration guidence for `conf_info` * Update docs/v2_migration.md Co-authored-by: Jordan Williams * example + notes about why to avoid it Co-authored-by: Jordan Williams --- docs/v2_migration.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/docs/v2_migration.md b/docs/v2_migration.md index 700c20b79a..f14a69ce85 100644 --- a/docs/v2_migration.md +++ b/docs/v2_migration.md @@ -54,6 +54,39 @@ When different build tools are use, at least one layout needs to be set. The `src_folder` must be the same when using different layouts and should not depend on settings or options. +## New conf_info properties + +As described in the documentation `self.user_info` has been depreated and you are now required to use +`self.conf_info` to define individual properties to expose to downstream recipes. +The [2.0 migrations docs](https://docs.conan.io/en/latest/migrating_to_2.0/recipes.html#removed-self-user-info) +should cover the technical details, however for ConanCenterIndex we need to make sure there are no collisions +`conf_info` must be named `user.:`. + +For usage options of `conf_info`, the [documenation](https://docs.conan.io/en/latest/reference/config_files/global_conf.html?highlight=conf_info#configuration-in-your-recipes) + +In ConanCenterIndex this will typically looks like: + +- defining a value + ```py + def package_info(self): + tool_path = os.path.join(self.package_folder, "bin", "tool") + self.conf_info.define("user.pkg:tool", tool_path) + ``` +- using a value + ```py + #generators = "VirtualBuildEnv", "VirtualRunEnv" + + def build_requirements(self): + self.tool_requires("tool/0.1") + + def build(self): + tool_path = self.conf_info.get("user.pkg:tool") + self.run(f"{tool_path} --build") + ``` +> **Note**: This should only be used when absolutely required. In the vast majority of cases, the new +> ["Environments"](https://docs.conan.io/en/latest/reference/conanfile/tools/env/environment.html?highlight=Virtual) +> will include the `self.cpp_info.bindirs` which will provide access to the tools in the correct scopes. + ## New cpp_info set_property model New Conan generators like