What is the best way to locate additional tools from a given GCC toolchain? Obviously GccPlatformToolChain provides easy access to the main binaries like gcc and g++, but I would also like to locate objcopy and strip for stripping unneeded symbols.
I wrote a basic plugin that facilitates this, but I’m using a fairly crude method of searching the toolchain bin directory, and I invoke the tools with Exec tasks. Useful snippet below, full plugin at GitHub. Is there any better way to do this?
private File findGccTool(NativeToolChain toolChain, String toolName) {
if (!(toolChain in Gcc)) return null
def tools = []
toolChain.path*.eachFile { tools << it }
return tools.find {
it.name == toolName || it.name.endsWith("-${toolName}")
}
}