Skip to content

Commit

Permalink
Update rule key calculation for AndroidAppModularity
Browse files Browse the repository at this point in the history
Summary: Adds a rule key for the graph inputs so that when the seeds change, the rule key changes

Test Plan: tested locally by changing the seeds and re-running the rule

fbshipit-source-id: 2a8ac07
  • Loading branch information
joelmccall authored and facebook-github-bot committed Oct 10, 2017
1 parent 81afdcd commit 1f717b5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,22 @@

import com.facebook.buck.android.apkmodule.APKModuleGraph;
import com.facebook.buck.android.packageable.AndroidPackageableCollection;
import com.facebook.buck.rules.AddToRuleKey;
import com.facebook.buck.rules.AddsToRuleKey;
import com.facebook.buck.rules.BuildRule;
import com.facebook.buck.util.immutables.BuckStyleImmutable;
import com.google.common.collect.ImmutableSortedSet;
import org.immutables.value.Value;

@Value.Immutable
@BuckStyleImmutable
interface AbstractAndroidAppModularityGraphEnhancementResult {
abstract class AbstractAndroidAppModularityGraphEnhancementResult implements AddsToRuleKey {

AndroidPackageableCollection getPackageableCollection();
public abstract AndroidPackageableCollection getPackageableCollection();

ImmutableSortedSet<BuildRule> getFinalDeps();
@AddToRuleKey
public abstract ImmutableSortedSet<BuildRule> getFinalDeps();

APKModuleGraph getAPKModuleGraph();
@AddToRuleKey
public abstract APKModuleGraph getAPKModuleGraph();
}
3 changes: 2 additions & 1 deletion src/com/facebook/buck/android/AndroidAppModularity.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.facebook.buck.model.BuildTarget;
import com.facebook.buck.model.BuildTargets;
import com.facebook.buck.rules.AbstractBuildRuleWithDeclaredAndExtraDeps;
import com.facebook.buck.rules.AddToRuleKey;
import com.facebook.buck.rules.BuildContext;
import com.facebook.buck.rules.BuildRuleParams;
import com.facebook.buck.rules.BuildableContext;
Expand All @@ -38,7 +39,7 @@

public class AndroidAppModularity extends AbstractBuildRuleWithDeclaredAndExtraDeps {

protected final AndroidAppModularityGraphEnhancementResult result;
@AddToRuleKey private final AndroidAppModularityGraphEnhancementResult result;

AndroidAppModularity(
BuildTarget buildTarget,
Expand Down
8 changes: 5 additions & 3 deletions src/com/facebook/buck/android/apkmodule/APKModuleGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import com.facebook.buck.jvm.java.classes.DefaultClasspathTraverser;
import com.facebook.buck.jvm.java.classes.FileLike;
import com.facebook.buck.model.BuildTarget;
import com.facebook.buck.rules.AddToRuleKey;
import com.facebook.buck.rules.AddsToRuleKey;
import com.facebook.buck.rules.TargetGraph;
import com.facebook.buck.rules.TargetNode;
import com.facebook.buck.util.MoreCollectors;
Expand Down Expand Up @@ -57,13 +59,13 @@
* the root. Targets that are dependencies of two or more groups but not dependencies of the root
* are added to their own group.
*/
public class APKModuleGraph {
public class APKModuleGraph implements AddsToRuleKey {

public static final String ROOT_APKMODULE_NAME = "dex";

private final TargetGraph targetGraph;
private final BuildTarget target;
private final Optional<Map<String, List<BuildTarget>>> suppliedSeedConfigMap;
@AddToRuleKey private final BuildTarget target;
@AddToRuleKey private final Optional<Map<String, List<BuildTarget>>> suppliedSeedConfigMap;
private final Optional<Set<BuildTarget>> seedTargets;
private final Map<APKModule, Set<BuildTarget>> buildTargetsMap = new HashMap<>();

Expand Down

0 comments on commit 1f717b5

Please sign in to comment.