Search in sources :

Example 26 with Flavor

use of com.facebook.buck.model.Flavor in project buck by facebook.

the class CxxBinaryDescriptionTest method mkSandboxNode.

private TargetNode<CxxBinaryDescription.Arg, ?> mkSandboxNode(BuildTarget libTarget) {
    Optional<Map.Entry<Flavor, CxxLibraryDescription.Type>> type = CxxLibraryDescription.getLibType(libTarget);
    Set<Flavor> flavors = Sets.newHashSet(libTarget.getFlavors());
    if (type.isPresent()) {
        flavors.remove(type.get().getKey());
    }
    BuildTarget target = BuildTarget.builder(libTarget.getUnflavoredBuildTarget()).addAllFlavors(flavors).addFlavors(CxxLibraryDescription.Type.SANDBOX_TREE.getFlavor()).build();
    return new CxxBinaryBuilder(target, cxxBuckConfig).build();
}
Also used : BuildTarget(com.facebook.buck.model.BuildTarget) InternalFlavor(com.facebook.buck.model.InternalFlavor) Flavor(com.facebook.buck.model.Flavor)

Example 27 with Flavor

use of com.facebook.buck.model.Flavor in project buck by facebook.

the class CompDirReplacerIntegrationTest method testCompDirReplacerForArm32Bit.

@Test
public void testCompDirReplacerForArm32Bit() throws Exception {
    Flavor platformFlavor = InternalFlavor.of("iphoneos-armv7");
    runCompDirReplacerWithPlatformFlavor(platformFlavor);
}
Also used : InternalFlavor(com.facebook.buck.model.InternalFlavor) Flavor(com.facebook.buck.model.Flavor) Test(org.junit.Test)

Example 28 with Flavor

use of com.facebook.buck.model.Flavor in project buck by facebook.

the class ObjectPathsAbsolutifierIntegrationTest method testAbsolutifyingPathsForIntel32Bit.

@Test
public void testAbsolutifyingPathsForIntel32Bit() throws IOException, InterruptedException {
    Flavor platformFlavor = InternalFlavor.of("iphonesimulator-i386");
    runAndCheckAbsolutificationWithPlatformFlavor(platformFlavor);
}
Also used : InternalFlavor(com.facebook.buck.model.InternalFlavor) Flavor(com.facebook.buck.model.Flavor) Test(org.junit.Test)

Example 29 with Flavor

use of com.facebook.buck.model.Flavor in project buck by facebook.

the class KnownBuildRuleTypesTest method ocamlUsesConfiguredDefaultPlatform.

@Test
public void ocamlUsesConfiguredDefaultPlatform() throws Exception {
    ProjectFilesystem filesystem = new ProjectFilesystem(temporaryFolder.getRoot());
    Flavor flavor = InternalFlavor.of("flavor");
    ImmutableMap<String, ImmutableMap<String, String>> sections = ImmutableMap.of("cxx", ImmutableMap.of("default_platform", flavor.toString()), "cxx#" + flavor, ImmutableMap.of());
    BuckConfig buckConfig = FakeBuckConfig.builder().setSections(sections).build();
    KnownBuildRuleTypes knownBuildRuleTypes = KnownBuildRuleTypes.createBuilder(buckConfig, filesystem, createExecutor(), new FakeAndroidDirectoryResolver()).build();
    OcamlLibraryDescription ocamlLibraryDescription = (OcamlLibraryDescription) knownBuildRuleTypes.getDescription(knownBuildRuleTypes.getBuildRuleType("ocaml_library"));
    assertThat(ocamlLibraryDescription.getOcamlBuckConfig().getCxxPlatform(), Matchers.equalTo(knownBuildRuleTypes.getCxxPlatforms().getValue(flavor)));
    OcamlBinaryDescription ocamlBinaryDescription = (OcamlBinaryDescription) knownBuildRuleTypes.getDescription(knownBuildRuleTypes.getBuildRuleType("ocaml_binary"));
    assertThat(ocamlBinaryDescription.getOcamlBuckConfig().getCxxPlatform(), Matchers.equalTo(knownBuildRuleTypes.getCxxPlatforms().getValue(flavor)));
}
Also used : FakeAndroidDirectoryResolver(com.facebook.buck.android.FakeAndroidDirectoryResolver) BuckConfig(com.facebook.buck.cli.BuckConfig) FakeBuckConfig(com.facebook.buck.cli.FakeBuckConfig) OcamlLibraryDescription(com.facebook.buck.ocaml.OcamlLibraryDescription) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) OcamlBinaryDescription(com.facebook.buck.ocaml.OcamlBinaryDescription) InternalFlavor(com.facebook.buck.model.InternalFlavor) Flavor(com.facebook.buck.model.Flavor) ImmutableMap(com.google.common.collect.ImmutableMap) Test(org.junit.Test)

Example 30 with Flavor

use of com.facebook.buck.model.Flavor in project buck by facebook.

the class KnownBuildRuleTypesTest method canOverrideDefaultHostPlatform.

@Test
public void canOverrideDefaultHostPlatform() throws Exception {
    ProjectFilesystem filesystem = new ProjectFilesystem(temporaryFolder.getRoot());
    Flavor flavor = InternalFlavor.of("flavor");
    String flag = "-flag";
    ImmutableMap<String, ImmutableMap<String, String>> sections = ImmutableMap.of("cxx#" + flavor, ImmutableMap.of("cflags", flag));
    BuckConfig buckConfig = FakeBuckConfig.builder().setSections(sections).build();
    KnownBuildRuleTypes knownBuildRuleTypes = KnownBuildRuleTypes.createBuilder(buckConfig, filesystem, createExecutor(), new FakeAndroidDirectoryResolver()).build();
    assertThat(knownBuildRuleTypes.getCxxPlatforms().getValue(flavor).getCflags(), Matchers.contains(flag));
}
Also used : FakeAndroidDirectoryResolver(com.facebook.buck.android.FakeAndroidDirectoryResolver) BuckConfig(com.facebook.buck.cli.BuckConfig) FakeBuckConfig(com.facebook.buck.cli.FakeBuckConfig) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) InternalFlavor(com.facebook.buck.model.InternalFlavor) Flavor(com.facebook.buck.model.Flavor) ImmutableMap(com.google.common.collect.ImmutableMap) Test(org.junit.Test)

Aggregations

Flavor (com.facebook.buck.model.Flavor)60 InternalFlavor (com.facebook.buck.model.InternalFlavor)42 BuildTarget (com.facebook.buck.model.BuildTarget)33 SourcePathRuleFinder (com.facebook.buck.rules.SourcePathRuleFinder)17 Test (org.junit.Test)17 SourcePath (com.facebook.buck.rules.SourcePath)14 SourcePathResolver (com.facebook.buck.rules.SourcePathResolver)14 ImmutableMap (com.google.common.collect.ImmutableMap)14 BuildRule (com.facebook.buck.rules.BuildRule)13 ImmutableSet (com.google.common.collect.ImmutableSet)13 BuildRuleParams (com.facebook.buck.rules.BuildRuleParams)12 HumanReadableException (com.facebook.buck.util.HumanReadableException)12 Path (java.nio.file.Path)12 BuildRuleResolver (com.facebook.buck.rules.BuildRuleResolver)11 Optional (java.util.Optional)10 ImmutableList (com.google.common.collect.ImmutableList)9 ImmutableSortedSet (com.google.common.collect.ImmutableSortedSet)9 Map (java.util.Map)9 CxxPlatform (com.facebook.buck.cxx.CxxPlatform)7 NoSuchBuildTargetException (com.facebook.buck.parser.NoSuchBuildTargetException)6