From 4d7935d39f68581ee305a2abf288a98d1cf9c6a3 Mon Sep 17 00:00:00 2001 From: dslomov Date: Thu, 24 Aug 2017 20:19:52 +0200 Subject: Naming style fix for AndroidInstrumentationInfo(Provider). RELNOTES: None. PiperOrigin-RevId: 166368143 --- .../lib/rules/android/AndroidInstrumentation.java | 3 +- .../rules/android/AndroidInstrumentationInfo.java | 49 +++++++++++++++++++++ .../AndroidInstrumentationInfoProvider.java | 50 ---------------------- .../rules/android/AndroidInstrumentationTest.java | 12 ++---- 4 files changed, 54 insertions(+), 60 deletions(-) create mode 100644 src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationInfo.java delete mode 100644 src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationInfoProvider.java (limited to 'src/main/java/com/google/devtools/build/lib/rules') 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/AndroidInstrumentationInfo.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationInfo.java new file mode 100644 index 0000000000..d7e53f79ee --- /dev/null +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationInfo.java @@ -0,0 +1,49 @@ +// Copyright 2017 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.google.devtools.build.lib.rules.android; + +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; +import com.google.devtools.build.lib.packages.NativeProvider; + +/** + * A provider for targets that create Android instrumentations. Consumed by {@link + * AndroidInstrumentationTest}. + */ +@Immutable +public class AndroidInstrumentationInfo extends NativeInfo { + + private static final String SKYLARK_NAME = "AndroidInstrumentationInfo"; + static final NativeProvider PROVIDER = + new NativeProvider( + AndroidInstrumentationInfo.class, SKYLARK_NAME) {}; + + private final Artifact targetApk; + private final Artifact instrumentationApk; + + public AndroidInstrumentationInfo(Artifact targetApk, Artifact instrumentationApk) { + super(PROVIDER); + this.targetApk = targetApk; + this.instrumentationApk = instrumentationApk; + } + + public Artifact getTargetApk() { + return targetApk; + } + + public Artifact getInstrumentationApk() { + return instrumentationApk; + } +} 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/AndroidInstrumentationInfoProvider.java deleted file mode 100644 index 70659fc6d0..0000000000 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationInfoProvider.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2017 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// 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; -import com.google.devtools.build.lib.packages.NativeProvider; - -/** - * A provider for targets that create Android instrumentations. Consumed by {@link - * AndroidInstrumentationTest}. - */ -@Immutable -public class AndroidInstrumentationInfoProvider extends NativeInfo { - - private static final String SKYLARK_NAME = "AndroidInstrumentationInfo"; - static final NativeProvider ANDROID_INSTRUMENTATION_INFO = - new NativeProvider( - AndroidInstrumentationInfoProvider.class, SKYLARK_NAME) {}; - - private final Artifact targetApk; - private final Artifact instrumentationApk; - - public AndroidInstrumentationInfoProvider(Artifact targetApk, Artifact instrumentationApk) { - super(ANDROID_INSTRUMENTATION_INFO, ImmutableMap.of()); - this.targetApk = targetApk; - this.instrumentationApk = instrumentationApk; - } - - public Artifact getTargetApk() { - return targetApk; - } - - public Artifact getInstrumentationApk() { - return instrumentationApk; - } -} 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 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 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. */ -- cgit v1.2.3