Search in sources :

Example 11 with Variables

use of com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.Variables in project bazel by bazelbuild.

the class LinkBuildVariablesTest method testLibrarySearchDirectoriesAreExported.

@Test
public void testLibrarySearchDirectoriesAreExported() throws Exception {
    AnalysisMock.get().ccSupport().setupCrosstool(mockToolsConfig);
    useConfiguration();
    scratch.file("x/BUILD", "cc_binary(name = 'bin', srcs = ['some-dir/bar.so'])");
    scratch.file("x/some-dir/bar.so");
    ConfiguredTarget target = getConfiguredTarget("//x:bin");
    Variables variables = getLinkBuildVariables(target, Link.LinkTargetType.EXECUTABLE);
    List<String> variableValue = getVariableValue(variables, CppLinkActionBuilder.LIBRARY_SEARCH_DIRECTORIES_VARIABLE);
    assertThat(Iterables.getOnlyElement(variableValue)).contains("some-dir");
}
Also used : Variables(com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.Variables) ConfiguredTarget(com.google.devtools.build.lib.analysis.ConfiguredTarget) Test(org.junit.Test)

Aggregations

Variables (com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.Variables)11 ConfiguredTarget (com.google.devtools.build.lib.analysis.ConfiguredTarget)9 Test (org.junit.Test)8 Artifact (com.google.devtools.build.lib.actions.Artifact)2 PathFragment (com.google.devtools.build.lib.vfs.PathFragment)2 ArrayList (java.util.ArrayList)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Builder (com.google.common.collect.ImmutableSet.Builder)1 Action (com.google.devtools.build.lib.actions.Action)1 ParameterFileWriteAction (com.google.devtools.build.lib.analysis.actions.ParameterFileWriteAction)1 IterablesChain (com.google.devtools.build.lib.collect.IterablesChain)1 NestedSetBuilder (com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder)1 SequenceBuilder (com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.Variables.SequenceBuilder)1 VariableValue (com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.Variables.VariableValue)1 VariablesExtension (com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.Variables.VariablesExtension)1 LibraryToLink (com.google.devtools.build.lib.rules.cpp.LinkerInputs.LibraryToLink)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Nullable (javax.annotation.Nullable)1