diff options
author | 2015-07-27 15:24:44 +0000 | |
---|---|---|
committer | 2015-07-27 16:34:22 +0000 | |
commit | aafaf8d4f725a96eda73ce62d1af4fc865a6eb8e (patch) | |
tree | 92699c374da2673168f7ad4393429e417a1d82a7 | |
parent | debf73aabc6a306f54651ea5e900b366246aa6aa (diff) |
RELNOTES[INC]: Remove built-in support for cc_public_library
--
MOS_MIGRATED_REVID=99180853
7 files changed, 32 insertions, 170 deletions
diff --git a/site/docs/query.html b/site/docs/query.html index bd5901d00a..1e36492a8e 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 @@ genrule( <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 65e6ce309b..28d5e5cd0c 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 @@ A visibility specification may contain a combination of package labels 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 2d2ba43dfe..912ed77d7b 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 @@ public class BazelCppRuleClasses { <!-- #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 7b7cc075b3..f4c2bb4382 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 @@ public abstract class CcLibrary implements RuleConfiguredTargetFactory { // 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 @@ public abstract class CcLibrary implements RuleConfiguredTargetFactory { 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 @@ public abstract class CcLibrary implements RuleConfiguredTargetFactory { .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 @@ public abstract class CcLibrary implements RuleConfiguredTargetFactory { } } - 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 535ec3cd83..ce817b2749 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 @@ public final class CcLibraryHelper { private boolean emitDynamicLibrary = true; private boolean checkDepsGenerateCpp = true; private boolean emitCompileProviders; - private boolean emitHeaderTargetModuleMaps = false; private final FeatureConfiguration featureConfiguration; @@ -569,14 +568,6 @@ public final class CcLibraryHelper { } /** - * 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 @@ public final class CcLibraryHelper { 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 17e2e5ce11..0000000000 --- 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 4f2a5854d9..0000000000 --- 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; - } -} |