Search in sources :

Example 21 with ImmutableMap

use of com.google.common.collect.ImmutableMap in project buck by facebook.

the class CxxPlatformXcodeConfigGeneratorTest method testResultHasIphoneOsSdkRootTakenFromIphoneSimulatorFlavor.

@Test
public void testResultHasIphoneOsSdkRootTakenFromIphoneSimulatorFlavor() {
    CxxPlatform platform = CxxPlatform.builder().from(DEFAULT_PLATFORM).setFlavor(InternalFlavor.of("iphonesimulator-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.SDKROOT), Matchers.equalTo("iphoneos"));
}
Also used : CxxPlatform(com.facebook.buck.cxx.CxxPlatform) ImmutableMap(com.google.common.collect.ImmutableMap) Test(org.junit.Test)

Example 22 with ImmutableMap

use of com.google.common.collect.ImmutableMap in project buck by facebook.

the class CxxPlatformXcodeConfigGeneratorTest method testResultHasCxxLanguageStardardValueTakenFromAppendConfigIfPresent.

@Test
public void testResultHasCxxLanguageStardardValueTakenFromAppendConfigIfPresent() {
    LinkedHashMap<String, String> appendConfig = new LinkedHashMap<String, String>();
    appendConfig.put(CxxPlatformXcodeConfigGenerator.CLANG_CXX_LANGUAGE_STANDARD, "value");
    CxxPlatform platform = CxxPlatform.builder().from(DEFAULT_PLATFORM).setCxxflags(ImmutableList.of("-std=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_LANGUAGE_STANDARD), Matchers.equalTo(appendConfig.get(CxxPlatformXcodeConfigGenerator.CLANG_CXX_LANGUAGE_STANDARD)));
}
Also used : CxxPlatform(com.facebook.buck.cxx.CxxPlatform) ImmutableMap(com.google.common.collect.ImmutableMap) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Example 23 with ImmutableMap

use of com.google.common.collect.ImmutableMap in project buck by facebook.

the class CxxPlatformXcodeConfigGeneratorTest method testResultHasMacOsxSdkRootTakenFromMacOsxFlavor.

@Test
public void testResultHasMacOsxSdkRootTakenFromMacOsxFlavor() {
    CxxPlatform platform = CxxPlatform.builder().from(DEFAULT_PLATFORM).setFlavor(InternalFlavor.of("macosx-12.0")).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("macosx"));
}
Also used : CxxPlatform(com.facebook.buck.cxx.CxxPlatform) ImmutableMap(com.google.common.collect.ImmutableMap) Test(org.junit.Test)

Example 24 with ImmutableMap

use of com.google.common.collect.ImmutableMap in project buck by facebook.

the class CxxPlatformXcodeConfigGeneratorTest method testResultHasCxxLibraryValueTakenFromPlatformCxxflags.

@Test
public void testResultHasCxxLibraryValueTakenFromPlatformCxxflags() {
    CxxPlatform platform = CxxPlatform.builder().from(DEFAULT_PLATFORM).setCxxflags(ImmutableList.of("-stdlib=somevalue")).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.CLANG_CXX_LIBRARY), Matchers.equalTo("somevalue"));
}
Also used : CxxPlatform(com.facebook.buck.cxx.CxxPlatform) ImmutableMap(com.google.common.collect.ImmutableMap) Test(org.junit.Test)

Example 25 with ImmutableMap

use of com.google.common.collect.ImmutableMap in project buck by facebook.

the class CxxPlatformXcodeConfigGeneratorTest method testAllBuildConfigurationsHaveSameConfigs.

@Test
public void testAllBuildConfigurationsHaveSameConfigs() {
    final String someCrazyKey = "SOME_CRAZY_KEY";
    LinkedHashMap<String, String> appendConfig = new LinkedHashMap<String, String>();
    appendConfig.put(someCrazyKey, "value");
    CxxPlatform platform = CxxPlatform.builder().from(DEFAULT_PLATFORM).setFlavor(InternalFlavor.of("macosx-12.0")).setCxxflags(ImmutableList.of("-Wno-warning", "-someflag", "-mmacosx-version-min=10.8")).build();
    ImmutableMap<String, ImmutableMap<String, String>> buildConfigs = CxxPlatformXcodeConfigGenerator.getDefaultXcodeBuildConfigurationsFromCxxPlatform(platform, appendConfig);
    ImmutableMap<String, String> debugConfig = buildConfigs.get(CxxPlatformXcodeConfigGenerator.DEBUG_BUILD_CONFIGURATION_NAME);
    ImmutableMap<String, String> releaseConfig = buildConfigs.get(CxxPlatformXcodeConfigGenerator.RELEASE_BUILD_CONFIGURATION_NAME);
    ImmutableMap<String, String> profileConfig = buildConfigs.get(CxxPlatformXcodeConfigGenerator.PROFILE_BUILD_CONFIGURATION_NAME);
    assertThat(debugConfig, Matchers.equalTo(releaseConfig));
    assertThat(releaseConfig, Matchers.equalTo(profileConfig));
}
Also used : CxxPlatform(com.facebook.buck.cxx.CxxPlatform) ImmutableMap(com.google.common.collect.ImmutableMap) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Aggregations

ImmutableMap (com.google.common.collect.ImmutableMap)702 Map (java.util.Map)346 Test (org.junit.Test)195 HashMap (java.util.HashMap)144 ImmutableList (com.google.common.collect.ImmutableList)126 Path (java.nio.file.Path)104 List (java.util.List)100 ImmutableSet (com.google.common.collect.ImmutableSet)89 IOException (java.io.IOException)84 ArrayList (java.util.ArrayList)74 Set (java.util.Set)69 Optional (java.util.Optional)61 BuildTarget (com.facebook.buck.model.BuildTarget)57 File (java.io.File)57 Collectors (java.util.stream.Collectors)45 HashSet (java.util.HashSet)44 SourcePath (com.facebook.buck.rules.SourcePath)41 VisibleForTesting (com.google.common.annotations.VisibleForTesting)39 Nullable (javax.annotation.Nullable)39 LinkedHashMap (java.util.LinkedHashMap)36