From 9fce7603ffd4f63b5b7e819e6699a603acda965c Mon Sep 17 00:00:00 2001 From: Cal Peyser Date: Tue, 26 Jul 2016 18:39:13 +0000 Subject: 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 --- .../google/devtools/build/lib/rules/cpp/Link.java | 37 +++++++++++++++++----- 1 file changed, 29 insertions(+), 8 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java') 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. -- cgit v1.2.3