@@ -32,7 +32,21 @@ def checkDsymutilAvailable() {
32
32
33
33
// Helper function to check if debug extraction should be skipped
34
34
def shouldSkipDebugExtraction () {
35
- return project. hasProperty(' skip-debug-extraction' )
35
+ // Skip if explicitly disabled
36
+ if (project. hasProperty(' skip-debug-extraction' )) {
37
+ return true
38
+ }
39
+
40
+ // Skip if required tools are not available
41
+ if (os(). isLinux() && ! checkObjcopyAvailable()) {
42
+ return true
43
+ }
44
+
45
+ if (os(). isMacOsX() && ! checkDsymutilAvailable()) {
46
+ return true
47
+ }
48
+
49
+ return false
36
50
}
37
51
38
52
// Helper function to get debug file path for a given config
@@ -73,24 +87,6 @@ def createDebugExtractionTask(config, linkTask) {
73
87
def sourceFile = linkTask. get(). linkedFile. get(). asFile
74
88
def debugFile = getDebugFilePath(config)
75
89
76
- // Check for required tools before proceeding
77
- if (os(). isLinux()) {
78
- if (! checkObjcopyAvailable()) {
79
- def installInstructions = """
80
- | - On Ubuntu/Debian: sudo apt-get install binutils
81
- | - On RHEL/CentOS: sudo yum install binutils
82
- | - On Alpine: apk add binutils""" . stripMargin()
83
- throw new GradleException (getMissingToolErrorMessage(' objcopy' , installInstructions))
84
- }
85
- } else if (os(). isMacOsX()) {
86
- if (! checkDsymutilAvailable()) {
87
- def installInstructions = """
88
- | dsymutil should be available with Xcode command line tools:
89
- | xcode-select --install""" . stripMargin()
90
- throw new GradleException (getMissingToolErrorMessage(' dsymutil' , installInstructions))
91
- }
92
- }
93
-
94
90
// Ensure debug directory exists
95
91
debugFile. parentFile. mkdirs()
96
92
@@ -118,15 +114,6 @@ def createDebugLinkTask(config, linkTask, extractDebugTask) {
118
114
def sourceFile = linkTask. get(). linkedFile. get(). asFile
119
115
def debugFile = getDebugFilePath(config)
120
116
121
- // Check for objcopy availability
122
- if (! checkObjcopyAvailable()) {
123
- def installInstructions = """
124
- | - On Ubuntu/Debian: sudo apt-get install binutils
125
- | - On RHEL/CentOS: sudo yum install binutils
126
- | - On Alpine: apk add binutils""" . stripMargin()
127
- throw new GradleException (getMissingToolErrorMessage(' objcopy' , installInstructions))
128
- }
129
-
130
117
commandLine = [' objcopy' , ' --add-gnu-debuglink=' + debugFile. absolutePath, sourceFile. absolutePath]
131
118
}
132
119
}
0 commit comments