Search in sources :

Example 41 with BuildId

use of com.facebook.buck.model.BuildId in project buck by facebook.

the class MiniAaptTest method testProcessFileNamesInDirectory.

@Test
public void testProcessFileNamesInDirectory() throws IOException, ResourceParseException {
    filesystem.touch(Paths.get("res/drawable/icon.png"));
    filesystem.touch(Paths.get("res/drawable/another_icon.png.orig"));
    filesystem.touch(Paths.get("res/drawable-ldpi/nine_patch.9.png"));
    filesystem.touch(Paths.get("res/drawable-ldpi/.DS_Store"));
    filesystem.touch(Paths.get("res/transition-v19/some_transition.xml"));
    filesystem.writeContentsToPath("<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<resources>" + "<bool name=\"v\">false</bool>" + "</resources>", Paths.get("res/values/value.xml~"));
    MiniAapt aapt = new MiniAapt(resolver, filesystem, new FakeSourcePath(filesystem, "res"), Paths.get("R.txt"), ImmutableSet.of());
    aapt.processFileNamesInDirectory(filesystem, Paths.get("res/drawable"));
    aapt.processFileNamesInDirectory(filesystem, Paths.get("res/drawable-ldpi"));
    aapt.processFileNamesInDirectory(filesystem, Paths.get("res/transition-v19"));
    aapt.processValues(filesystem, new BuckEventBus(new FakeClock(0), new BuildId("")), Paths.get("res/values"));
    assertEquals(ImmutableSet.<RDotTxtEntry>of(new FakeRDotTxtEntry(IdType.INT, RType.DRAWABLE, "icon"), new FakeRDotTxtEntry(IdType.INT, RType.DRAWABLE, "nine_patch"), new FakeRDotTxtEntry(IdType.INT, RType.TRANSITION, "some_transition")), aapt.getResourceCollector().getResources());
}
Also used : FakeSourcePath(com.facebook.buck.rules.FakeSourcePath) BuckEventBus(com.facebook.buck.event.BuckEventBus) BuildId(com.facebook.buck.model.BuildId) FakeClock(com.facebook.buck.timing.FakeClock) Test(org.junit.Test)

Aggregations

BuildId (com.facebook.buck.model.BuildId)41 Test (org.junit.Test)25 BuckEventBus (com.facebook.buck.event.BuckEventBus)22 Path (java.nio.file.Path)13 FakeClock (com.facebook.buck.timing.FakeClock)12 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)10 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)9 IOException (java.io.IOException)8 IncrementingFakeClock (com.facebook.buck.timing.IncrementingFakeClock)7 BuildTarget (com.facebook.buck.model.BuildTarget)6 Before (org.junit.Before)6 DefaultClock (com.facebook.buck.timing.DefaultClock)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 ArtifactCache (com.facebook.buck.artifact_cache.ArtifactCache)4 BuildRuleDurationTracker (com.facebook.buck.rules.BuildRuleDurationTracker)4 Clock (com.facebook.buck.timing.Clock)4 NullFileHashCache (com.facebook.buck.util.cache.NullFileHashCache)4 ImmutableList (com.google.common.collect.ImmutableList)4 RuleKey (com.facebook.buck.rules.RuleKey)3 FakeExecutor (com.facebook.buck.testutil.FakeExecutor)3