-
-
Notifications
You must be signed in to change notification settings - Fork 6
Support the application of Conan's BuildEnv/RunEnv #44
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
Support the application of Conan's BuildEnv/RunEnv #44
Conversation
resources/print_env.py
Outdated
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.
@hackenbergstefan I assume this is the conan file to activate the conan environment and retrieve all the environment variables, right?
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.
@hackenbergstefan I guess we can use a file watcher that watch the installation folder, where the file conanbuildenv.sh
or conanrunenv.sh
are stored and used to set the variable 😸 With this we have a neutral environment, since the conan python api in version 1 and 2 are different. What do you think?
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.
@h 8000 ackenbergstefan I assume this is the conan file to activate the conan environment and retrieve all the environment variables, right?
Yes, this is a small script that aggregates the environment variables. I've tried to manage using conan cmdline calls only, but that doesn't work.
Moreover, I've forgot to mention and document that it is working for conan 2 (currently) only. Conan 1 API is more complex... I have to investigate...
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.
@hackenbergstefan I guess we can use a file watcher that watch the installation folder, where the file
conanbuildenv.sh
orconanrunenv.sh
are stored and used to set the variable 😸 With this we have a neutral environment, since the conan python api in version 1 and 2 are different. What do you think?
Not sure I understood your suggestion... ^^
Do you mean to utilize these two shell scripts to determine the environment changes instead of having this script?
In principle this is a good idea. I see just two topics:
- We'll have to do different implementations for Windows (.bat) and Linux/Mac (.sh).
- Not sure how to efficiently locate these files. For Conan 2 they are located in
generators_folder
(https://github.com/conan-io/conan/blob/f357f8169c1e4ecf2bee5ca0b5fb723fc36d82b0/conan/tools/env/environment.py#L546). Not sure if it's possible to read out thegenerators_folder
e1d173a
to
a60d210
Compare
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.
There are some minority changes, but overall looks good :) after that we can merge the pull request
jest.mock('vscode', () => ({ | ||
workspace: { | ||
workspaceFolders: [{ uri: { fsPath: __dirname } }], | ||
} |
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.
You need to mock the vscode.window.showErrorMessage()
otherwise the test will not run, due to mocked vscode
module
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.
Hm. Actually, this code path is never reached:
- If Conan is not installed at all, the
execSync(
cd ${__dirname} && conan new basic --force);
fails - If Conan < 2 is installed, the same
execSync
fails as--force
is not valid - If Conan 2 is installed the test should not fail^^
Did you found a case where showErrorMessage()
gets called?
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.
or maybe it was because the python was not found in my system 🤔 anyway i will check it later during the process
a60d210
to
9c75285
Compare
Sorry for the whitespace changes 🙈 |
Thanks for merging! :-) |
Closes #36