Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 public DaemonParameters(BuildLayoutParameters layout, Map<String, String> extraSystemProperties) {
   this.uid = UUID.randomUUID().toString();
   jvmOptions.setAllJvmArgs(DEFAULT_JVM_ARGS);
   jvmOptions.systemProperties(extraSystemProperties);
   baseDir = new File(layout.getGradleUserHomeDir(), "daemon");
   gradleUserHomeDir = layout.getGradleUserHomeDir();
 }
Ejemplo n.º 3
0
 public void assertCanExecute() throws AssertionError {
   if (!getDistribution().isSupportsSpacesInGradleAndJavaOpts()) {
     Map<String, String> environmentVars = buildInvocation().environmentVars;
     for (String envVarName : Arrays.asList("JAVA_OPTS", "GRADLE_OPTS")) {
       String envVarValue = environmentVars.get(envVarName);
       if (envVarValue == null) {
         continue;
       }
       for (String arg : JvmOptions.fromString(envVarValue)) {
         if (arg.contains(" ")) {
           throw new AssertionError(
               String.format(
                   "Env var %s contains arg with space (%s) which is not supported by Gradle %s",
                   envVarName, arg, getDistribution().getVersion().getVersion()));
         }
       }
     }
   }
 }
Ejemplo n.º 4
0
 private boolean hasJvmArgs(DaemonParameters requiredBuildParameters) {
   return requiredBuildParameters.isUsingDefaultJvmArgs()
       || (effectiveJvmOptions
           .getManagedJvmArgs()
           .equals(requiredBuildParameters.getEffectiveJvmArgs()));
 }
Ejemplo n.º 5
0
 public List<String> getAllJvmArgs() {
   return jvmOptions.getAllJvmArgs();
 }
Ejemplo n.º 6
0
 public List<String> getEffectiveJvmArgs() {
   return jvmOptions.getAllImmutableJvmArgs();
 }
Ejemplo n.º 7
0
 public boolean getDebug() {
   return jvmOptions.getDebug();
 }
Ejemplo n.º 8
0
 public void setDebug(boolean debug) {
   jvmOptions.setDebug(debug);
 }
Ejemplo n.º 9
0
 public void setJvmArgs(Iterable<String> jvmArgs) {
   jvmOptions.setAllJvmArgs(jvmArgs);
 }
Ejemplo n.º 10
0
 public Map<String, String> getEffectiveSystemProperties() {
   Map<String, String> systemProperties = new HashMap<String, String>();
   GUtil.addToMap(systemProperties, jvmOptions.getSystemProperties());
   GUtil.addToMap(systemProperties, System.getProperties());
   return systemProperties;
 }