use of org.graalvm.component.installer.ComponentParam in project graal by oracle.
the class UpgradeTest method testInstallNewWithoutCoreUpgrade.
/**
* Upgrade command is used to install a new component, but the core is most recent one and need
* not to be upgraded. Component must go to the existing install.
*
* @throws Exception
*/
@Test
public void testInstallNewWithoutCoreUpgrade() throws Exception {
initVersion("1.0.1.0");
textParams.add("ruby");
UpgradeCommand cmd = new UpgradeCommand();
cmd.init(this, this);
helper = cmd.getProcess();
ComponentInfo info = cmd.configureProcess();
assertNotNull(info);
// will not install core
assertFalse(helper.installGraalCore(info));
assertNull(helper.getTargetInfo());
// found the current graalvm:
assertEquals(getLocalRegistry().getGraalVersion(), info.getVersion());
List<ComponentParam> toDownload = helper.allComponents();
// no component (e.g. migration) was added, requested ruby is in there
assertEquals(1, toDownload.size());
assertEquals("org.graalvm.ruby", toDownload.get(0).getShortName());
}
use of org.graalvm.component.installer.ComponentParam in project graal by oracle.
the class UpgradeTest method testUpgradeFromDevToSpecificVersion2.
/**
* Checks that upgrade will install graal for the specific Component.
*/
@Test
public void testUpgradeFromDevToSpecificVersion2() throws Exception {
initVersion("1.0.0-dev");
textParams.add("python=1.0.1");
UpgradeCommand cmd = new UpgradeCommand();
cmd.init(this, this);
ComponentInfo graalInfo = cmd.configureProcess();
assertNotNull(graalInfo);
// check that GraalVM appropriate for 1.0.1 component is selected
assertEquals("1.0.1.0", graalInfo.getVersion().toString());
assertEquals(1, cmd.getProcess().addedComponents().size());
ComponentParam p = cmd.getProcess().addedComponents().iterator().next();
ComponentInfo ci = p.createMetaLoader().getComponentInfo();
// check that component 1.0.1 will be installed
assertEquals("1.0.1.0", ci.getVersion().toString());
}
use of org.graalvm.component.installer.ComponentParam 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.ComponentParam 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.ComponentParam in project graal by oracle.
the class InstallCommand method completeInstallers0.
void completeInstallers0(List<ComponentParam> in) throws IOException {
// now fileName real installers for parameters which were omitted
for (ComponentParam p : in) {
Installer i = realInstallers.get(p);
if (i == null) {
MetadataLoader floader = p.createFileLoader();
ComponentInfo initialInfo = parameterInfos.get(p);
ComponentInfo finfo = floader.getComponentInfo();
if (initialInfo != null && (!initialInfo.getId().equals(finfo.getId()) || !initialInfo.getVersion().equals(finfo.getVersion()))) {
String msg = String.format(feedback.l10n("@INSTALL_Error_ComponentDiffers_Report"), initialInfo.getId(), finfo.getId(), initialInfo.getVersionString(), finfo.getVersionString());
feedback.verbatimPart(msg, true, false);
throw feedback.failure("INSTALL_Error_ComponentDiffers", null);
}
i = createInstaller(p, floader);
if (!verifyInstaller(i)) {
continue;
}
addLicenseToAccept(i, floader);
registerComponent(i, p);
if (validateBeforeInstall) {
current = i.getComponentInfo().getName();
i.validateAll();
} else {
if (!force) {
i.validateRequirements();
}
}
realInstallers.put(p, i);
}
}
}
Aggregations