diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentation.java | 3 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationInfo.java (renamed from src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationInfoProvider.java) | 15 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTest.java | 12 | ||||
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationRuleImplTest.java | 8 | ||||
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestTest.java | 8 |
5 files changed, 18 insertions, 28 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentation.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentation.java index d0d0812ebb..fb2a57fb7f 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentation.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentation.java @@ -61,8 +61,7 @@ public class AndroidInstrumentation implements RuleConfiguredTargetFactory { new Runfiles.Builder(ruleContext.getWorkspaceName()) .addTransitiveArtifacts(filesToBuild) .build())) - .addNativeDeclaredProvider( - new AndroidInstrumentationInfoProvider(targetApk, instrumentationApk)) + .addNativeDeclaredProvider(new AndroidInstrumentationInfo(targetApk, instrumentationApk)) .build(); } diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationInfoProvider.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationInfo.java index 70659fc6d0..d7e53f79ee 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationInfoProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationInfo.java @@ -13,7 +13,6 @@ // limitations under the License. package com.google.devtools.build.lib.rules.android; -import com.google.common.collect.ImmutableMap; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; import com.google.devtools.build.lib.packages.NativeInfo; @@ -24,24 +23,24 @@ import com.google.devtools.build.lib.packages.NativeProvider; * AndroidInstrumentationTest}. */ @Immutable -public class AndroidInstrumentationInfoProvider extends NativeInfo { +public class AndroidInstrumentationInfo extends NativeInfo { private static final String SKYLARK_NAME = "AndroidInstrumentationInfo"; - static final NativeProvider<AndroidInstrumentationInfoProvider> ANDROID_INSTRUMENTATION_INFO = - new NativeProvider<AndroidInstrumentationInfoProvider>( - AndroidInstrumentationInfoProvider.class, SKYLARK_NAME) {}; + static final NativeProvider<AndroidInstrumentationInfo> PROVIDER = + new NativeProvider<AndroidInstrumentationInfo>( + AndroidInstrumentationInfo.class, SKYLARK_NAME) {}; private final Artifact targetApk; private final Artifact instrumentationApk; - public AndroidInstrumentationInfoProvider(Artifact targetApk, Artifact instrumentationApk) { - super(ANDROID_INSTRUMENTATION_INFO, ImmutableMap.<String, Object>of()); + public AndroidInstrumentationInfo(Artifact targetApk, Artifact instrumentationApk) { + super(PROVIDER); this.targetApk = targetApk; this.instrumentationApk = instrumentationApk; } public Artifact getTargetApk() { - return targetApk; + return targetApk; } public Artifact getInstrumentationApk() { diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTest.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTest.java index 1fb52d2d9b..57a8880587 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTest.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTest.java @@ -182,10 +182,8 @@ public class AndroidInstrumentationTest implements RuleConfiguredTargetFactory { private static Iterable<Artifact> getTargetApks(RuleContext ruleContext) { return Iterables.transform( ruleContext.getPrerequisites( - "instrumentations", - Mode.TARGET, - AndroidInstrumentationInfoProvider.ANDROID_INSTRUMENTATION_INFO), - AndroidInstrumentationInfoProvider::getTargetApk); + "instrumentations", Mode.TARGET, AndroidInstrumentationInfo.PROVIDER), + AndroidInstrumentationInfo::getTargetApk); } /** @@ -195,10 +193,8 @@ public class AndroidInstrumentationTest implements RuleConfiguredTargetFactory { private static Iterable<Artifact> getInstrumentationApks(RuleContext ruleContext) { return Iterables.transform( ruleContext.getPrerequisites( - "instrumentations", - Mode.TARGET, - AndroidInstrumentationInfoProvider.ANDROID_INSTRUMENTATION_INFO), - AndroidInstrumentationInfoProvider::getInstrumentationApk); + "instrumentations", Mode.TARGET, AndroidInstrumentationInfo.PROVIDER), + AndroidInstrumentationInfo::getInstrumentationApk); } /** The support APKs from the {@code support_apks} and {@code fixtures} attributes. */ diff --git a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationRuleImplTest.java b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationRuleImplTest.java index 860082c483..000057a83d 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationRuleImplTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationRuleImplTest.java @@ -71,8 +71,8 @@ public class AndroidInstrumentationRuleImplTest extends AndroidBuildViewTestCase ")"); ConfiguredTarget instrumentation = getConfiguredTarget("//javatests/com/app/instrumentation"); assertThat(instrumentation).isNotNull(); - AndroidInstrumentationInfoProvider instrumentationProvider = - instrumentation.get(AndroidInstrumentationInfoProvider.ANDROID_INSTRUMENTATION_INFO); + AndroidInstrumentationInfo instrumentationProvider = + instrumentation.get(AndroidInstrumentationInfo.PROVIDER); assertThat(instrumentationProvider.getTargetApk()).isNotNull(); assertThat(instrumentationProvider.getTargetApk().prettyPrint()) .isEqualTo("javatests/com/app/instrumentation/instrumentation-target.apk"); @@ -95,8 +95,8 @@ public class AndroidInstrumentationRuleImplTest extends AndroidBuildViewTestCase ")"); ConfiguredTarget instrumentation = getConfiguredTarget("//javatests/com/app/instrumentation"); assertThat(instrumentation).isNotNull(); - AndroidInstrumentationInfoProvider instrumentationProvider = - instrumentation.get(AndroidInstrumentationInfoProvider.ANDROID_INSTRUMENTATION_INFO); + AndroidInstrumentationInfo instrumentationProvider = + instrumentation.get(AndroidInstrumentationInfo.PROVIDER); Artifact targetApk = instrumentationProvider.getTargetApk(); assertThat(targetApk).isNotNull(); diff --git a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestTest.java b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestTest.java index a80a221b87..647e583bcc 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestTest.java @@ -239,14 +239,10 @@ public class AndroidInstrumentationTestTest extends AndroidBuildViewTestCase { } private static Artifact getInstrumentationApk(ConfiguredTarget instrumentation) { - return instrumentation - .get(AndroidInstrumentationInfoProvider.ANDROID_INSTRUMENTATION_INFO) - .getInstrumentationApk(); + return instrumentation.get(AndroidInstrumentationInfo.PROVIDER).getInstrumentationApk(); } private static Artifact getTargetApk(ConfiguredTarget instrumentation) { - return instrumentation - .get(AndroidInstrumentationInfoProvider.ANDROID_INSTRUMENTATION_INFO) - .getTargetApk(); + return instrumentation.get(AndroidInstrumentationInfo.PROVIDER).getTargetApk(); } } |