From 84e9a07332b856abacb236eeb012cb9c7c47f773 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Thu, 11 Jan 2024 14:26:37 +0100 Subject: [PATCH] Use a Sentry release Contribute to CURA-11482 --- conanfile.py | 17 +++++++++++++---- src/main.cpp | 4 +++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/conanfile.py b/conanfile.py index 2b48aafee9..171d3704c7 100644 --- a/conanfile.py +++ b/conanfile.py @@ -8,7 +8,7 @@ from conan.tools.files import copy, mkdir, update_conandata from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout from conan.tools.build import check_min_cppstd -from conan.tools.scm import Version +from conan.tools.scm import Version, Git from conans.errors import ConanInvalidSystemRequirements required_conan_version = ">=1.58.0 <2.0.0" @@ -47,7 +47,8 @@ def set_version(self): self.version = self.conan_data["version"] + build_meta def export(self): - update_conandata(self, {"version": self.version}) + git = Git(self) + update_conandata(self, {"version": self.version, "commit": git.get_commit()}) def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) @@ -163,6 +164,7 @@ def build(self): cmake.build() if self.options.get_safe("enable_sentry", False): + # Upload debug symbols to sentry sentry_project = self.conf.get("user.curaengine:sentry_project", "", check_type=str) if sentry_project == "": raise ConanInvalidConfiguration("sentry_project is not set") @@ -170,10 +172,17 @@ def build(self): self.run(f"sentry-cli -V", output=output) if "sentry-cli" not in output.getvalue(): raise ConanInvalidSystemRequirements("sentry-cli is not installed") + self.output.info("Uploading debug symbols to sentry") ext = ".exe" if self.settings.os == "Windows" else "" - self.run(f"sentry-cli debug-files upload --include-sources ../../ -o {sentry_project} -p curaengine CuraEngine{ext}") + self.run(f"sentry-cli debug-files upload --include-sources {self.source_folder} -o {sentry_project} -p curaengine CuraEngine{ext}") if self.settings.os == "Windows" and self.settings.build_type == "RelWithDebInfo": - self.run(f"sentry-cli upload-dif --include-sources ../../ -o {sentry_project} -p curaengine CuraEngine.pdb") + self.run(f"sentry-cli upload-dif --include-sources {self.build_folder} -o {sentry_project} -p curaengine CuraEngine.pdb") + + # create a sentry release and link it to the commit this is based upon + self.output.info(f"Creating a new release {self.version} in Sentry and linking it to the current commit {self.conan_data['commit']}") + self.run(f"sentry-cli releases new -o {sentry_project} -p curaengine {self.version}") + self.run(f"sentry-cli releases set-commits -o {sentry_project} -p curaengine --commit \"Ultimaker/CuraEngine@{self.conan_data['commit']}\" {self.version}") + self.run(f"sentry-cli releases finalize -o {sentry_project} -p curaengine {self.version}") def package(self): ext = ".exe" if self.settings.os == "Windows" else "" diff --git a/src/main.cpp b/src/main.cpp index b1381244ce..f69b920e8c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2023 UltiMaker +// Copyright (c) 2024 UltiMaker // CuraEngine is released under the terms of the AGPLv3 or higher #include //To change the formatting of std::cerr. @@ -93,6 +93,7 @@ int main(int argc, char** argv) // Set the actual CuraEngine version sentry_options_set_release(options, fmt::format("curaengine@{}", cura_engine_version).c_str()); + spdlog::info("Starting sentry"); sentry_init(options); } #endif @@ -102,6 +103,7 @@ int main(int argc, char** argv) #ifdef SENTRY_URL if (const auto use_sentry = spdlog::details::os::getenv("use_sentry"); ! use_sentry.empty() && use_sentry == "1") { + spdlog::info("Closing sentry"); sentry_close(); } #endif