@@ -29,11 +29,13 @@ class ArcusConan(ConanFile):
29
29
"shared" : [True , False ],
30
30
"fPIC" : [True , False ],
31
31
"enable_sentry" : [True , False ],
32
+ "sentry_project" : ["ANY" ],
32
33
}
33
34
default_options = {
34
35
"shared" : True ,
35
36
"fPIC" : True ,
36
37
"enable_sentry" : False ,
38
+ "sentry_project" : name ,
37
39
}
38
40
39
41
def set_version (self ):
@@ -66,8 +68,6 @@ def export_sources(self):
66
68
def config_options (self ):
67
69
if self .settings .os == "Windows" :
68
70
del self .options .fPIC
69
- if self .conf .get ("user.curaengine:sentry_url" , "" , check_type = str ) == "" :
70
- del self .options .enable_sentry
71
71
72
72
def configure (self ):
73
73
if self .options .shared :
@@ -98,13 +98,18 @@ def validate(self):
98
98
f"{ self .ref } requires C++{ self ._min_cppstd } , which your compiler does not support."
99
99
)
100
100
101
+ if self .options .enable_sentry :
102
+ for sentry_setting in ["organization" , "token" ]:
103
+ if self .conf .get (f"user.sentry:{ sentry_setting } " , "" , check_type = str ) == "" :
104
+ raise ConanInvalidConfiguration (f"Unable to enable Sentry because no { sentry_setting } was configured" )
105
+
101
106
def build_requirements (self ):
102
107
self .test_requires ("standardprojectsettings/[>=0.2.0]@ultimaker/cura_11622" ) # FIXME: use stable after merge
103
108
self .tool_requires ("protobuf/3.21.12" )
104
109
105
110
def generate (self ):
106
111
tc = CMakeToolchain (self )
107
- tc .variables ["ENABLE_SENTRY" ] = self .options .get_safe ( " enable_sentry" , False )
112
+ tc .variables ["ENABLE_SENTRY" ] = self .options .enable_sentry
108
113
if is_msvc (self ):
109
114
tc .variables ["USE_MSVC_RUNTIME_LIBRARY_DLL" ] = not is_msvc_static_runtime (self )
110
115
tc .cache_variables ["CMAKE_POLICY_DEFAULT_CMP0077" ] = "NEW"
@@ -121,25 +126,24 @@ def build(self):
121
126
cmake .configure ()
122
127
cmake .build ()
123
128
124
- sentry_project = self .conf .get ("user.curaengine:sentry_project" , "" , check_type = str )
125
- sentry_org = self .conf .get ("user.curaengine:sentry_org" , "" , check_type = str )
126
- if self .options .get_safe ("enable_sentry" , False ) and os .environ .get ('SENTRY_TOKEN' , None ) and sentry_project != "" and sentry_org != "" :
127
- if sentry_project == "" or sentry_org == "" :
128
- raise ConanInvalidConfiguration ("sentry_project or sentry_org is not set" )
129
-
129
+ if self .options .enable_sentry :
130
+ sentry_project = self .options .sentry_project
131
+ sentry_organization = self .conf .get ("user.sentry:organization" , "" , check_type = str )
132
+ sentry_token = self .conf .get ("user.sentry:token" , "" , check_type = str )
133
+
130
134
if which ("sentry-cli" ) is None :
131
- self . output . warn ("sentry-cli is not installed, skipping uploading debug symbols" )
132
- else :
133
- if self .settings .os == "Linux" :
134
- self .output .info ("Stripping debug symbols from binary" )
135
- ext = ".so" if self .options .shared else ".a"
136
- self .run (f"objcopy --only-keep-debug --compress-debug-sections=zlib libArcus{ ext } libArcus.debug" )
137
- self .run (f"objcopy --strip-debug --strip-unneeded libArcus{ ext } " )
138
- self .run (f"objcopy --add-gnu-debuglink=libArcus.debug libArcus{ ext } " )
139
-
140
- build_source_dir = self .build_path .parent .parent .as_posix ()
141
- self .output .info ("Uploading debug symbols to sentry" )
142
- 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 } " )
135
+ raise ConanException ("sentry-cli is not installed, unable to upload debug symbols" )
136
+
137
+ if self .settings .os == "Linux" :
138
+ self .output .info ("Stripping debug symbols from binary" )
139
+ ext = ".so" if self .options .shared else ".a"
140
+ self .run (f"objcopy --only-keep-debug --compress-debug-sections=zlib libArcus{ ext } libArcus.debug" )
141
+ self .run (f"objcopy --strip-debug --strip-unneeded libArcus{ ext } " )
142
+ self .run (f"objcopy --add-gnu-debuglink=libArcus.debug libArcus{ ext } " )
143
+
144
+ build_source_dir = self .build_path .parent .parent .as_posix ()
145
+ self .output .info ("Uploading debug symbols to sentry" )
146
+ self .run (f"sentry-cli --auth-token { sentry_token } debug-files upload --include-sources -o { sentry_organization } -p { sentry_project } { build_source_dir } " )
143
147
144
148
def package (self ):
145
149
copy (self , pattern = "LICENSE*" , dst = "licenses" , src = self .source_folder )
0 commit comments