public static void parse ( CxxConfiguration config , File compileCommandsFile ) throws IOException { LOG . debug ( "Parsing 'JSON Compilation Database' format" ) ; ObjectMapper mapper = new ObjectMapper ( ) ; mapper . disable ( DeserializationFeature . FAIL_ON_UNKNOWN_PROPERTIES ) ; mapper . enable ( DeserializationFeature . USE_JAVA_ARRAY_FOR_JSON_ARRAY ) ; JsonCompilationDatabaseCommandObject [ ] commandObjects = mapper . readValue ( compileCommandsFile , JsonCompilationDatabaseCommandObject [ ] . class ) ; for ( JsonCompilationDatabaseCommandObject commandObject : commandObjects ) { Path cwd = Paths . get ( "." ) ; if ( commandObject . getDirectory ( ) != null ) { cwd = Paths . get ( commandObject . getDirectory ( ) ) ; } Path absPath = cwd . resolve ( commandObject . getFile ( ) ) ; if ( "__global__" . equals ( commandObject . getFile ( ) ) ) { CxxCompilationUnitSettings globalSettings = new CxxCompilationUnitSettings ( ) ; parseCommandObject ( globalSettings , commandObject ) ; config . setGlobalCompilationUnitSettings ( globalSettings ) ; } else { CxxCompilationUnitSettings settings = new CxxCompilationUnitSettings ( ) ; parseCommandObject ( settings , commandObject ) ; config . addCompilationUnitSettings ( absPath . toAbsolutePath ( ) . normalize ( ) . toString ( ) , settings ) ; } } }
Set up the given CxxConfiguration from the JSON compilation database