disroop / vs-code-conan

Conan integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=disroop.conan
MIT License
18 stars 10 forks source link

Conflicts between the automatically added install/build arguments and custom ones #139

Closed JonathanGirardeau closed 2 years ago

JonathanGirardeau commented 2 years ago

Hello,

The install and build folders arguments are automatically set and it causes conflicts whith ones set in installArg and buildArg in the conan-settings.json file.

For example:

{
    "name": "release-linux-x86_64",
    "conanFile": "${workspaceFolder}/conanfile.py",
    "profileBuild": "default",
    "installArg": "-if=cmake-build-release-linux-x86_64 -s build_type=Release",
    "buildArg": "-if=cmake-build-release-linux-x86_64",
}

Results in:

conan install --profile:build default --profile:host default -if=cmake-build-release-linux-x86_64 -s build_type=Release --install-folder [...]/build/release-linux-x86_64 [...]/conanfile.py
[...]
conan install: error: --install-folder can only be specified once

And:

conan build -if=cmake-build-release-linux-x86_64 --build-folder [...]/build/release-linux-x86_64 [...]/conanfile.py

In the install command I don't want the extension to set the install-folder automatically because I have already set it. In the build command I don't want the extension to set the build-folder automatically because now it can be set directly in the layout() function in the recipe.

It seems this issue has appeared in the 0.8.0 release.

mymichu commented 2 years ago

Hi @JonathanGirardeau Use instead of:

-if=cmake-build-release-linux-x86_64

The following in your configuration file.

-if cmake-build-release-linux-x86_64 (WITHOUT EQUAL SIGN)

mymichu commented 2 years ago

I will add that it will support the equal sign in the next release

mymichu commented 2 years ago

this issue is fixed in 0.8.5. Feel free to add a rating vscode marketplace.

JonathanGirardeau commented 2 years ago

Hello @mymichu and thank u for the quick fix.

I think there is also an issue with build arguments:

"buildArg": "-if=cmake-build-release-linux-x86_64" Results in:

conan build -if=cmake-build-release-linux-x86_64 --build-folder /mnt/development/common-cpp/build/release-linux-x86_64 /mnt/development/common-cpp/conanfile.py

As the extension now automatically add build-folder argument I added it too in settings to override it: "buildArg": "-if=cmake-build-release-linux-x86_64 -bf=cmake-build-release-linux-x86_64" Results in:

command: conan build -if=cmake-build-release-linux-x86_64 --build-folder /mnt/development/common-cpp/cmake-build-release-linux-x86_64 /mnt/development/common-cpp/conanfile.py
stderr: ERROR: conanbuildinfo.txt file not found in /home/developer/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/cmake-build-release-linux-x86_64

The extension seems to change in custom arguments relative paths to absolute paths but it is not done on install-folder argument in build command.

I think the less the extension changes stuff in custom arguments the less confusing it would be for users.