8000 Removed, no more needed, LibraryInstaller::updateIndex method · arduino-collections/Arduino-1@401fe65 · GitHub
[go: up one dir, main page]

Skip to content

Commit 401fe65

Browse files
committed
Removed, no more needed, LibraryInstaller::updateIndex method
1 parent 0056cbc commit 401fe65

File tree

3 files changed

+8
-52
lines changed

3 files changed

+8
-52
lines changed

app/src/cc/arduino/contributions/ContributionsSelfCheck.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
package cc.arduino.contributions;
3131

3232
import cc.arduino.UpdatableBoardsLibsFakeURLsHandler;
33-
import cc.arduino.contributions.libraries.LibraryInstaller;
33+
import cc.arduino.cli.ArduinoCoreInstance;
3434
import cc.arduino.contributions.libraries.filters.UpdatableLibraryPredicate;
3535
import cc.arduino.contributions.packages.ContributionInstaller;
3636
import cc.arduino.contributions.packages.filters.UpdatablePlatformPredicate;
@@ -53,19 +53,19 @@ public class ContributionsSelfCheck extends TimerTask implements NotificationPop
5353
private final Base base;
5454
private final HyperlinkListener hyperlinkListener;
5555
private final ContributionInstaller contributionInstaller;
56-
private final LibraryInstaller libraryInstaller;
56+
private final ArduinoCoreInstance core;
5757
private final ProgressListener progressListener;
5858
private final String boardsManagerURL = "http://boardsmanager/DropdownUpdatableCoresItem";
5959
private final String libraryManagerURL = "http://librarymanager/DropdownUpdatableLibrariesItem";
6060

6161
private volatile boolean cancelled;
6262
private volatile NotificationPopup notificationPopup;
6363

64-
public ContributionsSelfCheck(Base base, HyperlinkListener hyperlinkListener, ContributionInstaller contributionInstaller, LibraryInstaller libraryInstaller) {
64+
public ContributionsSelfCheck(Base base, HyperlinkListener hyperlinkListener, ContributionInstaller contributionInstaller, ArduinoCoreInstance core) {
6565
this.base = base;
6666
this.hyperlinkListener = hyperlinkListener;
6767
this.contributionInstaller = contributionInstaller;
68-
this.libraryInstaller = libraryInstaller;
68+
this.core = core;
6969
this.progressListener = new NoopProgressListener();
7070
this.cancelled = false;
7171
}
@@ -176,13 +176,13 @@ public void onOptionalButton2Callback() {
176176
goToManager(libraryManagerURL);
177177
}
178178

179-
static boolean checkForUpdatablePlatforms() {
179+
boolean checkForUpdatablePlatforms() {
180180
return BaseNoGui.indexer.getPackages().stream()
181181
.flatMap(pack -> pack.getPlatforms().stream())
182182
.anyMatch(new UpdatablePlatformPredicate());
183183
}
184184

185-
static boolean checkForUpdatableLibraries() {
185+
boolean checkForUpdatableLibraries() {
186186
return BaseNoGui.librariesIndexer.getIndex().getLibraries().stream()
187187
.anyMatch(new UpdatableLibraryPredicate());
188188
}
@@ -201,7 +201,7 @@ private void updateLibrariesIndex() {
201201
return;
202202
}
203203
try {
204-
libraryInstaller.updateIndex(progressListener);
204+
core.updateLibrariesIndex(progressListener);
205205
} catch (Exception e) {
206206
// ignore
207207
}

app/src/processing/app/Base.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ public Base(String[] args) throws Exception {
509509
if (PreferencesData.getBoolean("update.check")) {
510510
new UpdateCheck(this);
511511

512-
contributionsSelfCheck = new ContributionsSelfCheck(this, new UpdatableBoardsLibsFakeURLsHandler(this), contributionInstaller, libraryInstaller);
512+
contributionsSelfCheck = new ContributionsSelfCheck(this, new UpdatableBoardsLibsFakeURLsHandler(this), contributionInstaller, BaseNoGui.getArduinoCoreService());
513513
new Timer(false).schedule(contributionsSelfCheck, Constants.BOARDS_LIBS_UPDATABLE_CHECK_START_PERIOD);
514514
}
515515

arduino-core/src/cc/arduino/contributions/libraries/LibraryInstaller.java

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -65,50 +65,6 @@ public LibraryInstaller(Platform platform) {
6565
this.platform = platform;
6666
}
6767

68-
public synchronized void updateIndex(ProgressListener progressListener) throws Exception {
69-
/*
70-
final MultiStepProgress progress = new MultiStepProgress(3);
71-
DownloadableContributionsDownloader downloader = new DownloadableContributionsDownloader(BaseNoGui.librariesIndexer.getStagingFolder());
72-
// Step 1: Download index
73-
File outputFile = BaseNoGui.librariesIndexer.getIndexFile();
74-
// Create temp files
75-
String signatureFileName = FilenameUtils.getName(new URL(Constants.LIBRARY_INDEX_URL).getPath());
76-
File libraryIndexTemp = File.createTempFile(signatureFileName, ".tmp");
77-
final URL libraryURL = new URL(Constants.LIBRARY_INDEX_URL);
78-
final URL libraryGzURL = new URL(Constants.LIBRARY_INDEX_URL_GZ);
79-
final String statusText = tr("Downloading libraries index...");
80-
try {
81-
GZippedJsonDownloader gZippedJsonDownloader = new GZippedJsonDownloader(downloader, libraryURL, libraryGzURL);
82-
gZippedJsonDownloader.download(libraryIndexTemp, progress, statusText, progressListener, true);
83-
} catch (InterruptedException e) {
84-
// Download interrupted... just exit
85-
return;
86-
}
87-
progress.stepDone();
88-
89-
URL signatureUrl = new URL(libraryURL.toString() + ".sig");
90-
if (downloader.verifyDomain(signatureUrl)) {
91-
if (downloader.checkSignature(progress, signatureUrl, progressListener, signatureVerifier, statusText, libraryIndexTemp)) {
92-
// Replace old index with the updated one
93-
if (libraryIndexTemp.length() > 0) {
94-
Files.move(libraryIndexTemp.toPath(), outputFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
95-
}
96-
} else {
97-
FileDownloader.invalidateFiles(libraryGzURL, libraryURL, signatureUrl);
98-
log.error("Fail to verify the signature of {} the cached files have been removed", libraryURL);
99-
}
100-
} else {
101-
log.info("The domain is not selected to verify the signature. library index: {}", signatureUrl);
102-
}
103-
104-
// Step 2: Parse index
105-
BaseNoGui.librariesIndexer.regenerateIndex();
106-
107-
// Step 3: Rescan index
108-
rescanLibraryIndex(progress, progressListener);
109-
*/
110-
}
111-
11268
public void install(ContributedLibraryRelease lib, ProgressListener progressListener) throws Exception {
11369
ArrayList<ContributedLibraryRelease> libs = new ArrayList<>();
11470
libs.add(lib);

0 commit comments

Comments
 (0)
0