Skip to content

Commit e731fe0

Browse files
committed
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.
1 parent d8470e5 commit e731fe0

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

arduino-core/src/cc/arduino/contributions/packages/ContributionInstaller.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,15 @@ public synchronized List<String> install(ContributedPlatform contributedPlatform
7979
}
8080

8181
// Do not download already installed tools
82-
List<ContributedTool> tools = new LinkedList<>(contributedPlatform.getResolvedTools());
83-
Iterator<ContributedTool> toolsIterator = tools.iterator();
84-
while (toolsIterator.hasNext()) {
85-
ContributedTool tool = toolsIterator.next();
82+
List<ContributedTool> tools = new ArrayList<>();
83+
for (ContributedTool tool : contributedPlatform.getResolvedTools()) {
8684
DownloadableContribution downloadable = tool.getDownloadableContribution(platform);
8785
if (downloadable == null) {
8886
throw new Exception(format(tr("Tool {0} is not available for your operating system."), tool.getName()));
8987
}
90-
if (downloadable.isInstalled()) {
91-
toolsIterator.remove();
88+
// Download the tool if it's not installed or it's a built-in tool
89+
if (!downloadable.isInstalled() || downloadable.isReadOnly()) {
90+
tools.add(tool);
9291
}
9392
}
9493

@@ -125,10 +124,10 @@ public synchronized List<String> install(ContributedPlatform contributedPlatform
125124

126125
List<Map.Entry<ContributedToolReference, ContributedTool>> resolvedToolReferences = contributedPlatform.getResolvedToolReferences().entrySet()
127126
.stream()
128-
.filter((entry) -> !entry.getValue().getDownloadableContribution(platform).isInstalled())
127+
.filter((entry) -> !entry.getValue().getDownloadableContribution(platform).isInstalled()
128+
|| entry.getValue().getDownloadableContribution(platform).isReadOnly())
129129
.collect(Collectors.toList());
130130

131-
132131
int i = 1;
133132
for (Map.Entry<ContributedToolReference, ContributedTool> entry : resolvedToolReferences) {
134133
progress.setStatus(format(tr("Installing tools ({0}/{1})..."), i, resolvedToolReferences.size()));

arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ public boolean isContributedToolUsed(ContributedPlatform platformToIgnore, Contr
374374
if (platformToIgnore.equals(platform)) {
375375
continue;
376376
}
377-
if (!platform.isInstalled()) {
377+
if (!platform.isInstalled() || platform.isReadOnly()) {
378378
continue;
379379
}
380380
for (ContributedTool requiredTool : platform.getResolvedTools()) {

0 commit comments

Comments
 (0)