Skip to content

Commit

Permalink
Stop passing RuleContext to all of the Android Data Skylark API
Browse files Browse the repository at this point in the history
RELNOTES: none
PiperOrigin-RevId: 197735344
  • Loading branch information
asteinb authored and Copybara-Service committed May 23, 2018
1 parent e77b9d9 commit 14c6d8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
+ " manifests")
public class AndroidDataContext {

private final RuleContext ruleContext;

private final Label label;
private final ActionConstructionContext actionConstructionContext;
private final FilesToRunProvider busybox;
Expand All @@ -56,16 +54,19 @@ public static AndroidDataContext forNative(RuleContext ruleContext) {

public static AndroidDataContext makeContext(RuleContext ruleContext) {
return new AndroidDataContext(
ruleContext.getLabel(),
ruleContext,
ruleContext.getExecutablePrerequisite("$android_resources_busybox", Mode.HOST),
AndroidSdkProvider.fromRuleContext(ruleContext));
}

protected AndroidDataContext(
RuleContext ruleContext, FilesToRunProvider busybox, AndroidSdkProvider sdk) {
this.ruleContext = ruleContext;
this.label = ruleContext.getLabel();
this.actionConstructionContext = ruleContext;
Label label,
ActionConstructionContext actionConstructionContext,
FilesToRunProvider busybox,
AndroidSdkProvider sdk) {
this.label = label;
this.actionConstructionContext = actionConstructionContext;
this.busybox = busybox;
this.sdk = sdk;
}
Expand All @@ -86,17 +87,6 @@ public AndroidSdkProvider getSdk() {
return sdk;
}

/**
* Gets the current RuleContext.
*
* @deprecated RuleContext is only exposed to help migrate away from it. New code should only be
* written using other methods from this class.
*/
@Deprecated
public RuleContext getRuleContext() {
return ruleContext;
}

/*
* Convenience methods. These are just slightly cleaner ways of doing common tasks.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public static ProcessedAndroidData processBinaryDataFrom(
.conditionalKeepRules(conditionalKeepRules)
.setDataBindingInfoZip(
dataBindingEnabled
? DataBinding.getLayoutInfoFile(dataContext.getRuleContext())
? DataBinding.getLayoutInfoFile(dataContext.getActionConstructionContext())
: null)
.setFeatureOf(featureOf)
.setFeatureAfter(featureAfter);
Expand Down

0 comments on commit 14c6d8e

Please sign in to comment.