public void link ( final CCTask task , final File outputFile , final String [ ] sourceFiles , final CommandLineLinkerConfiguration config ) throws BuildException { final File parentDir = new File ( outputFile . getParent ( ) ) ; String parentPath ; try { parentPath = parentDir . getCanonicalPath ( ) ; } catch ( final IOException ex ) { parentPath = parentDir . getAbsolutePath ( ) ; } String [ ] execArgs = prepareArguments ( task , parentPath , outputFile . getName ( ) , sourceFiles , config ) ; int commandLength = 0 ; for ( final String execArg : execArgs ) { commandLength += execArg . length ( ) + 1 ; } // // if command length exceeds maximum // then create a temporary // file containing everything but the command name if ( commandLength >= this . getMaximumCommandLength ( ) ) { try { execArgs = prepareResponseFile ( outputFile , execArgs ) ; } catch ( final IOException ex ) { throw new BuildException ( ex ) ; } } final int retval = runCommand ( task , parentDir , execArgs ) ; // // if the process returned a failure code then // throw an BuildException // if ( retval != 0 ) { // // construct the exception // throw new BuildException ( getCommandWithPath ( config ) + " failed with return code " + retval , task . getLocation ( ) ) ; } }
Performs a link using a command line linker