Skip to content
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

polymorphic_value: conan v2 support #13973

Merged
merged 7 commits into from
Nov 28, 2022

Conversation

dvirtz
Copy link
Contributor

@dvirtz dvirtz commented Nov 2, 2022

Specify library name and version: polymorphic_value/*

done as part of @prince-chrismc's webinar


  • I've read the guidelines for contributing.
  • I've followed the PEP8 style guides for Python code in the recipes.
  • I've used the latest Conan client version.
  • I've tried at least one configuration locally with the conan-center hook activated.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

Copy link
Contributor

@prince-chrismc prince-chrismc left a comment

Choose a reason for hiding this comment

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

Thank so much for joining!!!

Great work here 🎉

Just a few tiny comments

else:
if tools.Version(self.settings.compiler.version) < min_version:
if tools.Version(self.info.settings.compiler.version) < min_version:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is in conan.tools.scm :)

self.info.clear()

def layout(self):
basic_layout(self, src_folder="source")
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just a style convention, 😎

Suggested change
basic_layout(self, src_folder="source")
basic_layout(self, src_folder="src")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

@dvirtz Conan docs is different from ConanCenterIndex convention. It's well documented on ConanCenterIndex templates: https://github.com/conan-io/conan-center-index/blob/master/docs/package_templates/cmake_package/all/conanfile.py#L70


required_conan_version = ">=1.43.0"
from conan import ConanFile, tools
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a private import, we recommend important the functions directly in CCI

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

Comment on lines 37 to 38
# FIXME: workaround https://github.com/conan-io/conan/issues/12210
info = self if Version(conan_version).major < 2 else self.info
Copy link
Member

Choose a reason for hiding this comment

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

No workaround, please. It should be fixed on next releases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reverted

@conan-center-bot

This comment has been minimized.

prince-chrismc
prince-chrismc previously approved these changes Nov 8, 2022
@conan-center-bot

This comment has been minimized.

Copy link
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

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

So far is not possible to combine self.info.clear() with self.info.settings. Conan V2 will be adapted on Beta-5 to work with self.settings on validate() method.

We have some open threads where you can obtain more information:

recipes/polymorphic_value/all/conanfile.py Outdated Show resolved Hide resolved
recipes/polymorphic_value/all/conanfile.py Outdated Show resolved Hide resolved
recipes/polymorphic_value/all/conanfile.py Outdated Show resolved Hide resolved
recipes/polymorphic_value/all/conanfile.py Outdated Show resolved Hide resolved
recipes/polymorphic_value/all/conanfile.py Outdated Show resolved Hide resolved
Copy link
Contributor Author

@dvirtz dvirtz left a comment

Choose a reason for hiding this comment

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

apply suggestions pressed wrong button

Co-authored-by: Uilian Ries <uilianries@gmail.com>
find_package(polymorphic_value REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE polymorphic_value::polymorphic_value)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)

enable_testing()
Copy link
Member

Choose a reason for hiding this comment

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

I added it to conan new but I regret, because cmake test hides the output.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It saves the need to track down the executable path though

Copy link
Member

Choose a reason for hiding this comment

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

The problem is running it the virtualenv. Running a test from cmake command, does not guarantee which environment (conanrun, conanbuild) is being used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CMake.test() should take the environment as an argument then



class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"
generators = "CMakeDeps", "CMakeToolchain"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
generators = "CMakeDeps", "CMakeToolchain"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

self.run(os.path.join("bin", "test_package"), run_environment=True)
if can_run(self):
cmake = CMake(self)
cmake.test()
Copy link
Member

Choose a reason for hiding this comment

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

The correct would run self.run which I prefer because you need to invoke with env=conanrun and I'm not sure if cmake.test() preserves it. So please, follow https://github.com/conan-io/conan-center-index/blob/master/docs/package_templates/cmake_package/all/test_package/conanfile.py as example which we know is safe.

@conan-center-bot

This comment has been minimized.

@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline

All green in build 9 (803ab4cb3701b3486ae0fef373625f54889505e1):

  • polymorphic_value/1.3.0@:
    All packages built successfully! (All logs)

Copy link
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

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

LGTM

@conan-center-bot conan-center-bot merged commit 421f4fa into conan-io:master Nov 28, 2022
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.

4 participants