RELNOTES[INC]: Remove built-in support for cc_public_library

--
MOS_MIGRATED_REVID=99180853
diff --git a/site/docs/query.html b/site/docs/query.html
index bd5901d..1e36492 100644
--- a/site/docs/query.html
+++ b/site/docs/query.html
@@ -272,7 +272,7 @@
 
 <h3>Cycles in the dependency graph</h3>
 <p>
-  Build dependency graphs should be acyclic, but in fact cycles do occur.
+  Build dependency graphs should be acyclic.
 
   The algorithms used by the query language are intended for use in
   acyclic graphs, but are robust against cycles.  The details of how
@@ -1483,7 +1483,6 @@
 <p>
   All nodes in a cycle are considered of equal rank.  (Most graphs are
   acyclic, but cycles do occur
-
   simply because BUILD files contain erroneous cycles.)
 </p>
 
diff --git a/src/main/java/com/google/devtools/build/docgen/templates/attributes/common/visibility.html b/src/main/java/com/google/devtools/build/docgen/templates/attributes/common/visibility.html
index 65e6ce3..28d5e5c 100644
--- a/src/main/java/com/google/devtools/build/docgen/templates/attributes/common/visibility.html
+++ b/src/main/java/com/google/devtools/build/docgen/templates/attributes/common/visibility.html
@@ -44,9 +44,7 @@
 the <code><a href="#package">default_visibility</a></code>
 attribute of the <code><a href="#package">package</a></code>
 statement in the BUILD file containing the rule is used
-(except <a href="#exports_files">exports_files</a>
-
-).</p>
+(except <a href="#exports_files">exports_files</a>).</p>
 <p>If the default visibility for the package is not specified,
 the rule is private.</p>
 <p><b>Example</b>:</p>
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java
index 2d2ba43..912ed77 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java
@@ -781,10 +781,6 @@
           <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
           .add(attr("alwayslink", BOOLEAN).
               nonconfigurable("value is referenced in an ImplicitOutputsFunction"))
-          // TODO(bazel-team): Remove this attribute?
-          .add(attr("implements", LABEL_LIST)
-              .allowedFileTypes()
-              .allowedRuleClasses("cc_public_library$headers"))
           .override(attr("linkstatic", BOOLEAN).value(false)
               .nonconfigurable("value is referenced in an ImplicitOutputsFunction"))
           .build();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java
index 7b7cc07..f4c2bb4 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java
@@ -84,18 +84,6 @@
     // runfiles.
     builder.addArtifacts(ccLinkingOutputs.getLibrariesForRunfiles(linkingStatically && !neverLink));
     builder.add(context, CppRunfilesProvider.runfilesFunction(linkingStatically));
-    if (context.getRule().isAttrDefined("implements", Type.LABEL_LIST)) {
-      builder.addTargets(context.getPrerequisites("implements", Mode.TARGET),
-          RunfilesProvider.DEFAULT_RUNFILES);
-      builder.addTargets(context.getPrerequisites("implements", Mode.TARGET),
-          CppRunfilesProvider.runfilesFunction(linkingStatically));
-    }
-    if (context.getRule().isAttrDefined("implementation", Type.LABEL_LIST)) {
-      builder.addTargets(context.getPrerequisites("implementation", Mode.TARGET),
-          RunfilesProvider.DEFAULT_RUNFILES);
-      builder.addTargets(context.getPrerequisites("implementation", Mode.TARGET),
-          CppRunfilesProvider.runfilesFunction(linkingStatically));
-    }
 
     builder.addDataDeps(context);
 
@@ -127,49 +115,40 @@
     FeatureConfiguration featureConfiguration = CcCommon.configureFeatures(ruleContext);
     final CcCommon common = new CcCommon(ruleContext, featureConfiguration);
 
-    CcLibraryHelper helper = new CcLibraryHelper(ruleContext, semantics, featureConfiguration)
-        .setLinkType(linkType)
-        .enableCcNativeLibrariesProvider()
-        .enableInterfaceSharedObjects()
-        .enableCompileProviders()
-        // Generate .a and .so outputs even without object files to fulfill the rule class contract
-        // wrt. implicit output files, if the contract says so. Behavior here differs between Bazel
-        // and Blaze.
-        .setGenerateLinkActionsIfEmpty(
-            ruleContext.getRule().getRuleClassObject().getImplicitOutputsFunction()
-                != ImplicitOutputsFunction.NONE)
-        .setNeverLink(neverLink)
-        .setHeadersCheckingMode(common.determineHeadersCheckingMode())
-        .addCopts(common.getCopts())
-        .setNoCopts(common.getNoCopts())
-        .addLinkopts(common.getLinkopts())
-        .addDefines(common.getDefines())
-        .addCompilationPrerequisites(common.getSharedLibrariesFromSrcs())
-        .addCompilationPrerequisites(common.getStaticLibrariesFromSrcs())
-        .addSources(common.getCAndCppSources())
-        .addPublicHeaders(common.getHeaders())
-        .addObjectFiles(common.getObjectFilesFromSrcs(false))
-        .addPicObjectFiles(common.getObjectFilesFromSrcs(true))
-        .addPicIndependentObjectFiles(common.getLinkerScripts())
-        .addDeps(ruleContext.getPrerequisites("deps", Mode.TARGET))
-        .addSystemIncludeDirs(common.getSystemIncludeDirs())
-        .addIncludeDirs(common.getIncludeDirs())
-        .addLooseIncludeDirs(common.getLooseIncludeDirs())
-        .setEmitHeaderTargetModuleMaps(
-            ruleContext.getRule().getRuleClass().equals("cc_public_library"));
-    
+    CcLibraryHelper helper =
+        new CcLibraryHelper(ruleContext, semantics, featureConfiguration)
+            .setLinkType(linkType)
+            .enableCcNativeLibrariesProvider()
+            .enableInterfaceSharedObjects()
+            .enableCompileProviders()
+            // Generate .a and .so outputs even without object files to fulfill the rule class contract
+            // wrt. implicit output files, if the contract says so. Behavior here differs between Bazel
+            // and Blaze.
+            .setGenerateLinkActionsIfEmpty(
+                ruleContext.getRule().getRuleClassObject().getImplicitOutputsFunction()
+                    != ImplicitOutputsFunction.NONE)
+            .setNeverLink(neverLink)
+            .setHeadersCheckingMode(common.determineHeadersCheckingMode())
+            .addCopts(common.getCopts())
+            .setNoCopts(common.getNoCopts())
+            .addLinkopts(common.getLinkopts())
+            .addDefines(common.getDefines())
+            .addCompilationPrerequisites(common.getSharedLibrariesFromSrcs())
+            .addCompilationPrerequisites(common.getStaticLibrariesFromSrcs())
+            .addSources(common.getCAndCppSources())
+            .addPublicHeaders(common.getHeaders())
+            .addObjectFiles(common.getObjectFilesFromSrcs(false))
+            .addPicObjectFiles(common.getObjectFilesFromSrcs(true))
+            .addPicIndependentObjectFiles(common.getLinkerScripts())
+            .addDeps(ruleContext.getPrerequisites("deps", Mode.TARGET))
+            .addSystemIncludeDirs(common.getSystemIncludeDirs())
+            .addIncludeDirs(common.getIncludeDirs())
+            .addLooseIncludeDirs(common.getLooseIncludeDirs());
+
     if (collectLinkstamp) {
       helper.addLinkstamps(ruleContext.getPrerequisites("linkstamp", Mode.TARGET));
     }
 
-    if (ruleContext.getRule().isAttrDefined("implements", Type.LABEL_LIST)) {
-      helper.addDeps(ruleContext.getPrerequisites("implements", Mode.TARGET));
-    }
-
-    if (ruleContext.getRule().isAttrDefined("implementation", Type.LABEL_LIST)) {
-      helper.addDeps(ruleContext.getPrerequisites("implementation", Mode.TARGET));
-    }
-
     PathFragment soImplFilename = null;
     if (ruleContext.getRule().isAttrDefined("outs", Type.STRING_LIST)) {
       List<String> outs = ruleContext.attributes().get("outs", Type.STRING_LIST);
@@ -291,8 +270,6 @@
         .add(RunfilesProvider.class, RunfilesProvider.withData(staticRunfiles, sharedRunfiles))
         // Remove this?
         .add(CppRunfilesProvider.class, new CppRunfilesProvider(staticRunfiles, sharedRunfiles))
-        .add(ImplementedCcPublicLibrariesProvider.class,
-            new ImplementedCcPublicLibrariesProvider(getImplementedCcPublicLibraries(ruleContext)))
         .addOutputGroup(OutputGroupProvider.HIDDEN_TOP_LEVEL, artifactsToForce)
         .addOutputGroup(OutputGroupProvider.BASELINE_COVERAGE, BaselineCoverageAction
                 .getBaselineCoverageArtifacts(ruleContext,
@@ -356,14 +333,6 @@
     }
   }
 
-  private static ImmutableList<Label> getImplementedCcPublicLibraries(RuleContext context) {
-    if (context.attributes().has("implements", Type.LABEL_LIST)) {
-      return ImmutableList.copyOf(context.attributes().get("implements", Type.LABEL_LIST));
-    } else {
-      return ImmutableList.of();
-    }
-  }
-
   /**
    * Returns true if the rule (which must be a cc_library rule) appears to have object files.
    * This only looks at the rule itself, not at any other rules (from this package or other
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibraryHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibraryHelper.java
index 535ec3c..ce817b2 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibraryHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibraryHelper.java
@@ -185,7 +185,6 @@
   private boolean emitDynamicLibrary = true;
   private boolean checkDepsGenerateCpp = true;
   private boolean emitCompileProviders;
-  private boolean emitHeaderTargetModuleMaps = false;
   
   private final FeatureConfiguration featureConfiguration;
 
@@ -569,14 +568,6 @@
   }
 
   /**
-   * Sets whether to emit the transitive module map references of a public library headers target.
-   */
-  public CcLibraryHelper setEmitHeaderTargetModuleMaps(boolean emitHeaderTargetModuleMaps) {
-    this.emitHeaderTargetModuleMaps = emitHeaderTargetModuleMaps;
-    return this;
-  }
-
-  /**
    * Create the C++ compile and link actions, and the corresponding C++-related providers.
    */
   public Info build() {
@@ -804,13 +795,6 @@
       result.add(toolchain.getCppCompilationContext().getCppModuleMap());
     }
 
-    if (emitHeaderTargetModuleMaps) {
-      for (HeaderTargetModuleMapProvider provider : AnalysisUtils.getProviders(
-          deps, HeaderTargetModuleMapProvider.class)) {
-        result.addAll(provider.getCppModuleMaps());
-      }
-    }
-
     return Iterables.filter(result, Predicates.<CppModuleMap>notNull());
   }
 
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderTargetModuleMapProvider.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderTargetModuleMapProvider.java
deleted file mode 100644
index 17e2e5c..0000000
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderTargetModuleMapProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2014 Google Inc. 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.cpp;
-
-import com.google.common.collect.ImmutableList;
-import com.google.devtools.build.lib.analysis.TransitiveInfoProvider;
-import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
-
-import java.util.List;
-
-/**
- * A provider for cc_public_library rules to be able to convey the information about the
- * header target's module map references to the public library target.
- */
-@Immutable
-public final class HeaderTargetModuleMapProvider implements TransitiveInfoProvider {
-
-  private final ImmutableList<CppModuleMap> cppModuleMaps;
-
-  public HeaderTargetModuleMapProvider(Iterable<CppModuleMap> cppModuleMaps) {
-    this.cppModuleMaps = ImmutableList.copyOf(cppModuleMaps);
-  }
-
-  /**
-   * Returns the module maps referenced by cc_public_library's headers target.
-   */
-  public List<CppModuleMap> getCppModuleMaps() {
-    return cppModuleMaps;
-  }
-}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/ImplementedCcPublicLibrariesProvider.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/ImplementedCcPublicLibrariesProvider.java
deleted file mode 100644
index 4f2a585..0000000
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/ImplementedCcPublicLibrariesProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2014 Google Inc. 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.cpp;
-
-import com.google.common.collect.ImmutableList;
-import com.google.devtools.build.lib.analysis.TransitiveInfoProvider;
-import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
-import com.google.devtools.build.lib.syntax.Label;
-
-/**
- * A provider for cc_library rules to be able to convey the information about which
- * cc_public_library rules they implement to dependent targets.
- */
-@Immutable
-public final class ImplementedCcPublicLibrariesProvider implements TransitiveInfoProvider {
-
-  private final ImmutableList<Label> implementedCcPublicLibraries;
-
-  public ImplementedCcPublicLibrariesProvider(ImmutableList<Label> implementedCcPublicLibraries) {
-    this.implementedCcPublicLibraries = implementedCcPublicLibraries;
-  }
-
-  /**
-   * Returns the labels for the "$headers" target that are implemented by the target which
-   * implements this interface.
-   */
-  public ImmutableList<Label> getImplementedCcPublicLibraries() {
-    return implementedCcPublicLibraries;
-  }
-}