ArduinoBuilderRunner.java 文件源码

java
阅读 14 收藏 0 点赞 0 评论 0

项目:chipKIT-importer 作者:
private List<Path> findMainLibraryPaths() throws ScriptException, FileNotFoundException {
    LOGGER.info("Looking for main library paths");

    Path includesCachePath = Paths.get(preprocessDirPath.toAbsolutePath().toString(), "includes.cache");
    ScriptEngine scriptEngine = new ScriptEngineManager().getEngineByExtension("js");
    ScriptObjectMirror mirror = (ScriptObjectMirror) scriptEngine.eval(new FileReader(includesCachePath.toString()));
    List<Path> libraryPaths = new ArrayList<>();
    mirror.entrySet().forEach(e -> {
        if (e.getValue() instanceof ScriptObjectMirror) {
            ScriptObjectMirror m = (ScriptObjectMirror) e.getValue();
            Object sourceFile = m.get("Sourcefile");
            if (sourceFile != null && !sourceFile.toString().trim().isEmpty()) {
                String entry = m.get("Includepath").toString();
                if ( !entry.trim().isEmpty() ) {
                    LOGGER.log( Level.INFO, "Found library path: {0}", entry );
                    libraryPaths.add( Paths.get(entry) );
                }
            }
        }
    });
    return libraryPaths;
}
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号