Search in sources :

Example 1 with GraalEditionList

use of org.graalvm.component.installer.remote.GraalEditionList in project graal by oracle.

the class InstallFromGdsTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    storage.graalInfo.put(CommonConstants.CAP_GRAALVM_VERSION, "20.3.0");
    Handler.bind("test://acme.org/GRAALVM_EE_JAVA8_20.3.0/license.txt", dataFile("data/license.txt").toUri().toURL());
    gdsDownloadFolder = dataFile("data");
    gdsCatalogPath = gdsDownloadFolder.resolve("insttest.json");
    gdsUrl = "{ee}gds:" + gdsCatalogPath.toUri().toURL().toString();
    catalogStorage.graalInfo.put(CommonConstants.RELEASE_CATALOG_KEY, gdsUrl);
    iterableInstance = new CatalogIterable(this, this);
    gl = new GraalEditionList(this, this, getLocalRegistry());
    gl.setDefaultCatalogSpec(gdsUrl);
    gl.setDefaultEdition(gl.getEdition("ee"));
}
Also used : GraalEditionList(org.graalvm.component.installer.remote.GraalEditionList) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable) Before(org.junit.Before)

Example 2 with GraalEditionList

use of org.graalvm.component.installer.remote.GraalEditionList in project graal by oracle.

the class ComponentInstaller method processOptions.

int processOptions(LinkedList<String> cmdline) {
    if (cmdline.size() < 1) {
        env = SIMPLE_ENV;
        printDefaultHelp(OptionCategory.USER);
        return 1;
    }
    SimpleGetopt go = createOptions(cmdline);
    launch(cmdline);
    go = interpretOptions(go);
    if (go == null) {
        return 0;
    }
    if (env.hasOption(Commands.OPTION_PRINT_VERSION)) {
        printVersion();
        return 0;
    } else if (env.hasOption(Commands.OPTION_SHOW_VERSION)) {
        printVersion();
    }
    // check only after the version option:
    if (cmdHandler == null) {
        // NOI18N
        error("ERROR_MissingCommand");
    }
    int srcCount = 0;
    if (input.hasOption(Commands.OPTION_FILES)) {
        srcCount++;
    }
    if (input.hasOption(Commands.OPTION_URLS)) {
        srcCount++;
    }
    if (srcCount > 1) {
        error("ERROR_MultipleSourcesUnsupported");
    }
    if (input.hasOption(Commands.OPTION_AUTO_YES)) {
        env.setAutoYesEnabled(true);
    }
    if (input.hasOption(Commands.OPTION_NON_INTERACTIVE)) {
        env.setNonInteractive(true);
    }
    // explicit location
    String catalogURL = getExplicitCatalogURL();
    String builtinCatLocation = getReleaseCatalogURL();
    if (builtinCatLocation == null) {
        builtinCatLocation = feedback.l10n("Installer_BuiltingCatalogURL");
    }
    GraalEditionList editionList = new GraalEditionList(feedback, input, input.getLocalRegistry());
    editionList.setDefaultCatalogSpec(builtinCatLocation);
    editionList.setOverrideCatalogSpec(catalogURL);
    env.setCatalogFactory(editionList);
    if (input.hasOption(Commands.OPTION_USE_EDITION)) {
        input.getLocalRegistry().setOverrideEdition(input.optValue(Commands.OPTION_USE_EDITION));
    }
    boolean builtinsImplied = true;
    boolean setIterable = true;
    if (input.hasOption(Commands.OPTION_FILES)) {
        FileIterable fi = new FileIterable(env, env);
        fi.setCatalogFactory(editionList);
        env.setFileIterable(fi);
        // optionally resolve local dependencies against parent directories
        // of specified files.
        builtinsImplied = false;
        if (input.hasOption(Commands.OPTION_LOCAL_DEPENDENCIES)) {
            while (env.hasParameter()) {
                String s = env.nextParameter();
                Path p = SystemUtils.fromUserString(s);
                if (p != null) {
                    Path parent = p.getParent();
                    if (parent != null && Files.isDirectory(parent)) {
                        SoftwareChannelSource localSource = new SoftwareChannelSource(parent.toUri().toString(), null);
                        localSource.setPriority(10000);
                        editionList.addLocalChannelSource(localSource);
                    }
                }
            }
            env.resetParameters();
        }
        setIterable = false;
    } else if (input.hasOption(Commands.OPTION_URLS)) {
        DownloadURLIterable dit = new DownloadURLIterable(env, env);
        dit.setCatalogFactory(editionList);
        env.setFileIterable(dit);
        setIterable = false;
        builtinsImplied = false;
    }
    if (setIterable) {
        env.setFileIterable(new CatalogIterable(env, env));
    }
    editionList.setRemoteSourcesAllowed(builtinsImplied || env.hasOption(Commands.OPTION_CATALOG) || env.hasOption(Commands.OPTION_FOREIGN_CATALOG));
    return -1;
}
Also used : Path(java.nio.file.Path) GraalEditionList(org.graalvm.component.installer.remote.GraalEditionList) CatalogIterable(org.graalvm.component.installer.remote.CatalogIterable)

Example 3 with GraalEditionList

use of org.graalvm.component.installer.remote.GraalEditionList in project graal by oracle.

the class AvailableTest method initRemoteStorage.

private void initRemoteStorage() {
    GraalEditionList list = new GraalEditionList(this, this, getLocalRegistry());
    this.registry = list.createComponentCatalog(this);
    this.editionList = list;
}
Also used : GraalEditionList(org.graalvm.component.installer.remote.GraalEditionList)

Aggregations

GraalEditionList (org.graalvm.component.installer.remote.GraalEditionList)3 CatalogIterable (org.graalvm.component.installer.remote.CatalogIterable)2 Path (java.nio.file.Path)1 Before (org.junit.Before)1