use of org.gradle.test.fixtures.file.ExecOutput in project gradle by gradle.
the class MSBuildExecutor method succeeds.
public List<ExecutionResult> succeeds(MSBuildAction action) {
withArgument(toTargetArgument(action));
ExecOutput result = findMSBuild().execute(args, buildEnvironment(workingDir));
System.out.println(result.getOut());
String output = trimLines(result.getOut());
String error = trimLines(result.getError());
List<ExecutionResult> results = new ArrayList<ExecutionResult>();
int first = output.indexOf(SEPARATOR);
if (first < 0) {
return Collections.emptyList();
}
output = output.substring(first + SEPARATOR.length());
while (output.length() > 0) {
int next = output.indexOf(SEPARATOR);
if (next < 0) {
results.add(OutputScrapingExecutionResult.from(output, error));
output = "";
} else {
results.add(OutputScrapingExecutionResult.from(output.substring(0, next), error));
output = output.substring(next + SEPARATOR.length());
}
error = "";
}
return results;
}
use of org.gradle.test.fixtures.file.ExecOutput in project gradle by gradle.
the class MSBuildVersionLocator method getMSBuildInstall.
public File getMSBuildInstall(AvailableToolChains.InstalledToolChain toolChain) {
VersionNumber vsVersion;
if (toolChain instanceof AvailableToolChains.InstalledVisualCpp) {
AvailableToolChains.InstalledVisualCpp visualCpp = (AvailableToolChains.InstalledVisualCpp) toolChain;
vsVersion = visualCpp.getVersion();
} else {
vsVersion = VersionNumber.version(15);
}
File vswhere = vswhereLocator.getVswhereInstall();
if (vswhere == null) {
throw new IllegalStateException("vswhere tool is required to be installed");
}
ExecOutput vsWhereOutput = new TestFile(vswhere).exec("-version", String.format("[%s.0,%s.0)", vsVersion.getMajor(), vsVersion.getMajor() + 1), "-products", "*", "-requires", "Microsoft.Component.MSBuild", "-property", "installationPath");
if (!vsWhereOutput.getError().trim().isEmpty()) {
throw new IllegalStateException(String.format("Could not determine the location of MSBuild %s: %s", vsVersion.getMajor(), vsWhereOutput.getError()));
}
String location = vsWhereOutput.getOut().trim();
TestFile msbuild;
if (!location.isEmpty()) {
msbuild = new TestFile(location).file("MSBuild/" + vsVersion.getMajor() + ".0/Bin/MSBuild.exe");
} else if (vsVersion.getMajor() == 11) {
msbuild = new TestFile("C:/Windows/Microsoft.Net/Framework/v4.0.30319/MSBuild.exe");
} else {
msbuild = new TestFile("C:/program files (x86)/MSBuild/" + vsVersion.getMajor() + ".0/Bin/MSBuild.exe");
}
if (!msbuild.exists()) {
throw new IllegalStateException(String.format("This test requires MSBuild %s to be installed. Expected it to be installed at %s.", vsVersion.getMajor(), msbuild));
}
return msbuild;
}
use of org.gradle.test.fixtures.file.ExecOutput in project gradle by gradle.
the class XcodebuildExecutor method fails.
public ExecutionFailure fails(XcodeAction action) {
withArgument(action.toString());
ExecOutput result = findXcodeBuild().execWithFailure(args, buildEnvironment(testDirectory));
// stderr of Gradle is redirected to stdout of xcodebuild tool. To work around, we consider xcodebuild stdout and stderr as
// the error output only if xcodebuild failed most likely due to Gradle.
System.out.println(result.getOut());
System.out.println(result.getError());
return OutputScrapingExecutionFailure.from(result.getOut(), result.getError());
}
use of org.gradle.test.fixtures.file.ExecOutput in project gradle by gradle.
the class XcodebuildExecutor method succeeds.
public ExecutionResult succeeds(XcodeAction action) {
withArgument(action.toString());
ExecOutput result = findXcodeBuild().execute(args, buildEnvironment(testDirectory));
System.out.println(result.getOut());
return OutputScrapingExecutionResult.from(result.getOut(), result.getError());
}
use of org.gradle.test.fixtures.file.ExecOutput in project gradle by gradle.
the class MSBuildExecutor method fails.
public ExecutionFailure fails(MSBuildAction action) {
withArgument(toTargetArgument(action));
ExecOutput result = findMSBuild().execWithFailure(args, buildEnvironment(workingDir));
System.out.println(result.getOut());
System.out.println(result.getError());
return OutputScrapingExecutionFailure.from(trimLines(result.getOut()), trimLines(result.getError()));
}
Aggregations