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 package distribution #39

Merged
merged 12 commits into from
Dec 31, 2018

Conversation

uilianries
Copy link
Contributor

Hi!

This PR is related to support BehaviorTree.CPP as distributed package.

Also, including:

  • conan/build.py
    Build script to create Conan package on Travis CI
  • conan/test_package/CMakeLists.txt
    CMake file to build test package
  • conan/test_package/conanfile.py
    Conan recipe to build test package
  • conan/test_package/test_package.cpp
    Example code to consume Conan package created
  • .travis.yml
    Update to run Conan job on CI

Conan uses the file conanfile.py as recipe to execute all steps necessary to create the package. As your project is a library, it needs to be built, and Conan defines the package id by settings + options + requires.

To make sure that your package is working well, Conan provides test_package, where we put a simple example consuming your package and building as well. When test_package.cpp is including BehaviorTree header, all files are imported from the packaged provided by Conan. Test package is not for unit testing propose, it's a package validation.

When running your package on CI (appveyor, travis or any other) we could run Conan to create the package and check. But prepare a full environment with compiler, build-essential , conan and all stuff could be boring, so we use Docker. Conan provides a good range of images, including gcc and clang. I added multiple jobs because your project should match (compiler version, arch, os, release/debug) when required as dependency.

How to upload?

Conan uses Bintray to store their packages. You need to create an account on bintray for that. There is a good documentation how to create a bintray account here.

In short, you need to create a new account here.
So you will have two options:

  • Create a repository based on your username
  • Create a new organization and so create a new repository.

I would recommend the second one, because you will be able to add more people to maintain your organization.

Following the second choice, create a new organization named BehaviorTree or any preferred name. And create a new repository named conan or any preferred name.

The build.py is configured following the reference BehaviorTree/conan/BehaviorTree.CPP/. Where:

BehaviorTree is your Bintray organization name
conan is the repository name
BehaviorTree.CPP is the package name

Also, build.py has a rule to upload only tags or any branch with the pattern name "\d+.\d+.\d+".

And finally, you must set the variable CONAN_PASSWORD on Travis settings. The password is the Bintray API Key, it's not your account password. To read your API key you need to access https://bintray.com/profile/edit and click on API Key button. Don't forget to mark as secret on Travis settings.

Bintray package page

After to upload your package by CI, we recommend update your Bintray package page:
https://bintray.com/BehaviorTree/conan/BehaviorTree.CPP%3ABehaviorTree/edit?tab=general
The page contains only project metadata, as url, maturity (official), license.

Conan Center request

Now that all steps are done. Just click on "Add to Conan Center" button, present on your package page, and wait for a review.

Okay, this is a lot of information. Please, feel free to ask anything.

I'm including @danimtb and @SSE4 to review this PR. They are Conan experts.

Regards!

/cc @danimtb @SSE4

related issue #2

- Add Travis support for Conan package
- Add Appveyor file to build on Windows

Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
conanfile.py Outdated Show resolved Hide resolved
conan/travis/install.sh Outdated Show resolved Hide resolved
Signed-off-by: Uilian Ries <uilianries@gmail.com>
@uilianries
Copy link
Contributor Author

Hi @facontidavide !

Is there anything I could do to help you in this PR?

Copy link

@danimtb danimtb left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -41,6 +48,10 @@ def build(self):
"""project(behaviortree_cpp)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()""")
# INFO (uilian): zmq could require libsodium
Copy link

Choose a reason for hiding this comment

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

Is this a "to-do" of this recipe or of the zmq one?

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's zmq cpp requirement. I think I wrote this when zmq was not official in Conan Center.

@facontidavide facontidavide merged commit acaac99 into BehaviorTree:master Dec 31, 2018
@facontidavide
Copy link
Collaborator

I have little or no time to review it for the time being, and my little understanding of Conan doesn-t help.

I will just merge it. Better to ask for forgiveness than permission...

@danimtb
Copy link

danimtb commented Dec 31, 2018

Thanks @facontidavide! We will keep an eye on it but just ping us if you have any trouble 😄

@facontidavide
Copy link
Collaborator

@uilianries
Copy link
Contributor Author

It requires conan-io/conan-package-tools#313 but until to be merged (maybe 2 Jan), I'll provide a patch for you.

uilianries added a commit to uilianries/BehaviorTree.CPP that referenced this pull request Jan 1, 2019
Signed-off-by: Uilian Ries <uilianries@gmail.com>
@uilianries uilianries mentioned this pull request Jan 1, 2019
facontidavide pushed a commit that referenced this pull request Jan 1, 2019
Signed-off-by: Uilian Ries <uilianries@gmail.com>
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.

None yet

4 participants