diff options
author | ajmichael <ajmichael@google.com> | 2017-05-19 17:21:05 +0200 |
---|---|---|
committer | Irina Iancu <elenairina@google.com> | 2017-05-22 14:36:00 +0200 |
commit | a79015e696f163436244887085d3b8a05ec1b0b1 (patch) | |
tree | a2391026165d5359feddf76d8beec2ad5d552d46 /src/main/java/com/google/devtools/build/lib/rules/android/AndroidHostServiceFixtureRule.java | |
parent | 42ca7907bf9293087ff6b7e7701e8874a4627712 (diff) |
Create new android_host_service_fixture rule.
This rule specifies a host binary that is run as part of an android_instrumentation_test. It merely collects options, support APKs and the runfiles for the host binary and passes them along to the upcoming android_instrumentation_test rule.
Note that this CL does _not_ install the rule, so this CL does not make it usable by anyone. Once the other android testing rules are ready, we will install them all.
One small step towards https://github.com/bazelbuild/bazel/issues/903.
RELNOTES: None
PiperOrigin-RevId: 156553198
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/AndroidHostServiceFixtureRule.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/AndroidHostServiceFixtureRule.java | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidHostServiceFixtureRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidHostServiceFixtureRule.java new file mode 100644 index 0000000000..1777f4f792 --- /dev/null +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidHostServiceFixtureRule.java @@ -0,0 +1,54 @@ +// 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 static com.google.devtools.build.lib.packages.Attribute.ConfigurationTransition.HOST; +import static com.google.devtools.build.lib.packages.Attribute.attr; +import static com.google.devtools.build.lib.packages.BuildType.LABEL; +import static com.google.devtools.build.lib.packages.BuildType.LABEL_LIST; +import static com.google.devtools.build.lib.syntax.Type.BOOLEAN; +import static com.google.devtools.build.lib.syntax.Type.STRING_LIST; + +import com.google.devtools.build.lib.analysis.BaseRuleClasses; +import com.google.devtools.build.lib.analysis.RuleDefinition; +import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment; +import com.google.devtools.build.lib.packages.RuleClass; +import com.google.devtools.build.lib.packages.RuleClass.Builder; + +/** Rule definition for the {@code android_host_service_fixture} rule. */ +public class AndroidHostServiceFixtureRule implements RuleDefinition { + @Override + public RuleClass build(Builder builder, RuleDefinitionEnvironment env) { + return builder + .setUndocumented() + .add(attr("executable", LABEL).exec().cfg(HOST).mandatory().allowedFileTypes()) + .add(attr("service_names", STRING_LIST)) + .add( + attr("support_apks", LABEL_LIST) + .allowedFileTypes(AndroidRuleClasses.APK) + .allowedRuleClasses("android_binary")) + .add(attr("provides_test_args", BOOLEAN).value(false)) + .add(attr("daemon", BOOLEAN).value(false)) + .build(); + } + + @Override + public Metadata getMetadata() { + return RuleDefinition.Metadata.builder() + .name("android_host_service_fixture") + .ancestors(BaseRuleClasses.RuleBase.class) + .factoryClass(AndroidHostServiceFixture.class) + .build(); + } +} |