use of org.gradle.process.internal.JvmOptions 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;
}
use of org.gradle.process.internal.JvmOptions in project intellij-community by JetBrains.
the class GradleExecutionHelper method mergeJvmArgs.
private static List<String> mergeJvmArgs(String serviceDirectory, List<String> jvmArgs, Set<String> jvmArgsFromIdeSettings) {
File gradleUserHomeDir = serviceDirectory != null ? new File(serviceDirectory) : new BuildLayoutParameters().getGradleUserHomeDir();
LOG.debug("Gradle home: " + gradleUserHomeDir);
NativeServices.initialize(gradleUserHomeDir);
Map<String, String> mergedArgs = new LinkedHashMap<>();
for (String jvmArg : ContainerUtil.concat(jvmArgs, jvmArgsFromIdeSettings)) {
int i = jvmArg.indexOf('=');
if (i <= 0) {
mergedArgs.put(jvmArg, "");
} else {
mergedArgs.put(jvmArg.substring(0, i), jvmArg.substring(i));
}
}
List<String> mergedList = new ArrayList<>();
for (Map.Entry<String, String> entry : mergedArgs.entrySet()) {
mergedList.add(entry.getKey() + entry.getValue());
}
JvmOptions jvmOptions = new JvmOptions(null);
jvmOptions.setAllJvmArgs(mergedList);
return jvmOptions.getAllJvmArgs();
}
Aggregations