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
CMake metadata badges #9823
Comments
We do have a handful of badges that extend You could look at
for examples of that sort of thing. We do have to be a bit more manual with the error handling because we can't apply a schema to ensure the response matches an expected format. |
Great, so having regex opperations is not considered too computationally expensive. Is there also an example that navigates git repo? Also where should these 2 badges be located? |
Yeah reasonable questions. I think make the "service" name cmake. So the files live in We do have some badges that assume GitHub, but I think the direction we're going in this days is trying to make this type of badges work for projects hosted on GitLab/BitBucket/etc So I reckon we have the badges accept a required query param which is a URL to the file we're going to parse. That makes it host-agnostic. So then an example call for the version badge with the file https://raw.githubusercontent.com/apiaryio/drafter/master/CMakeLists.txt would be like
Does that help? |
Very much, thank you. I will see what I can do around this |
There are two useful informations that can be extracted from a CMake project
cmake_minimum_required
project(VERSION)
Unfortunately it would not be possible to extract them via json/yaml/toml, but if regex is an option, here are the regex to extract the information:
cmake_minimum_required\([\n\r\s]*VERSION[\n\r\s]*(?P<version>[\d\.]+)[^\)]*\)
project\([^\)]*VERSION[\n\r\s]*(?P<version>[\d\.]+)[^\)]*\)
This can simply be run on the top-level file
CMakeLists.txt
or wherever the root is redirected.Let me know if this is appropriate to implement, and if I should make a PR for it.
The text was updated successfully, but these errors were encountered: