aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGravatar hlopko <hlopko@google.com>2018-06-07 01:15:01 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-07 01:16:34 -0700
commit5146ce0da00ea12f1730b7036e8e9f42d3561477 (patch)
tree62c270f54c4252fe1ea4b9a0ae049af5607db607 /src/main/java/com
parentd0982b905d93e219a0caccdcf5d6ae1e219387c2 (diff)
Expose C++ action names to Skylark
This cl adds Skylark constants allowing users to specify which C++ action they want for the feature configuration Skylark API. This is done by exposing a Skylark file at @bazel_tools//tools/cpp:action_names.bzl. Skylark api to the C++ toolchain doc: https://docs.google.com/document/d/1g91BWJITcYw_X-VxsDC0VgUn5E9g0kRBGoBSpoO41gA/edit#. Progress on #4571. RELNOTES: None. PiperOrigin-RevId: 199596778
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java29
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionNames.java75
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java69
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java22
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java8
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkstampCompileHelper.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java42
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariables.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/LtoBackendArtifacts.java4
10 files changed, 125 insertions, 132 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
index e169c4fbb2..04dab1586b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
@@ -110,17 +110,17 @@ public final class CcCommon {
public static final ImmutableSet<String> ALL_COMPILE_ACTIONS =
ImmutableSet.of(
- CppCompileAction.C_COMPILE,
- CppCompileAction.CPP_COMPILE,
- CppCompileAction.CPP_HEADER_PARSING,
- CppCompileAction.CPP_HEADER_PREPROCESSING,
- CppCompileAction.CPP_MODULE_COMPILE,
- CppCompileAction.CPP_MODULE_CODEGEN,
- CppCompileAction.ASSEMBLE,
- CppCompileAction.PREPROCESS_ASSEMBLE,
- CppCompileAction.CLIF_MATCH,
- CppCompileAction.LINKSTAMP_COMPILE,
- CppCompileAction.CC_FLAGS_MAKE_VARIABLE_ACTION_NAME);
+ CppActionNames.C_COMPILE,
+ CppActionNames.CPP_COMPILE,
+ CppActionNames.CPP_HEADER_PARSING,
+ CppActionNames.CPP_HEADER_PREPROCESSING,
+ CppActionNames.CPP_MODULE_COMPILE,
+ CppActionNames.CPP_MODULE_CODEGEN,
+ CppActionNames.ASSEMBLE,
+ CppActionNames.PREPROCESS_ASSEMBLE,
+ CppActionNames.CLIF_MATCH,
+ CppActionNames.LINKSTAMP_COMPILE,
+ CppActionNames.CC_FLAGS_MAKE_VARIABLE);
public static final ImmutableSet<String> ALL_LINK_ACTIONS =
ImmutableSet.of(
@@ -132,7 +132,7 @@ public final class CcCommon {
ImmutableSet.of(Link.LinkTargetType.STATIC_LIBRARY.getActionName());
public static final ImmutableSet<String> ALL_OTHER_ACTIONS =
- ImmutableSet.of(CppCompileAction.STRIP_ACTION_NAME);
+ ImmutableSet.of(CppActionNames.STRIP);
/** Action configs we request to enable. */
public static final ImmutableSet<String> DEFAULT_ACTION_CONFIGS =
@@ -971,8 +971,7 @@ public final class CcCommon {
(CcToolchainProvider) toolchain.get(ToolchainInfo.PROVIDER);
FeatureConfiguration featureConfiguration =
CcCommon.configureFeaturesOrReportRuleError(ruleContext, toolchainProvider);
- if (!featureConfiguration.actionIsConfigured(
- CppCompileAction.CC_FLAGS_MAKE_VARIABLE_ACTION_NAME)) {
+ if (!featureConfiguration.actionIsConfigured(CppActionNames.CC_FLAGS_MAKE_VARIABLE)) {
return null;
}
@@ -981,7 +980,7 @@ public final class CcCommon {
Joiner.on(" ")
.join(
featureConfiguration.getCommandLine(
- CppCompileAction.CC_FLAGS_MAKE_VARIABLE_ACTION_NAME, buildVariables));
+ CppActionNames.CC_FLAGS_MAKE_VARIABLE, buildVariables));
String oldCcFlags = "";
TemplateVariableInfo templateVariableInfo =
toolchain.get(TemplateVariableInfo.PROVIDER);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionNames.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionNames.java
new file mode 100644
index 0000000000..1f2c749a5a
--- /dev/null
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionNames.java
@@ -0,0 +1,75 @@
+// Copyright 2018 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.cpp;
+
+/** Class holding constants for all C++ action names */
+public class CppActionNames {
+
+ /** A string constant used to compute CC_FLAGS make variable value */
+ public static final String CC_FLAGS_MAKE_VARIABLE = "cc-flags-make-variable";
+ /** A string constant for the strip action name. */
+ public static final String STRIP = "strip";
+ /** A string constant for the linkstamp-compile action. */
+ public static final String LINKSTAMP_COMPILE = "linkstamp-compile";
+ /** A string constant for the c compilation action. */
+ public static final String C_COMPILE = "c-compile";
+ /** A string constant for the c++ compilation action. */
+ public static final String CPP_COMPILE = "c++-compile";
+ /** A string constant for the c++ module compile action. */
+ public static final String CPP_MODULE_CODEGEN = "c++-module-codegen";
+ /** A string constant for the objc compilation action. */
+ public static final String OBJC_COMPILE = "objc-compile";
+ /** A string constant for the objc++ compile action. */
+ public static final String OBJCPP_COMPILE = "objc++-compile";
+ /** A string constant for the c++ header parsing. */
+ public static final String CPP_HEADER_PARSING = "c++-header-parsing";
+ /** A string constant for the c++ header preprocessing. */
+ public static final String CPP_HEADER_PREPROCESSING = "c++-header-preprocessing";
+ /**
+ * A string constant for the c++ module compilation action. Note: currently we don't support C
+ * module compilation.
+ */
+ public static final String CPP_MODULE_COMPILE = "c++-module-compile";
+ /** A string constant for the assembler actions. */
+ public static final String ASSEMBLE = "assemble";
+
+ public static final String PREPROCESS_ASSEMBLE = "preprocess-assemble";
+ /**
+ * A string constant for the clif actions. Bazel enables different features of the toolchain based
+ * on the name of the action. This name enables the clif_matcher feature, which switches the
+ * "compiler" to the clif_matcher and adds some additional arguments as described in the CROSSTOOL
+ * file.
+ */
+ public static final String CLIF_MATCH = "clif-match";
+
+ /** Name of the action producing static library. */
+ public static final String CPP_LINK_STATIC_LIBRARY = "c++-link-static-library";
+ /** Name of the action producing dynamic library from cc_library. */
+ public static final String CPP_LINK_NODEPS_DYNAMIC_LIBRARY = "c++-link-nodeps-dynamic-library";
+ /** Name of the action producing dynamic library from cc_binary. */
+ public static final String CPP_LINK_DYNAMIC_LIBRARY = "c++-link-dynamic-library";
+ /** Name of the action producing executable binary. */
+ public static final String CPP_LINK_EXECUTABLE = "c++-link-executable";
+ /** Name of the objc action producing static library */
+ public static final String OBJC_ARCHIVE = "objc-archive";
+ /** Name of the objc action producing dynamic library */
+ public static final String OBJC_FULLY_LINK = "objc-fully-link";
+ /** Name of the objc action producing objc executable binary */
+ public static final String OBJC_EXECUTABLE = "objc-executable";
+ /** Name of the objc action producing objc++ executable binary */
+ public static final String OBJCPP_EXECUTABLE = "objc++-executable";
+
+ public static final String LTO_INDEXING = "lto-indexing";
+ public static final String LTO_BACKEND = "lto-backend";
+}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
index f19dc727e6..9c7e837e4c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
@@ -93,69 +93,6 @@ public class CppCompileAction extends AbstractAction
private static final int VALIDATION_DEBUG = 0; // 0==none, 1==warns/errors, 2==all
private static final boolean VALIDATION_DEBUG_WARN = VALIDATION_DEBUG >= 1;
- /** A string constant used to compute CC_FLAGS make variable value */
- public static final java.lang.String CC_FLAGS_MAKE_VARIABLE_ACTION_NAME =
- "cc-flags-make-variable";
-
- /** A string constant for the strip action name. */
- public static final String STRIP_ACTION_NAME = "strip";
-
- /** A string constant for the linkstamp-compile action. */
- public static final String LINKSTAMP_COMPILE = "linkstamp-compile";
-
- /**
- * A string constant for the c compilation action.
- */
- public static final String C_COMPILE = "c-compile";
-
- /**
- * A string constant for the c++ compilation action.
- */
- public static final String CPP_COMPILE = "c++-compile";
-
- /** A string constant for the c++ module compile action. */
- public static final String CPP_MODULE_CODEGEN = "c++-module-codegen";
-
- /**
- * A string constant for the objc compilation action.
- */
- public static final String OBJC_COMPILE = "objc-compile";
-
- /**
- * A string constant for the objc++ compile action.
- */
- public static final String OBJCPP_COMPILE = "objc++-compile";
-
- /**
- * A string constant for the c++ header parsing.
- */
- public static final String CPP_HEADER_PARSING = "c++-header-parsing";
-
- /**
- * A string constant for the c++ header preprocessing.
- */
- public static final String CPP_HEADER_PREPROCESSING = "c++-header-preprocessing";
-
- /**
- * A string constant for the c++ module compilation action.
- * Note: currently we don't support C module compilation.
- */
- public static final String CPP_MODULE_COMPILE = "c++-module-compile";
-
- /**
- * A string constant for the assembler actions.
- */
- public static final String ASSEMBLE = "assemble";
- public static final String PREPROCESS_ASSEMBLE = "preprocess-assemble";
-
- /**
- * A string constant for the clif actions. Bazel enables different features of the toolchain based
- * on the name of the action. This name enables the clif_matcher feature, which switches the
- * "compiler" to the clif_matcher and adds some additional arguments as described in the CROSSTOOL
- * file.
- */
- public static final String CLIF_MATCH = "clif-match";
-
protected final Artifact outputFile;
private final Artifact sourceFile;
private final NestedSet<Artifact> mandatoryInputs;
@@ -1327,11 +1264,11 @@ public class CppCompileAction extends AbstractAction
@Override
public String getMnemonic() {
switch (actionName) {
- case OBJC_COMPILE:
- case OBJCPP_COMPILE:
+ case CppActionNames.OBJC_COMPILE:
+ case CppActionNames.OBJCPP_COMPILE:
return "ObjcCompile";
- case LINKSTAMP_COMPILE:
+ case CppActionNames.LINKSTAMP_COMPILE:
// When compiling shared native deps, e.g. when two java_binary rules have the same set of
// native dependencies, the CppCompileAction for link stamp data is shared also. This means
// that out of two CppCompileAction instances, only one is actually executed, which means
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java
index 13d8f3eea6..9e8b583d7e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java
@@ -232,15 +232,15 @@ public class CppCompileActionBuilder {
}
PathFragment sourcePath = sourceFile.getExecPath();
if (CppFileTypes.CPP_MODULE_MAP.matches(sourcePath)) {
- return CppCompileAction.CPP_MODULE_COMPILE;
+ return CppActionNames.CPP_MODULE_COMPILE;
} else if (CppFileTypes.CPP_HEADER.matches(sourcePath)) {
// TODO(bazel-team): Handle C headers that probably don't work in C++ mode.
if (!cppConfiguration.getParseHeadersVerifiesModules()
&& featureConfiguration.isEnabled(CppRuleClasses.PARSE_HEADERS)) {
- return CppCompileAction.CPP_HEADER_PARSING;
+ return CppActionNames.CPP_HEADER_PARSING;
} else if (!cppConfiguration.getParseHeadersVerifiesModules()
&& featureConfiguration.isEnabled(CppRuleClasses.PREPROCESS_HEADERS)) {
- return CppCompileAction.CPP_HEADER_PREPROCESSING;
+ return CppActionNames.CPP_HEADER_PREPROCESSING;
} else {
// CcCommon.collectCAndCppSources() ensures we do not add headers to
// the compilation artifacts unless either 'parse_headers' or
@@ -248,21 +248,21 @@ public class CppCompileActionBuilder {
throw new IllegalStateException();
}
} else if (CppFileTypes.C_SOURCE.matches(sourcePath)) {
- return CppCompileAction.C_COMPILE;
+ return CppActionNames.C_COMPILE;
} else if (CppFileTypes.CPP_SOURCE.matches(sourcePath)) {
- return CppCompileAction.CPP_COMPILE;
+ return CppActionNames.CPP_COMPILE;
} else if (CppFileTypes.OBJC_SOURCE.matches(sourcePath)) {
- return CppCompileAction.OBJC_COMPILE;
+ return CppActionNames.OBJC_COMPILE;
} else if (CppFileTypes.OBJCPP_SOURCE.matches(sourcePath)) {
- return CppCompileAction.OBJCPP_COMPILE;
+ return CppActionNames.OBJCPP_COMPILE;
} else if (CppFileTypes.ASSEMBLER.matches(sourcePath)) {
- return CppCompileAction.ASSEMBLE;
+ return CppActionNames.ASSEMBLE;
} else if (CppFileTypes.ASSEMBLER_WITH_C_PREPROCESSOR.matches(sourcePath)) {
- return CppCompileAction.PREPROCESS_ASSEMBLE;
+ return CppActionNames.PREPROCESS_ASSEMBLE;
} else if (CppFileTypes.CLIF_INPUT_PROTO.matches(sourcePath)) {
- return CppCompileAction.CLIF_MATCH;
+ return CppActionNames.CLIF_MATCH;
} else if (CppFileTypes.CPP_MODULE.matches(sourcePath)) {
- return CppCompileAction.CPP_MODULE_CODEGEN;
+ return CppActionNames.CPP_MODULE_CODEGEN;
}
// CcCompilationHelper ensures CppCompileAction only gets instantiated for supported file types.
throw new IllegalStateException();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
index d5617e6f5b..646ad4c9e6 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
@@ -902,14 +902,13 @@ public class CppHelper {
return;
}
- if (!featureConfiguration.actionIsConfigured(CppCompileAction.STRIP_ACTION_NAME)) {
+ if (!featureConfiguration.actionIsConfigured(CppActionNames.STRIP)) {
context.ruleError("Expected action_config for 'strip' to be configured.");
return;
}
Tool stripTool =
- Preconditions.checkNotNull(
- featureConfiguration.getToolForAction(CppCompileAction.STRIP_ACTION_NAME));
+ Preconditions.checkNotNull(featureConfiguration.getToolForAction(CppActionNames.STRIP));
CcToolchainVariables variables =
new CcToolchainVariables.Builder(toolchain.getBuildVariables())
.addStringVariable(
@@ -919,8 +918,7 @@ public class CppHelper {
.addStringVariable(CcCommon.INPUT_FILE_VARIABLE_NAME, input.getExecPathString())
.build();
ImmutableList<String> commandLine =
- ImmutableList.copyOf(
- featureConfiguration.getCommandLine(CppCompileAction.STRIP_ACTION_NAME, variables));
+ ImmutableList.copyOf(featureConfiguration.getCommandLine(CppActionNames.STRIP, variables));
ImmutableMap.Builder<String, String> executionInfoBuilder = ImmutableMap.builder();
for (String executionRequirement : stripTool.getExecutionRequirements()) {
executionInfoBuilder.put(executionRequirement, "");
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkstampCompileHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkstampCompileHelper.java
index 67d020f8ef..ce8d5bc89c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkstampCompileHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkstampCompileHelper.java
@@ -75,7 +75,7 @@ public class CppLinkstampCompileHelper {
.setBuiltinIncludeFiles(buildInfoHeaderArtifacts)
.addMandatoryInputs(nonCodeInputs)
.setCppConfiguration(cppConfiguration)
- .setActionName(CppCompileAction.LINKSTAMP_COMPILE);
+ .setActionName(CppActionNames.LINKSTAMP_COMPILE);
semantics.finalizeCompileActionBuilder(ruleContext, builder);
return builder.buildOrThrowIllegalStateException();
}
@@ -140,7 +140,7 @@ public class CppLinkstampCompileHelper {
boolean codeCoverageEnabled) {
// TODO(b/34761650): Remove all this hardcoding by separating a full blown compile action.
Preconditions.checkArgument(
- featureConfiguration.actionIsConfigured(CppCompileAction.LINKSTAMP_COMPILE));
+ featureConfiguration.actionIsConfigured(CppActionNames.LINKSTAMP_COMPILE));
return CompileBuildVariables.setupVariablesOrReportRuleError(
ruleContext,
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
index 7e6d2783bb..fece268cd2 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
@@ -118,7 +118,7 @@ public class FakeCppCompileAction extends CppCompileAction {
/* additionalIncludeScanningRoots=*/ ImmutableList.of(),
GUID,
executionInfo,
- CppCompileAction.CPP_COMPILE,
+ CppActionNames.CPP_COMPILE,
cppSemantics,
cppProvider,
grepIncludes);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java
index c32a701207..54c0aca96d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java
@@ -28,24 +28,6 @@ import com.google.devtools.build.lib.util.FileTypeSet;
*/
public abstract class Link {
- /** Name of the action producing static library. */
- public static final String CPP_LINK_STATIC_LIBRARY_ACTION_NAME = "c++-link-static-library";
- /** Name of the action producing dynamic library from cc_library. */
- public static final String CPP_LINK_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME =
- "c++-link-nodeps-dynamic-library";
- /** Name of the action producing dynamic library from cc_binary. */
- public static final String CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME = "c++-link-dynamic-library";
- /** Name of the action producing executable binary. */
- public static final String CPP_LINK_EXECUTABLE_ACTION_NAME = "c++-link-executable";
- /** Name of the objc action producing static library */
- public static final String OBJC_ARCHIVE_ACTION_NAME = "objc-archive";
- /** Name of the objc action producing dynamic library */
- public static final String OBJC_FULLY_LINK_ACTION_NAME = "objc-fully-link";
- /** Name of the objc action producing objc executable binary */
- public static final String OBJC_EXECUTABLE_ACTION_NAME = "objc-executable";
- /** Name of the objc action producing objc++ executable binary */
- public static final String OBJCPP_EXECUTABLE_ACTION_NAME = "objc++-executable";
-
private Link() {} // uninstantiable
/**
@@ -115,7 +97,7 @@ public abstract class Link {
/** A normal static archive. */
STATIC_LIBRARY(
LinkerOrArchiver.ARCHIVER,
- CPP_LINK_STATIC_LIBRARY_ACTION_NAME,
+ CppActionNames.CPP_LINK_STATIC_LIBRARY,
Picness.NOPIC,
ArtifactCategory.STATIC_LIBRARY,
Executable.NOT_EXECUTABLE),
@@ -123,7 +105,7 @@ public abstract class Link {
/** An objc static archive. */
OBJC_ARCHIVE(
LinkerOrArchiver.ARCHIVER,
- OBJC_ARCHIVE_ACTION_NAME,
+ CppActionNames.OBJC_ARCHIVE,
Picness.NOPIC,
ArtifactCategory.STATIC_LIBRARY,
Executable.NOT_EXECUTABLE),
@@ -131,7 +113,7 @@ public abstract class Link {
/** An objc fully linked static archive. */
OBJC_FULLY_LINKED_ARCHIVE(
LinkerOrArchiver.ARCHIVER,
- OBJC_FULLY_LINK_ACTION_NAME,
+ CppActionNames.OBJC_FULLY_LINK,
Picness.NOPIC,
ArtifactCategory.STATIC_LIBRARY,
Executable.NOT_EXECUTABLE),
@@ -139,7 +121,7 @@ public abstract class Link {
/** An objc executable. */
OBJC_EXECUTABLE(
LinkerOrArchiver.LINKER,
- OBJC_EXECUTABLE_ACTION_NAME,
+ CppActionNames.OBJC_EXECUTABLE,
Picness.NOPIC,
ArtifactCategory.EXECUTABLE,
Executable.EXECUTABLE),
@@ -147,7 +129,7 @@ public abstract class Link {
/** An objc executable that includes objc++/c++ source. */
OBJCPP_EXECUTABLE(
LinkerOrArchiver.LINKER,
- OBJCPP_EXECUTABLE_ACTION_NAME,
+ CppActionNames.OBJCPP_EXECUTABLE,
Picness.NOPIC,
ArtifactCategory.EXECUTABLE,
Executable.EXECUTABLE),
@@ -155,7 +137,7 @@ public abstract class Link {
/** A static archive with .pic.o object files (compiled with -fPIC). */
PIC_STATIC_LIBRARY(
LinkerOrArchiver.ARCHIVER,
- CPP_LINK_STATIC_LIBRARY_ACTION_NAME,
+ CppActionNames.CPP_LINK_STATIC_LIBRARY,
Picness.PIC,
ArtifactCategory.STATIC_LIBRARY,
Executable.NOT_EXECUTABLE),
@@ -163,7 +145,7 @@ public abstract class Link {
/** An interface dynamic library. */
INTERFACE_DYNAMIC_LIBRARY(
LinkerOrArchiver.LINKER,
- CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME,
+ CppActionNames.CPP_LINK_DYNAMIC_LIBRARY,
Picness.NOPIC, // Actually PIC but it's not indicated in the file name
ArtifactCategory.INTERFACE_LIBRARY,
Executable.NOT_EXECUTABLE),
@@ -171,14 +153,14 @@ public abstract class Link {
/** A dynamic library built from cc_library srcs. */
NODEPS_DYNAMIC_LIBRARY(
LinkerOrArchiver.LINKER,
- CPP_LINK_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME,
+ CppActionNames.CPP_LINK_NODEPS_DYNAMIC_LIBRARY,
Picness.NOPIC, // Actually PIC but it's not indicated in the file name
ArtifactCategory.DYNAMIC_LIBRARY,
Executable.NOT_EXECUTABLE),
/** A transitive dynamic library used for distribution. */
DYNAMIC_LIBRARY(
LinkerOrArchiver.LINKER,
- CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME,
+ CppActionNames.CPP_LINK_DYNAMIC_LIBRARY,
Picness.NOPIC, // Actually PIC but it's not indicated in the file name
ArtifactCategory.DYNAMIC_LIBRARY,
Executable.NOT_EXECUTABLE),
@@ -186,7 +168,7 @@ public abstract class Link {
/** A static archive without removal of unused object files. */
ALWAYS_LINK_STATIC_LIBRARY(
LinkerOrArchiver.ARCHIVER,
- CPP_LINK_STATIC_LIBRARY_ACTION_NAME,
+ CppActionNames.CPP_LINK_STATIC_LIBRARY,
Picness.NOPIC,
ArtifactCategory.ALWAYSLINK_STATIC_LIBRARY,
Executable.NOT_EXECUTABLE),
@@ -194,7 +176,7 @@ public abstract class Link {
/** A PIC static archive without removal of unused object files. */
ALWAYS_LINK_PIC_STATIC_LIBRARY(
LinkerOrArchiver.ARCHIVER,
- CPP_LINK_STATIC_LIBRARY_ACTION_NAME,
+ CppActionNames.CPP_LINK_STATIC_LIBRARY,
Picness.PIC,
ArtifactCategory.ALWAYSLINK_STATIC_LIBRARY,
Executable.NOT_EXECUTABLE),
@@ -202,7 +184,7 @@ public abstract class Link {
/** An executable binary. */
EXECUTABLE(
LinkerOrArchiver.LINKER,
- CPP_LINK_EXECUTABLE_ACTION_NAME,
+ CppActionNames.CPP_LINK_EXECUTABLE,
Picness.NOPIC, // Picness is not indicate in the file name
ArtifactCategory.EXECUTABLE,
Executable.EXECUTABLE);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariables.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariables.java
index f0e56358aa..9104db77e0 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariables.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariables.java
@@ -252,7 +252,7 @@ public enum LinkBuildVariables {
List<String> opts = new ArrayList<>(userLinkFlags);
opts.addAll(
featureConfiguration.getCommandLine(
- "lto-indexing", buildVariables.build(), /* expander= */ null));
+ CppActionNames.LTO_INDEXING, buildVariables.build(), /* expander= */ null));
opts.addAll(ccToolchainProvider.getCppConfiguration().getLtoIndexOptions());
userLinkFlagsWithLtoIndexingIfNeeded = ImmutableList.copyOf(opts);
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LtoBackendArtifacts.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LtoBackendArtifacts.java
index f3e6d688a9..643fb26eb0 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LtoBackendArtifacts.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LtoBackendArtifacts.java
@@ -52,6 +52,7 @@ import java.util.Map;
*/
@AutoCodec
public final class LtoBackendArtifacts {
+
// A file containing mapping of symbol => bitcode file containing the symbol.
// It will be null when this is a shared non-lto backend.
private final Artifact index;
@@ -259,7 +260,8 @@ public final class LtoBackendArtifacts {
execArgs.addAll(commandLine);
CcToolchainVariables buildVariables = buildVariablesBuilder.build();
// Feature options should go after --copt for consistency with compile actions.
- execArgs.addAll(featureConfiguration.getCommandLine("lto-backend", buildVariables));
+ execArgs.addAll(
+ featureConfiguration.getCommandLine(CppActionNames.LTO_BACKEND, buildVariables));
// If this is a PIC compile (set based on the CppConfiguration), the PIC
// option should be added after the rest of the command line so that it
// cannot be overridden. This is consistent with the ordering in the