Search in sources :

Example 1 with RuleKey

use of com.facebook.buck.rules.RuleKey in project buck by facebook.

the class AaptPackageResourcesTest method testThatChangingAndroidManifestChangesRuleKey.

@Test
public void testThatChangingAndroidManifestChangesRuleKey() {
    // Generate a rule key for the defaults.
    AaptConstructorArgs args = new AaptConstructorArgs();
    args.manifest = createPathSourcePath("AndroidManifest.xml", "same_content");
    RuleKey previousRuleKey = calculateRuleKey(args);
    args.manifest = createPathSourcePath("other/AndroidManifest.xml", "same_content");
    previousRuleKey = assertKeyChanged(previousRuleKey, args);
    args.manifest = createPathSourcePath("other/AndroidManifest.xml", "different_content");
    previousRuleKey = assertKeyChanged(previousRuleKey, args);
}
Also used : RuleKey(com.facebook.buck.rules.RuleKey) Test(org.junit.Test)

Example 2 with RuleKey

use of com.facebook.buck.rules.RuleKey in project buck by facebook.

the class AaptPackageResourcesTest method testThatChangingResourceDirectoryOrderChangesRulekey.

@Test
public void testThatChangingResourceDirectoryOrderChangesRulekey() {
    // Generate a rule key for the defaults.
    AaptConstructorArgs args = new AaptConstructorArgs();
    RuleKey previousRuleKey = calculateRuleKey(args);
    args.hasAndroidResourceDeps = ImmutableList.of(resource1, resource2);
    args.filteredResourcesProvider = new IdentityResourcesProvider(ImmutableList.of(Paths.get("res1"), Paths.get("res2")));
    previousRuleKey = assertKeyChanged(previousRuleKey, args);
    args.hasAndroidResourceDeps = ImmutableList.of(resource1, resource2);
    args.filteredResourcesProvider = new IdentityResourcesProvider(ImmutableList.of(Paths.get("res2"), Paths.get("res1")));
// TODO(cjhopman): AaptPackageResources' rulekey doesn't properly reflect changes in the
// ordering of resource-only dependencies.
// previousRuleKey = assertKeyChanged(previousRuleKey, args);
}
Also used : RuleKey(com.facebook.buck.rules.RuleKey) Test(org.junit.Test)

Example 3 with RuleKey

use of com.facebook.buck.rules.RuleKey in project buck by facebook.

the class AaptPackageResourcesTest method testThatChangingResourcesChangesRuleKey.

@Test
public void testThatChangingResourcesChangesRuleKey() {
    // Generate a rule key for the defaults.
    AaptConstructorArgs args = new AaptConstructorArgs();
    RuleKey previousRuleKey = calculateRuleKey(args);
    args.hasAndroidResourceDeps = ImmutableList.of(resource1);
    previousRuleKey = assertKeyChanged(previousRuleKey, args);
    createPathSourcePath("res1", "different_value");
    previousRuleKey = assertKeyChanged(previousRuleKey, args);
}
Also used : RuleKey(com.facebook.buck.rules.RuleKey) Test(org.junit.Test)

Example 4 with RuleKey

use of com.facebook.buck.rules.RuleKey in project buck by facebook.

the class AaptPackageResourcesTest method testThatChangingManifestEntriesChangesRuleKey.

@Test
public void testThatChangingManifestEntriesChangesRuleKey() {
    // Generate a rule key for the defaults.
    AaptConstructorArgs args = new AaptConstructorArgs();
    args.manifestEntries = ManifestEntries.builder().setDebugMode(false).build();
    RuleKey previousRuleKey = calculateRuleKey(args);
    args.manifestEntries = ManifestEntries.builder().setDebugMode(true).build();
    previousRuleKey = assertKeyChanged(previousRuleKey, args);
}
Also used : RuleKey(com.facebook.buck.rules.RuleKey) Test(org.junit.Test)

Example 5 with RuleKey

use of com.facebook.buck.rules.RuleKey in project buck by facebook.

the class AaptPackageResourcesTest method testThatChangingAssetsChangesRuleKey.

@Test
public void testThatChangingAssetsChangesRuleKey() {
    // Generate a rule key for the defaults.
    AaptConstructorArgs args = new AaptConstructorArgs();
    RuleKey previousRuleKey = calculateRuleKey(args);
    args.hasAndroidResourceDeps = ImmutableList.of(resource1);
    args.assetsDirectories = ImmutableSet.of(resource1.getAssets(), justAssets.getAssets());
    // AndroidBinaryGraphEnhancer directly adds resource deps that have assets and no resources to
    // extraDeps.
    args.extraDeps = ImmutableSortedSet.of(justAssets);
    previousRuleKey = assertKeyChanged(previousRuleKey, args);
    createPathSourcePath("asset1", "different_value");
    previousRuleKey = assertKeyChanged(previousRuleKey, args);
    createPathSourcePath("justAssets", "different_value");
    previousRuleKey = assertKeyChanged(previousRuleKey, args);
}
Also used : RuleKey(com.facebook.buck.rules.RuleKey) Test(org.junit.Test)

Aggregations

RuleKey (com.facebook.buck.rules.RuleKey)149 Test (org.junit.Test)112 BuildRuleResolver (com.facebook.buck.rules.BuildRuleResolver)71 SourcePathResolver (com.facebook.buck.rules.SourcePathResolver)71 SourcePathRuleFinder (com.facebook.buck.rules.SourcePathRuleFinder)71 DefaultTargetNodeToBuildRuleTransformer (com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer)70 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)57 Path (java.nio.file.Path)57 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)42 BuildTarget (com.facebook.buck.model.BuildTarget)42 BuildRule (com.facebook.buck.rules.BuildRule)42 LazyPath (com.facebook.buck.io.LazyPath)34 DefaultRuleKeyFactory (com.facebook.buck.rules.keys.DefaultRuleKeyFactory)34 PathSourcePath (com.facebook.buck.rules.PathSourcePath)33 AddToRuleKey (com.facebook.buck.rules.AddToRuleKey)30 SourcePath (com.facebook.buck.rules.SourcePath)28 FakeFileHashCache (com.facebook.buck.testutil.FakeFileHashCache)27 FakeBuildRule (com.facebook.buck.rules.FakeBuildRule)25 IOException (java.io.IOException)25 StackedFileHashCache (com.facebook.buck.util.cache.StackedFileHashCache)23