8000 Library manager: dependency resolver (take 2) by cmaglie · Pull Request #8600 · arduino/Arduino · GitHub
[go: up one dir, main page]

Skip to content

Library manager: dependency resolver (take 2) #8600

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

Merged
merged 12 commits into from
Jul 18, 2019
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Lib installer: factored out method to perform lib installation
The new method will be used in next commits to handle installations
of multiple libraries.
This commit fix also minor bug in progress bar.
  • Loading branch information
cmaglie committed Jul 15, 2019
commit d7c1c872ef8bcda10ed07b9a6ce77e1789ceace1
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,31 @@ public synchronized void updateIndex(ProgressListener progressListener) throws E
}

public synchronized void install(ContributedLibrary lib, Optional<ContributedLibrary> mayReplacedLib, ProgressListener progressListener) throws Exception {
final MultiStepProgress progress = new MultiStepProgress(4);

// Do install library (3 steps)
performInstall(lib, mayReplacedLib, progressListener, progress);

// Rescan index (1 step)
rescanLibraryIndex(progress, progressListener);
}

private void performInstall(ContributedLibrary lib, Optional<ContributedLibrary> mayReplacedLib, ProgressListener progressListener, MultiStepProgress progress) throws Exception {
if (lib.isLibraryInstalled()) {
System.out.println(I18n.format(tr("Library is already installed: {0}:{1}"), lib.getName(), lib.getParsedVersion()));
return;
}

DownloadableContributionsDownloader downloader = new DownloadableContributionsDownloader(BaseNoGui.librariesIndexer.getStagingFolder());

final MultiStepProgress progress = new MultiStepProgress(3);

// Step 1: Download library
try {
downloader.download(lib, progress, I18n.format(tr("Downloading library: {0}"), lib.getName()), progressListener);
} catch (InterruptedException e) {
// Download interrupted... just exit
return;
}
progress.stepDone();

// TODO: Extract to temporary folders and move to the final destination only
// once everything is successfully unpacked. If the operation fails remove
Expand All @@ -129 5867 ,9 +138,6 @@ public synchronized void install(ContributedLibrary lib, Optional<ContributedLib
File destFolder = new File(libsFolder, lib.getName().replaceAll(" ", "_"));
tmpFolder.renameTo(destFolder);
progress.stepDone();

// Step 4: Rescan index
rescanLibraryIndex(progress, progressListener);
}

public synchronized void remove(ContributedLibrary lib, ProgressListener progressListener) throws IOException {
Expand Down
0