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

conan.io support #30

Merged
merged 8 commits into from
Feb 1, 2018
Merged

conan.io support #30

merged 8 commits into from
Feb 1, 2018

Conversation

Manu343726
Copy link
Contributor

No description provided.

@foonathan
Copy link
Owner

Your test package stuff does not seem to work.

Also I don't like that you have to copy an example for it.

@Manu343726
Copy link
Contributor Author

Your test package stuff does not seem to work.

Yeah, I think is a bug in the cmake generator of conan. I've sent a PR to fix it conan-io/conan#801

Also I don't like that you have to copy an example for it.

I agree it is not the best way to handle this, but I can also create the example cmake target using the examples/optional.cpp file directly.

@foonathan
Copy link
Owner

I agree it is not the best way to handle this, but I can also create the example cmake target using the examples/optional.cpp file directly.

Yes, that would be better.

@foonathan
Copy link
Owner

Ping @Manu343726.

@Manu343726
Copy link
Contributor Author

It seems there's still something weird with their cmake macro to check the compiler version:conan-io/conan#1011

We have a C++ meetup in Madrid in a couple of weeks, so reaching @drodri to (finally) fix this would be easier... (I need to review this with him since I don't see something specially weird in the code they are generating nor in the code generator)

NOTE: I'm explicitly spamming him since it seems this is the only way to make him not to ignore my messages :P

@foonathan
Copy link
Owner

Ping?

@foonathan
Copy link
Owner

So, how's it going?

.travis.yml Outdated
- cd type_safe/

script:
- mkdir build/ && cd build/
- $CMAKE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Wno-parentheses" -DTYPE_SAFE_BUILD_TEST_EXAMPLE=ON -DTYPE_SAFE_BUILD_DOC="$BUILD_DOCS" -DTYPE_SAFE_STANDARDESE_DOWNLOAD_DIRECTORY=../standardese/ ../
- $CMAKE --build .
- ./test/type_safe_test
- cd .. && conan test_package --build=outdated && cd build

Choose a reason for hiding this comment

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

This is very outdated now, please use conan create

README.md Outdated
@@ -2,6 +2,7 @@

[![Build Status](https://travis-ci.org/foonathan/type_safe.svg?branch=master)](https://travis-ci.org/foonathan/type_safe)
[![Build status](https://ci.appveyor.com/api/projects/status/aw1j2h2s52g4laen/branch/master?svg=true)](https://ci.appveyor.com/project/foonathan/type-safe/branch/master)
[![badge](https://img.shields.io/badge/conan.io-type_safe%2F0.1-green.svg?logo=data:image/png;base64%2CiVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAMAAAAolt3jAAAA1VBMVEUAAABhlctjlstkl8tlmMtlmMxlmcxmmcxnmsxpnMxpnM1qnc1sn85voM91oM11oc1xotB2oc56pNF6pNJ2ptJ8ptJ8ptN9ptN8p9N5qNJ9p9N9p9R8qtOBqdSAqtOAqtR%2BrNSCrNJ/rdWDrNWCsNWCsNaJs9eLs9iRvNuVvdyVv9yXwd2Zwt6axN6dxt%2Bfx%2BChyeGiyuGjyuCjyuGly%2BGlzOKmzOGozuKoz%2BKqz%2BOq0OOv1OWw1OWw1eWx1eWy1uay1%2Baz1%2Baz1%2Bez2Oe02Oe12ee22ujUGwH3AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfgBQkREyOxFIh/AAAAiklEQVQI12NgAAMbOwY4sLZ2NtQ1coVKWNvoc/Eq8XDr2wB5Ig62ekza9vaOqpK2TpoMzOxaFtwqZua2Bm4makIM7OzMAjoaCqYuxooSUqJALjs7o4yVpbowvzSUy87KqSwmxQfnsrPISyFzWeWAXCkpMaBVIC4bmCsOdgiUKwh3JojLgAQ4ZCE0AMm2D29tZwe6AAAAAElFTkSuQmCC)](http://www.conan.io/source/type_safe/0.1/Manu343726/testing)

Choose a reason for hiding this comment

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

These badges are outdated too, now using Bintray

conanfile.py Outdated
username = 'Manu343726'
channel = 'testing'
requires = 'debug_assert/1.1@Manu343726/testing'
exports = '*.hpp'

Choose a reason for hiding this comment

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

Use exports_sources instead

conanfile.py Outdated

class TypeSafe(ConanFile):
name = 'type_safe'
url = 'https://foonathan.github.io/blog/2016/10/11/type-safe.html'

Choose a reason for hiding this comment

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

The URL should point to the repo containing the recipe. It is the entry point to collaborate and give feedback.

Copy link
Owner

Choose a reason for hiding this comment

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

@Manu343726 Could you fix it?

conanfile.py Outdated
name = 'type_safe'
url = 'https://foonathan.github.io/blog/2016/10/11/type-safe.html'
version = '0.1'
username = 'Manu343726'

Choose a reason for hiding this comment

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

username and channel shouldn't be in the recipe at all

settings = 'os', 'compiler', 'build_type', 'arch'
requires = (
'cmake-utils/0.0.0@Manu343726/testing',
'type_safe/0.1@Manu343726/testing'

Choose a reason for hiding this comment

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

This requirement can be removed now, it is autoamtically injected


def build(self):
cmake = CMake(self.settings)
self.run('cmake {} {}'.format(self.conanfile_directory, cmake.command_line))

Choose a reason for hiding this comment

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

new cmake.configure() and cmake.build() methods might be more convenient.

cmake_minimum_required(VERSION 2.8)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
include(${CONAN_CMAKE-UTILS_ROOT}/conan.cmake)

Choose a reason for hiding this comment

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

This extra include of conan.cmake might be unnecessary. You might want to update to modern CMake syntax with conan_basic_setup(TARGETS)

@agauniyal
Copy link

I'd like to see this library in conan as well 😄

@Manu343726
Copy link
Contributor Author

pong (sorry). I would like to get into conan again in a couple of weeks, this lib being the no 1 in my list. BTW I would need your help @memsharded to get into the new jecosystem

@Manu343726 Manu343726 force-pushed the master branch 4 times, most recently from fa24512 to b74c080 Compare January 3, 2018 11:04
@Manu343726
Copy link
Contributor Author

I've finally got some time to update the packages. Both type safe and debug assert packages have been updated and pushed to my artifactory repository (https://bintray.com/manu343726/conan-packages). I'm waiting for the travis CI build to see if the package test is passing.

@Manu343726
Copy link
Contributor Author

Manu343726 commented Jan 4, 2018

BTW the last commit allows anyone to own the package with no changes in the recipe, just upload the package using your account and repo:

conan remote add your_remote_name your_bintray_repo_url # i.e. conan remote add origin https://bintray.com/manu343726/conan-packages
conan user -p your_bintray_user_token -r your_remote_name your_user_name
conan create your_user/your_channel # this generates and tests the package in channel "your_user/your_channel"
conan upload type_safe/0.1@your_user/your_channel --all --remote your_remote_name

@memsharded
Copy link

If you go one step further, you can also reuse it for future versions without modifying the recipe. Remove the name & version from the recipe then use:

conan create . PkgName/version@user/channel

@Manu343726
Copy link
Contributor Author

Oh, didn't know about that. Thanks my anonymous friend.

@Manu343726
Copy link
Contributor Author

this last commit should make the travis CI build compatible with the conan 1.0 stable release.

This commit adds a conan.io package recipe using my testing channel
(Manu343726/testing). The package will be manually released into my
own conan repository in artifactory
(https://bintray.com/manu343726/conan-packages). Note debug_assert is
released there too.

The package is tagged with version 0.1, until an official release of
type_safe is done.

The package currently depends on debug_assert 1.3, the latest release
packaged.

No automatic conan packaging is implemented in the CI, only a package
test. Note this must be trivial (encrypting the artifactory user key in
travis, using one of the travis environment variables to check if we're
building a release, etc).
Conan has two remotes (bintray official, named 'conan-center', and the
old conan.io repo for backwards compatibility). Since debug_assert (and
type_safe itself) is hosted in my own repository, we need to tell the
conan client to add a remote pointing to my repo in order to install the
debug_assert dependency
The current setup confuses conan profile discovery since conan uses
gcc and clang (instead of g++ and clang++) to ask for the compiler
version. The solution is simply keeping both in sync.
conan 1.0 sets this arg as mandatory for the create command. This should
fix your CI build.
Copy link
Owner

@foonathan foonathan left a comment

Choose a reason for hiding this comment

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

I don't really want to add a lot of releases for type_safe, how would that work with conan? Can people just get the latest mater?

conanfile.py Outdated

class TypeSafe(ConanFile):
name = 'type_safe'
url = 'https://foonathan.github.io/blog/2016/10/11/type-safe.html'
Copy link
Owner

Choose a reason for hiding this comment

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

@Manu343726 Could you fix it?

conanfile.py Outdated
name = 'type_safe'
url = 'https://foonathan.github.io/blog/2016/10/11/type-safe.html'
version = '0.1'
requires = 'debug_assert/1.3@Manu343726/testing'
Copy link
Owner

Choose a reason for hiding this comment

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

I'm guessing I have to update this one everytime I release a new version and/or update debug_assert?

@Manu343726
Copy link
Contributor Author

Manu343726 commented Jan 18, 2018

I don't really want to add a lot of releases for type_safe, how would that work with conan? Can people just get the latest mater?

We could maintain two different channels for the package (think of channels as "upstreams"), one with fixed package releases (the "stable" channel) and another one pointing to the latest master version of type_safe ("master"?, "latest"). Neither options are a problem from the recipe perspective (it's python after all, dwtfywt), just a matter of organization.

I'm not sure if conan packaging allows packages without explicit versioning. @memsharded?
Anyway, the different versions of the latest channel could just correspond to fixes in the recipes.

@Manu343726 Could you fix it?

Of course, sorry. I will check debug_assert recipe too just in case.

I'm guessing I have to update this one everytime I release a new version and/or update debug_assert?

Right, but we could infer the dependency programmatically from your sources. If type_safe uses a fixed debug_assert tag as submodule, we could parse that version from type_safe sources and set the package version from that tag. Note you would need to release a debug_assert package with the required version first.
OTOH we could follow the "latest" channel approach above, and tell the debug_assert package to use the latest version tagged in the sources:

def get_package_version():
   return os.system("git describe --abbrev=0 --tags", cwd=???)

class DebugAssert(ConanFile):
    version = get_package_version()
...

In general, I see what you're asking for: To release new versions of type_safe & debug_assert packages automatically, taking into account users can rely on the master branch, so packages should pick the latest master sources directly. What do you think @memsharded ? How would you handle this use case? (I'm not an expert, my comments above were just suggestions that come to my mind.

IMO the right approach would be to set up a CI build for debug_assert that handles packaging (Using your own bintray account) and only runs on releases. Then add a task to the type_safe CI on master that checks for changes and pushes a new package increasing the release fix number (i.e. if the latest type_safe git tag on master was 0.1, release 0.1.0, 0.1.2, and so on, or even user the travis build number as fix; I do that at work and works very well). It's up to the package users to update their requirements.

@memsharded
Copy link

In many cases you just want to have packages for tagged/published versions, in this case, v0.1.

Though you can perfectly have just pkg/master@... versions too. Packages get overwritten from the latest master.

@Manu343726
Copy link
Contributor Author

@memsharded so we could tag the package as master, cool. About getting the package version from git or an environment variable, what do you think?

@memsharded
Copy link

You can leave the version undefined in the recipe. Then, in your CI, for example, get it from a branch convention (like release/X.Y.Z), and use:

$ conan create . Pkg/X.Y.Z@user/channel

@Manu343726
Copy link
Contributor Author

Purrrrrfect, thanks a lot

@foonathan
Copy link
Owner

@Manu343726 Could you just update the project URL and then I'll merge it.

@Manu343726
Copy link
Contributor Author

Sure, I was trying to find a way to automate the dependency version.

@Manu343726
Copy link
Contributor Author

Done. Note both the package version and the dependency version would require manual changes in the recipe. Also, the debug_assert dependency is pointing to my jfrog account, it's up to you to configure your own account and submit debug_assert there.

@foonathan foonathan merged commit 96662e1 into foonathan:master Feb 1, 2018
saraedum pushed a commit to saraedum/type_safe that referenced this pull request Jul 28, 2019
Implement support for C style comments and exclamation mark comments,
i.e. /**, /*!, /// and //! are now supported.
In C style comments the first star in a row is stripped but no C++ style
comment markers.

Fixes foonathan#30.`
saraedum pushed a commit to saraedum/type_safe that referenced this pull request Jul 28, 2019
Support for new comment styles - ///, //!, /**, /*! (fixes foonathan#30), as well
as end-of-line comments (//<).
Comment parsing and matching done by standardese, instead of libclang.
Smart merging of adjacent comments.

Change command parsing, now allows putting multiple commands in the same
paragraph and merge documentation paragraph if needed.

Add \entity to allow remote comments, i.e. documentation in comments
that aren't matched. Add \file as shorthand for \entity current-file.

Add \param, \tparam and \base to document (template) parameters and base
classes inside the parent comment.
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