Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix double libraries rescan. #10270

Merged
merged 1 commit into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions app/test/cc/arduino/contributions/UpdatableLibraryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public void testUpdatableLibrary() throws Exception {
LibrariesIndexer indexer = new LibrariesIndexer(index_SD_only);
BaseNoGui.librariesIndexer = indexer;
indexer.parseIndex();
indexer.setLibrariesFolders(folders);
indexer.rescanLibraries();
indexer.setLibrariesFoldersAndRescan(folders);

ContributedLibrary sdLib = indexer.getIndex().getInstalled("SD").get();
assertTrue("SD lib is installed", sdLib.isLibraryInstalled());
Expand All @@ -46,7 +45,7 @@ public void testUpdatableLibrary() throws Exception {
assertTrue(ContributionsSelfCheck.checkForUpdatableLibraries());

folders.add(new UserLibraryFolder(SD121, Location.SKETCHBOOK));
indexer.setLibrariesFolders(folders);
indexer.setLibrariesFoldersAndRescan(folders);

sdLib = indexer.getIndex().getInstalled("SD").get();
assertTrue("SD lib is installed", sdLib.isLibraryInstalled());
Expand All @@ -63,8 +62,7 @@ public void testUpdatableLibraryWithBundled() throws Exception {
LibrariesIndexer indexer = new LibrariesIndexer(index_Bridge_only);
BaseNoGui.librariesIndexer = indexer;
indexer.parseIndex();
indexer.setLibrariesFolders(folders);
indexer.rescanLibraries();
indexer.setLibrariesFoldersAndRescan(folders);

ContributedLibrary l = indexer.getIndex().getInstalled("Bridge").get();
assertTrue("Bridge lib is installed", l.isLibraryInstalled());
Expand All @@ -73,7 +71,7 @@ public void testUpdatableLibraryWithBundled() throws Exception {
assertTrue(ContributionsSelfCheck.checkForUpdatableLibraries());

folders.add(new UserLibraryFolder(Bridge170, Location.SKETCHBOOK));
indexer.setLibrariesFolders(folders);
indexer.setLibrariesFoldersAndRescan(folders);

l = indexer.getIndex().getInstalled("Bridge").get();
assertTrue("Bridge lib is installed", l.isLibraryInstalled());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ private void parseIndex(File file) throws IOException {
}

public void setLibrariesFolders(List<UserLibraryFolder> folders) {
librariesFolders = folders;
this.librariesFolders = folders;
}

public void setLibrariesFoldersAndRescan(List<UserLibraryFolder> folders) {
setLibrariesFolders(folders);
rescanLibraries();
}

Expand Down