Search in sources :

Example 21 with ExecutionContext

use of com.facebook.buck.step.ExecutionContext in project buck by facebook.

the class AaptStepTest method shouldEmitFlagsForManifestEntries.

@Test
public void shouldEmitFlagsForManifestEntries() throws Exception {
    ManifestEntries entries = ManifestEntries.builder().setMinSdkVersion(3).setTargetSdkVersion(5).setVersionCode(7).setVersionName("eleven").setDebugMode(true).build();
    AaptStep aaptStep = buildAaptStep(proguardConfig, true, false, entries);
    ExecutionContext executionContext = createTestExecutionContext(Verbosity.ALL);
    ImmutableList<String> command = aaptStep.getShellCommandInternal(executionContext);
    assertTrue(command.contains("--min-sdk-version"));
    assertEquals("3", command.get(command.indexOf("--min-sdk-version") + 1));
    assertTrue(command.contains("--target-sdk-version"));
    assertEquals("5", command.get(command.indexOf("--target-sdk-version") + 1));
    assertTrue(command.contains("--version-code"));
    assertEquals("7", command.get(command.indexOf("--version-code") + 1));
    assertTrue(command.contains("--version-name"));
    assertEquals("eleven", command.get(command.indexOf("--version-name") + 1));
    assertTrue(command.contains("--debug-mode"));
    // This should be present because we've emitted > 0 manifest-changing flags.
    assertTrue(command.contains("--error-on-failed-insert"));
}
Also used : ExecutionContext(com.facebook.buck.step.ExecutionContext) TestExecutionContext(com.facebook.buck.step.TestExecutionContext) ManifestEntries(com.facebook.buck.rules.coercer.ManifestEntries) Test(org.junit.Test)

Example 22 with ExecutionContext

use of com.facebook.buck.step.ExecutionContext in project buck by facebook.

the class AaptStepTest method shouldNotEmitFailOnInsertWithoutManifestEntries.

@Test
public void shouldNotEmitFailOnInsertWithoutManifestEntries() throws Exception {
    AaptStep aaptStep = buildAaptStep(proguardConfig, true, false, ManifestEntries.empty());
    ExecutionContext executionContext = createTestExecutionContext(Verbosity.ALL);
    ImmutableList<String> command = aaptStep.getShellCommandInternal(executionContext);
    assertFalse(command.contains("--error-on-failed-insert"));
}
Also used : ExecutionContext(com.facebook.buck.step.ExecutionContext) TestExecutionContext(com.facebook.buck.step.TestExecutionContext) Test(org.junit.Test)

Example 23 with ExecutionContext

use of com.facebook.buck.step.ExecutionContext in project buck by facebook.

the class AaptStepTest method shouldEmitVerbosityFlagWithVerboseContext.

@Test
public void shouldEmitVerbosityFlagWithVerboseContext() throws Exception {
    AaptStep aaptStep = buildAaptStep(proguardConfig, false, false, ManifestEntries.empty());
    ExecutionContext executionContext = createTestExecutionContext(Verbosity.ALL);
    ImmutableList<String> command = aaptStep.getShellCommandInternal(executionContext);
    assertTrue(command.contains("-v"));
}
Also used : ExecutionContext(com.facebook.buck.step.ExecutionContext) TestExecutionContext(com.facebook.buck.step.TestExecutionContext) Test(org.junit.Test)

Example 24 with ExecutionContext

use of com.facebook.buck.step.ExecutionContext in project buck by facebook.

the class AaptStepTest method shouldEmitNoCrunchFlagIfNotCrunch.

@Test
public void shouldEmitNoCrunchFlagIfNotCrunch() throws Exception {
    AaptStep aaptStep = buildAaptStep(proguardConfig, false, false, ManifestEntries.empty());
    ExecutionContext executionContext = createTestExecutionContext(Verbosity.ALL);
    ImmutableList<String> command = aaptStep.getShellCommandInternal(executionContext);
    assertTrue(command.contains("--no-crunch"));
}
Also used : ExecutionContext(com.facebook.buck.step.ExecutionContext) TestExecutionContext(com.facebook.buck.step.TestExecutionContext) Test(org.junit.Test)

Example 25 with ExecutionContext

use of com.facebook.buck.step.ExecutionContext in project buck by facebook.

the class AaptStepTest method shouldNotEmitNoCrunchFlagIfCrunch.

@Test
public void shouldNotEmitNoCrunchFlagIfCrunch() throws Exception {
    AaptStep aaptStep = buildAaptStep(proguardConfig, true, false, ManifestEntries.empty());
    ExecutionContext executionContext = createTestExecutionContext(Verbosity.ALL);
    ImmutableList<String> command = aaptStep.getShellCommandInternal(executionContext);
    assertFalse(command.contains("--no-crunch"));
}
Also used : ExecutionContext(com.facebook.buck.step.ExecutionContext) TestExecutionContext(com.facebook.buck.step.TestExecutionContext) Test(org.junit.Test)

Aggregations

ExecutionContext (com.facebook.buck.step.ExecutionContext)176 TestExecutionContext (com.facebook.buck.step.TestExecutionContext)140 Test (org.junit.Test)128 Path (java.nio.file.Path)79 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)67 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)66 SourcePathResolver (com.facebook.buck.rules.SourcePathResolver)55 SourcePathRuleFinder (com.facebook.buck.rules.SourcePathRuleFinder)50 BuildRuleResolver (com.facebook.buck.rules.BuildRuleResolver)45 DefaultTargetNodeToBuildRuleTransformer (com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer)44 Step (com.facebook.buck.step.Step)34 ImmutableList (com.google.common.collect.ImmutableList)32 BuildTarget (com.facebook.buck.model.BuildTarget)31 SourcePath (com.facebook.buck.rules.SourcePath)26 TestConsole (com.facebook.buck.testutil.TestConsole)25 FakeProcess (com.facebook.buck.util.FakeProcess)21 ProcessExecutorParams (com.facebook.buck.util.ProcessExecutorParams)20 ImmutableMap (com.google.common.collect.ImmutableMap)20 MakeCleanDirectoryStep (com.facebook.buck.step.fs.MakeCleanDirectoryStep)19 FakeProcessExecutor (com.facebook.buck.util.FakeProcessExecutor)19