use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class CatalogIterableTest method testCreateFileLoader.
@Test
public void testCreateFileLoader() throws Exception {
initRemoteComponent("persist/data/truffleruby3.jar", "test://graalvm.io/download/truffleruby.zip", "testComponent", "test");
MetadataLoader ldr = param.createFileLoader();
ldr.setNoVerifySymlinks(false);
ldr.loadPaths();
ldr.loadPermissions();
ldr.loadSymlinks();
ComponentInfo meta = ldr.getComponentInfo();
assertEquals("ruby", meta.getId());
assertNull(meta.getInfoPath());
assertFalse(meta.getPaths().isEmpty());
assertEquals("TruffleRuby 0.33-dev", meta.getName());
assertEquals("0.33-dev", meta.getVersionString());
assertTrue(Handler.isVisited(url));
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class InstallCommand method printComponentList.
String printComponentList(Collection<ComponentInfo> requestors) {
if (requestors == null || requestors.isEmpty()) {
// NOI18N
return "";
}
StringBuilder sb = new StringBuilder();
List<ComponentInfo> infos = new ArrayList<>(requestors);
Collections.sort(infos, (c1, c2) -> c1.getId().compareTo(c2.getId()));
for (ComponentInfo i : infos) {
if (sb.length() > 0) {
sb.append(", ");
}
sb.append(feedback.l10n("INSTALL_RequiredDependencyItem", i.getName(), i.getId()));
}
return feedback.l10n("INSTALL_RequiredDependencySuffix", sb.toString());
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class InstallCommand method addDependencies.
void addDependencies(ComponentInfo ci) {
if (input.hasOption(Commands.OPTION_NO_DEPENDENCIES)) {
return;
}
// dependencies are scanned breadth-first; so the deeper dependencies are
// later in the iterator order. Installers from dependencies will be reversed
// in registerComponent
Set<ComponentInfo> deps = new LinkedHashSet<>();
LOG.log(Level.FINE, "Inspecting dependencies of {0}", ci);
Set<String> errors = input.getRegistry().findDependencies(ci, true, Boolean.FALSE, deps);
LOG.log(Level.FINE, "Direct dependencies: {0}, errors: {1}", new Object[] { deps, errors });
if (errors != null) {
unresolvedDependencies.addAll(errors);
for (String s : errors) {
dependencyMap.computeIfAbsent(s, (id) -> new HashSet<>()).add(ci);
}
}
for (ComponentInfo i : deps) {
// will be sorted later, when converting to Installers.
if (!knownDeps.add(i)) {
continue;
}
ComponentParam p = input.existingFiles().createParam(i.getId(), i);
dependencies.add(p);
dependencyMap.computeIfAbsent(i.getId(), (id) -> new HashSet<>()).add(ci);
}
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class InfoCommand method execute.
@Override
public int execute() throws IOException {
if (input.optValue(Commands.OPTION_HELP) != null) {
feedback.output("INFO_Help");
return 0;
}
if (!input.hasParameter()) {
feedback.error("INFO_MissingFilename", null);
return 1;
}
try {
collectComponents();
printTable = getComponents().size() > 1 && !isVerbose() && !suppressTable;
super.printComponents();
} finally {
for (ComponentParam c : components) {
try {
c.close();
} catch (IOException ex) {
ComponentInfo ci = c.createMetaLoader().getComponentInfo();
feedback.error("INFO_ClosingComponent", ex, ci == null ? c.getSpecification() : shortenComponentId(ci), ex.getLocalizedMessage());
}
}
}
return 0;
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class RemoteStorageTest method testLoadMetadata.
@Test
public void testLoadMetadata() throws Exception {
ComponentInfo rInfo = loadLastComponent("r");
assertEquals("FastR 0.33-dev", rInfo.getName());
assertEquals("R", rInfo.getId());
}
Aggregations