mirror of https://github.com/noisymime/Arduino.git
Installing tools from packager (eg: arduino) in packager folder, thus avoiding
tools duplication and disk space wasting. Fixes #4193
This commit is contained in:
parent
a1e223ad62
commit
d5a0476948
|
@ -21,10 +21,10 @@
|
||||||
<classpathentry kind="lib" path="app/lib/jssc-2.8.0.jar"/>
|
<classpathentry kind="lib" path="app/lib/jssc-2.8.0.jar"/>
|
||||||
<classpathentry kind="lib" path="app/lib/bcpg-jdk15on-152.jar"/>
|
<classpathentry kind="lib" path="app/lib/bcpg-jdk15on-152.jar"/>
|
||||||
<classpathentry kind="lib" path="app/lib/bcprov-jdk15on-152.jar"/>
|
<classpathentry kind="lib" path="app/lib/bcprov-jdk15on-152.jar"/>
|
||||||
<classpathentry kind="lib" path="app/lib/jackson-core-2.2.3.jar"/>
|
<classpathentry kind="lib" path="app/lib/jackson-core-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="app/lib/jackson-databind-2.2.3.jar"/>
|
<classpathentry kind="lib" path="app/lib/jackson-databind-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="app/lib/jackson-module-mrbean-2.2.3.jar"/>
|
<classpathentry kind="lib" path="app/lib/jackson-module-mrbean-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="app/lib/jackson-annotations-2.2.3.jar"/>
|
<classpathentry kind="lib" path="app/lib/jackson-annotations-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="app/lib/commons-compress-1.8.jar"/>
|
<classpathentry kind="lib" path="app/lib/commons-compress-1.8.jar"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/arduino-core"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/arduino-core"/>
|
||||||
<classpathentry kind="output" path="app/bin"/>
|
<classpathentry kind="output" path="app/bin"/>
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
<classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
|
<classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/commons-logging-1.0.4.jar"/>
|
<classpathentry kind="lib" path="lib/commons-logging-1.0.4.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/commons-net-3.3.jar"/>
|
<classpathentry kind="lib" path="lib/commons-net-3.3.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jackson-annotations-2.2.3.jar"/>
|
<classpathentry kind="lib" path="lib/jackson-annotations-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jackson-core-2.2.3.jar"/>
|
<classpathentry kind="lib" path="lib/jackson-core-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jackson-databind-2.2.3.jar"/>
|
<classpathentry kind="lib" path="lib/jackson-databind-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jackson-module-mrbean-2.2.3.jar"/>
|
<classpathentry kind="lib" path="lib/jackson-module-mrbean-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jmdns-3.4.1.jar"/>
|
<classpathentry kind="lib" path="lib/jmdns-3.4.1.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jsch-0.1.50.jar"/>
|
<classpathentry kind="lib" path="lib/jsch-0.1.50.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jssc-2.8.0.jar"/>
|
<classpathentry kind="lib" path="lib/jssc-2.8.0.jar"/>
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -13,10 +13,10 @@
|
||||||
<classpathentry kind="lib" path="../app/lib/commons-compress-1.8.jar"/>
|
<classpathentry kind="lib" path="../app/lib/commons-compress-1.8.jar"/>
|
||||||
<classpathentry kind="lib" path="../app/lib/commons-exec-1.1.jar"/>
|
<classpathentry kind="lib" path="../app/lib/commons-exec-1.1.jar"/>
|
||||||
<classpathentry kind="lib" path="../app/lib/commons-httpclient-3.1.jar"/>
|
<classpathentry kind="lib" path="../app/lib/commons-httpclient-3.1.jar"/>
|
||||||
<classpathentry kind="lib" path="../app/lib/jackson-annotations-2.2.3.jar"/>
|
<classpathentry kind="lib" path="../app/lib/jackson-annotations-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="../app/lib/jackson-core-2.2.3.jar"/>
|
<classpathentry kind="lib" path="../app/lib/jackson-core-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="../app/lib/jackson-databind-2.2.3.jar"/>
|
<classpathentry kind="lib" path="../app/lib/jackson-databind-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="../app/lib/jackson-module-mrbean-2.2.3.jar"/>
|
<classpathentry kind="lib" path="../app/lib/jackson-module-mrbean-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="../app/lib/bcpg-jdk15on-152.jar"/>
|
<classpathentry kind="lib" path="../app/lib/bcpg-jdk15on-152.jar"/>
|
||||||
<classpathentry kind="lib" path="../app/lib/bcprov-jdk15on-152.jar"/>
|
<classpathentry kind="lib" path="../app/lib/bcprov-jdk15on-152.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/bcpg-jdk15on-152.jar"/>
|
<classpathentry kind="lib" path="lib/bcpg-jdk15on-152.jar"/>
|
||||||
|
@ -24,10 +24,10 @@
|
||||||
<classpathentry kind="lib" path="lib/commons-codec-1.7.jar"/>
|
<classpathentry kind="lib" path="lib/commons-codec-1.7.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/commons-compress-1.8.jar"/>
|
<classpathentry kind="lib" path="lib/commons-compress-1.8.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/commons-lang3-3.3.2.jar"/>
|
<classpathentry kind="lib" path="lib/commons-lang3-3.3.2.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jackson-annotations-2.2.3.jar"/>
|
<classpathentry kind="lib" path="lib/jackson-annotations-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jackson-core-2.2.3.jar"/>
|
<classpathentry kind="lib" path="lib/jackson-core-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jackson-databind-2.2.3.jar"/>
|
<classpathentry kind="lib" path="lib/jackson-databind-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jackson-module-mrbean-2.2.3.jar"/>
|
<classpathentry kind="lib" path="lib/jackson-module-mrbean-2.6.3.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/java-semver-0.8.0.jar"/>
|
<classpathentry kind="lib" path="lib/java-semver-0.8.0.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jna-4.1.0.jar"/>
|
<classpathentry kind="lib" path="lib/jna-4.1.0.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jna-platform-4.1.0.jar"/>
|
<classpathentry kind="lib" path="lib/jna-platform-4.1.0.jar"/>
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -30,11 +30,9 @@
|
||||||
package cc.arduino.contributions.packages;
|
package cc.arduino.contributions.packages;
|
||||||
|
|
||||||
import cc.arduino.contributions.DownloadableContribution;
|
import cc.arduino.contributions.DownloadableContribution;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class ContributedPlatform extends DownloadableContribution {
|
public abstract class ContributedPlatform extends DownloadableContribution {
|
||||||
|
|
||||||
|
@ -54,18 +52,21 @@ public abstract class ContributedPlatform extends DownloadableContribution {
|
||||||
|
|
||||||
public abstract ContributedHelp getHelp();
|
public abstract ContributedHelp getHelp();
|
||||||
|
|
||||||
private List<ContributedTool> resolvedTools;
|
private Map<ContributedToolReference, ContributedTool> resolvedToolReferences;
|
||||||
|
|
||||||
private ContributedPackage parentPackage;
|
private ContributedPackage parentPackage;
|
||||||
|
|
||||||
public List<ContributedTool> getResolvedTools() {
|
public List<ContributedTool> getResolvedTools() {
|
||||||
if (resolvedTools == null) {
|
return new LinkedList<>(resolvedToolReferences.values());
|
||||||
return null;
|
}
|
||||||
}
|
|
||||||
return new LinkedList<>(resolvedTools);
|
@JsonIgnore
|
||||||
|
public Map<ContributedToolReference, ContributedTool> getResolvedToolReferences() {
|
||||||
|
return resolvedToolReferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resolveToolsDependencies(Collection<ContributedPackage> packages) {
|
public void resolveToolsDependencies(Collection<ContributedPackage> packages) {
|
||||||
resolvedTools = new ArrayList<>();
|
resolvedToolReferences = new HashMap<>();
|
||||||
|
|
||||||
// If there are no dependencies return empty list
|
// If there are no dependencies return empty list
|
||||||
if (getToolsDependencies() == null) {
|
if (getToolsDependencies() == null) {
|
||||||
|
@ -79,7 +80,7 @@ public abstract class ContributedPlatform extends DownloadableContribution {
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
System.err.println("Index error: could not find referenced tool " + dep);
|
System.err.println("Index error: could not find referenced tool " + dep);
|
||||||
} else {
|
} else {
|
||||||
resolvedTools.add(tool);
|
resolvedToolReferences.put(dep, tool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,8 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -122,26 +124,31 @@ public class ContributionInstaller {
|
||||||
// once everything is successfully unpacked. If the operation fails remove
|
// once everything is successfully unpacked. If the operation fails remove
|
||||||
// all the temporary folders and abort installation.
|
// all the temporary folders and abort installation.
|
||||||
|
|
||||||
// Unzip tools on the correct location
|
List<Map.Entry<ContributedToolReference, ContributedTool>> resolvedToolReferences = contributedPlatform.getResolvedToolReferences().entrySet()
|
||||||
File toolsFolder = new File(packageFolder, "tools");
|
.stream()
|
||||||
|
.filter((entry) -> !entry.getValue().getDownloadableContribution(platform).isInstalled())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
for (ContributedTool tool : tools) {
|
for (Map.Entry<ContributedToolReference, ContributedTool> entry : resolvedToolReferences) {
|
||||||
progress.setStatus(format(tr("Installing tools ({0}/{1})..."), i, tools.size()));
|
progress.setStatus(format(tr("Installing tools ({0}/{1})..."), i, resolvedToolReferences.size()));
|
||||||
progressListener.onProgress(progress);
|
progressListener.onProgress(progress);
|
||||||
i++;
|
i++;
|
||||||
|
ContributedTool tool = entry.getValue();
|
||||||
DownloadableContribution toolContrib = tool.getDownloadableContribution(platform);
|
DownloadableContribution toolContrib = tool.getDownloadableContribution(platform);
|
||||||
File destFolder = new File(toolsFolder, tool.getName() + File.separator + tool.getVersion());
|
Path destFolder = Paths.get(indexer.getPackagesFolder().getAbsolutePath(), entry.getKey().getPackager(), "tools", tool.getName(), tool.getVersion());
|
||||||
|
|
||||||
Files.createDirectories(destFolder.toPath());
|
Files.createDirectories(destFolder);
|
||||||
assert toolContrib.getDownloadedFile() != null;
|
assert toolContrib.getDownloadedFile() != null;
|
||||||
new ArchiveExtractor(platform).extract(toolContrib.getDownloadedFile(), destFolder, 1);
|
new ArchiveExtractor(platform).extract(toolContrib.getDownloadedFile(), destFolder.toFile(), 1);
|
||||||
try {
|
try {
|
||||||
findAndExecutePostInstallScriptIfAny(destFolder, contributedPlatform.getParentPackage().isTrusted(), PreferencesData.getBoolean(Constants.PREF_CONTRIBUTIONS_TRUST_ALL));
|
findAndExecutePostInstallScriptIfAny(destFolder.toFile(), contributedPlatform.getParentPackage().isTrusted(), PreferencesData.getBoolean(Constants.PREF_CONTRIBUTIONS_TRUST_ALL));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
errors.add(tr("Error running post install script"));
|
errors.add(tr("Error running post install script"));
|
||||||
}
|
}
|
||||||
toolContrib.setInstalled(true);
|
toolContrib.setInstalled(true);
|
||||||
toolContrib.setInstalledFolder(destFolder);
|
toolContrib.setInstalledFolder(destFolder.toFile());
|
||||||
progress.stepDone();
|
progress.stepDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,9 @@ public class ContributionsIndexer {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ContributedPackage> packages = index.getPackages();
|
List<ContributedPackage> packages = index.getPackages();
|
||||||
Collection<ContributedPackage> packagesWithTools = packages.stream().filter(input -> input.getTools() != null).collect(Collectors.toList());
|
Collection<ContributedPackage> packagesWithTools = packages.stream()
|
||||||
|
.filter(input -> input.getTools() != null && !input.getTools().isEmpty())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
for (ContributedPackage pack : packages) {
|
for (ContributedPackage pack : packages) {
|
||||||
for (ContributedPlatform platform : pack.getPlatforms()) {
|
for (ContributedPlatform platform : pack.getPlatforms()) {
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
<cp>%EXEDIR%/lib/commons-logging-1.0.4.jar</cp>
|
<cp>%EXEDIR%/lib/commons-logging-1.0.4.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/commons-net-3.3.jar</cp>
|
<cp>%EXEDIR%/lib/commons-net-3.3.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/ecj.jar</cp>
|
<cp>%EXEDIR%/lib/ecj.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/jackson-annotations-2.2.3.jar</cp>
|
<cp>%EXEDIR%/lib/jackson-annotations-2.6.3.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/jackson-core-2.2.3.jar</cp>
|
<cp>%EXEDIR%/lib/jackson-core-2.6.3.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/jackson-databind-2.2.3.jar</cp>
|
<cp>%EXEDIR%/lib/jackson-databind-2.6.3.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/jackson-module-mrbean-2.2.3.jar</cp>
|
<cp>%EXEDIR%/lib/jackson-module-mrbean-2.6.3.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/java-semver-0.8.0.jar</cp>
|
<cp>%EXEDIR%/lib/java-semver-0.8.0.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/jmdns-3.4.1.jar</cp>
|
<cp>%EXEDIR%/lib/jmdns-3.4.1.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/jna-4.1.0.jar</cp>
|
<cp>%EXEDIR%/lib/jna-4.1.0.jar</cp>
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
<cp>%EXEDIR%/lib/commons-logging-1.0.4.jar</cp>
|
<cp>%EXEDIR%/lib/commons-logging-1.0.4.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/commons-net-3.3.jar</cp>
|
<cp>%EXEDIR%/lib/commons-net-3.3.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/ecj.jar</cp>
|
<cp>%EXEDIR%/lib/ecj.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/jackson-annotations-2.2.3.jar</cp>
|
<cp>%EXEDIR%/lib/jackson-annotations-2.6.3.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/jackson-core-2.2.3.jar</cp>
|
<cp>%EXEDIR%/lib/jackson-core-2.6.3.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/jackson-databind-2.2.3.jar</cp>
|
<cp>%EXEDIR%/lib/jackson-databind-2.6.3.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/jackson-module-mrbean-2.2.3.jar</cp>
|
<cp>%EXEDIR%/lib/jackson-module-mrbean-2.6.3.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/java-semver-0.8.0.jar</cp>
|
<cp>%EXEDIR%/lib/java-semver-0.8.0.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/jmdns-3.4.1.jar</cp>
|
<cp>%EXEDIR%/lib/jmdns-3.4.1.jar</cp>
|
||||||
<cp>%EXEDIR%/lib/jna-4.1.0.jar</cp>
|
<cp>%EXEDIR%/lib/jna-4.1.0.jar</cp>
|
||||||
|
|
Loading…
Reference in New Issue