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
Feature: MSBuildDeps generator: CAExcludePath #8682
Conversation
Signed-off-by: SSE4 <tomskside@gmail.com>
conan/tools/microsoft/msbuilddeps.py
Outdated
@@ -25,6 +26,7 @@ class MSBuildDeps(object): | |||
<Conan{name}BinaryDirectories>{bin_dirs}</Conan{name}BinaryDirectories> | |||
<Conan{name}Libraries>{libs}</Conan{name}Libraries> | |||
<Conan{name}SystemDeps>{system_libs}</Conan{name}SystemDeps> | |||
<Conan{name}CAExcludeDirectories>{ca_exclude_dirs}</Conan{name}CAExcludeDirectories> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not new "data" definition, shouldn't be defined here, but just in the group below, as an if ca_exclude_path
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I follow - it uses the same structure as another definitions...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section contains the pure translation of cpp_info
fields, nothing more.
The custom logic of this generator is not defined in this section, but somewhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, then I agree it shouldn't be there
conan/tools/microsoft/msbuilddeps.py
Outdated
@@ -42,6 +44,7 @@ class MSBuildDeps(object): | |||
<PropertyGroup> | |||
<LocalDebuggerEnvironment>PATH=%PATH%;$(Conan{name}BinaryDirectories)$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment> | |||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> | |||
<CAExcludePath>$(Conan{name}CAExcludeDirectories);$(CAExcludePath)</CAExcludePath> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the conditional here, to define it or not (by default, this line shouldn't appear)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do I need condition here? $(Conan{name}CAExcludeDirectories)
will just resolve to an empty string, so line will have no effect.
Co-authored-by: James <james@conan.io>
Co-authored-by: James <james@conan.io>
Co-authored-by: James <james@conan.io>
conan/tools/microsoft/msbuilddeps.py
Outdated
exclude_code_analysis = self._conanfile.conf["tools.microsoft.msbuilddeps"].exclude_code_analysis | ||
if exclude_code_analysis is not None: | ||
self.exclude_code_analysis = eval(exclude_code_analysis) | ||
assert isinstance(self.exclude_code_analysis, (bool, list)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@memsharded I've applied your suggestions, but now, string pattern doesn't work any longer, as you accept only bool and list here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have pushed some changes
conan/tools/microsoft/msbuilddeps.py
Outdated
@@ -25,6 +26,7 @@ class MSBuildDeps(object): | |||
<Conan{name}BinaryDirectories>{bin_dirs}</Conan{name}BinaryDirectories> | |||
<Conan{name}Libraries>{libs}</Conan{name}Libraries> | |||
<Conan{name}SystemDeps>{system_libs}</Conan{name}SystemDeps> | |||
<Conan{name}CAExcludeDirectories>{ca_exclude_dirs}</Conan{name}CAExcludeDirectories> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section contains the pure translation of cpp_info
fields, nothing more.
The custom logic of this generator is not defined in this section, but somewhere else.
ca_exclude = self._conanfile.conf["tools.microsoft.msbuilddeps"].exclude_code_analysis | ||
if ca_exclude is not None: | ||
# TODO: Accept single strings, not lists | ||
self.exclude_code_analysis = eval(ca_exclude) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we really okay if eval
usage? it seems to be pretty dangerous, as it may allow arbitrary code execution:
https://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as well as every Conan recipe, how this would be more dangerous than Conan python evaluation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can avoid eval then? if use just a regexp, if regexp matches nothing, it acts effectively as disabled matching
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem is that all the matches we have in Conan for matching packages references are fnmatch based. Introducing now regex for this would be very asymmetric. And for fnmatch, we should probably allow multiple patterns, as it is not as expressive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets merge it, but keep it not documented while we finalize the UX, but there are some template changes that are useful for other PRs.
closes: #8633
Changelog: Feature: MSBuildDeps generator: CAExcludePath
Docs: TODO
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.