16
16
17
17
import static com .google .common .truth .Truth .assertThat ;
18
18
19
- import com .google .common .base .Joiner ;
20
19
import com .google .common .collect .ImmutableSet ;
21
20
import com .google .common .collect .Iterables ;
22
21
import com .google .devtools .build .lib .actions .Artifact ;
25
24
import com .google .devtools .build .lib .analysis .actions .SpawnAction ;
26
25
import com .google .devtools .build .lib .analysis .util .BuildViewTestCase ;
27
26
import com .google .devtools .build .lib .rules .cpp .CcToolchainFeatures .FeatureConfiguration ;
28
- import com .google .devtools .build .lib .vfs .PathFragment ;
29
- import com .google .devtools .build .lib .view .config .crosstool .CrosstoolConfig .CToolchain ;
30
- import com .google .protobuf .TextFormat ;
31
27
import java .util .List ;
32
28
33
29
/**
@@ -119,22 +115,11 @@ protected CcToolchainVariables getLinkBuildVariables(
119
115
return getLinkCommandLine (getCppLinkAction (target , type )).getBuildVariables ();
120
116
}
121
117
122
- /** Creates a CcToolchainFeatures from features described in the given toolchain fragment. */
123
- public static CcToolchainFeatures buildFeatures (RuleContext ruleContext , String ... toolchain )
124
- throws Exception {
125
- CToolchain .Builder toolchainBuilder = CToolchain .newBuilder ();
126
- TextFormat .merge (Joiner .on ("" ).join (toolchain ), toolchainBuilder );
127
- return new CcToolchainFeatures (
128
- CcToolchainConfigInfo .fromToolchainForTestingOnly (toolchainBuilder .buildPartial ()),
129
- /* ccToolchainPath= */ PathFragment .EMPTY_FRAGMENT );
130
- }
131
-
132
118
/** Returns the value of a given sequence variable in context of the given Variables instance. */
133
119
protected static List <String > getSequenceVariableValue (
134
120
RuleContext ruleContext , CcToolchainVariables variables , String variable ) throws Exception {
135
121
FeatureConfiguration mockFeatureConfiguration =
136
- buildFeatures (
137
- ruleContext ,
122
+ CcToolchainTestHelper .buildFeatures (
138
123
"feature {" ,
139
124
" name: 'a'" ,
140
125
" flag_set {" ,
@@ -153,8 +138,7 @@ protected static List<String> getSequenceVariableValue(
153
138
protected static String getVariableValue (
154
139
RuleContext ruleContext , CcToolchainVariables variables , String variable ) throws Exception {
155
140
FeatureConfiguration mockFeatureConfiguration =
156
- buildFeatures (
157
- ruleContext ,
141
+ CcToolchainTestHelper .buildFeatures (
158
142
"feature {" ,
159
143
" name: 'a'" ,
160
144
" flag_set {" ,
0 commit comments