public final DependencyInfo parseIncludes ( final CCTask task , final File source , final File [ ] includePath , final File [ ] sysIncludePath , final File [ ] envIncludePath , final File baseDir , final String includePathIdentifier ) { // // if any of the include files can not be identified // change the sourceLastModified to Long.MAX_VALUE to // force recompilation of anything that depends on it long sourceLastModified = source . lastModified ( ) ; final File [ ] sourcePath = new File [ 1 ] ; sourcePath [ 0 ] = new File ( source . getParent ( ) ) ; final Vector onIncludePath = new Vector ( ) ; final Vector onSysIncludePath = new Vector ( ) ; String baseDirPath ; try { baseDirPath = baseDir . getCanonicalPath ( ) ; } catch ( final IOException ex ) { baseDirPath = baseDir . toString ( ) ; } final String relativeSource = CUtil . getRelativePath ( baseDirPath , source ) ; String [ ] includes = emptyIncludeArray ; if ( canParse ( source ) ) { final Parser parser = createParser ( source ) ; try { final Reader reader = new BufferedReader ( new FileReader ( source ) ) ; parser . parse ( reader ) ; includes = parser . getIncludes ( ) ; } catch ( final IOException ex ) { task . log ( "Error parsing " + source . toString ( ) + ":" + ex . toString ( ) ) ; includes = new String [ 0 ] ; } } for ( final String include : includes ) { if ( ! resolveInclude ( include , sourcePath , onIncludePath ) ) { if ( ! resolveInclude ( include , includePath , onIncludePath ) ) { if ( ! resolveInclude ( include , sysIncludePath , onSysIncludePath ) ) { if ( ! resolveInclude ( include , envIncludePath , onSysIncludePath ) ) { // // this should be enough to require us to reparse // the file with the missing include for dependency // information without forcing a rebuild sourceLastModified += 2 * CUtil . FILETIME_EPSILON ; } } } } } for ( int i = 0 ; i < onIncludePath . size ( ) ; i ++ ) { final String relativeInclude = CUtil . getRelativePath ( baseDirPath , ( File ) onIncludePath . elementAt ( i ) ) ; onIncludePath . setElementAt ( relativeInclude , i ) ; } for ( int i = 0 ; i < onSysIncludePath . size ( ) ; i ++ ) { final String relativeInclude = CUtil . getRelativePath ( baseDirPath , ( File ) onSysIncludePath . elementAt ( i ) ) ; onSysIncludePath . setElementAt ( relativeInclude , i ) ; } return new DependencyInfo ( includePathIdentifier , relativeSource , sourceLastModified , onIncludePath , onSysIncludePath ) ; }
Returns dependency info for the specified source file