Update android_binary to take a SourcePath for its manifest parameter. Summary: In practice, we have been using genfile() to use a generated file as a manifest for an android_binary(). This relaxes android_binary() to accept a SourcePath, which will help us start to do away with genfile(). Test Plan: Sandcastle builds.
diff --git a/src/com/facebook/buck/android/AndroidBinaryBuildRuleFactory.java b/src/com/facebook/buck/android/AndroidBinaryBuildRuleFactory.java index 3a20be3..fa804cf 100644 --- a/src/com/facebook/buck/android/AndroidBinaryBuildRuleFactory.java +++ b/src/com/facebook/buck/android/AndroidBinaryBuildRuleFactory.java
@@ -38,9 +38,7 @@ protected void amendBuilder(AndroidBinaryRule.Builder builder, BuildRuleFactoryParams params) throws NoSuchBuildTargetException { // manifest - String manifestAttribute = params.getRequiredStringAttribute("manifest"); - String manifestPath = params.resolveFilePathRelativeToBuildFileDirectory(manifestAttribute); - builder.setManifest(manifestPath); + builder.setManifest(params.getRequiredSourcePath("manifest", builder)); // target String target = params.getRequiredStringAttribute("target");
diff --git a/src/com/facebook/buck/android/AndroidBinaryRule.java b/src/com/facebook/buck/android/AndroidBinaryRule.java index f6ece50..e5a1bc3 100644 --- a/src/com/facebook/buck/android/AndroidBinaryRule.java +++ b/src/com/facebook/buck/android/AndroidBinaryRule.java
@@ -40,10 +40,10 @@ import com.facebook.buck.rules.BuildableProperties; import com.facebook.buck.rules.DependencyGraph; import com.facebook.buck.rules.DoNotUseAbstractBuildable; -import com.facebook.buck.rules.FileSourcePath; import com.facebook.buck.rules.InstallableBuildRule; import com.facebook.buck.rules.RuleKey; import com.facebook.buck.rules.SourcePath; +import com.facebook.buck.rules.SourcePaths; import com.facebook.buck.shell.AbstractGenruleStep; import com.facebook.buck.shell.EchoStep; import com.facebook.buck.shell.SymlinkFilesIntoDirectoryStep; @@ -59,6 +59,7 @@ import com.facebook.buck.util.DirectoryTraverser; import com.facebook.buck.util.HumanReadableException; import com.facebook.buck.util.MorePaths; +import com.facebook.buck.util.Optionals; import com.facebook.buck.zip.RepackZipEntriesStep; import com.facebook.buck.zip.ZipDirectoryWithMaxDeflateStep; import com.google.common.annotations.VisibleForTesting; @@ -168,7 +169,7 @@ } } - private final String manifest; + private final SourcePath manifest; private final String target; private final ImmutableSortedSet<BuildRule> classpathDeps; private final Keystore keystore; @@ -209,7 +210,7 @@ */ protected AndroidBinaryRule( BuildRuleParams buildRuleParams, - String manifest, + SourcePath manifest, String target, ImmutableSortedSet<BuildRule> classpathDeps, Keystore keystore, @@ -270,7 +271,7 @@ @Override public RuleKey.Builder appendToRuleKey(RuleKey.Builder builder) throws IOException { super.appendToRuleKey(builder) - .set("manifest", manifest) + .set("manifest", manifest.asReference()) .set("target", target) .set("keystore", keystore.getBuildTarget().getFullyQualifiedName()) .setRuleNames("classpathDeps", classpathDeps) @@ -424,16 +425,13 @@ @Override public List<String> getInputsToCompareToOutput() { - ImmutableList.Builder<String> inputs = ImmutableList.builder(); - inputs.add(manifest); - if (proguardConfig.isPresent()) { - SourcePath sourcePath = proguardConfig.get(); - // Alternatively, if it is a BuildTargetSourcePath, then it should not be included. - if (sourcePath instanceof FileSourcePath) { - inputs.add(sourcePath.asReference()); - } - } + ImmutableList.Builder<SourcePath> sourcePaths = ImmutableList.builder(); + sourcePaths.add(manifest); + Optionals.addIfPresent(proguardConfig, sourcePaths); + + ImmutableList.Builder<String> inputs = ImmutableList.builder(); + inputs.addAll(SourcePaths.filterInputsToCompareToOutput(sourcePaths.build())); return inputs.build(); } @@ -476,7 +474,8 @@ // Symlink the manifest to a path named AndroidManifest.xml. Do this before running any other // commands to ensure that it is available at the desired path. - steps.add(new MkdirAndSymlinkFileStep(getManifest(), getAndroidManifestXml())); + steps.add(new MkdirAndSymlinkFileStep(getManifest().resolve(context).toString(), + getAndroidManifestXml())); final AndroidTransitiveDependencies transitiveDependencies = findTransitiveDependencies( context.getDependencyGraph()); @@ -1184,7 +1183,7 @@ * AndroidManifest.xml. */ @Override - public String getManifest() { + public SourcePath getManifest() { return manifest; } @@ -1229,7 +1228,7 @@ public static class Builder extends AbstractBuildRuleBuilder<AndroidBinaryRule> { private static final PackageType DEFAULT_PACKAGE_TYPE = PackageType.DEBUG; - private String manifest; + private SourcePath manifest; private String target; /** This should always be a subset of {@link #getDeps()}. */ @@ -1352,7 +1351,7 @@ return this; } - public Builder setManifest(String manifest) { + public Builder setManifest(SourcePath manifest) { this.manifest = manifest; return this; }
diff --git a/src/com/facebook/buck/android/AndroidInstrumentationApk.java b/src/com/facebook/buck/android/AndroidInstrumentationApk.java index bb5bd03..356b035 100644 --- a/src/com/facebook/buck/android/AndroidInstrumentationApk.java +++ b/src/com/facebook/buck/android/AndroidInstrumentationApk.java
@@ -28,6 +28,7 @@ import com.facebook.buck.rules.DependencyGraph; import com.facebook.buck.rules.InstallableBuildRule; import com.facebook.buck.rules.RuleKey; +import com.facebook.buck.rules.SourcePath; import com.facebook.buck.util.HumanReadableException; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; @@ -55,7 +56,7 @@ private final ImmutableSortedSet<BuildRule> classpathDepsForInstrumentationApk; private AndroidInstrumentationApk(BuildRuleParams buildRuleParams, - String manifest, + SourcePath manifest, AndroidBinaryRule apkUnderTest, ImmutableSortedSet<BuildRule> classpathDepsForInstrumentationApk) { super(buildRuleParams, @@ -129,7 +130,7 @@ public static class Builder extends AbstractBuildRuleBuilder<AndroidInstrumentationApk> { - private String manifest = null; + private SourcePath manifest = null; private BuildTarget apk = null; /** This should always be a subset of {@link #getDeps()}. */ @@ -160,7 +161,7 @@ getBuildTargetsAsBuildRules(ruleResolver, classpathDeps.build())); } - public Builder setManifest(String manifest) { + public Builder setManifest(SourcePath manifest) { this.manifest = manifest; return this; }
diff --git a/src/com/facebook/buck/android/AndroidInstrumentationApkRuleFactory.java b/src/com/facebook/buck/android/AndroidInstrumentationApkRuleFactory.java index 04e4a43..2576e7e 100644 --- a/src/com/facebook/buck/android/AndroidInstrumentationApkRuleFactory.java +++ b/src/com/facebook/buck/android/AndroidInstrumentationApkRuleFactory.java
@@ -17,10 +17,10 @@ package com.facebook.buck.android; import com.facebook.buck.model.BuildTarget; -import com.facebook.buck.rules.AbstractBuildRuleFactory; -import com.facebook.buck.rules.BuildRuleFactoryParams; import com.facebook.buck.parser.NoSuchBuildTargetException; import com.facebook.buck.rules.AbstractBuildRuleBuilderParams; +import com.facebook.buck.rules.AbstractBuildRuleFactory; +import com.facebook.buck.rules.BuildRuleFactoryParams; public class AndroidInstrumentationApkRuleFactory extends AbstractBuildRuleFactory<AndroidInstrumentationApk.Builder> { @@ -34,9 +34,7 @@ protected void amendBuilder(AndroidInstrumentationApk.Builder builder, BuildRuleFactoryParams params) throws NoSuchBuildTargetException { // manifest - String manifestAttribute = params.getRequiredStringAttribute("manifest"); - String manifestPath = params.resolveFilePathRelativeToBuildFileDirectory(manifestAttribute); - builder.setManifest(manifestPath); + builder.setManifest(params.getRequiredSourcePath("manifest", builder)); // apk String apk = params.getRequiredStringAttribute("apk");
diff --git a/src/com/facebook/buck/android/ApkGenrule.java b/src/com/facebook/buck/android/ApkGenrule.java index 839db09..926ca14 100644 --- a/src/com/facebook/buck/android/ApkGenrule.java +++ b/src/com/facebook/buck/android/ApkGenrule.java
@@ -27,6 +27,7 @@ import com.facebook.buck.rules.BuildableProperties; import com.facebook.buck.rules.InstallableBuildRule; import com.facebook.buck.rules.RuleKey; +import com.facebook.buck.rules.SourcePath; import com.facebook.buck.shell.Genrule; import com.facebook.buck.step.ExecutionContext; import com.facebook.buck.util.HumanReadableException; @@ -100,7 +101,7 @@ } @Override - public String getManifest() { + public SourcePath getManifest() { return apk.getManifest(); }
diff --git a/src/com/facebook/buck/cli/InstallCommand.java b/src/com/facebook/buck/cli/InstallCommand.java index 821bee5..cabfa0e 100644 --- a/src/com/facebook/buck/cli/InstallCommand.java +++ b/src/com/facebook/buck/cli/InstallCommand.java
@@ -24,6 +24,7 @@ import com.android.ddmlib.TimeoutException; import com.facebook.buck.command.Build; import com.facebook.buck.event.LogEvent; +import com.facebook.buck.rules.BuildContext; import com.facebook.buck.rules.BuildRule; import com.facebook.buck.rules.DependencyGraph; import com.facebook.buck.rules.InstallableBuildRule; @@ -83,7 +84,8 @@ // Uninstall the app first, if requested. if (options.shouldUninstallFirst()) { - String packageName = tryToExtractPackageNameFromManifest(installableBuildRule); + String packageName = tryToExtractPackageNameFromManifest(installableBuildRule, + build.getBuildContext().getDependencyGraph()); uninstallApk(packageName, options.adbOptions(), options.targetDeviceOptions(), @@ -99,7 +101,10 @@ // We've installed the application successfully. // Is either of --activity or --run present? if (options.shouldStartActivity()) { - exitCode = startActivity(installableBuildRule, options.getActivityToStart(), options, + exitCode = startActivity(installableBuildRule, + options.getActivityToStart(), + options, + build.getBuildContext(), build.getExecutionContext()); if (exitCode != 0) { return exitCode; @@ -109,12 +114,15 @@ return exitCode; } - private int startActivity(InstallableBuildRule androidBinaryRule, String activity, - InstallCommandOptions options, ExecutionContext context) throws IOException { + private int startActivity(InstallableBuildRule androidBinaryRule, + String activity, + InstallCommandOptions options, + BuildContext buildContext, + ExecutionContext context) throws IOException { // Might need the package name and activities from the AndroidManifest. - AndroidManifestReader reader = DefaultAndroidManifestReader.forPath( - androidBinaryRule.getManifest()); + String pathToManifest = androidBinaryRule.getManifest().resolve(buildContext).toString(); + AndroidManifestReader reader = DefaultAndroidManifestReader.forPath(pathToManifest); if (activity == null) { // Get list of activities that show up in the launcher.
diff --git a/src/com/facebook/buck/cli/UninstallCommand.java b/src/com/facebook/buck/cli/UninstallCommand.java index 6b264b3..d97553d 100644 --- a/src/com/facebook/buck/cli/UninstallCommand.java +++ b/src/com/facebook/buck/cli/UninstallCommand.java
@@ -86,7 +86,8 @@ ExecutionContext context = createExecutionContext(options, dependencyGraph); // Find application package name from manifest and uninstall from matching devices. - String appId = tryToExtractPackageNameFromManifest(installableBuildRule); + String appId = tryToExtractPackageNameFromManifest(installableBuildRule, + dependencyGraph); return uninstallApk(appId, options.adbOptions(), options.targetDeviceOptions(),
diff --git a/src/com/facebook/buck/cli/UninstallSupportCommandRunner.java b/src/com/facebook/buck/cli/UninstallSupportCommandRunner.java index 8653018..35af8ea 100644 --- a/src/com/facebook/buck/cli/UninstallSupportCommandRunner.java +++ b/src/com/facebook/buck/cli/UninstallSupportCommandRunner.java
@@ -23,6 +23,7 @@ import com.android.ddmlib.ShellCommandUnresponsiveException; import com.android.ddmlib.TimeoutException; import com.facebook.buck.cli.UninstallCommandOptions.UninstallOptions; +import com.facebook.buck.rules.DependencyGraph; import com.facebook.buck.rules.InstallableBuildRule; import com.facebook.buck.step.ExecutionContext; import com.facebook.buck.util.DefaultAndroidManifestReader; @@ -148,8 +149,9 @@ } } - String tryToExtractPackageNameFromManifest(InstallableBuildRule androidBinaryRule) { - String pathToManifest = androidBinaryRule.getManifest(); + String tryToExtractPackageNameFromManifest(InstallableBuildRule androidBinaryRule, + DependencyGraph dependencyGraph) { + String pathToManifest = androidBinaryRule.getManifest().resolve(dependencyGraph).toString(); // Note that the file may not exist if AndroidManifest.xml is a generated file. File androidManifestXml = new File(pathToManifest);
diff --git a/src/com/facebook/buck/rules/BuildRuleFactoryParams.java b/src/com/facebook/buck/rules/BuildRuleFactoryParams.java index 3deceb7..34d3018 100644 --- a/src/com/facebook/buck/rules/BuildRuleFactoryParams.java +++ b/src/com/facebook/buck/rules/BuildRuleFactoryParams.java
@@ -232,6 +232,17 @@ } /** + * @param identifier for the argument in this params. + * @param builder If the value associated with {@code identifier} corresponds to a + * {@link BuildTarget}, that build target will be added to the {@code deps} of this builder. + * @return a source path that corresponds to the specified {@code identifier}. + */ + public SourcePath getRequiredSourcePath(String identifier, AbstractBuildRuleBuilder<?> builder) { + String resource = getRequiredStringAttribute(identifier); + return asSourcePath(resource, builder); + } + + /** * @param resource that identifies either a file path or a build target. * @param builder If {@code resource} corresponds to a {@link BuildTarget}, that build target will * be added to the {@code deps} of this builder.
diff --git a/src/com/facebook/buck/rules/BuildTargetSourcePath.java b/src/com/facebook/buck/rules/BuildTargetSourcePath.java index f90dd2f..3dc3d8b 100644 --- a/src/com/facebook/buck/rules/BuildTargetSourcePath.java +++ b/src/com/facebook/buck/rules/BuildTargetSourcePath.java
@@ -36,7 +36,12 @@ @Override public Path resolve(BuildContext context) { - BuildRule rule = context.getDependencyGraph().findBuildRuleByTarget(buildTarget); + return resolve(context.getDependencyGraph()); + } + + @Override + public Path resolve(DependencyGraph graph) { + BuildRule rule = graph.findBuildRuleByTarget(buildTarget); if (rule == null) { throw new HumanReadableException("Cannot resolve: %s", buildTarget); }
diff --git a/src/com/facebook/buck/rules/FileSourcePath.java b/src/com/facebook/buck/rules/FileSourcePath.java index ad808a7..f44fcd6 100644 --- a/src/com/facebook/buck/rules/FileSourcePath.java +++ b/src/com/facebook/buck/rules/FileSourcePath.java
@@ -34,6 +34,11 @@ } @Override + public Path resolve(DependencyGraph graph) { + return Paths.get(relativePath); + } + + @Override public String asReference() { return relativePath; }
diff --git a/src/com/facebook/buck/rules/InstallableBuildRule.java b/src/com/facebook/buck/rules/InstallableBuildRule.java index cca3ebb..7e2b81e 100644 --- a/src/com/facebook/buck/rules/InstallableBuildRule.java +++ b/src/com/facebook/buck/rules/InstallableBuildRule.java
@@ -21,7 +21,7 @@ /** * @return The manifest file for this build rule. */ - public String getManifest(); + public SourcePath getManifest(); /** * @return The APK at this path is the final one that points to an APK that a user should
diff --git a/src/com/facebook/buck/rules/SourcePath.java b/src/com/facebook/buck/rules/SourcePath.java index 2e10249..cd84465 100644 --- a/src/com/facebook/buck/rules/SourcePath.java +++ b/src/com/facebook/buck/rules/SourcePath.java
@@ -41,6 +41,8 @@ */ public Path resolve(BuildContext context); + public Path resolve(DependencyGraph graph); + /** * @return a representation of path in a stable manner that does not involve calling {#resolve()} */
diff --git a/test/com/facebook/buck/android/AndroidBinaryRuleTest.java b/test/com/facebook/buck/android/AndroidBinaryRuleTest.java index a75bc26..26277f4 100644 --- a/test/com/facebook/buck/android/AndroidBinaryRuleTest.java +++ b/test/com/facebook/buck/android/AndroidBinaryRuleTest.java
@@ -99,7 +99,7 @@ .addClasspathDep(libraryTwo.getBuildTarget()) .addBuildRuleToExcludeFromDex( BuildTargetFactory.newInstance("//java/src/com/facebook/base:libraryTwo")) - .setManifest("java/src/com/facebook/base/AndroidManifest.xml") + .setManifest(new FileSourcePath("java/src/com/facebook/base/AndroidManifest.xml")) .setTarget("Google Inc.:Google APIs:16") .setKeystore(addKeystoreRule(ruleResolver)) .setPackageType("debug")); @@ -177,7 +177,7 @@ .setBuildTarget(binaryBuildTarget) .addClasspathDep(libraryOne.getBuildTarget()) .addClasspathDep(libraryTwo.getBuildTarget()) - .setManifest("java/src/com/facebook/base/AndroidManifest.xml") + .setManifest(new FileSourcePath("java/src/com/facebook/base/AndroidManifest.xml")) .setTarget("Google Inc.:Google APIs:16") .setKeystore(addKeystoreRule(ruleResolver)) .setPackageType("debug")); @@ -236,7 +236,7 @@ .setBuildTarget(binaryBuildTarget) .addClasspathDep(libraryOne.getBuildTarget()) .addClasspathDep(libraryTwo.getBuildTarget()) - .setManifest("java/src/com/facebook/base/AndroidManifest.xml") + .setManifest(new FileSourcePath("java/src/com/facebook/base/AndroidManifest.xml")) .setTarget("Google Inc.:Google APIs:16") .setKeystore(addKeystoreRule(ruleResolver)) .setPackageType("debug")); @@ -306,7 +306,7 @@ .setBuildTarget(binaryBuildTarget) .addClasspathDep(libraryOne.getBuildTarget()) .addClasspathDep(libraryTwo.getBuildTarget()) - .setManifest("java/src/com/facebook/base/AndroidManifest.xml") + .setManifest(new FileSourcePath("java/src/com/facebook/base/AndroidManifest.xml")) .setTarget("Google Inc.:Google APIs:16") .setKeystore(addKeystoreRule(ruleResolver)) .setPackageType("debug")); @@ -413,7 +413,7 @@ AndroidBinaryRule.Builder androidBinaryRuleBuilder = AndroidBinaryRule .newAndroidBinaryRuleBuilder(new FakeAbstractBuildRuleBuilderParams()) .setBuildTarget(BuildTargetFactory.newInstance("//java/src/com/facebook:app")) - .setManifest("java/src/com/facebook/AndroidManifest.xml") + .setManifest(new FileSourcePath("java/src/com/facebook/AndroidManifest.xml")) .setTarget("Google Inc.:Google APIs:16") .setKeystore(addKeystoreRule(ruleResolver)); @@ -448,7 +448,7 @@ AndroidBinaryRule ruleInRootDirectory = ruleResolver.buildAndAddToIndex( AndroidBinaryRule.newAndroidBinaryRuleBuilder(new FakeAbstractBuildRuleBuilderParams()) .setBuildTarget(BuildTargetFactory.newInstance("//:fb4a")) - .setManifest("AndroidManifest.xml") + .setManifest(new FileSourcePath("AndroidManifest.xml")) .setKeystore(keystoreTarget) .setTarget("Google Inc.:Google APIs:16")); assertEquals(GEN_DIR + "/fb4a.apk", ruleInRootDirectory.getApkPath()); @@ -456,7 +456,7 @@ AndroidBinaryRule ruleInNonRootDirectory = ruleResolver.buildAndAddToIndex( AndroidBinaryRule.newAndroidBinaryRuleBuilder(new FakeAbstractBuildRuleBuilderParams()) .setBuildTarget(BuildTargetFactory.newInstance("//java/com/example:fb4a")) - .setManifest("AndroidManifest.xml") + .setManifest(new FileSourcePath("AndroidManifest.xml")) .setKeystore(keystoreTarget) .setTarget("Google Inc.:Google APIs:16")); assertEquals(GEN_DIR + "/java/com/example/fb4a.apk", ruleInNonRootDirectory.getApkPath()); @@ -469,7 +469,7 @@ AndroidBinaryRule rule = ruleResolver.buildAndAddToIndex( AndroidBinaryRule.newAndroidBinaryRuleBuilder(new FakeAbstractBuildRuleBuilderParams()) .setBuildTarget(BuildTargetFactory.newInstance("//:fbandroid_with_dash_debug_fbsign")) - .setManifest("AndroidManifest.xml") + .setManifest(new FileSourcePath("AndroidManifest.xml")) .setKeystore(addKeystoreRule(ruleResolver)) .setTarget("Google Inc.:Google APIs:16")); @@ -499,7 +499,7 @@ AndroidBinaryRule splitDexRule = ruleResolver.buildAndAddToIndex( AndroidBinaryRule.newAndroidBinaryRuleBuilder(new FakeAbstractBuildRuleBuilderParams()) .setBuildTarget(BuildTargetFactory.newInstance("//:fbandroid_with_dash_debug_fbsign")) - .setManifest("AndroidManifest.xml") + .setManifest(new FileSourcePath("AndroidManifest.xml")) .setKeystore(addKeystoreRule(ruleResolver)) .setTarget("Google Inc.:Google APIs:16") .setDexSplitMode(new DexSplitMode( @@ -571,7 +571,7 @@ AndroidBinaryRule.Builder builder = AndroidBinaryRule.newAndroidBinaryRuleBuilder( new FakeAbstractBuildRuleBuilderParams()) .setBuildTarget(BuildTargetFactory.newInstance("//:target")) - .setManifest("AndroidManifest.xml") + .setManifest(new FileSourcePath("AndroidManifest.xml")) .setKeystore(addKeystoreRule(resolver)) .setTarget("Google Inc:Google APIs:16") .setResourceFilter(new ResourceFilter(ImmutableList.<String>of("mdpi"))) @@ -623,7 +623,7 @@ AndroidBinaryRule.Builder builder = AndroidBinaryRule.newAndroidBinaryRuleBuilder( new FakeAbstractBuildRuleBuilderParams()) .setBuildTarget(BuildTargetFactory.newInstance("//:fbandroid_with_dash_debug_fbsign")) - .setManifest("AndroidManifest.xml") + .setManifest(new FileSourcePath("AndroidManifest.xml")) .setKeystore(addKeystoreRule(ruleResolver)) .setTarget("Google Inc:Google APIs:16");
diff --git a/test/com/facebook/buck/android/AndroidResourceRuleTest.java b/test/com/facebook/buck/android/AndroidResourceRuleTest.java index f403be9..2480d94 100644 --- a/test/com/facebook/buck/android/AndroidResourceRuleTest.java +++ b/test/com/facebook/buck/android/AndroidResourceRuleTest.java
@@ -28,6 +28,7 @@ import com.facebook.buck.rules.DependencyGraph; import com.facebook.buck.rules.FakeAbstractBuildRuleBuilderParams; import com.facebook.buck.rules.FakeBuildRuleParams; +import com.facebook.buck.rules.FileSourcePath; import com.facebook.buck.testutil.MoreAsserts; import com.facebook.buck.testutil.RuleMap; import com.google.common.collect.ImmutableList; @@ -150,7 +151,7 @@ AndroidBinaryRule e = ruleResolver.buildAndAddToIndex( AndroidBinaryRule.newAndroidBinaryRuleBuilder(new FakeAbstractBuildRuleBuilderParams()) .setBuildTarget(BuildTargetFactory.newInstance("//:e")) - .setManifest("AndroidManfiest.xml") + .setManifest(new FileSourcePath("AndroidManfiest.xml")) .setTarget("Google Inc.:Google APIs:16") .setKeystore(keystoreTarget) .addDep(BuildTargetFactory.newInstance("//:a"))
diff --git a/test/com/facebook/buck/android/AndroidTransitiveDependencyGraphTest.java b/test/com/facebook/buck/android/AndroidTransitiveDependencyGraphTest.java index c1de5ba..799f08c 100644 --- a/test/com/facebook/buck/android/AndroidTransitiveDependencyGraphTest.java +++ b/test/com/facebook/buck/android/AndroidTransitiveDependencyGraphTest.java
@@ -28,6 +28,7 @@ import com.facebook.buck.rules.BuildRuleResolver; import com.facebook.buck.rules.DependencyGraph; import com.facebook.buck.rules.FakeAbstractBuildRuleBuilderParams; +import com.facebook.buck.rules.FileSourcePath; import com.facebook.buck.testutil.RuleMap; import com.facebook.buck.util.BuckConstant; import com.google.common.collect.ImmutableSet; @@ -101,7 +102,7 @@ .addClasspathDep(libraryRule.getBuildTarget()) .addClasspathDep(manifestRule.getBuildTarget()) .addBuildRuleToExcludeFromDex(BuildTargetFactory.newInstance("//third_party/guava:guava")) - .setManifest("java/src/com/facebook/AndroidManifest.xml") + .setManifest(new FileSourcePath("java/src/com/facebook/AndroidManifest.xml")) .setTarget("Google Inc.:Google APIs:16") .setKeystore(keystoreTarget)); @@ -182,7 +183,7 @@ AndroidBinaryRule androidBinaryRule = ruleResolver.buildAndAddToIndex( AndroidBinaryRule.newAndroidBinaryRuleBuilder(new FakeAbstractBuildRuleBuilderParams()) .setBuildTarget(new BuildTarget("//apps/sample", "app")) - .setManifest("apps/sample/AndroidManifest.xml") + .setManifest(new FileSourcePath("apps/sample/AndroidManifest.xml")) .setTarget("Google Inc.:Google APIs:16") .setKeystore(keystoreTarget) .addClasspathDep(androidLibraryTarget));
diff --git a/test/com/facebook/buck/android/ApkGenruleTest.java b/test/com/facebook/buck/android/ApkGenruleTest.java index fb3276a..097e3b3 100644 --- a/test/com/facebook/buck/android/ApkGenruleTest.java +++ b/test/com/facebook/buck/android/ApkGenruleTest.java
@@ -26,19 +26,20 @@ import com.facebook.buck.model.BuildTarget; import com.facebook.buck.model.BuildTargetFactory; import com.facebook.buck.model.BuildTargetPattern; -import com.facebook.buck.rules.BuildRuleFactoryParams; import com.facebook.buck.parser.BuildTargetParser; import com.facebook.buck.parser.NoSuchBuildTargetException; -import com.facebook.buck.rules.NonCheckingBuildRuleFactoryParams; import com.facebook.buck.parser.ParseContext; import com.facebook.buck.rules.ArtifactCache; import com.facebook.buck.rules.BuildContext; +import com.facebook.buck.rules.BuildRuleFactoryParams; import com.facebook.buck.rules.BuildRuleResolver; import com.facebook.buck.rules.BuildRuleType; import com.facebook.buck.rules.DependencyGraph; import com.facebook.buck.rules.FakeAbstractBuildRuleBuilderParams; import com.facebook.buck.rules.FakeBuildableContext; +import com.facebook.buck.rules.FileSourcePath; import com.facebook.buck.rules.JavaPackageFinder; +import com.facebook.buck.rules.NonCheckingBuildRuleFactoryParams; import com.facebook.buck.shell.ShellStep; import com.facebook.buck.step.ExecutionContext; import com.facebook.buck.step.Step; @@ -99,7 +100,7 @@ ruleResolver.buildAndAddToIndex( AndroidBinaryRule.newAndroidBinaryRuleBuilder(new FakeAbstractBuildRuleBuilderParams()) .setBuildTarget(BuildTargetFactory.newInstance("//:fb4a")) - .setManifest("AndroidManifest.xml") + .setManifest(new FileSourcePath("AndroidManifest.xml")) .setTarget("Google Inc.:Google APIs:16") .setKeystore(keystoreTarget) .addDep(libAndroidTarget)
diff --git a/test/com/facebook/buck/cli/AuditClasspathCommandTest.java b/test/com/facebook/buck/cli/AuditClasspathCommandTest.java index 8f31a96..5a95997 100644 --- a/test/com/facebook/buck/cli/AuditClasspathCommandTest.java +++ b/test/com/facebook/buck/cli/AuditClasspathCommandTest.java
@@ -33,6 +33,7 @@ import com.facebook.buck.rules.BuildRuleResolver; import com.facebook.buck.rules.DependencyGraph; import com.facebook.buck.rules.FakeAbstractBuildRuleBuilderParams; +import com.facebook.buck.rules.FileSourcePath; import com.facebook.buck.rules.KnownBuildRuleTypes; import com.facebook.buck.rules.NoopArtifactCache; import com.facebook.buck.testutil.BuckTestConstant; @@ -125,7 +126,7 @@ ruleResolver.buildAndAddToIndex( AndroidBinaryRule.newAndroidBinaryRuleBuilder(new FakeAbstractBuildRuleBuilderParams()) .setBuildTarget(BuildTargetFactory.newInstance("//:test-android-binary")) - .setManifest("AndroidManifest.xml") + .setManifest(new FileSourcePath("AndroidManifest.xml")) .setTarget("Google Inc.:Google APIs:16") .setKeystore(keystoreBuildTarget) .addClasspathDep(BuildTargetFactory.newInstance("//:test-android-library"))
diff --git a/test/com/facebook/buck/command/ProjectTest.java b/test/com/facebook/buck/command/ProjectTest.java index 78e1e61..0ff32a8 100644 --- a/test/com/facebook/buck/command/ProjectTest.java +++ b/test/com/facebook/buck/command/ProjectTest.java
@@ -41,6 +41,7 @@ import com.facebook.buck.rules.BuildRuleResolver; import com.facebook.buck.rules.DependencyGraph; import com.facebook.buck.rules.FakeAbstractBuildRuleBuilderParams; +import com.facebook.buck.rules.FileSourcePath; import com.facebook.buck.rules.JavaPackageFinder; import com.facebook.buck.rules.ProjectConfigRule; import com.facebook.buck.step.ExecutionContext; @@ -184,7 +185,7 @@ AndroidBinaryRule.newAndroidBinaryRuleBuilder(new FakeAbstractBuildRuleBuilderParams()) .setBuildTarget(BuildTargetFactory.newInstance("//foo:app")) .addClasspathDep(BuildTargetFactory.newInstance("//java/src/com/facebook/base:base")) - .setManifest("foo/AndroidManifest.xml") + .setManifest(new FileSourcePath("foo/AndroidManifest.xml")) .setTarget("Google Inc.:Google APIs:16") .setKeystore(keystoreTarget) .addBuildRuleToExcludeFromDex(BuildTargetFactory.newInstance("//third_party/guava:guava"))); @@ -200,7 +201,7 @@ AndroidBinaryRule.newAndroidBinaryRuleBuilder(new FakeAbstractBuildRuleBuilderParams()) .setBuildTarget(BuildTargetFactory.newInstance("//bar:app")) .addClasspathDep(BuildTargetFactory.newInstance("//java/src/com/facebook/base:base")) - .setManifest("foo/AndroidManifest.xml") + .setManifest(new FileSourcePath("foo/AndroidManifest.xml")) .setTarget("Google Inc.:Google APIs:16") .setKeystore(keystoreTarget));