-
Notifications
You must be signed in to change notification settings - Fork 344
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
[missing doc] Undocumented side-effect and parameter auto_generate
#3676
Comments
Thanks @araffin for reporting this. It is true that https://docs.conan.io/2/reference/tools/env/virtualbuildenv.html#reference shows the argument, but not fully document it. We added the argument to allow our usage to not cause this effect, but we are also reconsidering if instantiating directly these generators elsewhere for the purpose of aggregating env-vars, but not generating environment script files is the way to go. We might refactor these generator into some base classes that don't generate files and can be used everywhere, but this is not fully clear yet. In general I think it makes sense to think that if |
By default, conan2 uses
VirtualRunEnv
andVirtualBuildEnv
generators (this is briefly mentioned but is missing from theVirtualRunEnv
doc).However, if a generator (or anything from the top conanfile) instantiates
VirtualRunEnv
(orVirtualBuildEnv
) for its own use, this will have a side effect, prevent the default behavior andVirtualRunEnv.generate()
will never be called (soconanrun.sh
won't be present).A solution is to use the undocumented parameter
auto_generate=True
or to explicitly callself.virtual_run_env.generate()
everytimeVirtualRunEnv()
is instantiated.It would be nice to document the parameter, default behavior and side effect (if intended).
Relevant code:
https://github.com/conan-io/conan/blob/ad0b39c228ecb6b5539fb5995c7a3e98f85c9bf9/conan/tools/env/virtualrunenv.py#L39-L40
The behavior was introduced in conan-io/conan#9543
How to reproduce it
The text was updated successfully, but these errors were encountered: