aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar janakr <janakr@google.com>2018-06-07 15:53:06 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-07 15:54:31 -0700
commit1bef35d54d3f25a69a7055b3a5f19e425b54a4d1 (patch)
treef902d96815ec9bf0f469b1750fe91dad30dd507b /src
parent6afc2eb67675e928bc8fa10c5d1745223186b6e0 (diff)
Automated rollback of commit d0982b905d93e219a0caccdcf5d6ae1e219387c2.
*** Reason for rollback *** See linked bug. *** Original change description *** C++: Delete PyCcLinkParamsProvider. No longer needed. RELNOTES:none PiperOrigin-RevId: 199710626
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java1
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/python/PyCcLinkParamsProvider.java43
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/python/PyLibrary.java1
3 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java b/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java
index 07a1213bca..41e19c497c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/python/PyBinary.java
@@ -164,6 +164,7 @@ public abstract class PyBinary implements RuleConfiguredTargetFactory {
CcLinkParams.Builder builder, boolean linkingStatically, boolean linkShared) {
builder.addTransitiveTargets(
ruleContext.getPrerequisites("deps", Mode.TARGET),
+ PyCcLinkParamsProvider.TO_LINK_PARAMS,
CcLinkParamsStore.TO_LINK_PARAMS);
}
};
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PyCcLinkParamsProvider.java b/src/main/java/com/google/devtools/build/lib/rules/python/PyCcLinkParamsProvider.java
new file mode 100644
index 0000000000..8a270ac306
--- /dev/null
+++ b/src/main/java/com/google/devtools/build/lib/rules/python/PyCcLinkParamsProvider.java
@@ -0,0 +1,43 @@
+// Copyright 2014 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.Immutable;
+import com.google.devtools.build.lib.rules.cpp.AbstractCcLinkParamsStore;
+import com.google.devtools.build.lib.rules.cpp.CcLinkParamsStore;
+import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
+
+/** A target that provides C++ libraries to be linked into Python targets. */
+@Immutable
+@AutoCodec
+public final class PyCcLinkParamsProvider implements TransitiveInfoProvider {
+ private final CcLinkParamsStore store;
+
+ public PyCcLinkParamsProvider(CcLinkParamsStore store) {
+ this.store = store;
+ }
+
+ public AbstractCcLinkParamsStore getLinkParams() {
+ return store;
+ }
+
+ public static final Function<TransitiveInfoCollection, AbstractCcLinkParamsStore> TO_LINK_PARAMS =
+ input -> {
+ PyCcLinkParamsProvider provider = input.getProvider(PyCcLinkParamsProvider.class);
+ return provider == null ? null : provider.getLinkParams();
+ };
+}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PyLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/python/PyLibrary.java
index 97060f345c..e40a1ab978 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/python/PyLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/python/PyLibrary.java
@@ -71,6 +71,7 @@ public abstract class PyLibrary implements RuleConfiguredTargetFactory {
CcLinkParams.Builder builder, boolean linkingStatically, boolean linkShared) {
builder.addTransitiveTargets(
ruleContext.getPrerequisites("deps", Mode.TARGET),
+ PyCcLinkParamsProvider.TO_LINK_PARAMS,
CcLinkParamsStore.TO_LINK_PARAMS);
}
};