private List<String> getVmstatOutput() { try { StreamByteBuffer buffer = new StreamByteBuffer(); ExecHandleBuilder builder = new DefaultExecActionFactory(new IdentityFileResolver()).newExec(); builder.setWorkingDir(new File(".").getAbsolutePath()); builder.setCommandLine(VMSTAT_EXECUTABLE_PATH); builder.setStandardOutput(buffer.getOutputStream()); builder.build().start().waitForFinish().assertNormalExitValue(); BufferedReader reader = new BufferedReader(new InputStreamReader(buffer.getInputStream())); List<String> lines = Lists.newArrayList(); String line; while ((line = reader.readLine()) != null) { lines.add(line); } return lines; } catch (Exception e) { throw new UnsupportedOperationException("Unable to read memory info from " + VMSTAT_EXECUTABLE_PATH, e); } }
/** * 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; }
/** * 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 = getJavaHome().equals(requiredBuildParameters.getEffectiveJavaHome()); List<String> currentImmutable = new JvmOptions(new IdentityFileResolver()).getAllImmutableJvmArgs(); List<String> requiredImmutable = requiredBuildParameters.getEffectiveJvmArgs(); List<String> requiredImmutableMinusDefaults = removeDefaults(requiredImmutable); boolean noImmutableJvmArgsRequired = requiredImmutableMinusDefaults.equals(currentImmutable); 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; }
/** * 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 = getJavaHome().equals(requiredBuildParameters.getEffectiveJavaHome()); JvmOptions optionsWithNoArgsSet = new JvmOptions(new IdentityFileResolver()); boolean noImmutableJvmArgsRequired = requiredBuildParameters.isUsingDefaultJvmArgs() || requiredBuildParameters.getEffectiveJvmArgs().equals(optionsWithNoArgsSet.getAllImmutableJvmArgs()); 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; }
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; }
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()))))); }
public DefaultExecHandleBuilder() { super(new IdentityFileResolver()); }
public PathKeyFileStore(File baseDir) { this.baseDir = baseDir; IdentityFileResolver fileResolver = new IdentityFileResolver(); deleter = new Deleter(fileResolver, fileResolver.getFileSystem()); }
public DefaultFileCollectionResolveContext() { this(new IdentityFileResolver()); }
public BuildDependenciesOnlyFileCollectionResolveContext() { super(new IdentityFileResolver(), new BuildableFileTreeInternalConverter(), new BuildableFileTreeInternalConverter()); }
public ExecHandleBuilder() { super(new IdentityFileResolver()); }
public static SAPManifest createSAPManifest() { FileResolver fileResolver = new IdentityFileResolver(); SAPManifest sapManifest = new SAPManifest(fileResolver); return sapManifest; }