Skip to content

Detecting libraries and examples implementation #3

@tngyn

Description

@tngyn

We suspect that the Arduino IDE finds all the libraries and examples within a sketchbook using Base.java:rebuildExamplesMenu(). Using this code directly leads to dependency issues when trying to isolate the code.

The detection of the examples starts in Base.java’s rebuildExamplesMenu(JMenu menu) method, which calls the Base.java getIDELibs method which has a dependency on the LibrariesIndexer file. The LibrariesIndexer has a lot of dependencies on other Arduino files itself. More specifically, we need the entire class and its instance variables to use a couple of methods to set things up. The LIbrariesIndexer needs to return the installedLibraries variable to Base.java’s getIDELibs() method. To do that, LibrariesIndexer needs to call these functions which have dependencies to files listed between square brackets [].

From within LibrariesIndexer.java setLibrariesFolders -> rescanLibraries -> scanInstalledLibraries [BaseNoGui call, OnlyDirs] -> scanLibrary [FileUtils, LegacyUserLibrary, UserLibrary, ContributedLibrary]

Furthermore, there are a lot of things going on in BaseNoGui.java that are needed to detect the correct libraries and examples.

As a result, our current implementation tries to find and parse the "libraries" and "examples" folders by looking for a top level "libraries" folder and then finding all the correct sketches using getSketches(), which is the original function we used to detect sketches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions