Skip to content

Listing of tools and core configurations - #8821

Merged
memsharded merged 6 commits into
conan-io:developfrom
uilianries:feature/manage-conf
Apr 26, 2021
Merged

memsharded merged 6 commits into
conan-io:developfrom
uilianries:feature/manage-conf

Conversation

@uilianries

@uilianries uilianries commented Apr 16, 2021

Copy link
Copy Markdown
Member

Some points need to be defined yet:

For global printing (conan config get), we can group conan.conf, global.conf and profile[conf] at same output.

However, get single item, update and adding a new one is more complicated. So far conan config only manages conan.conf file. We will need to support a new argument, like --global.

Also, we can't print all possible configurations to be used by [conf], because ConfDefition is empty, and all items are read when a specific condition occurs. We would need to centralize all configuration again, just like we did for conan.conf, but I'm sure if we want it.

Another point, we have 3 configurations, conan.conf, global.conf and profile[conf]. Printing all this is a mess, we could create a new layer to abstract them, otherwise we would need called separately. See line 629

Changelog: Feature: List tools and core from profile and global.conf.
Docs: conan-io/docs#2077

closes #8696

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.

Signed-off-by: Uilian Ries <uilianries@gmail.com>
Comment thread conans/client/conan_api.py Outdated
if item is None:
# TODO: Provide a helper
result += "\n[conf]\n"
result += self.app.cache.new_config.dumps() + "\n"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No, this is not the feature. It is not about listing current configuration.

It is about listing all possible configurations that are in our codebase, together with an explanation/documentation of what it does. Kind of conan --help for commands, but for configurations. Could be in conan config --help, for example, or conan config list.

At some point we might use it to validate user inputs, to avoid typos, for example.

@uilianries uilianries Apr 19, 2021

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We don't populate new_config, we just read if a key is present or not. For example:

required_range_new = cache.new_config["core"].required_conan_version

We will need to centralize them and populate with empty values.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Centralize their definition:

confs = {
    "core.required_conan_version": "help for this config",
    "tools.microsoft.....": "help for this one too",
}

Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
@uilianries
uilianries marked this pull request as ready for review April 23, 2021 21:56
Signed-off-by: Uilian Ries <uilianries@gmail.com>
@uilianries

Copy link
Copy Markdown
Member Author

@memsharded I've added a new subcommand: conan config list, which should list all possible configurations.

I also collected all core and tools key for new_config. However, it's a bit fragile, because all developers when adding a new key, need to remember about DEFAULT_CONFIGURATION too. Another option is populating ConfDefinition with default values + help, but still we can't avoid people adding new keys, but not updating ConfDefinition.

The current output is:

$ conan config list
Supported Conan conan.conf properties:
core.required_conan_version: Will raise if the current Conan version does not match the defined version range.
core.package_id.msvc_visual_incompatible: Allows opting-out the fallback from the new msvc compiler to the Visual Studio compiler existing binaries
tools.microsoft.msbuild:verbosity: Verbosity level for MSBuild: 'Quiet', 'Minimal', 'Normal', 'Detailed', 'Diagnostic'
tools.microsoft.msbuild:max_cpu_count: Argument for the /m (/maxCpuCount) when running MSBuild
tools.microsoft.msbuild:vs_version: Defines the compiler version when using using the new msvc compiler
tools.microsoft.msbuilddeps:exclude_code_analysis: Suppress MSBuild code analysis for patterns
tools.microsoft.msbuildtoolchain:compile_options: Dictionary with MSBuild compiler options
tools.build:processes: Default jobs number
tools.ninja:jobs: Argument for the --jobs parameter when running Ninja generator
tools.gnu.make:jobs: Argument for the -j parameter when running Make generator
tools.gnu:make_program: Indicate path to make program
tools.env.virtualenv:auto_use: Automatically activate virtualenvs when changing into a directory
tools.cmake.cmaketoolchain:msvc_parallel_compile: Argument for the /MP when running msvc
tools.cmake.cmaketoolchain:find_package_prefer_config: Argument for the CMAKE_FIND_PACKAGE_PREFER_CONFIG
tools.android:ndk_path: Argument for the CMAKE_ANDROID_NDK
tools.files.download:retry: Number of retries in case of failure when downloading
tools.files.download:retry_wait: Seconds to wait between download attempts

@memsharded

Copy link
Copy Markdown
Member

I also collected all core and tools key for new_config. However, it's a bit fragile, because all developers when adding a new key, need to remember about DEFAULT_CONFIGURATION too. Another option is populating ConfDefinition with default values + help, but still we can't avoid people adding new keys, but not updating ConfDefinition.

Yes, I know. We should don't forget now in code reviews. But we should remind to document them anyway, so at least let's start to build the DB now, we could add later checks/validation against this DB (so people adding new confs without adding them here will raise)

@memsharded memsharded left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, minor fixes, lets try to merge it for Conan 1.36

Comment thread conans/test/integration/command/config_test.py Outdated
Comment thread conans/client/command.py Outdated
Comment thread conans/client/command.py Outdated
Signed-off-by: Uilian Ries <uilianries@gmail.com>
@uilianries

Copy link
Copy Markdown
Member Author

@memsharded All done, please, review again.

@memsharded memsharded added this to the 1.36 milestone Apr 26, 2021
@memsharded
memsharded merged commit 6c5a6b3 into conan-io:develop Apr 26, 2021
@uilianries

Copy link
Copy Markdown
Member Author

Docs PR: conan-io/docs#2077

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.

[feature] Implement discoverability for [conf] items

2 participants