Search in sources :

Example 1 with IdentityFileResolver

use of org.gradle.api.internal.file.IdentityFileResolver in project gradle by gradle.

the class CommandLineActionFactory method createActionFactories.

protected void createActionFactories(ServiceRegistry loggingServices, Collection<CommandLineAction> actions) {
    actions.add(new GuiActionsFactory());
    actions.add(new BuildActionsFactory(loggingServices, new ParametersConverter(), new CachingJvmVersionDetector(new DefaultJvmVersionDetector(new DefaultExecActionFactory(new IdentityFileResolver())))));
}
Also used : DefaultExecActionFactory(org.gradle.process.internal.DefaultExecActionFactory) IdentityFileResolver(org.gradle.api.internal.file.IdentityFileResolver) DefaultJvmVersionDetector(org.gradle.internal.jvm.inspection.DefaultJvmVersionDetector) CachingJvmVersionDetector(org.gradle.internal.jvm.inspection.CachingJvmVersionDetector)

Example 2 with IdentityFileResolver

use of org.gradle.api.internal.file.IdentityFileResolver in project gradle by gradle.

the class CurrentProcess method inferJvmOptions.

private static JvmOptions inferJvmOptions() {
    // Try to infer the effective jvm options for the currently running process.
    // We only care about 'managed' jvm args, anything else is unimportant to the running build
    JvmOptions jvmOptions = new JvmOptions(new IdentityFileResolver());
    jvmOptions.setAllJvmArgs(ManagementFactory.getRuntimeMXBean().getInputArguments());
    return jvmOptions;
}
Also used : IdentityFileResolver(org.gradle.api.internal.file.IdentityFileResolver)

Example 3 with IdentityFileResolver

use of org.gradle.api.internal.file.IdentityFileResolver in project gradle by gradle.

the class BuildProcess method configureForBuild.

/**
     * Attempts to configure the current process to run with the required build parameters.
     * @return True if the current process could be configured, false otherwise.
     */
public boolean configureForBuild(DaemonParameters requiredBuildParameters) {
    boolean javaHomeMatch = getJvm().equals(requiredBuildParameters.getEffectiveJvm());
    final JvmOptions jvmOptions = new JvmOptions(new IdentityFileResolver());
    jvmOptions.systemProperties(getJvmOptions().getImmutableSystemProperties());
    List<String> currentImmutables = jvmOptions.getAllImmutableJvmArgs();
    List<String> requiredImmutables = requiredBuildParameters.getEffectiveSingleUseJvmArgs();
    requiredImmutables.removeAll(DaemonParameters.DEFAULT_JVM_ARGS);
    boolean noImmutableJvmArgsRequired = requiredImmutables.equals(currentImmutables);
    if (javaHomeMatch && noImmutableJvmArgsRequired) {
        // Set the system properties and use this process
        Properties properties = new Properties();
        properties.putAll(requiredBuildParameters.getEffectiveSystemProperties());
        System.setProperties(properties);
        return true;
    }
    return false;
}
Also used : IdentityFileResolver(org.gradle.api.internal.file.IdentityFileResolver) JvmOptions(org.gradle.process.internal.JvmOptions) Properties(java.util.Properties)

Aggregations

IdentityFileResolver (org.gradle.api.internal.file.IdentityFileResolver)3 Properties (java.util.Properties)1 CachingJvmVersionDetector (org.gradle.internal.jvm.inspection.CachingJvmVersionDetector)1 DefaultJvmVersionDetector (org.gradle.internal.jvm.inspection.DefaultJvmVersionDetector)1 DefaultExecActionFactory (org.gradle.process.internal.DefaultExecActionFactory)1 JvmOptions (org.gradle.process.internal.JvmOptions)1