1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-13 10:29:35 +01:00

Boards Manager now install tools even if they are available in the IDE bundle

Previously if a 3rd party core would require a tool already bundled
in the IDE then boards manager skipped the installation of that tool.
This is could lead to missing tools if the IDE is upgraded and the
bundled tools may change.

This patch fixes the bug by always installing tools when needed, even
if they are already bundled.
This commit is contained in:
Cristian Maglie 2016-08-11 15:11:30 +02:00
parent d8470e59f4
commit e731fe026f
2 changed files with 8 additions and 9 deletions

View File

@ -79,16 +79,15 @@ public class ContributionInstaller {
}
// Do not download already installed tools
List<ContributedTool> tools = new LinkedList<>(contributedPlatform.getResolvedTools());
Iterator<ContributedTool> toolsIterator = tools.iterator();
while (toolsIterator.hasNext()) {
ContributedTool tool = toolsIterator.next();
List<ContributedTool> tools = new ArrayList<>();
for (ContributedTool tool : contributedPlatform.getResolvedTools()) {
DownloadableContribution downloadable = tool.getDownloadableContribution(platform);
if (downloadable == null) {
throw new Exception(format(tr("Tool {0} is not available for your operating system."), tool.getName()));
}
if (downloadable.isInstalled()) {
toolsIterator.remove();
// Download the tool if it's not installed or it's a built-in tool
if (!downloadable.isInstalled() || downloadable.isReadOnly()) {
tools.add(tool);
}
}
@ -125,10 +124,10 @@ public class ContributionInstaller {
List<Map.Entry<ContributedToolReference, ContributedTool>> resolvedToolReferences = contributedPlatform.getResolvedToolReferences().entrySet()
.stream()
.filter((entry) -> !entry.getValue().getDownloadableContribution(platform).isInstalled())
.filter((entry) -> !entry.getValue().getDownloadableContribution(platform).isInstalled()
|| entry.getValue().getDownloadableContribution(platform).isReadOnly())
.collect(Collectors.toList());
int i = 1;
for (Map.Entry<ContributedToolReference, ContributedTool> entry : resolvedToolReferences) {
progress.setStatus(format(tr("Installing tools ({0}/{1})..."), i, resolvedToolReferences.size()));

View File

@ -374,7 +374,7 @@ public class ContributionsIndexer {
if (platformToIgnore.equals(platform)) {
continue;
}
if (!platform.isInstalled()) {
if (!platform.isInstalled() || platform.isReadOnly()) {
continue;
}
for (ContributedTool requiredTool : platform.getResolvedTools()) {