-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add logr v0.1.0 #3812
Add logr v0.1.0 #3812
Conversation
All green in build 1 (
|
recipes/logr/0.1.0/conanfile.py
Outdated
options = { 'spdlog_backend' : [True, False], | ||
'glog_backend' : [True, False], | ||
'log4cplus_backend' : [True, False] } | ||
|
||
default_options = { 'spdlog_backend': True, | ||
'glog_backend': True, | ||
'log4cplus_backend': True } | ||
|
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.
Can you please rename these options to: spdlog
, glog
and log4cplus
.
Also can all 3 backends be used together, or are they to be used exclusive?
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.
The meaning of this options is whether the corresponding header file would be installed or not. By default all of them are present.
def _build_subfolder(self): | ||
return "build_subfolder" | ||
|
||
def requirements(self): |
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'm surprised you don't add a requirement on either spdlog, glog or log4plus.
If this is a frontend substitution, then the backend should be available. Isn't it?
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 consider the following reasoning:
- Deciding what logger to use in your application (among the three supported).
- Once logger library is decided, the application adds it to the list of dependencies (so logger is already in deps list).
- Then it is decided to use another "frontend" to it.
Deciding the logger happens in the first place (so deps machinery is applied for logger lib), and the logr is like an extension to a selected library.
And in case of using in conanfile it would be less bothering to just specify logr without forcing the user to dig into options.
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.
The problem is that logr
won't work when having the following conanfile.txt:
[requires]
spdlog/0.1.0
[options]
logr:with_spdlog_backend=True
logr:with_glog_backend=False
logr:with_log4cplus_backend=False
because spdlog is is not available.
I would do this in requirements
:
if self.options.with_spdlog_backend:
self.requires("spdlog/x.y")
elif self.options.with_glog_backend
self.requires("log4cplus/x.y")
elif self.options.with_log4cplus_backend:
self.requires("log4cplus/x.y")
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've tested the following conanfile.txt
[requires]
logr/0.1.0
[options]
logr:spdlog_backend=True
logr:glog_backend=False
logr:log4cplus_backend=False
[generators]
cmake
And a project based on test_project works just fine.
The libs is a collection of headers and it has some options to add a certain headers or not.
Would it be ok to just remove all options and make all headers to be unconditionally present?
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.
How usable is this library without any backend?
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.
That could be a way, but I think you should also add these library as a requirement of logr. Or shouldn't you?
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.
options = { "backend": ["spdlog", "glog", "log4cplus", "all", None }
default_options = { "backend": ["spdlog"]}
all is the option for local dev builds. As I want all of them to be available in single build (for examples and benchmarks) and I want to keep local conanfile at most similar to projects own conanfile.
Does Conan introduces dependencie propogation when I specify self.requires("spdlog/x.y")
? Or I need to modify projects cmake files and add something like target_link_libraries(logr INTERFACE spdlog::spdlog)
?
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.
Personally, I have given up on keeping project's conanfiles equal to cci's conanfiles.
Mostly because I don't want the project to need a cmake wrapper script, just for conan.
When you add self.requires("spdlog/x.y")
to logr,
then linking to the logr::logr
cmake target will also link to spdlog::spdlog
.
I changed your example a bit by removing the list from default_options
.
It can only have one.
options = { "backend": ["spdlog", "glog", "log4cplus", "all", None }
default_options = { "backend": "spdlog"}
As @prince-chrismc already mentioned, I don't think an all
option does not make muck sense for cci. For your personal development branch, it might.
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.
Personally, I have given up on keeping project's conanfiles equal to cci's conanfiles.
Yep! CCI is trying to provide the most convince to as many consumers as possible. Which may not meet the needs of the project!
That being said, as a very happy RESTinio consumer, it seems unlikely that a project will have multiple logging methods.... but then they wouldn't need this library either!
✅ There is no right or wrong answer, so ultimately the choice is yours.
I have to agree with @madebr suggestion for a single option that adds the correct requires... for myself this adds the freedom to change in the future with little impact.
Again the opinion of a potential consumer =)
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.
Refactored to a single option "backend", which implies dependency to a specific logger library.
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
All green in build 2 (
|
All green in build 3 (
|
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
An unexpected error happened and has been reported. Help is on its way! 🏇 |
recipes/logr/0.1.0/conanfile.py
Outdated
default_options = { "spdlog_backend": True, | ||
"glog_backend": True, | ||
"log4cplus_backend": True } |
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.
seem's a little odd to have 3 logging method's 🤔
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.
The relevant comment to similar comment
#3812 (comment)
Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
All green in build 7 (
|
tools.rmdir(os.path.join(self.package_folder, "lib")) | ||
|
||
def package_id(self): | ||
self.info.header_only() |
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.
An optimisation we like to add is no_copy_source
attribute near the options.
On mobile so I do not have an example
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've tried to set no_copy_source, but then I have to use projects own root CMakeLists.txt, and it doesn't workout great as I use "cmake_find_package" generator there and some cmake-scripts are in submodule wich is not a part of tarball. For next release I'll handle those issues and will apply this options.
Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
All green in build 8 (
|
ericLemanissier pointed out "this PR is missing config.yml" I do not see it either |
Yes, I removed my message, because I realized that config.yml is not mandatory if the folder name is identical to the version |
I was unaware that was a feature! |
All green in build 9 (
|
All green in build 11 (
|
recipes/logr/0.1.0/conanfile.py
Outdated
elif self.options.backend == "log4cplus": | ||
self.requires("log4cplus/2.0.5") | ||
self.build_requires_options["log4cplus"].unicode = False | ||
elif self.options.backend == "log4cplus-unicode": | ||
self.requires("log4cplus/2.0.5") | ||
self.build_requires_options["log4cplus"].unicode = True |
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 does not seem to change anything for logr https://github.com/conan-io/conan-center-index/pull/3812/files#diff-ad137baee4c6c3f95ccebfa8aa275fa0c0d5fff4e1f37e8b7ca65d2541479aeaR73
would it be possible to just have one and let the consumer set his own options?
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.
LGTM
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.
Avoid forcing dependencies options, it creates an implicit package id, doesn't matter what you pass, it forces another package id. Instead, raise an error to warn the user.
Co-authored-by: Uilian Ries <uilianries@gmail.com>
All green in build 12 (
|
Co-authored-by: Uilian Ries <uilianries@gmail.com>
Co-authored-by: Uilian Ries <uilianries@gmail.com>
All green in build 14 (
|
* master: (73 commits) (conan-io#3878) opengl: support FreeBSD (conan-io#3882) [system-cci] Fix hooks (conan-io#3881) [szip] Fix hooks (conan-io#3880) [tcl] Fix hooks (conan-io#3866) xorg: add freebsd packages (conan-io#3825) Adds baikal-p7 5.6 (conan-io#3758) minimal recipe for pciutils/3.7.0 (conan-io#3211) added recipe for extra-cmake-modules (conan-io#3870) tl: fix compiler version check again (conan-io#3865) bump eigen/3.3.9 (conan-io#3864) add functionalplus/0.2.13-p0 bump fmt/7.1.3 (conan-io#3694) (conan-io#3858) fix: zulu-openjdk package info (conan-io#3836) gmp: bump + enable building static libraries on MSVC (conan-io#3812) Add logr v0.1.0 (conan-io#3786) add Open62541 recipe v1.0.3 and v1.1.3 (conan-io#3696) openh264: refactor + add 2.1.1 release (conan-io#3607) add botan/2.17.2 (conan-io#3854) Add PEGTL 3.0.0 (conan-io#3859) bump spdlog/1.8.2 ...
See details here: conan-io/conan-center-index#3812 It is honoured to make it possible to package a library without extra CMake wrapper.
* Adjustments for conan packaging See details here: conan-io/conan-center-index#3812 It is honoured to make it possible to package a library without any extra CMake wrapper.
Specify library name and version: logr/0.1.0
conan-center hook activated.