Skip to content

Commit 137e203

Browse files
committed
split debug - make binutils optional
1 parent c4dd50e commit 137e203

File tree

1 file changed

+15
-28
lines changed

1 file changed

+15
-28
lines changed

ddprof-lib/build.gradle

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,21 @@ def checkDsymutilAvailable() {
3232

3333
// Helper function to check if debug extraction should be skipped
3434
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
3650
}
3751

3852
// Helper function to get debug file path for a given config
@@ -73,24 +87,6 @@ def createDebugExtractionTask(config, linkTask) {
7387
def sourceFile = linkTask.get().linkedFile.get().asFile
7488
def debugFile = getDebugFilePath(config)
7589

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-
9490
// Ensure debug directory exists
9591
debugFile.parentFile.mkdirs()
9692

@@ -118,15 +114,6 @@ def createDebugLinkTask(config, linkTask, extractDebugTask) {
118114
def sourceFile = linkTask.get().linkedFile.get().asFile
119115
def debugFile = getDebugFilePath(config)
120116

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-
130117
commandLine = ['objcopy', '--add-gnu-debuglink=' + debugFile.absolutePath, sourceFile.absolutePath]
131118
}
132119
}

0 commit comments

Comments
 (0)