|
14 | 14 |
|
15 | 15 | package com.google.devtools.build.lib.rules.cpp;
|
16 | 16 |
|
17 |
| -import static com.google.devtools.build.lib.packages.BuildType.LABEL_LIST; |
18 |
| - |
19 |
| -import com.google.common.collect.ImmutableCollection; |
20 | 17 | import com.google.common.collect.ImmutableList;
|
21 | 18 | import com.google.common.collect.ImmutableMap;
|
22 | 19 | import com.google.devtools.build.lib.actions.Artifact;
|
23 | 20 | import com.google.devtools.build.lib.actions.Artifact.SpecialArtifact;
|
24 | 21 | import com.google.devtools.build.lib.actions.FailAction;
|
25 | 22 | import com.google.devtools.build.lib.actions.PathMapper;
|
26 |
| -import com.google.devtools.build.lib.analysis.AliasProvider; |
27 | 23 | import com.google.devtools.build.lib.analysis.AnalysisUtils;
|
28 |
| -import com.google.devtools.build.lib.analysis.Expander; |
29 |
| -import com.google.devtools.build.lib.analysis.FileProvider; |
30 | 24 | import com.google.devtools.build.lib.analysis.RuleContext;
|
31 | 25 | import com.google.devtools.build.lib.analysis.RuleErrorConsumer;
|
32 |
| -import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; |
33 | 26 | import com.google.devtools.build.lib.analysis.actions.ActionConstructionContext;
|
34 | 27 | import com.google.devtools.build.lib.analysis.config.BuildConfigurationValue;
|
35 | 28 | import com.google.devtools.build.lib.analysis.config.CompilationMode;
|
36 | 29 | import com.google.devtools.build.lib.analysis.platform.ToolchainInfo;
|
37 | 30 | import com.google.devtools.build.lib.cmdline.Label;
|
38 | 31 | import com.google.devtools.build.lib.packages.Info;
|
39 | 32 | import com.google.devtools.build.lib.packages.RuleClass.ConfiguredTargetFactory.RuleErrorException;
|
40 |
| -import com.google.devtools.build.lib.packages.Types; |
41 | 33 | import com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.ExpansionException;
|
42 | 34 | import com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.FeatureConfiguration;
|
43 | 35 | import com.google.devtools.build.lib.rules.cpp.CppLinkActionBuilder.LinkActionConstruction;
|
44 | 36 | import com.google.devtools.build.lib.rules.cpp.Link.LinkTargetType;
|
45 | 37 | import com.google.devtools.build.lib.server.FailureDetails.FailAction.Code;
|
46 | 38 | import com.google.devtools.build.lib.vfs.FileSystemUtils;
|
47 | 39 | import com.google.devtools.build.lib.vfs.PathFragment;
|
48 |
| -import java.util.ArrayList; |
49 |
| -import java.util.List; |
50 | 40 | import javax.annotation.Nullable;
|
51 | 41 | import net.starlark.java.eval.EvalException;
|
52 | 42 |
|
@@ -74,41 +64,6 @@ private CppHelper() {
|
74 | 64 | // prevents construction
|
75 | 65 | }
|
76 | 66 |
|
77 |
| - /** Tokenizes and expands make variables. */ |
78 |
| - public static List<String> expandLinkopts( |
79 |
| - RuleContext ruleContext, String attrName, Iterable<String> values) |
80 |
| - throws InterruptedException { |
81 |
| - List<String> result = new ArrayList<>(); |
82 |
| - ImmutableMap.Builder<Label, ImmutableCollection<Artifact>> builder = ImmutableMap.builder(); |
83 |
| - |
84 |
| - if (ruleContext.attributes().has("additional_linker_inputs", LABEL_LIST)) { |
85 |
| - for (TransitiveInfoCollection current : |
86 |
| - ruleContext.getPrerequisites("additional_linker_inputs")) { |
87 |
| - builder.put( |
88 |
| - AliasProvider.getDependencyLabel(current), |
89 |
| - current.getProvider(FileProvider.class).getFilesToBuild().toList()); |
90 |
| - } |
91 |
| - } |
92 |
| - |
93 |
| - Expander expander = ruleContext.getExpander(builder.buildOrThrow()).withDataExecLocations(); |
94 |
| - for (String value : values) { |
95 |
| - expander.tokenizeAndExpandMakeVars(result, attrName, value); |
96 |
| - } |
97 |
| - return result; |
98 |
| - } |
99 |
| - |
100 |
| - /** Returns the linkopts for the rule context. */ |
101 |
| - public static ImmutableList<String> getLinkopts(RuleContext ruleContext) |
102 |
| - throws InterruptedException { |
103 |
| - if (ruleContext.attributes().has("linkopts", Types.STRING_LIST)) { |
104 |
| - Iterable<String> linkopts = ruleContext.attributes().get("linkopts", Types.STRING_LIST); |
105 |
| - if (linkopts != null) { |
106 |
| - return ImmutableList.copyOf(expandLinkopts(ruleContext, "linkopts", linkopts)); |
107 |
| - } |
108 |
| - } |
109 |
| - return ImmutableList.of(); |
110 |
| - } |
111 |
| - |
112 | 67 | /** Returns C++ toolchain, using toolchain resolution */
|
113 | 68 | public static CcToolchainProvider getToolchain(RuleContext ruleContext)
|
114 | 69 | throws RuleErrorException {
|
|
0 commit comments