Search in sources :

Example 1 with FakeSourcePath

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

the class AndroidBinaryGraphEnhancerTest method testPackageStringsDependsOnResourcesFilter.

@Test
public void testPackageStringsDependsOnResourcesFilter() throws Exception {
    BuildRuleResolver ruleResolver = new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
    // set it up.
    BuildTarget target = BuildTargetFactory.newInstance("//:target");
    BuildRuleParams originalParams = new FakeBuildRuleParamsBuilder(target).build();
    AndroidBinaryGraphEnhancer graphEnhancer = new AndroidBinaryGraphEnhancer(originalParams, ruleResolver, ResourcesFilter.ResourceCompressionMode.ENABLED_WITH_STRINGS_AS_ASSETS, FilterResourcesStep.ResourceFilter.EMPTY_FILTER, /* bannedDuplicateResourceTypes */
    EnumSet.noneOf(RType.class), Optional.empty(), /* locales */
    ImmutableSet.of(), new FakeSourcePath("AndroidManifest.xml"), AndroidBinary.PackageType.DEBUG, /* cpuFilters */
    ImmutableSet.of(), /* shouldBuildStringSourceMap */
    false, /* shouldPreDex */
    false, BuildTargets.getScratchPath(originalParams.getProjectFilesystem(), target, "%s/classes.dex"), DexSplitMode.NO_SPLIT, /* buildRulesToExcludeFromDex */
    ImmutableSet.of(), /* resourcesToExclude */
    ImmutableSet.of(), /* skipCrunchPngs */
    false, /* includesVectorDrawables */
    false, ANDROID_JAVAC_OPTIONS, EnumSet.of(ExopackageMode.SECONDARY_DEX), /* buildConfigValues */
    BuildConfigFields.empty(), /* buildConfigValuesFiles */
    Optional.empty(), /* xzCompressionLevel */
    Optional.empty(), /* trimResourceIds */
    false, /* keepResourcePattern */
    Optional.empty(), /* nativePlatforms */
    ImmutableMap.of(), /* nativeLibraryMergeMap */
    Optional.empty(), /* nativeLibraryMergeGlue */
    Optional.empty(), /* nativeLibraryMergeCodeGenerator */
    Optional.empty(), AndroidBinary.RelinkerMode.DISABLED, MoreExecutors.newDirectExecutorService(), /* manifestEntries */
    ManifestEntries.empty(), CxxPlatformUtils.DEFAULT_CONFIG, new APKModuleGraph(TargetGraph.EMPTY, originalParams.getBuildTarget(), Optional.empty()), new DxConfig(FakeBuckConfig.builder().build()));
    graphEnhancer.createAdditionalBuildables();
    ResourcesFilter resourcesFilter = findRuleOfType(ruleResolver, ResourcesFilter.class);
    PackageStringAssets packageStringAssetsRule = findRuleOfType(ruleResolver, PackageStringAssets.class);
    MoreAsserts.assertDepends("PackageStringAssets must depend on AaptPackageResources", packageStringAssetsRule, resourcesFilter);
}
Also used : FakeSourcePath(com.facebook.buck.rules.FakeSourcePath) BuildRuleParams(com.facebook.buck.rules.BuildRuleParams) BuildTarget(com.facebook.buck.model.BuildTarget) RType(com.facebook.buck.android.aapt.RDotTxtEntry.RType) FakeBuildRuleParamsBuilder(com.facebook.buck.rules.FakeBuildRuleParamsBuilder) DefaultTargetNodeToBuildRuleTransformer(com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer) BuildRuleResolver(com.facebook.buck.rules.BuildRuleResolver) Test(org.junit.Test)

Example 2 with FakeSourcePath

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

the class AndroidBinaryGraphEnhancerTest method testCreateDepsForPreDexing.

@Test
public void testCreateDepsForPreDexing() throws Exception {
    // Create three Java rules, :dep1, :dep2, and :lib. :lib depends on :dep1 and :dep2.
    BuildTarget javaDep1BuildTarget = BuildTargetFactory.newInstance("//java/com/example:dep1");
    TargetNode<?, ?> javaDep1Node = JavaLibraryBuilder.createBuilder(javaDep1BuildTarget).addSrc(Paths.get("java/com/example/Dep1.java")).build();
    BuildTarget javaDep2BuildTarget = BuildTargetFactory.newInstance("//java/com/example:dep2");
    TargetNode<?, ?> javaDep2Node = JavaLibraryBuilder.createBuilder(javaDep2BuildTarget).addSrc(Paths.get("java/com/example/Dep2.java")).build();
    BuildTarget javaLibBuildTarget = BuildTargetFactory.newInstance("//java/com/example:lib");
    TargetNode<?, ?> javaLibNode = JavaLibraryBuilder.createBuilder(javaLibBuildTarget).addSrc(Paths.get("java/com/example/Lib.java")).addDep(javaDep1Node.getBuildTarget()).addDep(javaDep2Node.getBuildTarget()).build();
    TargetGraph targetGraph = TargetGraphFactory.newInstance(javaDep1Node, javaDep2Node, javaLibNode);
    BuildRuleResolver ruleResolver = new BuildRuleResolver(targetGraph, new DefaultTargetNodeToBuildRuleTransformer());
    SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(ruleResolver);
    BuildRule javaDep1 = ruleResolver.requireRule(javaDep1BuildTarget);
    BuildRule javaDep2 = ruleResolver.requireRule(javaDep2BuildTarget);
    BuildRule javaLib = ruleResolver.requireRule(javaLibBuildTarget);
    // Assume we are enhancing an android_binary rule whose only dep
    // is //java/com/example:lib, and that //java/com/example:dep2 is in its no_dx list.
    ImmutableSortedSet<BuildRule> originalDeps = ImmutableSortedSet.of(javaLib);
    ImmutableSet<BuildTarget> buildRulesToExcludeFromDex = ImmutableSet.of(javaDep2BuildTarget);
    BuildTarget apkTarget = BuildTargetFactory.newInstance("//java/com/example:apk");
    FakeProjectFilesystem filesystem = new FakeProjectFilesystem();
    BuildRuleParams originalParams = new BuildRuleParams(apkTarget, Suppliers.ofInstance(originalDeps), Suppliers.ofInstance(originalDeps), filesystem, TestCellBuilder.createCellRoots(filesystem));
    AndroidBinaryGraphEnhancer graphEnhancer = new AndroidBinaryGraphEnhancer(originalParams, ruleResolver, ResourcesFilter.ResourceCompressionMode.DISABLED, FilterResourcesStep.ResourceFilter.EMPTY_FILTER, /* bannedDuplicateResourceTypes */
    EnumSet.noneOf(RType.class), Optional.empty(), /* locales */
    ImmutableSet.of(), createStrictMock(PathSourcePath.class), AndroidBinary.PackageType.DEBUG, /* cpuFilters */
    ImmutableSet.of(), /* shouldBuildStringSourceMap */
    false, /* shouldPreDex */
    true, BuildTargets.getScratchPath(originalParams.getProjectFilesystem(), apkTarget, "%s/classes.dex"), DexSplitMode.NO_SPLIT, buildRulesToExcludeFromDex, /* resourcesToExclude */
    ImmutableSet.of(), /* skipCrunchPngs */
    false, /* includesVectorDrawables */
    false, ANDROID_JAVAC_OPTIONS, EnumSet.noneOf(ExopackageMode.class), /* buildConfigValues */
    BuildConfigFields.empty(), /* buildConfigValuesFile */
    Optional.empty(), /* xzCompressionLevel */
    Optional.empty(), /* trimResourceIds */
    false, /* keepResourcePattern */
    Optional.empty(), /* nativePlatforms */
    ImmutableMap.of(), /* nativeLibraryMergeMap */
    Optional.empty(), /* nativeLibraryMergeGlue */
    Optional.empty(), /* nativeLibraryMergeCodeGenerator */
    Optional.empty(), AndroidBinary.RelinkerMode.DISABLED, MoreExecutors.newDirectExecutorService(), /* manifestEntries */
    ManifestEntries.empty(), CxxPlatformUtils.DEFAULT_CONFIG, new APKModuleGraph(TargetGraph.EMPTY, originalParams.getBuildTarget(), Optional.empty()), new DxConfig(FakeBuckConfig.builder().build()));
    BuildTarget aaptPackageResourcesTarget = BuildTargetFactory.newInstance("//java/com/example:apk#aapt_package");
    BuildRuleParams aaptPackageResourcesParams = new FakeBuildRuleParamsBuilder(aaptPackageResourcesTarget).build();
    AaptPackageResources aaptPackageResources = new AaptPackageResources(aaptPackageResourcesParams, ruleFinder, ruleResolver, /* manifest */
    new FakeSourcePath("java/src/com/facebook/base/AndroidManifest.xml"), new IdentityResourcesProvider(ImmutableList.of()), ImmutableList.of(), ImmutableSortedSet.of(), ImmutableSet.of(), /* resourceUnionPackage */
    Optional.empty(), false, /* skipCrunchPngs */
    false, /* includesVectorDrawables */
    false, /* bannedDuplicateResourceTypes */
    EnumSet.noneOf(RType.class), /* manifestEntries */
    ManifestEntries.empty());
    ruleResolver.addToIndex(aaptPackageResources);
    AndroidPackageableCollection collection = new AndroidPackageableCollector(/* collectionRoot */
    apkTarget, ImmutableSet.of(javaDep2BuildTarget), /* resourcesToExclude */
    ImmutableSet.of(), new APKModuleGraph(TargetGraph.EMPTY, apkTarget, Optional.empty())).addClasspathEntry(((HasJavaClassHashes) javaDep1), new FakeSourcePath("ignored")).addClasspathEntry(((HasJavaClassHashes) javaDep2), new FakeSourcePath("ignored")).addClasspathEntry(((HasJavaClassHashes) javaLib), new FakeSourcePath("ignored")).build();
    ImmutableMultimap<APKModule, DexProducedFromJavaLibrary> preDexedLibraries = graphEnhancer.createPreDexRulesForLibraries(/* additionalJavaLibrariesToDex */
    ImmutableList.of(), collection);
    BuildTarget fakeUberRDotJavaCompileTarget = BuildTargetFactory.newInstance("//fake:uber_r_dot_java#compile");
    JavaLibrary fakeUberRDotJavaCompile = JavaLibraryBuilder.createBuilder(fakeUberRDotJavaCompileTarget).build(ruleResolver);
    BuildTarget fakeUberRDotJavaDexTarget = BuildTargetFactory.newInstance("//fake:uber_r_dot_java#dex");
    DexProducedFromJavaLibrary fakeUberRDotJavaDex = new DexProducedFromJavaLibrary(new FakeBuildRuleParamsBuilder(fakeUberRDotJavaDexTarget).build(), fakeUberRDotJavaCompile);
    ruleResolver.addToIndex(fakeUberRDotJavaDex);
    BuildRule preDexMergeRule = graphEnhancer.createPreDexMergeRule(preDexedLibraries, fakeUberRDotJavaDex);
    BuildTarget dexMergeTarget = BuildTargetFactory.newInstance("//java/com/example:apk#dex_merge");
    BuildRule dexMergeRule = ruleResolver.getRule(dexMergeTarget);
    assertEquals(dexMergeRule, preDexMergeRule);
    BuildTarget javaDep1DexBuildTarget = BuildTarget.builder(javaDep1BuildTarget).addFlavors(AndroidBinaryGraphEnhancer.DEX_FLAVOR).build();
    BuildTarget javaDep2DexBuildTarget = BuildTarget.builder(javaDep2BuildTarget).addFlavors(AndroidBinaryGraphEnhancer.DEX_FLAVOR).build();
    BuildTarget javaLibDexBuildTarget = BuildTarget.builder(javaLibBuildTarget).addFlavors(AndroidBinaryGraphEnhancer.DEX_FLAVOR).build();
    assertThat("There should be a #dex rule for dep1 and lib, but not dep2 because it is in the no_dx " + "list.  And we should depend on uber_r_dot_java", Iterables.transform(dexMergeRule.getDeps(), BuildRule::getBuildTarget), Matchers.allOf(Matchers.not(Matchers.hasItem(javaDep1BuildTarget)), Matchers.hasItem(javaDep1DexBuildTarget), Matchers.not(Matchers.hasItem(javaDep2BuildTarget)), Matchers.not(Matchers.hasItem(javaDep2DexBuildTarget)), Matchers.hasItem(javaLibDexBuildTarget), Matchers.hasItem(fakeUberRDotJavaDex.getBuildTarget())));
}
Also used : RType(com.facebook.buck.android.aapt.RDotTxtEntry.RType) TargetGraph(com.facebook.buck.rules.TargetGraph) FakeBuildRuleParamsBuilder(com.facebook.buck.rules.FakeBuildRuleParamsBuilder) BuildRuleResolver(com.facebook.buck.rules.BuildRuleResolver) BuildTarget(com.facebook.buck.model.BuildTarget) FakeBuildRule(com.facebook.buck.rules.FakeBuildRule) BuildRule(com.facebook.buck.rules.BuildRule) DefaultTargetNodeToBuildRuleTransformer(com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer) FakeSourcePath(com.facebook.buck.rules.FakeSourcePath) HasJavaClassHashes(com.facebook.buck.jvm.core.HasJavaClassHashes) FakeProjectFilesystem(com.facebook.buck.testutil.FakeProjectFilesystem) PathSourcePath(com.facebook.buck.rules.PathSourcePath) SourcePathRuleFinder(com.facebook.buck.rules.SourcePathRuleFinder) ExopackageMode(com.facebook.buck.android.AndroidBinary.ExopackageMode) BuildRuleParams(com.facebook.buck.rules.BuildRuleParams) JavaLibrary(com.facebook.buck.jvm.java.JavaLibrary) Test(org.junit.Test)

Example 3 with FakeSourcePath

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

the class AndroidBinaryGraphEnhancerTest method testResourceRulesDependOnRulesBehindResourceSourcePaths.

@Test
public void testResourceRulesDependOnRulesBehindResourceSourcePaths() throws Exception {
    BuildRuleResolver ruleResolver = new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
    SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(ruleResolver);
    SourcePathResolver pathResolver = new SourcePathResolver(ruleFinder);
    FakeBuildRule resourcesDep = ruleResolver.addToIndex(new FakeBuildRule(BuildTargetFactory.newInstance("//:resource_dep"), pathResolver));
    resourcesDep.setOutputFile("foo");
    AndroidResource resource = ruleResolver.addToIndex(new AndroidResource(new FakeBuildRuleParamsBuilder("//:resources").build().copyAppendingExtraDeps(ImmutableSortedSet.of(resourcesDep)), ruleFinder, ImmutableSortedSet.of(), resourcesDep.getSourcePathToOutput(), ImmutableSortedMap.of(), null, null, ImmutableSortedMap.of(), new FakeSourcePath("manifest"), false));
    // set it up.
    BuildTarget target = BuildTargetFactory.newInstance("//:target");
    BuildRuleParams originalParams = new FakeBuildRuleParamsBuilder(target).setDeclaredDeps(ImmutableSortedSet.of(resource)).build();
    AndroidBinaryGraphEnhancer graphEnhancer = new AndroidBinaryGraphEnhancer(originalParams, ruleResolver, ResourcesFilter.ResourceCompressionMode.ENABLED_WITH_STRINGS_AS_ASSETS, FilterResourcesStep.ResourceFilter.EMPTY_FILTER, /* bannedDuplicateResourceTypes */
    EnumSet.noneOf(RType.class), Optional.empty(), /* locales */
    ImmutableSet.of(), new FakeSourcePath("AndroidManifest.xml"), AndroidBinary.PackageType.DEBUG, /* cpuFilters */
    ImmutableSet.of(), /* shouldBuildStringSourceMap */
    false, /* shouldPreDex */
    false, BuildTargets.getScratchPath(originalParams.getProjectFilesystem(), target, "%s/classes.dex"), DexSplitMode.NO_SPLIT, /* buildRulesToExcludeFromDex */
    ImmutableSet.of(), /* resourcesToExclude */
    ImmutableSet.of(), /* skipCrunchPngs */
    false, /* includesVectorDrawables */
    false, ANDROID_JAVAC_OPTIONS, EnumSet.of(ExopackageMode.SECONDARY_DEX), /* buildConfigValues */
    BuildConfigFields.empty(), /* buildConfigValuesFiles */
    Optional.empty(), /* xzCompressionLevel */
    Optional.empty(), /* trimResourceIds */
    false, /* keepResourcePattern */
    Optional.empty(), /* nativePlatforms */
    ImmutableMap.of(), /* nativeLibraryMergeMap */
    Optional.empty(), /* nativeLibraryMergeGlue */
    Optional.empty(), /* nativeLibraryMergeCodeGenerator */
    Optional.empty(), AndroidBinary.RelinkerMode.DISABLED, MoreExecutors.newDirectExecutorService(), /* manifestEntries */
    ManifestEntries.empty(), CxxPlatformUtils.DEFAULT_CONFIG, new APKModuleGraph(TargetGraph.EMPTY, originalParams.getBuildTarget(), Optional.empty()), new DxConfig(FakeBuckConfig.builder().build()));
    graphEnhancer.createAdditionalBuildables();
    ResourcesFilter resourcesFilter = findRuleOfType(ruleResolver, ResourcesFilter.class);
    MoreAsserts.assertDepends("ResourcesFilter must depend on rules behind resources source paths", resourcesFilter, resourcesDep);
}
Also used : FakeSourcePath(com.facebook.buck.rules.FakeSourcePath) RType(com.facebook.buck.android.aapt.RDotTxtEntry.RType) FakeBuildRuleParamsBuilder(com.facebook.buck.rules.FakeBuildRuleParamsBuilder) SourcePathRuleFinder(com.facebook.buck.rules.SourcePathRuleFinder) SourcePathResolver(com.facebook.buck.rules.SourcePathResolver) BuildRuleResolver(com.facebook.buck.rules.BuildRuleResolver) BuildRuleParams(com.facebook.buck.rules.BuildRuleParams) FakeBuildRule(com.facebook.buck.rules.FakeBuildRule) BuildTarget(com.facebook.buck.model.BuildTarget) DefaultTargetNodeToBuildRuleTransformer(com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer) Test(org.junit.Test)

Example 4 with FakeSourcePath

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

the class APKModuleTest method testAPKModuleGraphSimple.

/*
                          + - - - - - -+
                        ' root:      '
                        '            '
                        ' +--------+ '
        +-------------- ' | Binary | ' --------+
        |               ' +--------+ '         |
        |               '   |        '         |
        |               '   |        '         |
        v               '   |        '         v
    + - - - - - - +     '   |        '     +- - - - - +
    ' android:    '     '   |        '     ' java:    '
    '             '     '   |        '     '          '
    ' +---------+ '     '   |        '     ' +------+ '
    ' | Android | '     '   |        '     ' | Java | '
    ' +---------+ '     '   |        '     ' +------+ '
    '             '     '   |        '     '          '
    + - - - - - - +     '   |        '     +- - - - - +
        |               '   |        '         |
        |               '   |        '         |
        |               '   v        '         |
        |               ' +--------+ '         |
        +-------------> ' | Common | ' <-------+
                        ' +--------+ '
                        '            '
                        + - - - - - -+
   */
@Test
public void testAPKModuleGraphSimple() throws Exception {
    ImmutableSet.Builder<TargetNode<?, ?>> nodeBuilder = ImmutableSet.builder();
    BuildTarget commonLibraryTarget = BuildTargetFactory.newInstance("//src/com/facebook/test-common-library:test-common-library");
    nodeBuilder.add(AndroidLibraryBuilder.createBuilder(commonLibraryTarget).addSrc(Paths.get("src/com/facebook/TestCommonLibrary.java")).build());
    BuildTarget javaLibraryTarget = BuildTargetFactory.newInstance("//src/com/facebook/test-java-library:test-java-library").withFlavors(InternalFlavor.of("flavor"));
    nodeBuilder.add(JavaLibraryBuilder.createBuilder(javaLibraryTarget).addSrc(Paths.get("src/com/facebook/TestJavaLibrary.java")).addDep(commonLibraryTarget).build());
    BuildTarget androidLibraryTarget = BuildTargetFactory.newInstance("//src/com/facebook/test-android-library:test-android-library");
    nodeBuilder.add(AndroidLibraryBuilder.createBuilder(androidLibraryTarget).addSrc(Paths.get("src/com/facebook/TestAndroidLibrary.java")).addDep(commonLibraryTarget).build());
    BuildTarget keystoreTarget = BuildTargetFactory.newInstance("//:keystore");
    nodeBuilder.add(KeystoreBuilder.createBuilder(keystoreTarget).setStore(new FakeSourcePath("debug.keystore")).setProperties(new FakeSourcePath("keystore.properties")).build());
    BuildTarget androidBinaryTarget = BuildTargetFactory.newInstance("//src/com/facebook/test-android-binary:test-android-binary");
    nodeBuilder.add(AndroidBinaryBuilder.createBuilder(androidBinaryTarget).setManifest(new FakeSourcePath("AndroidManifest.xml")).setKeystore(keystoreTarget).setOriginalDeps(ImmutableSortedSet.of(androidLibraryTarget, javaLibraryTarget, commonLibraryTarget)).build());
    TargetGraph graph = TargetGraphFactory.newInstance(nodeBuilder.build());
    Set<BuildTarget> seedTargets = new HashSet<>();
    seedTargets.add(androidLibraryTarget);
    seedTargets.add(javaLibraryTarget);
    APKModuleGraph dag = new APKModuleGraph(graph, androidBinaryTarget, Optional.of(seedTargets));
    ImmutableSet<APKModule> topLevelNodes = dag.getGraph().getNodesWithNoIncomingEdges();
    assertThat(topLevelNodes.size(), is(2));
    for (APKModule apkModule : topLevelNodes) {
        assertThat(apkModule.getName(), oneOf("src.com.facebook.test.android.library", "src.com.facebook.test.java.library.test.java.library.flavor"));
        ImmutableSet<APKModule> dependencies = dag.getGraph().getOutgoingNodesFor(apkModule);
        assertThat(apkModule.isRootModule(), is(false));
        assertThat(dependencies.size(), is(1));
        assertThat(Iterables.getFirst(dependencies, null).getName(), is(APKModuleGraph.ROOT_APKMODULE_NAME));
        assertThat(Iterables.getFirst(dependencies, null).isRootModule(), is(true));
    }
    assertThat(dag.getAPKModules().stream().map(APKModule::getName).collect(MoreCollectors.toImmutableSet()), containsInAnyOrder("dex", "src.com.facebook.test.android.library", "src.com.facebook.test.java.library.test.java.library.flavor"));
}
Also used : FakeSourcePath(com.facebook.buck.rules.FakeSourcePath) TargetNode(com.facebook.buck.rules.TargetNode) ImmutableSet(com.google.common.collect.ImmutableSet) BuildTarget(com.facebook.buck.model.BuildTarget) TargetGraph(com.facebook.buck.rules.TargetGraph) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 5 with FakeSourcePath

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

the class AndroidBinaryTest method testGetUnsignedApkPath.

@Test
public void testGetUnsignedApkPath() throws Exception {
    BuildRuleResolver ruleResolver = new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
    SourcePathResolver pathResolver = new SourcePathResolver(new SourcePathRuleFinder(ruleResolver));
    Keystore keystore = addKeystoreRule(ruleResolver);
    BuildTarget targetInRootDirectory = BuildTargetFactory.newInstance("//:fb4a");
    AndroidBinary ruleInRootDirectory = AndroidBinaryBuilder.createBuilder(targetInRootDirectory).setManifest(new FakeSourcePath("AndroidManifest.xml")).setKeystore(keystore.getBuildTarget()).build(ruleResolver);
    assertEquals(BuildTargets.getGenPath(ruleInRootDirectory.getProjectFilesystem(), targetInRootDirectory, "%s.apk"), pathResolver.getRelativePath(ruleInRootDirectory.getApkInfo().getApkPath()));
    BuildTarget targetInNonRootDirectory = BuildTargetFactory.newInstance("//java/com/example:fb4a");
    AndroidBinary ruleInNonRootDirectory = AndroidBinaryBuilder.createBuilder(targetInNonRootDirectory).setManifest(new FakeSourcePath("AndroidManifest.xml")).setKeystore(keystore.getBuildTarget()).build(ruleResolver);
    assertEquals(BuildTargets.getGenPath(ruleInNonRootDirectory.getProjectFilesystem(), targetInNonRootDirectory, "%s.apk"), pathResolver.getRelativePath(ruleInNonRootDirectory.getApkInfo().getApkPath()));
}
Also used : Keystore(com.facebook.buck.jvm.java.Keystore) FakeSourcePath(com.facebook.buck.rules.FakeSourcePath) BuildTarget(com.facebook.buck.model.BuildTarget) DefaultTargetNodeToBuildRuleTransformer(com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer) SourcePathResolver(com.facebook.buck.rules.SourcePathResolver) SourcePathRuleFinder(com.facebook.buck.rules.SourcePathRuleFinder) BuildRuleResolver(com.facebook.buck.rules.BuildRuleResolver) Test(org.junit.Test)

Aggregations

FakeSourcePath (com.facebook.buck.rules.FakeSourcePath)318 Test (org.junit.Test)297 BuildRuleResolver (com.facebook.buck.rules.BuildRuleResolver)188 DefaultTargetNodeToBuildRuleTransformer (com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer)188 BuildTarget (com.facebook.buck.model.BuildTarget)182 SourcePathRuleFinder (com.facebook.buck.rules.SourcePathRuleFinder)116 SourcePathResolver (com.facebook.buck.rules.SourcePathResolver)104 SourcePath (com.facebook.buck.rules.SourcePath)90 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)85 TargetGraph (com.facebook.buck.rules.TargetGraph)84 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)68 Path (java.nio.file.Path)67 BuildRule (com.facebook.buck.rules.BuildRule)52 PathSourcePath (com.facebook.buck.rules.PathSourcePath)48 DefaultBuildTargetSourcePath (com.facebook.buck.rules.DefaultBuildTargetSourcePath)46 PBXTarget (com.facebook.buck.apple.xcode.xcodeproj.PBXTarget)45 FakeBuildRuleParamsBuilder (com.facebook.buck.rules.FakeBuildRuleParamsBuilder)45 BuildRuleParams (com.facebook.buck.rules.BuildRuleParams)35 CxxLibraryBuilder (com.facebook.buck.cxx.CxxLibraryBuilder)25 NSString (com.dd.plist.NSString)24