aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java
diff options
context:
space:
mode:
authorGravatar Cal Peyser <cpeyser@google.com>2016-07-26 18:39:13 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-07-27 11:15:10 +0000
commit9fce7603ffd4f63b5b7e819e6699a603acda965c (patch)
treeaccc96ee605ce840f44614d029ca082ffbded9ea /src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java
parentcb5aa0067d5775c5ada1b751adc502ad2375352b (diff)
Linker outputs can optionally be configured from the CROSSTOOL. Introduces infrastructure to allow other artifact categories (such as debug symbols or compiler outputs) to be defined in other changes.
-- MOS_MIGRATED_REVID=128495797
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java37
1 files changed, 29 insertions, 8 deletions
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 38ab7e8ccf..8826b0acb7 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
@@ -94,34 +94,50 @@ public abstract class Link {
*/
public enum LinkTargetType {
/** A normal static archive. */
- STATIC_LIBRARY(".a", true, "c++-link-static-library"),
+ STATIC_LIBRARY(".a", true, "c++-link-static-library", ArtifactCategory.STATIC_LIBRARY),
/** A static archive with .pic.o object files (compiled with -fPIC). */
- PIC_STATIC_LIBRARY(".pic.a", true, "c++-link-pic-static-library"),
+ PIC_STATIC_LIBRARY(
+ ".pic.a", true, "c++-link-pic-static-library", ArtifactCategory.PIC_STATIC_LIBRARY),
/** An interface dynamic library. */
- INTERFACE_DYNAMIC_LIBRARY(".ifso", false, "c++-link-interface-dynamic-library"),
+ INTERFACE_DYNAMIC_LIBRARY(
+ ".ifso", false, "c++-link-interface-dynamic-library", ArtifactCategory.INTERFACE),
/** A dynamic library. */
- DYNAMIC_LIBRARY(".so", false, "c++-link-dynamic-library"),
+ DYNAMIC_LIBRARY(".so", false, "c++-link-dynamic-library", ArtifactCategory.DYNAMIC_LIBRARY),
/** A static archive without removal of unused object files. */
- ALWAYS_LINK_STATIC_LIBRARY(".lo", true, "c++-link-alwayslink-static-library"),
+ ALWAYS_LINK_STATIC_LIBRARY(
+ ".lo",
+ true,
+ "c++-link-alwayslink-static-library",
+ ArtifactCategory.ALWAYS_LINK_STATIC_LIBRARY),
/** A PIC static archive without removal of unused object files. */
- ALWAYS_LINK_PIC_STATIC_LIBRARY(".pic.lo", true, "c++-link-alwayslink-pic-static-library"),
+ ALWAYS_LINK_PIC_STATIC_LIBRARY(
+ ".pic.lo",
+ true,
+ "c++-link-alwayslink-pic-static-library",
+ ArtifactCategory.ALWAYS_LINK_PIC_STATIC_LIBRARY),
/** An executable binary. */
- EXECUTABLE("", false, "c++-link-executable");
+ EXECUTABLE("", false, "c++-link-executable", ArtifactCategory.EXECUTABLE);
private final String extension;
private final boolean staticLibraryLink;
private final String actionName;
+ private final ArtifactCategory linkerOutput;
- private LinkTargetType(String extension, boolean staticLibraryLink, String actionName) {
+ private LinkTargetType(
+ String extension,
+ boolean staticLibraryLink,
+ String actionName,
+ ArtifactCategory linkerOutput) {
this.extension = extension;
this.staticLibraryLink = staticLibraryLink;
this.actionName = actionName;
+ this.linkerOutput = linkerOutput;
}
public String getExtension() {
@@ -132,6 +148,11 @@ public abstract class Link {
return staticLibraryLink;
}
+ /** Returns an {@code ArtifactCategory} identifying the artifact type this link action emits. */
+ public ArtifactCategory getLinkerOutput() {
+ return linkerOutput;
+ }
+
/**
* The name of a link action with this LinkTargetType, for the purpose of crosstool feature
* selection.