use of com.facebook.buck.model.Flavor in project buck by facebook.
the class AppleBundleDescription method findDepsForTargetFromConstructorArgs.
/**
* Propagate the bundle's platform, debug symbol and strip flavors to its dependents
* which are other bundles (e.g. extensions)
*/
@Override
public ImmutableSet<BuildTarget> findDepsForTargetFromConstructorArgs(BuildTarget buildTarget, CellPathResolver cellRoots, AppleBundleDescription.Arg constructorArg) {
if (!cxxPlatformFlavorDomain.containsAnyOf(buildTarget.getFlavors())) {
buildTarget = BuildTarget.builder(buildTarget).addAllFlavors(ImmutableSet.of(defaultCxxPlatform.getFlavor())).build();
}
Optional<MultiarchFileInfo> fatBinaryInfo = MultiarchFileInfos.create(appleCxxPlatformsFlavorDomain, buildTarget);
CxxPlatform cxxPlatform;
if (fatBinaryInfo.isPresent()) {
AppleCxxPlatform appleCxxPlatform = fatBinaryInfo.get().getRepresentativePlatform();
cxxPlatform = appleCxxPlatform.getCxxPlatform();
} else {
cxxPlatform = ApplePlatforms.getCxxPlatformForBuildTarget(cxxPlatformFlavorDomain, defaultCxxPlatform, buildTarget);
}
String platformName = cxxPlatform.getFlavor().getName();
final Flavor actualWatchFlavor;
if (ApplePlatform.isSimulator(platformName)) {
actualWatchFlavor = WATCH_SIMULATOR_FLAVOR;
} else if (platformName.startsWith(ApplePlatform.IPHONEOS.getName()) || platformName.startsWith(ApplePlatform.WATCHOS.getName())) {
actualWatchFlavor = WATCH_OS_FLAVOR;
} else {
actualWatchFlavor = InternalFlavor.of(platformName);
}
FluentIterable<BuildTarget> depsExcludingBinary = FluentIterable.from(constructorArg.deps).filter(Predicates.not(constructorArg.binary::equals));
// Propagate platform flavors. Need special handling for watch to map the pseudo-flavor
// watch to the actual watch platform (simulator or device) so can't use
// BuildTargets.propagateFlavorsInDomainIfNotPresent()
{
FluentIterable<BuildTarget> targetsWithPlatformFlavors = depsExcludingBinary.filter(BuildTargets.containsFlavors(cxxPlatformFlavorDomain));
FluentIterable<BuildTarget> targetsWithoutPlatformFlavors = depsExcludingBinary.filter(Predicates.not(BuildTargets.containsFlavors(cxxPlatformFlavorDomain)));
FluentIterable<BuildTarget> watchTargets = targetsWithoutPlatformFlavors.filter(BuildTargets.containsFlavor(WATCH)).transform(input -> BuildTarget.builder(input.withoutFlavors(WATCH)).addFlavors(actualWatchFlavor).build());
targetsWithoutPlatformFlavors = targetsWithoutPlatformFlavors.filter(Predicates.not(BuildTargets.containsFlavor(WATCH)));
// Gather all the deps now that we've added platform flavors to everything.
depsExcludingBinary = targetsWithPlatformFlavors.append(watchTargets).append(BuildTargets.propagateFlavorDomains(buildTarget, ImmutableSet.of(cxxPlatformFlavorDomain), targetsWithoutPlatformFlavors));
}
// Propagate some flavors
depsExcludingBinary = BuildTargets.propagateFlavorsInDomainIfNotPresent(StripStyle.FLAVOR_DOMAIN, buildTarget, depsExcludingBinary);
depsExcludingBinary = BuildTargets.propagateFlavorsInDomainIfNotPresent(AppleDebugFormat.FLAVOR_DOMAIN, buildTarget, depsExcludingBinary);
depsExcludingBinary = BuildTargets.propagateFlavorsInDomainIfNotPresent(LinkerMapMode.FLAVOR_DOMAIN, buildTarget, depsExcludingBinary);
if (fatBinaryInfo.isPresent()) {
depsExcludingBinary = depsExcludingBinary.append(fatBinaryInfo.get().getRepresentativePlatform().getCodesignProvider().getParseTimeDeps());
} else {
depsExcludingBinary = depsExcludingBinary.append(appleCxxPlatformsFlavorDomain.getValue(buildTarget).map(platform -> platform.getCodesignProvider().getParseTimeDeps()).orElse(ImmutableSet.of()));
}
return ImmutableSet.copyOf(depsExcludingBinary);
}
use of com.facebook.buck.model.Flavor in project buck by facebook.
the class AppleBinaryDescription method createMetadata.
@Override
public <A extends Arg, U> Optional<U> createMetadata(BuildTarget buildTarget, BuildRuleResolver resolver, A args, Optional<ImmutableMap<BuildTarget, Version>> selectedVersions, Class<U> metadataClass) throws NoSuchBuildTargetException {
if (!metadataClass.isAssignableFrom(FrameworkDependencies.class)) {
CxxBinaryDescription.Arg delegateArg = delegate.createUnpopulatedConstructorArg();
AppleDescriptions.populateCxxBinaryDescriptionArg(new SourcePathResolver(new SourcePathRuleFinder(resolver)), delegateArg, args, buildTarget);
return delegate.createMetadata(buildTarget, resolver, delegateArg, selectedVersions, metadataClass);
}
Optional<Flavor> cxxPlatformFlavor = delegate.getCxxPlatforms().getFlavor(buildTarget);
Preconditions.checkState(cxxPlatformFlavor.isPresent(), "Could not find cxx platform in:\n%s", Joiner.on(", ").join(buildTarget.getFlavors()));
ImmutableSet.Builder<SourcePath> sourcePaths = ImmutableSet.builder();
for (BuildTarget dep : args.deps) {
Optional<FrameworkDependencies> frameworks = resolver.requireMetadata(BuildTarget.builder(dep).addFlavors(AppleDescriptions.NO_INCLUDE_FRAMEWORKS_FLAVOR).addFlavors(cxxPlatformFlavor.get()).build(), FrameworkDependencies.class);
if (frameworks.isPresent()) {
sourcePaths.addAll(frameworks.get().getSourcePaths());
}
}
return Optional.of(metadataClass.cast(FrameworkDependencies.of(sourcePaths.build())));
}
use of com.facebook.buck.model.Flavor in project buck by facebook.
the class KnownBuildRuleTypes method createBuilder.
@VisibleForTesting
static Builder createBuilder(BuckConfig config, ProjectFilesystem filesystem, ProcessExecutor processExecutor, AndroidDirectoryResolver androidDirectoryResolver) throws InterruptedException, IOException {
Platform platform = Platform.detect();
AndroidBuckConfig androidConfig = new AndroidBuckConfig(config, platform);
Optional<String> ndkVersion = androidConfig.getNdkVersion();
// out which one we will end up using.
if (!ndkVersion.isPresent()) {
ndkVersion = androidDirectoryResolver.getNdkVersion();
}
AppleConfig appleConfig = new AppleConfig(config);
SwiftBuckConfig swiftBuckConfig = new SwiftBuckConfig(config);
final ImmutableList<AppleCxxPlatform> appleCxxPlatforms = buildAppleCxxPlatforms(filesystem, appleConfig.getAppleDeveloperDirectorySupplier(processExecutor), appleConfig.getExtraToolchainPaths(), appleConfig.getExtraPlatformPaths(), config, appleConfig, swiftBuckConfig, processExecutor);
final FlavorDomain<AppleCxxPlatform> platformFlavorsToAppleCxxPlatforms = FlavorDomain.from("Apple C++ Platform", appleCxxPlatforms);
ImmutableMap.Builder<Flavor, SwiftPlatform> swiftPlatforms = ImmutableMap.builder();
for (Flavor flavor : platformFlavorsToAppleCxxPlatforms.getFlavors()) {
Optional<SwiftPlatform> swiftPlatformOptional = platformFlavorsToAppleCxxPlatforms.getValue(flavor).getSwiftPlatform();
if (swiftPlatformOptional.isPresent()) {
swiftPlatforms.put(flavor, swiftPlatformOptional.get());
}
}
CxxBuckConfig cxxBuckConfig = new CxxBuckConfig(config);
// Setup the NDK C/C++ platforms.
Optional<Path> ndkRoot = androidDirectoryResolver.getNdkOrAbsent();
ImmutableMap.Builder<NdkCxxPlatforms.TargetCpuType, NdkCxxPlatform> ndkCxxPlatformsBuilder = ImmutableMap.builder();
if (ndkRoot.isPresent()) {
NdkCxxPlatformCompiler.Type compilerType = androidConfig.getNdkCompiler().orElse(NdkCxxPlatforms.DEFAULT_COMPILER_TYPE);
String gccVersion = androidConfig.getNdkGccVersion().orElse(NdkCxxPlatforms.getDefaultGccVersionForNdk(ndkVersion));
String clangVersion = androidConfig.getNdkClangVersion().orElse(NdkCxxPlatforms.getDefaultClangVersionForNdk(ndkVersion));
String compilerVersion = compilerType == NdkCxxPlatformCompiler.Type.GCC ? gccVersion : clangVersion;
NdkCxxPlatformCompiler compiler = NdkCxxPlatformCompiler.builder().setType(compilerType).setVersion(compilerVersion).setGccVersion(gccVersion).build();
ndkCxxPlatformsBuilder.putAll(NdkCxxPlatforms.getPlatforms(cxxBuckConfig, filesystem, ndkRoot.get(), compiler, androidConfig.getNdkCxxRuntime().orElse(NdkCxxPlatforms.DEFAULT_CXX_RUNTIME), androidConfig.getNdkAppPlatform().orElse(NdkCxxPlatforms.DEFAULT_TARGET_APP_PLATFORM), androidConfig.getNdkCpuAbis().orElse(NdkCxxPlatforms.DEFAULT_CPU_ABIS), platform));
}
ImmutableMap<NdkCxxPlatforms.TargetCpuType, NdkCxxPlatform> ndkCxxPlatforms = ndkCxxPlatformsBuilder.build();
// Create a map of system platforms.
ImmutableMap.Builder<Flavor, CxxPlatform> cxxSystemPlatformsBuilder = ImmutableMap.builder();
// testing our Android NDK support for right now.
for (NdkCxxPlatform ndkCxxPlatform : ndkCxxPlatforms.values()) {
cxxSystemPlatformsBuilder.put(ndkCxxPlatform.getCxxPlatform().getFlavor(), ndkCxxPlatform.getCxxPlatform());
}
for (AppleCxxPlatform appleCxxPlatform : platformFlavorsToAppleCxxPlatforms.getValues()) {
cxxSystemPlatformsBuilder.put(appleCxxPlatform.getCxxPlatform().getFlavor(), appleCxxPlatform.getCxxPlatform());
}
CxxPlatform defaultHostCxxPlatform = DefaultCxxPlatforms.build(platform, filesystem, cxxBuckConfig);
cxxSystemPlatformsBuilder.put(defaultHostCxxPlatform.getFlavor(), defaultHostCxxPlatform);
ImmutableMap<Flavor, CxxPlatform> cxxSystemPlatformsMap = cxxSystemPlatformsBuilder.build();
// Add the host platform if needed (for example, when building on Linux).
Flavor hostFlavor = CxxPlatforms.getHostFlavor();
if (!cxxSystemPlatformsMap.containsKey(hostFlavor)) {
cxxSystemPlatformsBuilder.put(hostFlavor, CxxPlatform.builder().from(defaultHostCxxPlatform).setFlavor(hostFlavor).build());
cxxSystemPlatformsMap = cxxSystemPlatformsBuilder.build();
}
// Add platforms for each cxx flavor obtained from the buck config files
// from sections of the form cxx#{flavor name}.
// These platforms are overrides for existing system platforms.
ImmutableSet<Flavor> possibleHostFlavors = CxxPlatforms.getAllPossibleHostFlavors();
HashMap<Flavor, CxxPlatform> cxxOverridePlatformsMap = new HashMap<Flavor, CxxPlatform>(cxxSystemPlatformsMap);
ImmutableSet<Flavor> cxxFlavors = CxxBuckConfig.getCxxFlavors(config);
for (Flavor flavor : cxxFlavors) {
CxxPlatform baseCxxPlatform = cxxSystemPlatformsMap.get(flavor);
if (baseCxxPlatform == null) {
if (possibleHostFlavors.contains(flavor)) {
// If a flavor is for an alternate host, it's safe to skip.
continue;
}
LOG.info("Applying \"%s\" overrides to default host platform", flavor);
baseCxxPlatform = defaultHostCxxPlatform;
}
cxxOverridePlatformsMap.put(flavor, CxxPlatforms.copyPlatformWithFlavorAndConfig(baseCxxPlatform, platform, new CxxBuckConfig(config, flavor), flavor));
}
// Finalize our "default" host.
// TODO(Ktwu) The host flavor should default to a concrete flavor
// like "linux-x86_64", not "default".
hostFlavor = DefaultCxxPlatforms.FLAVOR;
Optional<String> hostCxxPlatformOverride = cxxBuckConfig.getHostPlatform();
if (hostCxxPlatformOverride.isPresent()) {
Flavor overrideFlavor = InternalFlavor.of(hostCxxPlatformOverride.get());
if (cxxOverridePlatformsMap.containsKey(overrideFlavor)) {
hostFlavor = overrideFlavor;
}
}
CxxPlatform hostCxxPlatform = CxxPlatform.builder().from(cxxOverridePlatformsMap.get(hostFlavor)).setFlavor(DefaultCxxPlatforms.FLAVOR).build();
cxxOverridePlatformsMap.put(DefaultCxxPlatforms.FLAVOR, hostCxxPlatform);
ImmutableMap<Flavor, CxxPlatform> cxxPlatformsMap = ImmutableMap.<Flavor, CxxPlatform>builder().putAll(cxxOverridePlatformsMap).build();
ExecutableFinder executableFinder = new ExecutableFinder();
// Build up the final list of C/C++ platforms.
FlavorDomain<CxxPlatform> cxxPlatforms = new FlavorDomain<>("C/C++ platform", cxxPlatformsMap);
// Get the default target platform from config.
CxxPlatform defaultCxxPlatform = CxxPlatforms.getConfigDefaultCxxPlatform(cxxBuckConfig, cxxPlatformsMap, hostCxxPlatform);
DBuckConfig dBuckConfig = new DBuckConfig(config);
ReactNativeBuckConfig reactNativeBuckConfig = new ReactNativeBuckConfig(config);
RustBuckConfig rustBuckConfig = new RustBuckConfig(config);
GoBuckConfig goBuckConfig = new GoBuckConfig(config, processExecutor, cxxPlatforms);
HalideBuckConfig halideBuckConfig = new HalideBuckConfig(config);
ProGuardConfig proGuardConfig = new ProGuardConfig(config);
DxConfig dxConfig = new DxConfig(config);
PythonBuckConfig pyConfig = new PythonBuckConfig(config, executableFinder);
ImmutableList<PythonPlatform> pythonPlatformsList = pyConfig.getPythonPlatforms(processExecutor);
FlavorDomain<PythonPlatform> pythonPlatforms = FlavorDomain.from("Python Platform", pythonPlatformsList);
PythonBinaryDescription pythonBinaryDescription = new PythonBinaryDescription(pyConfig, pythonPlatforms, cxxBuckConfig, defaultCxxPlatform, cxxPlatforms);
// Look up the timeout to apply to entire test rules.
Optional<Long> defaultTestRuleTimeoutMs = config.getLong("test", "rule_timeout");
// Prepare the downloader if we're allowing mid-build downloads
Downloader downloader;
DownloadConfig downloadConfig = new DownloadConfig(config);
if (downloadConfig.isDownloadAtRuntimeOk()) {
downloader = StackedDownloader.createFromConfig(config, androidDirectoryResolver.getSdkOrAbsent());
} else {
// Or just set one that blows up
downloader = new ExplodingDownloader();
}
Builder builder = builder();
JavaBuckConfig javaConfig = config.getView(JavaBuckConfig.class);
JavacOptions defaultJavacOptions = javaConfig.getDefaultJavacOptions();
JavaOptions defaultJavaOptions = javaConfig.getDefaultJavaOptions();
JavaOptions defaultJavaOptionsForTests = javaConfig.getDefaultJavaOptionsForTests();
KotlinBuckConfig kotlinBuckConfig = new KotlinBuckConfig(config);
ScalaBuckConfig scalaConfig = new ScalaBuckConfig(config);
InferBuckConfig inferBuckConfig = new InferBuckConfig(config);
LuaConfig luaConfig = new LuaBuckConfig(config, executableFinder);
CxxBinaryDescription cxxBinaryDescription = new CxxBinaryDescription(cxxBuckConfig, inferBuckConfig, defaultCxxPlatform, cxxPlatforms);
CxxLibraryDescription cxxLibraryDescription = new CxxLibraryDescription(cxxBuckConfig, defaultCxxPlatform, inferBuckConfig, cxxPlatforms);
FlavorDomain<SwiftPlatform> platformFlavorsToSwiftPlatforms = new FlavorDomain<>("Swift Platform", swiftPlatforms.build());
SwiftLibraryDescription swiftLibraryDescription = new SwiftLibraryDescription(cxxBuckConfig, swiftBuckConfig, cxxPlatforms, platformFlavorsToSwiftPlatforms);
builder.register(swiftLibraryDescription);
CodeSignIdentityStore codeSignIdentityStore = CodeSignIdentityStore.fromSystem(processExecutor, appleConfig.getCodeSignIdentitiesCommand());
ProvisioningProfileStore provisioningProfileStore = ProvisioningProfileStore.fromSearchPath(processExecutor, appleConfig.getProvisioningProfileReadCommand(), appleConfig.getProvisioningProfileSearchPath());
AppleLibraryDescription appleLibraryDescription = new AppleLibraryDescription(cxxLibraryDescription, swiftLibraryDescription, platformFlavorsToAppleCxxPlatforms, defaultCxxPlatform, codeSignIdentityStore, provisioningProfileStore, appleConfig);
builder.register(appleLibraryDescription);
PrebuiltAppleFrameworkDescription appleFrameworkDescription = new PrebuiltAppleFrameworkDescription();
builder.register(appleFrameworkDescription);
AppleBinaryDescription appleBinaryDescription = new AppleBinaryDescription(cxxBinaryDescription, swiftLibraryDescription, platformFlavorsToAppleCxxPlatforms, codeSignIdentityStore, provisioningProfileStore, appleConfig);
builder.register(appleBinaryDescription);
HaskellBuckConfig haskellBuckConfig = new HaskellBuckConfig(config, executableFinder);
builder.register(new HaskellLibraryDescription(haskellBuckConfig, cxxBuckConfig, cxxPlatforms));
builder.register(new HaskellBinaryDescription(haskellBuckConfig, cxxPlatforms, defaultCxxPlatform));
builder.register(new HaskellPrebuiltLibraryDescription());
if (javaConfig.getDxThreadCount().isPresent()) {
LOG.warn("java.dx_threads has been deprecated. Use dx.max_threads instead");
}
// Create an executor service exclusively for the smart dexing step.
ListeningExecutorService dxExecutorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(dxConfig.getDxMaxThreadCount().orElse(javaConfig.getDxThreadCount().orElse(SmartDexingStep.determineOptimalThreadCount())), new CommandThreadFactory("SmartDexing")));
builder.register(new AndroidAarDescription(new AndroidManifestDescription(), cxxBuckConfig, defaultJavacOptions, ndkCxxPlatforms));
builder.register(new AndroidBinaryDescription(defaultJavaOptions, defaultJavacOptions, proGuardConfig, ndkCxxPlatforms, dxExecutorService, config, cxxBuckConfig, dxConfig));
builder.register(new AndroidBuildConfigDescription(defaultJavacOptions));
builder.register(new AndroidInstrumentationApkDescription(proGuardConfig, defaultJavacOptions, ndkCxxPlatforms, dxExecutorService, cxxBuckConfig, dxConfig));
builder.register(new AndroidInstrumentationTestDescription(defaultJavaOptions, defaultTestRuleTimeoutMs));
builder.register(new AndroidLibraryDescription(defaultJavacOptions, new DefaultAndroidLibraryCompilerFactory(scalaConfig, kotlinBuckConfig)));
builder.register(new AndroidManifestDescription());
builder.register(new AndroidPrebuiltAarDescription(defaultJavacOptions));
builder.register(new AndroidReactNativeLibraryDescription(reactNativeBuckConfig));
builder.register(new AndroidResourceDescription(config.isGrayscaleImageProcessingEnabled()));
builder.register(new ApkGenruleDescription());
builder.register(new AppleAssetCatalogDescription());
builder.register(new ApplePackageDescription(appleConfig, defaultCxxPlatform, platformFlavorsToAppleCxxPlatforms));
AppleBundleDescription appleBundleDescription = new AppleBundleDescription(appleBinaryDescription, appleLibraryDescription, cxxPlatforms, platformFlavorsToAppleCxxPlatforms, defaultCxxPlatform, codeSignIdentityStore, provisioningProfileStore, appleConfig);
builder.register(appleBundleDescription);
builder.register(new AppleResourceDescription());
builder.register(new AppleTestDescription(appleConfig, appleLibraryDescription, cxxPlatforms, platformFlavorsToAppleCxxPlatforms, defaultCxxPlatform, codeSignIdentityStore, provisioningProfileStore, appleConfig.getAppleDeveloperDirectorySupplierForTests(processExecutor), defaultTestRuleTimeoutMs));
builder.register(new CoreDataModelDescription());
builder.register(new CsharpLibraryDescription());
builder.register(cxxBinaryDescription);
builder.register(cxxLibraryDescription);
builder.register(new CxxGenruleDescription(cxxPlatforms));
builder.register(new CxxLuaExtensionDescription(luaConfig, cxxBuckConfig, cxxPlatforms));
builder.register(new CxxPythonExtensionDescription(pythonPlatforms, cxxBuckConfig, cxxPlatforms));
builder.register(new CxxTestDescription(cxxBuckConfig, defaultCxxPlatform, cxxPlatforms, defaultTestRuleTimeoutMs));
builder.register(new DBinaryDescription(dBuckConfig, cxxBuckConfig, defaultCxxPlatform));
builder.register(new DLibraryDescription(dBuckConfig, cxxBuckConfig, defaultCxxPlatform));
builder.register(new DTestDescription(dBuckConfig, cxxBuckConfig, defaultCxxPlatform, defaultTestRuleTimeoutMs));
builder.register(new ExportFileDescription());
builder.register(new GenruleDescription());
builder.register(new GenAidlDescription());
builder.register(new GoBinaryDescription(goBuckConfig));
builder.register(new GoLibraryDescription(goBuckConfig));
builder.register(new GoTestDescription(goBuckConfig, defaultTestRuleTimeoutMs));
builder.register(new GraphqlLibraryDescription());
GroovyBuckConfig groovyBuckConfig = new GroovyBuckConfig(config);
builder.register(new GroovyLibraryDescription(groovyBuckConfig, defaultJavacOptions));
builder.register(new GroovyTestDescription(groovyBuckConfig, defaultJavaOptionsForTests, defaultJavacOptions, defaultTestRuleTimeoutMs));
builder.register(new GwtBinaryDescription(defaultJavaOptions));
builder.register(new HalideLibraryDescription(cxxBuckConfig, defaultCxxPlatform, cxxPlatforms, halideBuckConfig));
builder.register(new IosReactNativeLibraryDescription(reactNativeBuckConfig));
builder.register(new JavaBinaryDescription(defaultJavaOptions, defaultJavacOptions, defaultCxxPlatform, javaConfig));
builder.register(new JavaAnnotationProcessorDescription());
builder.register(new JavaLibraryDescription(defaultJavacOptions));
builder.register(new JavaTestDescription(defaultJavaOptionsForTests, defaultJavacOptions, defaultTestRuleTimeoutMs, defaultCxxPlatform));
builder.register(new JsBundleDescription());
builder.register(new JsLibraryDescription());
builder.register(new KeystoreDescription());
builder.register(new KotlinLibraryDescription(kotlinBuckConfig, defaultJavacOptions));
builder.register(new KotlinTestDescription(kotlinBuckConfig, defaultJavaOptionsForTests, defaultJavacOptions, defaultTestRuleTimeoutMs));
builder.register(new LuaBinaryDescription(luaConfig, cxxBuckConfig, defaultCxxPlatform, cxxPlatforms, pythonPlatforms));
builder.register(new LuaLibraryDescription());
builder.register(new NdkLibraryDescription(ndkVersion, ndkCxxPlatforms));
OcamlBuckConfig ocamlBuckConfig = new OcamlBuckConfig(config, defaultCxxPlatform);
builder.register(new OcamlBinaryDescription(ocamlBuckConfig));
builder.register(new OcamlLibraryDescription(ocamlBuckConfig));
builder.register(new PrebuiltCxxLibraryDescription(cxxBuckConfig, cxxPlatforms));
builder.register(PrebuiltCxxLibraryGroupDescription.of());
builder.register(new CxxPrecompiledHeaderDescription());
builder.register(new PrebuiltDotnetLibraryDescription());
builder.register(new PrebuiltJarDescription());
builder.register(new PrebuiltNativeLibraryDescription());
builder.register(new PrebuiltOcamlLibraryDescription());
builder.register(new PrebuiltPythonLibraryDescription());
builder.register(new ProjectConfigDescription());
builder.register(pythonBinaryDescription);
PythonLibraryDescription pythonLibraryDescription = new PythonLibraryDescription(pythonPlatforms, cxxPlatforms);
builder.register(pythonLibraryDescription);
builder.register(new PythonTestDescription(pythonBinaryDescription, pyConfig, pythonPlatforms, cxxBuckConfig, defaultCxxPlatform, defaultTestRuleTimeoutMs, cxxPlatforms));
builder.register(new RemoteFileDescription(downloader));
builder.register(new RobolectricTestDescription(defaultJavaOptionsForTests, defaultJavacOptions, defaultTestRuleTimeoutMs, defaultCxxPlatform));
builder.register(new RustBinaryDescription(rustBuckConfig, cxxPlatforms, defaultCxxPlatform));
builder.register(new RustLibraryDescription(rustBuckConfig, cxxPlatforms, defaultCxxPlatform));
builder.register(new RustTestDescription(rustBuckConfig, cxxPlatforms, defaultCxxPlatform));
builder.register(new PrebuiltRustLibraryDescription());
builder.register(new ScalaLibraryDescription(scalaConfig));
builder.register(new ScalaTestDescription(scalaConfig, defaultJavaOptionsForTests, defaultTestRuleTimeoutMs, defaultCxxPlatform));
builder.register(new SceneKitAssetsDescription());
builder.register(new ShBinaryDescription());
builder.register(new ShTestDescription(defaultTestRuleTimeoutMs));
builder.register(new WorkerToolDescription(config));
builder.register(new XcodePostbuildScriptDescription());
builder.register(new XcodePrebuildScriptDescription());
builder.register(new XcodeWorkspaceConfigDescription());
builder.register(new ZipFileDescription());
builder.register(new TargetGroupDescription());
builder.setCxxPlatforms(cxxPlatforms);
builder.setDefaultCxxPlatform(defaultCxxPlatform);
builder.register(VersionedAliasDescription.of());
return builder;
}
use of com.facebook.buck.model.Flavor in project buck by facebook.
the class BuildRuleParams method withoutFlavor.
public BuildRuleParams withoutFlavor(Flavor flavor) {
Set<Flavor> flavors = Sets.newHashSet(getBuildTarget().getFlavors());
flavors.remove(flavor);
BuildTarget target = BuildTarget.builder(getBuildTarget().getUnflavoredBuildTarget()).addAllFlavors(flavors).build();
return new BuildRuleParams(this, target, projectFilesystem, cellRoots);
}
use of com.facebook.buck.model.Flavor in project buck by facebook.
the class BuildTargetParserTest method testParseRuleWithFlavors.
@Test
public void testParseRuleWithFlavors() {
BuildTarget buildTarget = parser.parse("//:lib#foo,bar", fullyQualifiedParser, createCellRoots(null));
// Note the sort order.
assertEquals("lib#bar,foo", buildTarget.getShortNameAndFlavorPostfix());
assertEquals("//", buildTarget.getBaseName());
assertEquals(Paths.get(""), buildTarget.getBasePath());
// Note the sort order.
assertEquals("//:lib#bar,foo", buildTarget.getFullyQualifiedName());
assertThat(buildTarget.getFlavors(), hasItems((Flavor) InternalFlavor.of("foo"), InternalFlavor.of("bar")));
}
Aggregations