use of com.facebook.buck.step.Step in project buck by facebook.
the class ProGuardObfuscateStepTest method testProguardJvmArgs.
@Test
public void testProguardJvmArgs() {
List<String> proguardJvmArgs = Arrays.asList("-Dparam1=value1", "-Dparam2=value2");
ImmutableList.Builder<Step> steps = ImmutableList.builder();
ProGuardObfuscateStep.create(JavaCompilationConstants.DEFAULT_JAVA_OPTIONS.getJavaRuntimeLauncher(), new FakeProjectFilesystem(), /* proguardJarOverride */
Optional.empty(), "1024M", Optional.empty(), Paths.get("generated/proguard.txt"), /* customProguardConfigs */
ImmutableSet.of(), ProGuardObfuscateStep.SdkProguardType.DEFAULT, /* optimizationPasses */
Optional.empty(), Optional.of(proguardJvmArgs), /* inputAndOutputEntries */
ImmutableMap.of(), /* additionalLibraryJarsForProguard */
ImmutableSet.of(Paths.get("myfavorite.jar"), Paths.get("another.jar")), Paths.get("proguard-directory"), new FakeBuildableContext(), false, steps);
ProGuardObfuscateStep proguardStep = (ProGuardObfuscateStep) steps.build().get(2);
ImmutableList<String> parameters = proguardStep.getShellCommandInternal(executionContext);
for (String s : proguardJvmArgs) {
assertNotEquals(-1, parameters.indexOf(s));
}
}
use of com.facebook.buck.step.Step in project buck by facebook.
the class SmartDexingStepTest method testCreateDxStepForDxPseudoRuleWithDexOutput.
@Test
public void testCreateDxStepForDxPseudoRuleWithDexOutput() throws IOException {
ProjectFilesystem filesystem = FakeProjectFilesystem.createJavaOnlyFilesystem();
ImmutableList<Path> filesToDex = ImmutableList.of(Paths.get("foo.dex.jar"), Paths.get("bar.dex.jar"));
Path outputPath = Paths.get("classes.dex");
EnumSet<DxStep.Option> dxOptions = EnumSet.noneOf(DxStep.Option.class);
Step dxStep = SmartDexingStep.createDxStepForDxPseudoRule(filesystem, filesToDex, outputPath, dxOptions, Optional.empty(), Optional.empty());
assertEquals(Joiner.on(" ").join("(cd", filesystem.getRootPath(), "&&", Paths.get("/usr/bin/dx"), "--dex --output", filesystem.resolve("classes.dex"), filesystem.resolve("foo.dex.jar"), filesystem.resolve("bar.dex.jar") + ")"), dxStep.getDescription(createMockedExecutionContext()));
verifyAll();
}
use of com.facebook.buck.step.Step in project buck by facebook.
the class MultiarchFileTest method descriptionWithMultiplePlatformArgsShouldGenerateMultiarchFile.
@SuppressWarnings({ "unchecked" })
@Test
public void descriptionWithMultiplePlatformArgsShouldGenerateMultiarchFile() throws Exception {
BuildTarget target = BuildTargetFactory.newInstance("//foo:thing#iphoneos-i386,iphoneos-x86_64");
BuildTarget sandboxTarget = BuildTargetFactory.newInstance("//foo:thing#iphoneos-i386,iphoneos-x86_64,sandbox");
BuildRuleResolver resolver = new BuildRuleResolver(TargetGraphFactory.newInstance(new AppleLibraryBuilder(sandboxTarget).build()), new DefaultTargetNodeToBuildRuleTransformer());
SourcePathResolver pathResolver = new SourcePathResolver(new SourcePathRuleFinder(resolver));
ProjectFilesystem filesystem = new FakeProjectFilesystem();
BuildRule multiarchRule = nodeBuilderFactory.getNodeBuilder(target).build(resolver, filesystem);
assertThat(multiarchRule, instanceOf(MultiarchFile.class));
ImmutableList<Step> steps = multiarchRule.getBuildSteps(FakeBuildContext.withSourcePathResolver(pathResolver), new FakeBuildableContext());
ShellStep step = Iterables.getLast(Iterables.filter(steps, ShellStep.class));
ExecutionContext executionContext = TestExecutionContext.newInstance();
ImmutableList<String> command = step.getShellCommand(executionContext);
assertThat(command, Matchers.contains(endsWith("lipo"), equalTo("-create"), equalTo("-output"), containsString("foo/thing#"), containsString("/thing#"), containsString("/thing#")));
}
use of com.facebook.buck.step.Step in project buck by facebook.
the class AbstractElfExtractSectionsStep method execute.
@Override
public StepExecutionResult execute(ExecutionContext context) throws IOException, InterruptedException {
ImmutableMap<String, Long> addresses = getNewSectionAddresses();
Step objcopy = new DefaultShellStep(getFilesystem().getRootPath(), /* args */
getObjcopyCommand(addresses), /* env */
ImmutableMap.of());
return objcopy.execute(context);
}
use of com.facebook.buck.step.Step in project buck by facebook.
the class GoTest method runTests.
@Override
public ImmutableList<Step> runTests(ExecutionContext executionContext, TestRunningOptions options, SourcePathResolver pathResolver, TestReportingCallback testReportingCallback) {
Optional<Long> processTimeoutMs = testRuleTimeoutMs.isPresent() ? Optional.of(testRuleTimeoutMs.get() + PROCESS_TIMEOUT_EXTRA_MS) : Optional.empty();
ImmutableList.Builder<String> args = ImmutableList.builder();
args.addAll(testMain.getExecutableCommand().getCommandPrefix(pathResolver));
args.add("-test.v");
if (testRuleTimeoutMs.isPresent()) {
args.add("-test.timeout", testRuleTimeoutMs.get() + "ms");
}
return ImmutableList.of(new MakeCleanDirectoryStep(getProjectFilesystem(), getPathToTestOutputDirectory()), new MakeCleanDirectoryStep(getProjectFilesystem(), getPathToTestWorkingDirectory()), new SymlinkTreeStep(getProjectFilesystem(), getPathToTestWorkingDirectory(), ImmutableMap.copyOf(FluentIterable.from(resources).transform(input -> Maps.immutableEntry(getProjectFilesystem().getPath(pathResolver.getSourcePathName(getBuildTarget(), input)), pathResolver.getAbsolutePath(input))))), new GoTestStep(getProjectFilesystem(), getPathToTestWorkingDirectory(), args.build(), testMain.getExecutableCommand().getEnvironment(pathResolver), getPathToTestExitCode(), processTimeoutMs, getPathToTestResults()));
}
Aggregations