static public List<String> getLibraries(String path, Target target) {
    List<String> result = new ArrayList<String>();
    try {
      Sketch sketch = new Sketch(null, path);
      sketch.preprocess(Base.getBuildFolder().getAbsolutePath(), target);

      Vector<Library> libraries = new Vector<Library>();
      LibraryManager libraryManager = new LibraryManager();
      for (File file : sketch.getImportedLibraries()) {
        String item = file.getName();
        libraryManager.addLibrary(libraries, libraryManager.get(item), true);
      }

      String prefLibs = Preferences.get("boards." + Preferences.get("board") + ".build.libraries");
      if (prefLibs != null) {
        String[] boardLibraries = prefLibs.trim().split("\\s+");
        for (String item : boardLibraries) {
          libraryManager.addLibrary(libraries, libraryManager.get(item), true);
        }
      }

      for (Library library : libraries) {
        result.add(library.getName());
      }

    } catch (IOException e) {
      e.printStackTrace();
    } catch (RunnerException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return result;
  }