aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar Carmi Grushko <carmi@google.com>2015-11-23 23:26:15 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2015-11-24 14:41:34 +0000
commitb8f0e86b9d6de8d05d2b34cb0e9363dbf9fe2a1e (patch)
tree6c081e6d0516e95f5a7712ad1049742f1798b734 /src/main/java/com/google/devtools/build/lib
parent904463a0a3c019e9024ffebb869bbe592f567818 (diff)
Description redacted.
-- MOS_MIGRATED_REVID=108555227
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/ConfiguredAspect.java7
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/RuleConfiguredTargetBuilder.java11
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/python/AspectPyCcLinkParamsProvider.java45
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/python/AspectPythonRunfilesProvider.java51
4 files changed, 18 insertions, 96 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredAspect.java b/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredAspect.java
index 8ffb94df89..681803bd07 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredAspect.java
@@ -126,6 +126,13 @@ public final class ConfiguredAspect implements Iterable<TransitiveInfoProvider>
return addProvider(value.getClass(), value);
}
+ public Builder addProviders(Iterable<? extends TransitiveInfoProvider> providers) {
+ for (TransitiveInfoProvider provider : providers) {
+ addProvider(provider);
+ }
+ return this;
+ }
+
/**
* Adds a set of files to an output group.
*/
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RuleConfiguredTargetBuilder.java b/src/main/java/com/google/devtools/build/lib/analysis/RuleConfiguredTargetBuilder.java
index f1737be2a0..86eb8082fc 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/RuleConfiguredTargetBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/RuleConfiguredTargetBuilder.java
@@ -257,6 +257,17 @@ public final class RuleConfiguredTargetBuilder {
}
/**
+ * Add multiple providers with given values.
+ */
+ public RuleConfiguredTargetBuilder addProviders(
+ Iterable<? extends TransitiveInfoProvider> providers) {
+ for (TransitiveInfoProvider provider : providers) {
+ addProvider(provider);
+ }
+ return this;
+ }
+
+ /**
* Add a Skylark transitive info. The provider value must be safe (i.e. a String, a Boolean,
* an Integer, an Artifact, a Label, None, a Java TransitiveInfoProvider or something composed
* from these in Skylark using lists, sets, structs or dicts). Otherwise an EvalException is
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/AspectPyCcLinkParamsProvider.java b/src/main/java/com/google/devtools/build/lib/rules/python/AspectPyCcLinkParamsProvider.java
deleted file mode 100644
index 46c8a9cb4e..0000000000
--- a/src/main/java/com/google/devtools/build/lib/rules/python/AspectPyCcLinkParamsProvider.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2015 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.python;
-
-import com.google.common.base.Function;
-import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
-import com.google.devtools.build.lib.analysis.TransitiveInfoProvider;
-import com.google.devtools.build.lib.concurrent.ThreadSafety;
-import com.google.devtools.build.lib.rules.cpp.CcLinkParamsStore;
-
-/**
- * Wrapper around PyCcLinkParamsProvider, to allow PythonProtoAspect to add Providers to
- * proto_library rules with py_api_version. If PythonProtoAspect provides PyCcLinkParamsProvider
- * directly on such a proto_library rule, Bazel crashes with
- *
- * Provider class PyCcLinkParamsProvider provided twice
- */
-@ThreadSafety.Immutable
-public final class AspectPyCcLinkParamsProvider implements TransitiveInfoProvider {
- public final PyCcLinkParamsProvider provider;
- public AspectPyCcLinkParamsProvider(PyCcLinkParamsProvider provider) {
- this.provider = provider;
- }
-
- public static final Function<TransitiveInfoCollection, CcLinkParamsStore> TO_LINK_PARAMS =
- new Function<TransitiveInfoCollection, CcLinkParamsStore>() {
- @Override
- public CcLinkParamsStore apply(TransitiveInfoCollection input) {
- AspectPyCcLinkParamsProvider wrapper = input.getProvider(
- AspectPyCcLinkParamsProvider.class);
- return wrapper == null ? null : wrapper.provider.getLinkParams();
- }
- };
-}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/AspectPythonRunfilesProvider.java b/src/main/java/com/google/devtools/build/lib/rules/python/AspectPythonRunfilesProvider.java
deleted file mode 100644
index 39baf18e43..0000000000
--- a/src/main/java/com/google/devtools/build/lib/rules/python/AspectPythonRunfilesProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2015 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.python;
-
-import com.google.common.base.Function;
-import com.google.devtools.build.lib.analysis.Runfiles;
-import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
-import com.google.devtools.build.lib.analysis.TransitiveInfoProvider;
-import com.google.devtools.build.lib.concurrent.ThreadSafety;
-
-/**
- * Wrapper around PythonRunfilesProvider, to allow PythonProtoAspect to add Providers to
- * proto_library rules with py_api_version. If PythonProtoAspect provides PythonRunfilesProvider
- * directly on such a proto_library rule, Bazel crashes with
- *
- * Provider class PythonRunfilesProvider provided twice
- */
-@ThreadSafety.Immutable
-public final class AspectPythonRunfilesProvider implements TransitiveInfoProvider {
- public final PythonRunfilesProvider provider;
- public AspectPythonRunfilesProvider(PythonRunfilesProvider provider) {
- this.provider = provider;
- }
-
- /**
- * A function that gets the Python runfiles from a {@link TransitiveInfoCollection} or
- * the empty runfiles instance if it does not contain that provider.
- */
- public static final Function<TransitiveInfoCollection, Runfiles> TO_RUNFILES =
- new Function<TransitiveInfoCollection, Runfiles>() {
- @Override
- public Runfiles apply(TransitiveInfoCollection input) {
- AspectPythonRunfilesProvider wrapper =
- input.getProvider(AspectPythonRunfilesProvider.class);
- return wrapper == null
- ? Runfiles.EMPTY
- : wrapper.provider.getPythonRunfiles();
- }
- };
-}