Search in sources :

Example 1 with Bootstrap

use of net.runelite.launcher.beans.Bootstrap in project launcher by runelite.

the class Launcher method main.

public static void main(String[] args) throws Exception {
    OptionParser parser = new OptionParser();
    parser.accepts("version").withRequiredArg();
    parser.accepts("clientargs").withRequiredArg();
    parser.accepts("nojvm");
    parser.accepts("debug");
    OptionSet options = parser.parse(args);
    try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception ex) {
        logger.warn("Unable to set cross platform look and feel", ex);
    }
    LauncherFrame frame = new LauncherFrame();
    Bootstrap bootstrap = getBootstrap();
    // update packr vmargs
    PackrConfig.updateLauncherArgs(bootstrap);
    if (options.has("version")) {
        String version = (String) options.valueOf("version");
        logger.info("Using version {}", version);
        DefaultArtifact artifact = bootstrap.getClient();
        artifact = (DefaultArtifact) artifact.setVersion(version);
        bootstrap.setClient(artifact);
        // non-releases are not signed
        verify = false;
    }
    ArtifactResolver resolver = new ArtifactResolver(REPO_DIR);
    resolver.setListener(frame);
    resolver.addRepositories();
    Artifact a = bootstrap.getClient();
    List<ArtifactResult> results = resolver.resolveArtifacts(a);
    if (results.isEmpty()) {
        logger.error("Unable to resolve artifacts");
        return;
    }
    try {
        verifyJarSignature(results.get(0).getArtifact().getFile());
        logger.info("Verified signature of {}", results.get(0).getArtifact());
    } catch (CertificateException | IOException | SecurityException ex) {
        if (verify) {
            logger.error("Unable to verify signature of jar file", ex);
            return;
        } else {
            logger.warn("Unable to verify signature of jar file", ex);
        }
    }
    frame.setVisible(false);
    frame.dispose();
    String clientArgs = getArgs(options);
    // packr doesn't let us specify command line arguments
    if ("true".equals(System.getProperty("runelite.launcher.nojvm")) || options.has("nojvm")) {
        ReflectionLauncher.launch(results, clientArgs, options);
    } else {
        JvmLauncher.launch(bootstrap, results, clientArgs, options);
    }
}
Also used : CertificateException(java.security.cert.CertificateException) IOException(java.io.IOException) OptionParser(joptsimple.OptionParser) IOException(java.io.IOException) CertificateException(java.security.cert.CertificateException) DefaultArtifact(org.eclipse.aether.artifact.DefaultArtifact) Artifact(org.eclipse.aether.artifact.Artifact) ArtifactResult(org.eclipse.aether.resolution.ArtifactResult) Bootstrap(net.runelite.launcher.beans.Bootstrap) OptionSet(joptsimple.OptionSet) DefaultArtifact(org.eclipse.aether.artifact.DefaultArtifact)

Example 2 with Bootstrap

use of net.runelite.launcher.beans.Bootstrap in project launcher by runelite.

the class ArtifactResolverTest method printJson.

@Test
public void printJson() {
    Bootstrap b = new Bootstrap();
    Gson g = new Gson();
    DefaultArtifact a = new DefaultArtifact("net.runelite", "client", "", "jar", "1.0.0-SNAPSHOT");
    b.setClient(a);
    b.setClientJvmArguments(new String[] { "-Xmx256m", "-Xss2m", "-Dsun.java2d.noddraw=true", "-XX:CompileThreshold=1500", "-Xincgc", "-XX:+UseConcMarkSweepGC", "-XX:+UseParNewGC" });
    System.out.println(g.toJson(b));
}
Also used : Bootstrap(net.runelite.launcher.beans.Bootstrap) Gson(com.google.gson.Gson) DefaultArtifact(org.eclipse.aether.artifact.DefaultArtifact) Test(org.junit.Test)

Aggregations

Bootstrap (net.runelite.launcher.beans.Bootstrap)2 DefaultArtifact (org.eclipse.aether.artifact.DefaultArtifact)2 Gson (com.google.gson.Gson)1 IOException (java.io.IOException)1 CertificateException (java.security.cert.CertificateException)1 OptionParser (joptsimple.OptionParser)1 OptionSet (joptsimple.OptionSet)1 Artifact (org.eclipse.aether.artifact.Artifact)1 ArtifactResult (org.eclipse.aether.resolution.ArtifactResult)1 Test (org.junit.Test)1