From 3d7ee84505060dee32d5847eb532158480c8eca5 Mon Sep 17 00:00:00 2001 From: Jelle Spijker <jelle.spijker@ultimaker.com> Date: Mon, 12 Feb 2024 11:48:49 +0100 Subject: [PATCH 01/14] Use Conan v2 Contributes to CURA-11622 --- .github/workflows/conan-package.yml | 84 ++++++++++++++++++----------- conanfile.py | 21 ++++---- test_package/conanfile.py | 6 ++- 3 files changed, 66 insertions(+), 45 deletions(-) diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index 212a49d5..96ecb8c6 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -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 diff --git a/conanfile.py b/conanfile.py index d8459352..61c060f8 100644 --- a/conanfile.py +++ b/conanfile.py @@ -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 @@ -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): @@ -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], @@ -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) @@ -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": @@ -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: @@ -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) @@ -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) diff --git a/test_package/conanfile.py b/test_package/conanfile.py index 17be25be..3064ac93 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -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) From 43c4fc4336f103d3b6f9e1f7ae3251af18797d52 Mon Sep 17 00:00:00 2001 From: Remco Burema <r.burema@ultimaker.com> Date: Tue, 3 Sep 2024 15:04:46 +0200 Subject: [PATCH 02/14] Signal update (to v2) in required conan version. part of CURA-11622 --- .github/workflows/conan-package.yml | 2 +- conanfile.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index 96ecb8c6..6a987f67 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -8,10 +8,10 @@ on: - 'include/**' - 'cmake/**' - 'conanfile.py' + - 'conandata.yml' - 'CMakeLists.txt' - '.github/workflows/conan-package.yml' - '.github/workflows/requirements*' - - 'conandata.yml' - '.gitattributes' branches: - main diff --git a/conanfile.py b/conanfile.py index 10349a9b..27cd3e23 100644 --- a/conanfile.py +++ b/conanfile.py @@ -11,7 +11,7 @@ from conan.tools.scm import Version, Git -required_conan_version = ">=1.58.0" +required_conan_version = ">=2.7.0" class ArcusConan(ConanFile): From 8121937a64249b4a42c52fab8844cd92f3db5557 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU <erwan.mathieu@ultimaker.com> Date: Thu, 5 Sep 2024 15:30:05 +0200 Subject: [PATCH 03/14] Set proper step name --- .github/workflows/conan-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index 6a987f67..56c91282 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -28,7 +28,7 @@ jobs: project_name: arcus # FIXME: Use main once merged - conan-package-export: + conan-recipe-export: needs: [ conan-recipe-version ] uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-export.yml@CURA-11622_conan_v2 with: From bfa2e047802f58902d265c02e1f70ce82a47ee68 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU <erwan.mathieu@ultimaker.com> Date: Thu, 5 Sep 2024 15:34:02 +0200 Subject: [PATCH 04/14] Fix step renaming with dependencies --- .github/workflows/conan-package.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index 56c91282..3876897a 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -41,7 +41,7 @@ jobs: # FIXME: Use main once merged conan-package-create-macos: - needs: [ conan-recipe-version, conan-package-export ] + needs: [ conan-recipe-version, conan-recipe-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: @@ -54,7 +54,7 @@ jobs: # FIXME: Use main once merged conan-package-create-windows: - needs: [ conan-recipe-version, conan-package-export ] + needs: [ conan-recipe-version, conan-recipe-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: @@ -67,7 +67,7 @@ jobs: # FIXME: Use main once merged conan-package-create-linux: - needs: [ conan-recipe-version, conan-package-export ] + needs: [ conan-recipe-version, conan-recipe-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: From 14da066fc05e0f72038c569badc58732d8036163 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU <erwan.mathieu@ultimaker.com> Date: Thu, 12 Sep 2024 11:33:58 +0200 Subject: [PATCH 05/14] Use common package creation workflow --- .github/workflows/conan-package.yml | 54 ++--------------------------- 1 file changed, 2 insertions(+), 52 deletions(-) diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index 3876897a..d9f50890 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -22,58 +22,8 @@ on: jobs: # FIXME: Use main once merged - conan-recipe-version: - uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@CURA-11622_conan_v2 + conan-package: + uses: ultimaker/cura-workflows/.github/workflows/conan-package.yml@CURA-11622_conan_v2 with: project_name: arcus - -# FIXME: Use main once merged - conan-recipe-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 - -# FIXME: Use main once merged - conan-package-create-macos: - needs: [ conan-recipe-version, conan-recipe-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 - -# FIXME: Use main once merged - conan-package-create-windows: - needs: [ conan-recipe-version, conan-recipe-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 - -# FIXME: Use main once merged - conan-package-create-linux: - needs: [ conan-recipe-version, conan-recipe-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 From 0e985f75deadc116a8b60eb384b414173feb6ff7 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU <erwan.mathieu@ultimaker.com> Date: Thu, 12 Sep 2024 11:34:32 +0200 Subject: [PATCH 06/14] Use uptodate checkout action --- .github/workflows/process-pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/process-pull-request.yml b/.github/workflows/process-pull-request.yml index 56fb015b..2aa5d6de 100644 --- a/.github/workflows/process-pull-request.yml +++ b/.github/workflows/process-pull-request.yml @@ -8,7 +8,7 @@ jobs: add_label: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-ecosystem/action-add-labels@v1 if: ${{ github.event.pull_request.head.repo.full_name != github.repository }} with: From 49c38edd4d57b153c96a14776aaf95da22ea2532 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU <erwan.mathieu@ultimaker.com> Date: Tue, 17 Sep 2024 08:21:40 +0200 Subject: [PATCH 07/14] Remove now useless file --- .github/workflows/requirements-runner.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .github/workflows/requirements-runner.txt diff --git a/.github/workflows/requirements-runner.txt b/.github/workflows/requirements-runner.txt deleted file mode 100644 index e69de29b..00000000 From 6135ed3fab7b2448f51b01d70d2b532a902864c9 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU <erwan.mathieu@ultimaker.com> Date: Wed, 25 Sep 2024 15:26:10 +0200 Subject: [PATCH 08/14] Update variable name --- .github/workflows/conan-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index d9f50890..34bdd05f 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -25,5 +25,5 @@ jobs: conan-package: uses: ultimaker/cura-workflows/.github/workflows/conan-package.yml@CURA-11622_conan_v2 with: - project_name: arcus + package_name: arcus secrets: inherit From e7860b74bbfe35f26f41edef375d17c24647435a Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU <erwan.mathieu@ultimaker.com> Date: Fri, 22 Nov 2024 10:53:44 +0100 Subject: [PATCH 09/14] Change the way of enabling sentry --- conanfile.py | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/conanfile.py b/conanfile.py index 27cd3e23..ffd08537 100644 --- a/conanfile.py +++ b/conanfile.py @@ -29,11 +29,13 @@ class ArcusConan(ConanFile): "shared": [True, False], "fPIC": [True, False], "enable_sentry": [True, False], + "sentry_project": ["ANY"], } default_options = { "shared": True, "fPIC": True, "enable_sentry": False, + "sentry_project": name, } def set_version(self): @@ -66,8 +68,6 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.conf.get("user.curaengine:sentry_url", "", check_type=str) == "": - del self.options.enable_sentry def configure(self): if self.options.shared: @@ -98,13 +98,18 @@ def validate(self): f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) + if self.options.enable_sentry: + for sentry_setting in ["organization", "token"]: + if self.conf.get(f"user.sentry:{sentry_setting}", "", check_type=str) == "": + raise ConanInvalidConfiguration(f"Unable to enable Sentry because no {sentry_setting} was configured") + def build_requirements(self): 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) - tc.variables["ENABLE_SENTRY"] = self.options.get_safe("enable_sentry", False) + tc.variables["ENABLE_SENTRY"] = self.options.enable_sentry if is_msvc(self): tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" @@ -121,25 +126,24 @@ def build(self): cmake.configure() cmake.build() - sentry_project = self.conf.get("user.curaengine:sentry_project", "", check_type=str) - sentry_org = self.conf.get("user.curaengine:sentry_org", "", check_type=str) - if self.options.get_safe("enable_sentry", False) and os.environ.get('SENTRY_TOKEN', None) and sentry_project != "" and sentry_org != "": - if sentry_project == "" or sentry_org == "": - raise ConanInvalidConfiguration("sentry_project or sentry_org is not set") - + if self.options.enable_sentry: + sentry_project = self.options.sentry_project + sentry_organization = self.conf.get("user.sentry:organization", "", check_type=str) + sentry_token = self.conf.get("user.sentry:token", "", check_type=str) + if which("sentry-cli") is None: - self.output.warn("sentry-cli is not installed, skipping uploading debug symbols") - else: - if self.settings.os == "Linux": - self.output.info("Stripping debug symbols from binary") - ext = ".so" if self.options.shared else ".a" - self.run(f"objcopy --only-keep-debug --compress-debug-sections=zlib libArcus{ext} libArcus.debug") - self.run(f"objcopy --strip-debug --strip-unneeded libArcus{ext}") - self.run(f"objcopy --add-gnu-debuglink=libArcus.debug libArcus{ext}") - - build_source_dir = self.build_path.parent.parent.as_posix() - 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}") + raise ConanException("sentry-cli is not installed, unable to upload debug symbols") + + if self.settings.os == "Linux": + self.output.info("Stripping debug symbols from binary") + ext = ".so" if self.options.shared else ".a" + self.run(f"objcopy --only-keep-debug --compress-debug-sections=zlib libArcus{ext} libArcus.debug") + self.run(f"objcopy --strip-debug --strip-unneeded libArcus{ext}") + self.run(f"objcopy --add-gnu-debuglink=libArcus.debug libArcus{ext}") + + build_source_dir = self.build_path.parent.parent.as_posix() + self.output.info("Uploading debug symbols to sentry") + self.run(f"sentry-cli --auth-token {sentry_token} debug-files upload --include-sources -o {sentry_organization} -p {sentry_project} {build_source_dir}") def package(self): copy(self, pattern="LICENSE*", dst="licenses", src=self.source_folder) From 5f40061ef77b1daaa083cc6270c473ffa4e95ffe Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU <erwan.mathieu@ultimaker.com> Date: Fri, 22 Nov 2024 13:18:14 +0100 Subject: [PATCH 10/14] Use common sentry actions --- conanfile.py | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/conanfile.py b/conanfile.py index ffd08537..bb26814e 100644 --- a/conanfile.py +++ b/conanfile.py @@ -24,20 +24,22 @@ class ArcusConan(ConanFile): settings = "os", "compiler", "build_type", "arch" exports = "LICENSE*" package_type = "library" + python_requires = "sentrylibrary/1.0@ultimaker/cura_11622" # FIXME: use main after merge + python_requires_extend = "sentrylibrary.SentryLibrary" options = { "shared": [True, False], "fPIC": [True, False], - "enable_sentry": [True, False], - "sentry_project": ["ANY"], } default_options = { "shared": True, "fPIC": True, - "enable_sentry": False, - "sentry_project": name, } + def init(self): + base = self.python_requires["sentrylibrary"].module.SentryLibrary + self.options.update(base.options, base.default_options) + def set_version(self): if not self.version: self.version = self.conan_data["version"] @@ -66,10 +68,14 @@ def export_sources(self): copy(self, "*", os.path.join(self.recipe_folder, "include"), os.path.join(self.export_sources_folder, "include")) def config_options(self): + super().config_options() + if self.settings.os == "Windows": del self.options.fPIC def configure(self): + super().configure() + if self.options.shared: self.options.rm_safe("fPIC") @@ -85,9 +91,13 @@ def layout(self): self.cpp.package.system_libs = ["ws2_32"] def requirements(self): + super().requirements() + self.requires("protobuf/3.21.12", transitive_headers=True) def validate(self): + super().validate() + if self.settings.compiler.cppstd: check_min_cppstd(self, self._min_cppstd) check_min_vs(self, 192) # TODO: remove in Conan 2.0 @@ -109,10 +119,10 @@ def build_requirements(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["ENABLE_SENTRY"] = self.options.enable_sentry if is_msvc(self): tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + self.setup_cmake_toolchain_sentry(tc) tc.generate() tc = CMakeDeps(self) @@ -126,24 +136,7 @@ def build(self): cmake.configure() cmake.build() - if self.options.enable_sentry: - sentry_project = self.options.sentry_project - sentry_organization = self.conf.get("user.sentry:organization", "", check_type=str) - sentry_token = self.conf.get("user.sentry:token", "", check_type=str) - - if which("sentry-cli") is None: - raise ConanException("sentry-cli is not installed, unable to upload debug symbols") - - if self.settings.os == "Linux": - self.output.info("Stripping debug symbols from binary") - ext = ".so" if self.options.shared else ".a" - self.run(f"objcopy --only-keep-debug --compress-debug-sections=zlib libArcus{ext} libArcus.debug") - self.run(f"objcopy --strip-debug --strip-unneeded libArcus{ext}") - self.run(f"objcopy --add-gnu-debuglink=libArcus.debug libArcus{ext}") - - build_source_dir = self.build_path.parent.parent.as_posix() - self.output.info("Uploading debug symbols to sentry") - self.run(f"sentry-cli --auth-token {sentry_token} debug-files upload --include-sources -o {sentry_organization} -p {sentry_project} {build_source_dir}") + self.send_sentry_debug_files() def package(self): copy(self, pattern="LICENSE*", dst="licenses", src=self.source_folder) From 7450a71f3a38c236500d57376cf50635db088385 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU <erwan.mathieu@ultimaker.com> Date: Fri, 22 Nov 2024 13:47:18 +0100 Subject: [PATCH 11/14] Set binary file for sentry --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index bb26814e..23f4ab1a 100644 --- a/conanfile.py +++ b/conanfile.py @@ -136,7 +136,7 @@ def build(self): cmake.configure() cmake.build() - self.send_sentry_debug_files() + self.send_sentry_debug_files(binary_basename = "libArcus") def package(self): copy(self, pattern="LICENSE*", dst="licenses", src=self.source_folder) From ba5d30887d87db1dce2c4b15967c710917261b91 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU <erwan.mathieu@ultimaker.com> Date: Fri, 22 Nov 2024 15:47:32 +0100 Subject: [PATCH 12/14] Use proper sentrylibrary version --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index 23f4ab1a..4ef85235 100644 --- a/conanfile.py +++ b/conanfile.py @@ -24,7 +24,7 @@ class ArcusConan(ConanFile): settings = "os", "compiler", "build_type", "arch" exports = "LICENSE*" package_type = "library" - python_requires = "sentrylibrary/1.0@ultimaker/cura_11622" # FIXME: use main after merge + python_requires = "sentrylibrary/1.0.0@ultimaker/cura_11622" # FIXME: use main after merge python_requires_extend = "sentrylibrary.SentryLibrary" options = { From fd280fef56bd7bd8ac126b2181c658872d3f0a4b Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU <erwan.mathieu@ultimaker.com> Date: Tue, 26 Nov 2024 11:20:11 +0100 Subject: [PATCH 13/14] Use simplified package creation workflow --- .github/workflows/conan-package.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index 34bdd05f..7f032647 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -24,6 +24,4 @@ jobs: # FIXME: Use main once merged conan-package: uses: ultimaker/cura-workflows/.github/workflows/conan-package.yml@CURA-11622_conan_v2 - with: - package_name: arcus secrets: inherit From bc3e5c48dd3fd298f67b55b626800233119e7e84 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU <erwan.mathieu@ultimaker.com> Date: Wed, 4 Dec 2024 09:08:14 +0100 Subject: [PATCH 14/14] Prepare for merge --- .github/workflows/conan-package.yml | 3 +-- conanfile.py | 4 ++-- test_package/conanfile.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index 7f032647..43f36e80 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -21,7 +21,6 @@ on: - '[0-9].[0-9][0-9]*' jobs: -# FIXME: Use main once merged conan-package: - uses: ultimaker/cura-workflows/.github/workflows/conan-package.yml@CURA-11622_conan_v2 + uses: ultimaker/cura-workflows/.github/workflows/conan-package.yml@main secrets: inherit diff --git a/conanfile.py b/conanfile.py index 4ef85235..93defb1e 100644 --- a/conanfile.py +++ b/conanfile.py @@ -24,7 +24,7 @@ class ArcusConan(ConanFile): settings = "os", "compiler", "build_type", "arch" exports = "LICENSE*" package_type = "library" - python_requires = "sentrylibrary/1.0.0@ultimaker/cura_11622" # FIXME: use main after merge + python_requires = "sentrylibrary/1.0.0@ultimaker/stable" python_requires_extend = "sentrylibrary.SentryLibrary" options = { @@ -114,7 +114,7 @@ def validate(self): raise ConanInvalidConfiguration(f"Unable to enable Sentry because no {sentry_setting} was configured") def build_requirements(self): - self.test_requires("standardprojectsettings/[>=0.2.0]@ultimaker/cura_11622") # FIXME: use stable after merge + self.test_requires("standardprojectsettings/[>=0.2.0]@ultimaker/stable") self.tool_requires("protobuf/3.21.12") def generate(self): diff --git a/test_package/conanfile.py b/test_package/conanfile.py index 3064ac93..e9b23a0a 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -9,7 +9,7 @@ class ArcusTestConan(ConanFile): test_type = "explicit" def build_requirements(self): - self.test_requires("standardprojectsettings/[>=0.2.0]@ultimaker/cura_11622") # FIXME: use stable after merge + self.test_requires("standardprojectsettings/[>=0.2.0]@ultimaker/stable") self.tool_requires("protobuf/3.21.12") def requirements(self):