Search in sources :

Example 46 with Flavor

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

the class ObjectPathsAbsolutifierIntegrationTest method testAbsolutifyingPathsForIntel64Bit.

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

Example 47 with Flavor

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

the class ObjectPathsAbsolutifierIntegrationTest method testAbsolutifyingPathsForArm64Bit.

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

Example 48 with Flavor

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

the class ObjectPathsAbsolutifierIntegrationTest method testAbsolutifyingPathsForArm32Bit.

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

Example 49 with Flavor

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

the class CompDirReplacerIntegrationTest method testCompDirReplacerForIntel64Bit.

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

Example 50 with Flavor

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

the class AndroidPrebuiltAarDescription method createBuildRule.

@Override
public <A extends Arg> BuildRule createBuildRule(TargetGraph targetGraph, BuildRuleParams params, BuildRuleResolver buildRuleResolver, A args) throws NoSuchBuildTargetException {
    SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(buildRuleResolver);
    ImmutableSet<Flavor> flavors = params.getBuildTarget().getFlavors();
    if (flavors.contains(AAR_UNZIP_FLAVOR)) {
        Preconditions.checkState(flavors.size() == 1);
        BuildRuleParams unzipAarParams = params.copyReplacingDeclaredAndExtraDeps(Suppliers.ofInstance(ImmutableSortedSet.of()), Suppliers.ofInstance(ImmutableSortedSet.copyOf(ruleFinder.filterBuildRuleInputs(args.aar))));
        return new UnzipAar(unzipAarParams, args.aar);
    }
    BuildRule unzipAarRule = buildRuleResolver.requireRule(params.getBuildTarget().withFlavors(AAR_UNZIP_FLAVOR));
    Preconditions.checkState(unzipAarRule instanceof UnzipAar, "aar_unzip flavor created rule of unexpected type %s for target %s", unzipAarRule.getClass(), params.getBuildTarget());
    UnzipAar unzipAar = (UnzipAar) unzipAarRule;
    if (CalculateAbi.isAbiTarget(params.getBuildTarget())) {
        return CalculateAbi.of(params.getBuildTarget(), ruleFinder, params, new ExplicitBuildTargetSourcePath(unzipAar.getBuildTarget(), unzipAar.getPathToClassesJar()));
    }
    SourcePathResolver pathResolver = new SourcePathResolver(ruleFinder);
    Iterable<PrebuiltJar> javaDeps = Iterables.concat(Iterables.filter(buildRuleResolver.getAllRules(args.deps), PrebuiltJar.class), Iterables.transform(Iterables.filter(buildRuleResolver.getAllRules(args.deps), AndroidPrebuiltAar.class), AndroidPrebuiltAar::getPrebuiltJar));
    if (flavors.contains(AAR_PREBUILT_JAR_FLAVOR)) {
        Preconditions.checkState(flavors.size() == 1, "Expected only flavor to be %s but also found %s", AAR_PREBUILT_JAR_FLAVOR, flavors);
        BuildRuleParams buildRuleParams = params.copyReplacingDeclaredAndExtraDeps(Suppliers.ofInstance(ImmutableSortedSet.copyOf(javaDeps)), Suppliers.ofInstance(ImmutableSortedSet.of(unzipAar)));
        return new PrebuiltJar(/* params */
        buildRuleParams, /* resolver */
        pathResolver, /* binaryJar */
        new ExplicitBuildTargetSourcePath(unzipAar.getBuildTarget(), unzipAar.getPathToClassesJar()), /* sourceJar */
        Optional.empty(), /* gwtJar */
        Optional.empty(), /* javadocUrl */
        Optional.empty(), /* mavenCoords */
        Optional.empty(), /* provided */
        false);
    }
    BuildRule prebuiltJarRule = buildRuleResolver.requireRule(BuildTargets.createFlavoredBuildTarget(params.getBuildTarget().checkUnflavored(), AAR_PREBUILT_JAR_FLAVOR));
    Preconditions.checkState(prebuiltJarRule instanceof PrebuiltJar, "%s flavor created rule of unexpected type %s for target %s", AAR_PREBUILT_JAR_FLAVOR, unzipAarRule.getType(), params.getBuildTarget());
    PrebuiltJar prebuiltJar = (PrebuiltJar) prebuiltJarRule;
    Preconditions.checkArgument(flavors.isEmpty(), "Unexpected flavors for android_prebuilt_aar: %s", flavors);
    BuildRuleParams androidLibraryParams = params.copyReplacingDeclaredAndExtraDeps(/* declaredDeps */
    Suppliers.ofInstance(ImmutableSortedSet.of(prebuiltJar)), /* extraDeps */
    Suppliers.ofInstance(ImmutableSortedSet.of(unzipAar)));
    return new AndroidPrebuiltAar(androidLibraryParams, /* resolver */
    pathResolver, ruleFinder, /* proguardConfig */
    new ExplicitBuildTargetSourcePath(unzipAar.getBuildTarget(), unzipAar.getProguardConfig()), /* nativeLibsDirectory */
    new ExplicitBuildTargetSourcePath(unzipAar.getBuildTarget(), unzipAar.getNativeLibsDirectory()), /* prebuiltJar */
    prebuiltJar, /* unzipRule */
    unzipAar, /* javacOptions */
    javacOptions, new JavacToJarStepFactory(javacOptions, new BootClasspathAppender()), /* exportedDeps */
    javaDeps, JavaLibraryRules.getAbiInputs(buildRuleResolver, androidLibraryParams.getDeps()));
}
Also used : JavacToJarStepFactory(com.facebook.buck.jvm.java.JavacToJarStepFactory) PrebuiltJar(com.facebook.buck.jvm.java.PrebuiltJar) SourcePathRuleFinder(com.facebook.buck.rules.SourcePathRuleFinder) InternalFlavor(com.facebook.buck.model.InternalFlavor) Flavor(com.facebook.buck.model.Flavor) SourcePathResolver(com.facebook.buck.rules.SourcePathResolver) BuildRuleParams(com.facebook.buck.rules.BuildRuleParams) BuildRule(com.facebook.buck.rules.BuildRule) ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath)

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