Skip to content

Commit

Permalink
Use Conan v2
Browse files Browse the repository at this point in the history
Contributes to CURA-11622
  • Loading branch information
jellespijker committed Feb 12, 2024
1 parent 46fa0ba commit 3d7ee84
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 45 deletions.
84 changes: 52 additions & 32 deletions .github/workflows/conan-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,59 @@ on:
- '[0-9].[0-9][0-9]*'

jobs:
conan-recipe-version:
uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@main
with:
project_name: arcus
# FIXME: Use main once merged
conan-recipe-version:
uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@CURA-11622_conan_v2
with:
project_name: arcus

conan-package-export:
needs: [ conan-recipe-version ]
uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-export.yml@main
with:
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
recipe_id_latest: ${{ needs.conan-recipe-version.outputs.recipe_id_latest }}
secrets: inherit
# FIXME: Use main once merged
conan-package-export:
needs: [ conan-recipe-version ]
uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-export.yml@CURA-11622_conan_v2
with:
recipe_id_name: ${{ needs.conan-recipe-version.outputs.project_name }}
recipe_id_version: ${{ needs.conan-recipe-version.outputs.recipe_semver_full }}
recipe_id_user: ${{ needs.conan-recipe-version.outputs.user }}
recipe_id_channel: ${{ needs.conan-recipe-version.outputs.channel }}
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
secrets: inherit

conan-package-create-macos:
needs: [ conan-recipe-version, conan-package-export ]
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-macos.yml@main
with:
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
secrets: inherit
# FIXME: Use main once merged
conan-package-create-macos:
needs: [ conan-recipe-version, conan-package-export ]
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-macos.yml@CURA-11622_conan_v2
with:
recipe_id_name: ${{ needs.conan-recipe-version.outputs.project_name }}
recipe_id_version: ${{ needs.conan-recipe-version.outputs.recipe_semver_full }}
recipe_id_user: ${{ needs.conan-recipe-version.outputs.user }}
recipe_id_channel: ${{ needs.conan-recipe-version.outputs.channel }}
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
secrets: inherit

conan-package-create-windows:
needs: [ conan-recipe-version, conan-package-export ]
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-windows.yml@main
with:
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
secrets: inherit
# FIXME: Use main once merged
conan-package-create-windows:
needs: [ conan-recipe-version, conan-package-export ]
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-windows.yml@CURA-11622_conan_v2
with:
recipe_id_name: ${{ needs.conan-recipe-version.outputs.project_name }}
recipe_id_version: ${{ needs.conan-recipe-version.outputs.recipe_semver_full }}
recipe_id_user: ${{ needs.conan-recipe-version.outputs.user }}
recipe_id_channel: ${{ needs.conan-recipe-version.outputs.channel }}
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
secrets: inherit

conan-package-create-linux:
needs: [ conan-recipe-version, conan-package-export ]
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-linux.yml@main
with:
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
secrets: inherit
# FIXME: Use main once merged
conan-package-create-linux:
needs: [ conan-recipe-version, conan-package-export ]
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }}
uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-linux.yml@CURA-11622_conan_v2
with:
recipe_id_name: ${{ needs.conan-recipe-version.outputs.project_name }}
recipe_id_version: ${{ needs.conan-recipe-version.outputs.recipe_semver_full }}
recipe_id_user: ${{ needs.conan-recipe-version.outputs.user }}
recipe_id_channel: ${{ needs.conan-recipe-version.outputs.channel }}
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
secrets: inherit
21 changes: 10 additions & 11 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from io import StringIO
import os
from os import path
from shutil import which

from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
Expand All @@ -10,9 +9,9 @@
from conan.tools.files import copy, AutoPackager, update_conandata
from conan.tools.microsoft import check_min_vs, is_msvc, is_msvc_static_runtime
from conan.tools.scm import Version, Git
from conans.tools import which

required_conan_version = ">=1.55.0"

required_conan_version = ">=1.58.0"


class ArcusConan(ConanFile):
Expand All @@ -24,6 +23,7 @@ class ArcusConan(ConanFile):
topics = ("conan", "binding", "cura", "protobuf", "c++")
settings = "os", "compiler", "build_type", "arch"
exports = "LICENSE*"
package_type = "library"

options = {
"shared": [True, False],
Expand All @@ -38,8 +38,7 @@ class ArcusConan(ConanFile):

def set_version(self):
if not self.version:
build_meta = "" if self.develop else "+source"
self.version = self.conan_data["version"] + build_meta
self.version = self.conan_data["version"]

def export(self):
git = Git(self)
Expand All @@ -61,8 +60,8 @@ def _compilers_minimum_version(self):

def export_sources(self):
copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder)
copy(self, "*", path.join(self.recipe_folder, "src"), path.join(self.export_sources_folder, "src"))
copy(self, "*", path.join(self.recipe_folder, "include"), path.join(self.export_sources_folder, "include"))
copy(self, "*", os.path.join(self.recipe_folder, "src"), os.path.join(self.export_sources_folder, "src"))
copy(self, "*", os.path.join(self.recipe_folder, "include"), os.path.join(self.export_sources_folder, "include"))

def config_options(self):
if self.settings.os == "Windows":
Expand All @@ -86,7 +85,7 @@ def layout(self):
self.cpp.package.system_libs = ["ws2_32"]

def requirements(self):
self.requires("protobuf/3.21.9", transitive_headers=True)
self.requires("protobuf/3.21.12", transitive_headers=True)

def validate(self):
if self.settings.compiler.cppstd:
Expand All @@ -100,7 +99,8 @@ def validate(self):
)

def build_requirements(self):
self.test_requires("standardprojectsettings/[>=0.1.0]@ultimaker/stable")
self.test_requires("standardprojectsettings/[>=0.2.0]@ultimaker/cura_11622") # FIXME: use stable after merge
self.tool_requires("protobuf/3.21.12")

def generate(self):
tc = CMakeToolchain(self)
Expand Down Expand Up @@ -142,7 +142,6 @@ def build(self):
self.output.info("Uploading debug symbols to sentry")
self.run(f"sentry-cli --auth-token {os.environ['SENTRY_TOKEN']} debug-files upload --include-sources -o {sentry_org} -p {sentry_project} {build_source_dir}")


def package(self):
copy(self, pattern="LICENSE*", dst="licenses", src=self.source_folder)
packager = AutoPackager(self)
Expand Down
6 changes: 4 additions & 2 deletions test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ class ArcusTestConan(ConanFile):
test_type = "explicit"

def build_requirements(self):
self.test_requires("standardprojectsettings/[>=0.1.0]@ultimaker/stable")
self.test_requires("standardprojectsettings/[>=0.2.0]@ultimaker/cura_11622") # FIXME: use stable after merge
self.tool_requires("protobuf/3.21.12")

def requirements(self):
self.requires(self.tested_reference_str)
self.requires("protobuf/3.21.4")
self.requires("protobuf/3.21.12")

def layout(self):
cmake_layout(self)
Expand Down

0 comments on commit 3d7ee84

Please sign in to comment.