Search in sources :

Example 31 with CxxPlatform

use of com.facebook.buck.cxx.CxxPlatform in project buck by facebook.

the class CxxPlatformXcodeConfigGeneratorTest method testResultHasCxxLibraryValueTakenFromAppendConfigIfPresent.

@Test
public void testResultHasCxxLibraryValueTakenFromAppendConfigIfPresent() {
    LinkedHashMap<String, String> appendConfig = new LinkedHashMap<String, String>();
    appendConfig.put(CxxPlatformXcodeConfigGenerator.CLANG_CXX_LIBRARY, "value");
    CxxPlatform platform = CxxPlatform.builder().from(DEFAULT_PLATFORM).setCxxflags(ImmutableList.of("-stdlib=cxxflagsvalue")).build();
    ImmutableMap<String, ImmutableMap<String, String>> buildConfigs = CxxPlatformXcodeConfigGenerator.getDefaultXcodeBuildConfigurationsFromCxxPlatform(platform, appendConfig);
    ImmutableMap<String, String> config = buildConfigs.get(CxxPlatformXcodeConfigGenerator.DEBUG_BUILD_CONFIGURATION_NAME);
    assertThat(config.get(CxxPlatformXcodeConfigGenerator.CLANG_CXX_LIBRARY), Matchers.equalTo(appendConfig.get(CxxPlatformXcodeConfigGenerator.CLANG_CXX_LIBRARY)));
}
Also used : CxxPlatform(com.facebook.buck.cxx.CxxPlatform) ImmutableMap(com.google.common.collect.ImmutableMap) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Example 32 with CxxPlatform

use of com.facebook.buck.cxx.CxxPlatform in project buck by facebook.

the class CxxPlatformXcodeConfigGeneratorTest method testResultHasNoArchSetToAllowAutomaticDeviceSwitchInXcode.

@Test
public void testResultHasNoArchSetToAllowAutomaticDeviceSwitchInXcode() {
    CxxPlatform platform = CxxPlatform.builder().from(DEFAULT_PLATFORM).setCxxflags(ImmutableList.of("-arch", "x86-64")).build();
    ImmutableMap<String, ImmutableMap<String, String>> buildConfigs = CxxPlatformXcodeConfigGenerator.getDefaultXcodeBuildConfigurationsFromCxxPlatform(platform, new LinkedHashMap<String, String>());
    ImmutableMap<String, String> config = buildConfigs.get(CxxPlatformXcodeConfigGenerator.DEBUG_BUILD_CONFIGURATION_NAME);
    assertThat(config.get(CxxPlatformXcodeConfigGenerator.ARCHS), Matchers.nullValue());
}
Also used : CxxPlatform(com.facebook.buck.cxx.CxxPlatform) ImmutableMap(com.google.common.collect.ImmutableMap) Test(org.junit.Test)

Example 33 with CxxPlatform

use of com.facebook.buck.cxx.CxxPlatform in project buck by facebook.

the class CxxPlatformXcodeConfigGeneratorTest method testResultHasOtherCxxFlagsTakenFromPlatformCxxflagsAndMergedWithAppendConfig.

@Test
public void testResultHasOtherCxxFlagsTakenFromPlatformCxxflagsAndMergedWithAppendConfig() {
    LinkedHashMap<String, String> appendConfig = new LinkedHashMap<String, String>();
    appendConfig.put(CxxPlatformXcodeConfigGenerator.OTHER_CPLUSPLUSFLAGS, "-flag1 -flag2");
    CxxPlatform platform = CxxPlatform.builder().from(DEFAULT_PLATFORM).setCxxflags(ImmutableList.of("-Wno-warning", "-someflag", "-g")).build();
    ImmutableMap<String, ImmutableMap<String, String>> buildConfigs = CxxPlatformXcodeConfigGenerator.getDefaultXcodeBuildConfigurationsFromCxxPlatform(platform, appendConfig);
    ImmutableMap<String, String> config = buildConfigs.get(CxxPlatformXcodeConfigGenerator.DEBUG_BUILD_CONFIGURATION_NAME);
    assertThat(config.get(CxxPlatformXcodeConfigGenerator.OTHER_CPLUSPLUSFLAGS), Matchers.equalTo("-flag1 -flag2 -Wno-warning -someflag -g"));
}
Also used : CxxPlatform(com.facebook.buck.cxx.CxxPlatform) ImmutableMap(com.google.common.collect.ImmutableMap) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Example 34 with CxxPlatform

use of com.facebook.buck.cxx.CxxPlatform in project buck by facebook.

the class CxxPlatformXcodeConfigGeneratorTest method testResultHasIphoneOsSdkRootTakenFromIphoneOsFlavor.

@Test
public void testResultHasIphoneOsSdkRootTakenFromIphoneOsFlavor() {
    CxxPlatform platform = CxxPlatform.builder().from(DEFAULT_PLATFORM).setFlavor(InternalFlavor.of("iphoneos-9.1")).build();
    ImmutableMap<String, ImmutableMap<String, String>> buildConfigs = CxxPlatformXcodeConfigGenerator.getDefaultXcodeBuildConfigurationsFromCxxPlatform(platform, new LinkedHashMap<String, String>());
    ImmutableMap<String, String> config = buildConfigs.get(CxxPlatformXcodeConfigGenerator.DEBUG_BUILD_CONFIGURATION_NAME);
    assertThat(config.get(CxxPlatformXcodeConfigGenerator.SDKROOT), Matchers.equalTo("iphoneos"));
}
Also used : CxxPlatform(com.facebook.buck.cxx.CxxPlatform) ImmutableMap(com.google.common.collect.ImmutableMap) Test(org.junit.Test)

Example 35 with CxxPlatform

use of com.facebook.buck.cxx.CxxPlatform in project buck by facebook.

the class CxxPlatformXcodeConfigGeneratorTest method testResultHasDeploymentTargetValueTakenFromPlatformCxxflags.

@Test
public void testResultHasDeploymentTargetValueTakenFromPlatformCxxflags() {
    CxxPlatform platform = CxxPlatform.builder().from(DEFAULT_PLATFORM).setFlavor(InternalFlavor.of("macosx-12.0")).setCxxflags(ImmutableList.of("-mmacosx-version-min=10.8")).build();
    ImmutableMap<String, ImmutableMap<String, String>> buildConfigs = CxxPlatformXcodeConfigGenerator.getDefaultXcodeBuildConfigurationsFromCxxPlatform(platform, new LinkedHashMap<String, String>());
    ImmutableMap<String, String> config = buildConfigs.get(CxxPlatformXcodeConfigGenerator.DEBUG_BUILD_CONFIGURATION_NAME);
    assertThat(config.get("MACOSX_DEPLOYMENT_TARGET"), Matchers.equalTo("10.8"));
}
Also used : CxxPlatform(com.facebook.buck.cxx.CxxPlatform) ImmutableMap(com.google.common.collect.ImmutableMap) Test(org.junit.Test)

Aggregations

CxxPlatform (com.facebook.buck.cxx.CxxPlatform)52 Test (org.junit.Test)25 ImmutableMap (com.google.common.collect.ImmutableMap)24 Path (java.nio.file.Path)22 SourcePathRuleFinder (com.facebook.buck.rules.SourcePathRuleFinder)20 BuildTarget (com.facebook.buck.model.BuildTarget)19 SourcePathResolver (com.facebook.buck.rules.SourcePathResolver)19 SourcePath (com.facebook.buck.rules.SourcePath)17 BuildRule (com.facebook.buck.rules.BuildRule)14 ImmutableList (com.google.common.collect.ImmutableList)11 HumanReadableException (com.facebook.buck.util.HumanReadableException)9 ImmutableSet (com.google.common.collect.ImmutableSet)9 FakeExecutableFinder (com.facebook.buck.io.FakeExecutableFinder)8 BuildRuleResolver (com.facebook.buck.rules.BuildRuleResolver)8 FakeSourcePath (com.facebook.buck.rules.FakeSourcePath)8 Optional (java.util.Optional)8 Flavor (com.facebook.buck.model.Flavor)7 ImmutableSortedSet (com.google.common.collect.ImmutableSortedSet)7 CxxBuckConfig (com.facebook.buck.cxx.CxxBuckConfig)6 Linker (com.facebook.buck.cxx.Linker)6