Java 类org.gradle.api.tasks.compile.ForkOptions 实例源码

项目:Reer    文件:JavaCompilerArgumentsBuilder.java   
private void addLauncherOptions() {
    if (!includeLauncherOptions) {
        return;
    }

    ForkOptions forkOptions = spec.getCompileOptions().getForkOptions();
    if (forkOptions.getMemoryInitialSize() != null) {
        args.add("-J-Xms" + forkOptions.getMemoryInitialSize().trim());
    }
    if (forkOptions.getMemoryMaximumSize() != null) {
        args.add("-J-Xmx" + forkOptions.getMemoryMaximumSize().trim());
    }
    if (forkOptions.getJvmArgs() != null) {
        args.addAll(forkOptions.getJvmArgs());
    }
}
项目:Reer    文件:DaemonJavaCompiler.java   
@Override
protected DaemonForkOptions toDaemonOptions(JavaCompileSpec spec) {
    ForkOptions forkOptions = spec.getCompileOptions().getForkOptions();
    return new DaemonForkOptions(
            forkOptions.getMemoryInitialSize(), forkOptions.getMemoryMaximumSize(), forkOptions.getJvmArgs(),
            Collections.<File>emptyList(), SHARED_PACKAGES);
}
项目:Pushjet-Android    文件:JavaCompilerArgumentsBuilder.java   
private void addLauncherOptions() {
    if (!includeLauncherOptions) { return; }

    ForkOptions forkOptions = spec.getCompileOptions().getForkOptions();
    if (forkOptions.getMemoryInitialSize() != null) {
        args.add("-J-Xms" + forkOptions.getMemoryInitialSize().trim());
    }
    if (forkOptions.getMemoryMaximumSize() != null) {
        args.add("-J-Xmx" + forkOptions.getMemoryMaximumSize().trim());
    }
    if (forkOptions.getJvmArgs() != null) {
        args.addAll(forkOptions.getJvmArgs());
    }
}
项目:Pushjet-Android    文件:DaemonJavaCompiler.java   
@Override
protected DaemonForkOptions toDaemonOptions(JavaCompileSpec spec) {
    ForkOptions forkOptions = spec.getCompileOptions().getForkOptions();
    return new DaemonForkOptions(
            forkOptions.getMemoryInitialSize(), forkOptions.getMemoryMaximumSize(), forkOptions.getJvmArgs(),
            Collections.<File>emptyList(), Collections.singleton("com.sun.tools.javac"));
}
项目:Pushjet-Android    文件:JavaCompilerArgumentsBuilder.java   
private void addLauncherOptions() {
    if (!includeLauncherOptions) { return; }

    ForkOptions forkOptions = spec.getCompileOptions().getForkOptions();
    if (forkOptions.getMemoryInitialSize() != null) {
        args.add("-J-Xms" + forkOptions.getMemoryInitialSize().trim());
    }
    if (forkOptions.getMemoryMaximumSize() != null) {
        args.add("-J-Xmx" + forkOptions.getMemoryMaximumSize().trim());
    }
    if (forkOptions.getJvmArgs() != null) {
        args.addAll(forkOptions.getJvmArgs());
    }
}
项目:Pushjet-Android    文件:DaemonJavaCompiler.java   
public WorkResult execute(JavaCompileSpec spec) {
    ForkOptions forkOptions = spec.getCompileOptions().getForkOptions();
    DaemonForkOptions daemonForkOptions = new DaemonForkOptions(
            forkOptions.getMemoryInitialSize(), forkOptions.getMemoryMaximumSize(), forkOptions.getJvmArgs(),
            Collections.<File>emptyList(), Collections.singleton("com.sun.tools.javac"));
    CompilerDaemon daemon = compilerDaemonManager.getDaemon(project.getRootProject().getProjectDir(), daemonForkOptions);
    CompileResult result = daemon.execute(delegate, spec);
    if (result.isSuccess()) {
        return result;
    }
    throw UncheckedException.throwAsUncheckedException(result.getException());
}
项目:Reer    文件:DaemonGroovyCompiler.java   
private DaemonForkOptions createJavaForkOptions(GroovyJavaJointCompileSpec spec) {
    ForkOptions options = spec.getCompileOptions().getForkOptions();
    return new DaemonForkOptions(options.getMemoryInitialSize(), options.getMemoryMaximumSize(), options.getJvmArgs());
}
项目:Reer    文件:DaemonScalaCompiler.java   
private DaemonForkOptions createJavaForkOptions(T spec) {
    ForkOptions options = spec.getCompileOptions().getForkOptions();
    return new DaemonForkOptions(options.getMemoryInitialSize(), options.getMemoryMaximumSize(), options.getJvmArgs());
}
项目:gradle-project-config    文件:JavaConfigPlugin.java   
/**
 * Configure the compile tasks
 *
 * @param javaCompile Compile task to configure
 * @param project Project context
 * @param javaConfig Java configuration
 * @param configurations Configurations containing compiler configuration
 */
@Mutate
public void configureCompileTask(@Each JavaCompile javaCompile, ProjectContext project, JavaConfig javaConfig,
        ConfigurationContainer configurations) {
    File propertiesFile = new File(project.getBuildDir(),
            "tmp/" + javaCompile.getName() + "/eclipseJavaCompiler.prefs");

    javaCompile.doFirst(t -> {
        propertiesFile.getParentFile().mkdirs();

        Properties properties = Classes.loadProperties(JavaConfigPlugin.class, "eclipseJavaCompiler.prefs");
        properties.putAll(javaConfig.getEclipseCompilerProperties());

        try (FileWriter out = new FileWriter(propertiesFile)) {
            properties.store(out, "Eclipse Java Compiler options for task " + t.getName());
        }
        catch (IOException e) {
            throw new GradleException(String.format("Could not write properties file '%s'", propertiesFile), e);
        }
    });

    Configuration compilerConfiguration = configurations.getByName(ECLIPSE_JAVA_COMPILER_CONFIGURATION);

    CompileOptions options = javaCompile.getOptions();

    List<String> compilerArgs = new ArrayList<>();
    compilerArgs.add("-properties");
    compilerArgs.add(propertiesFile.getPath());

    if (Boolean.TRUE.equals(javaConfig.isOptimize())) {
        compilerArgs.add("-o");
    }

    if (Boolean.TRUE.equals(javaConfig.isDebug())) {
        compilerArgs.add("-g:lines,vars,source");
    }
    else {
        compilerArgs.add("-g:none");
    }

    options.setCompilerArgs(compilerArgs);

    options.setFork(true);

    String[] jvmArgs = new String[] { "-classpath", compilerConfiguration.getAsPath(),
            "org.eclipse.jdt.internal.compiler.batch.Main" };

    ForkOptions forkOptions = options.getForkOptions();
    forkOptions.setExecutable("java");
    forkOptions.setJvmArgs(Arrays.asList(jvmArgs));
}
项目:Pushjet-Android    文件:DaemonScalaCompiler.java   
private DaemonForkOptions createJavaForkOptions(ScalaJavaJointCompileSpec spec) {
    ForkOptions options = spec.getCompileOptions().getForkOptions();
    return new DaemonForkOptions(options.getMemoryInitialSize(), options.getMemoryMaximumSize(), options.getJvmArgs());
}
项目:Pushjet-Android    文件:DaemonGroovyCompiler.java   
private DaemonForkOptions createJavaForkOptions(GroovyJavaJointCompileSpec spec) {
    ForkOptions options = spec.getCompileOptions().getForkOptions();
    return new DaemonForkOptions(options.getMemoryInitialSize(), options.getMemoryMaximumSize(), options.getJvmArgs());
}
项目:Pushjet-Android    文件:DaemonScalaCompiler.java   
private DaemonForkOptions createJavaForkOptions(ScalaJavaJointCompileSpec spec) {
    ForkOptions options = spec.getCompileOptions().getForkOptions();
    return new DaemonForkOptions(options.getMemoryInitialSize(), options.getMemoryMaximumSize(), options.getJvmArgs());
}
项目:Pushjet-Android    文件:DaemonGroovyCompiler.java   
private DaemonForkOptions createJavaForkOptions(GroovyJavaJointCompileSpec spec) {
    ForkOptions options = spec.getCompileOptions().getForkOptions();
    return new DaemonForkOptions(options.getMemoryInitialSize(), options.getMemoryMaximumSize(), options.getJvmArgs());
}