From dd8922878df9351544eda4e50b359c201f475482 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Mon, 12 Nov 2018 14:49:42 -0200 Subject: [PATCH] Update Conan version Automatically (#5027) * #5026 Add FindFlatBuffers.cmake to Conan Package Signed-off-by: Uilian Ries * #5026 Build Flatbuffers on OSX 10 Signed-off-by: Uilian Ries * #5026 Auto update Conan package version Signed-off-by: Uilian Ries * #5026 Update Conan docker images Signed-off-by: Uilian Ries * #5026 Update tag var on Appveyor Signed-off-by: Uilian Ries * #5026 Filter appveyor brach name Signed-off-by: Uilian Ries --- .travis.yml | 29 ++++++++++++++++------------- conan/build.py | 41 +++++++++++++++++++++++++++++++++++++++-- conanfile.py | 5 +++-- 3 files changed, 58 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 40d38302f..2d79589a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,9 @@ env: conan-linux: &conan-linux os: linux - sudo: required + dist: xenial language: python - python: "3.6" + python: "3.7" services: - docker install: @@ -82,7 +82,7 @@ matrix: - make - LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/google/grpc/install/lib make test ARGS=-V - bash .travis/check-generate-code.sh - - if [ "$CONAN" == "true" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo pip install conan && conan create . google/testing -s build_type=$BUILD_TYPE -tf conan/test_package; fi + - if [ "$CONAN" == "true" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo pip install conan && conan create . flatbuffers/${TRAVIS_BRANCH}@google/testing -s build_type=$BUILD_TYPE -tf conan/test_package; fi - language: cpp os: osx @@ -105,23 +105,23 @@ matrix: - DYLD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/google/grpc/install/lib ./grpctest - <<: *conan-linux - env: CONAN_GCC_VERSIONS=4.9 CONAN_DOCKER_IMAGE=lasote/conangcc49 + env: CONAN_GCC_VERSIONS=4.9 CONAN_DOCKER_IMAGE=conanio/gcc49 - <<: *conan-linux - env: CONAN_GCC_VERSIONS=5 CONAN_DOCKER_IMAGE=lasote/conangcc5 + env: CONAN_GCC_VERSIONS=5 CONAN_DOCKER_IMAGE=conanio/gcc5 - <<: *conan-linux - env: CONAN_GCC_VERSIONS=6 CONAN_DOCKER_IMAGE=lasote/conangcc6 + env: CONAN_GCC_VERSIONS=6 CONAN_DOCKER_IMAGE=conanio/gcc6 - <<: *conan-linux - env: CONAN_GCC_VERSIONS=7 CONAN_DOCKER_IMAGE=lasote/conangcc7 + env: CONAN_GCC_VERSIONS=7 CONAN_DOCKER_IMAGE=conanio/gcc7 - <<: *conan-linux - env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=lasote/conangcc8 + env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/gcc8 - <<: *conan-linux - env: CONAN_CLANG_VERSIONS=3.9 CONAN_DOCKER_IMAGE=lasote/conanclang39 + env: CONAN_CLANG_VERSIONS=3.9 CONAN_DOCKER_IMAGE=conanio/clang39 - <<: *conan-linux - env: CONAN_CLANG_VERSIONS=4.0 CONAN_DOCKER_IMAGE=lasote/conanclang40 + env: CONAN_CLANG_VERSIONS=4.0 CONAN_DOCKER_IMAGE=conanio/clang40 - <<: *conan-linux - env: CONAN_CLANG_VERSIONS=5.0 CONAN_DOCKER_IMAGE=lasote/conanclang50 + env: CONAN_CLANG_VERSIONS=5.0 CONAN_DOCKER_IMAGE=conanio/clang50 - <<: *conan-linux - env: CONAN_CLANG_VERSIONS=6.0 CONAN_DOCKER_IMAGE=lasote/conanclang60 + env: CONAN_CLANG_VERSIONS=6.0 CONAN_DOCKER_IMAGE=conanio/clang60 - <<: *conan-osx osx_image: xcode7.3 env: CONAN_APPLE_CLANG_VERSIONS=7.3 @@ -132,8 +132,11 @@ matrix: osx_image: xcode9 env: CONAN_APPLE_CLANG_VERSIONS=9.0 - <<: *conan-osx - osx_image: xcode9.3 + osx_image: xcode9.4 env: CONAN_APPLE_CLANG_VERSIONS=9.1 + - <<: *conan-osx + osx_image: xcode10 + env: CONAN_APPLE_CLANG_VERSIONS=10.0 - language: android sudo: true diff --git a/conan/build.py b/conan/build.py index 6c63de8b2..55456311b 100644 --- a/conan/build.py +++ b/conan/build.py @@ -1,7 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from cpt.packager import ConanMultiPackager import os +import re +import subprocess +from cpt.packager import ConanMultiPackager + def set_appveyor_environment(): if os.getenv("APPVEYOR") is not None: @@ -13,6 +16,39 @@ def set_appveyor_environment(): os.environ["CONAN_ARCHS"] = ci_platform os.environ["CONAN_BUILD_TYPES"] = os.getenv("Configuration").replace('"', '') + +def get_branch(): + try: + for line in subprocess.check_output("git branch", shell=True).decode().splitlines(): + line = line.strip() + if line.startswith("*") and " (HEAD detached" not in line: + return line.replace("*", "", 1).strip() + return "" + except Exception: + pass + return "" + + +def get_version(): + version = get_branch() + if os.getenv("TRAVIS", False): + version = os.getenv("TRAVIS_BRANCH") + + if os.getenv("APPVEYOR", False): + version = os.getenv("APPVEYOR_REPO_BRANCH") + if os.getenv("APPVEYOR_REPO_TAG") == "true": + version = os.getenv("APPVEYOR_REPO_TAG_NAME") + + match = re.search(r"v(\d+\.\d+\.\d+.*)", version) + if match: + return match.group(1) + return version + + +def get_reference(username): + return "flatbuffers/{}@google/stable".format(get_version()) + + if __name__ == "__main__": login_username = os.getenv("CONAN_LOGIN_USERNAME", "aardappel") username = os.getenv("CONAN_USERNAME", "google") @@ -22,7 +58,8 @@ if __name__ == "__main__": upload_only_when_stable = os.getenv("CONAN_UPLOAD_ONLY_WHEN_STABLE", True) set_appveyor_environment() - builder = ConanMultiPackager(username=username, + builder = ConanMultiPackager(reference=get_reference(username), + username=username, login_username=login_username, upload=upload, stable_branch_pattern=stable_branch_pattern, diff --git a/conanfile.py b/conanfile.py index 2c8b77de5..bdd832c36 100644 --- a/conanfile.py +++ b/conanfile.py @@ -10,15 +10,15 @@ from conans import ConanFile, CMake, tools class FlatbuffersConan(ConanFile): name = "flatbuffers" - version = "1.10.0" license = "Apache-2.0" url = "https://github.com/google/flatbuffers" homepage = "http://google.github.io/flatbuffers/" author = "Wouter van Oortmerssen" + topics = ("conan", "flatbuffers", "serialization", "rpc", "json-parser") description = "Memory Efficient Serialization Library" settings = "os", "compiler", "build_type", "arch" options = {"shared": [True, False], "fPIC": [True, False]} - default_options = "shared=False", "fPIC=True" + default_options = {"shared": False, "fPIC": True} generators = "cmake" exports = "LICENSE.txt" exports_sources = ["CMake/*", "include/*", "src/*", "grpc/*", "CMakeLists.txt", "conan/CMakeLists.txt"] @@ -57,6 +57,7 @@ class FlatbuffersConan(ConanFile): cmake = self.configure_cmake() cmake.install() self.copy(pattern="LICENSE.txt", dst="licenses") + self.copy(pattern="FindFlatBuffers.cmake", dst=os.path.join("lib", "cmake", "flatbuffers"), src="CMake") self.copy(pattern="flathash*", dst="bin", src="bin") self.copy(pattern="flatc*", dst="bin", src="bin") if self.settings.os == "Windows" and self.options.shared: