public static HeaderSymlinkTree createHeaderSymlinkTree( BuildTarget buildTarget, ProjectFilesystem projectFilesystem, HeaderMode mode, ImmutableMap<Path, SourcePath> headers, HeaderVisibility headerVisibility, Flavor... flavors) { BuildTarget headerSymlinkTreeTarget = CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget( buildTarget, headerVisibility, flavors); Path headerSymlinkTreeRoot = CxxDescriptionEnhancer.getHeaderSymlinkTreePath( projectFilesystem, buildTarget, headerVisibility, flavors); return CxxPreprocessables.createHeaderSymlinkTreeBuildRule( headerSymlinkTreeTarget, projectFilesystem, headerSymlinkTreeRoot, headers, mode); }
@Override public boolean hasFlavors(ImmutableSet<Flavor> flavors) { if (FluentIterable.from(flavors).allMatch(SUPPORTED_FLAVORS::contains)) { return true; } ImmutableSet<Flavor> delegateFlavors = ImmutableSet.copyOf(Sets.difference(flavors, NON_DELEGATE_FLAVORS)); if (swiftDelegate.map(swift -> swift.hasFlavors(delegateFlavors)).orElse(false)) { return true; } ImmutableList<ImmutableSortedSet<Flavor>> thinFlavorSets = generateThinDelegateFlavors(delegateFlavors); if (thinFlavorSets.size() > 0) { return Iterables.all(thinFlavorSets, cxxBinaryFlavored::hasFlavors); } else { return cxxBinaryFlavored.hasFlavors(delegateFlavors); } }
public static BuildTarget createSharedLibraryBuildTarget( BuildTarget target, Flavor platform, Linker.LinkType linkType) { Flavor linkFlavor; switch (linkType) { case SHARED: linkFlavor = SHARED_FLAVOR; break; case MACH_O_BUNDLE: linkFlavor = MACH_O_BUNDLE_FLAVOR; break; case EXECUTABLE: default: throw new IllegalStateException( "Only SHARED and MACH_O_BUNDLE types expected, got: " + linkType); } return target.withAppendedFlavors(platform, linkFlavor); }
public static Path getStaticLibraryPath( ProjectFilesystem filesystem, BuildTarget target, Flavor platform, PicType pic, Optional<String> staticLibraryBasename, String extension, String suffix, boolean uniqueLibraryNameEnabled) { String basename; if (staticLibraryBasename.isPresent()) { basename = staticLibraryBasename.get(); } else { basename = getStaticLibraryBasename(target, suffix, uniqueLibraryNameEnabled); } String name = String.format("lib%s.%s", basename, extension); return BuildTargets.getGenPath( filesystem, createStaticLibraryBuildTarget(target, platform, pic), "%s") .resolve(name); }
public ImmutableSortedSet<Flavor> addImplicitFlavorsForRuleTypes( ImmutableSortedSet<Flavor> argDefaultFlavors, BuildRuleType... types) { Optional<Flavor> platformFlavor = getCxxPlatformsProvider().getCxxPlatforms().getFlavor(argDefaultFlavors); for (BuildRuleType type : types) { ImmutableMap<String, Flavor> libraryDefaults = cxxBuckConfig.getDefaultFlavorsForRuleType(type); if (!platformFlavor.isPresent()) { platformFlavor = Optional.ofNullable(libraryDefaults.get(CxxBuckConfig.DEFAULT_FLAVOR_PLATFORM)); } } if (platformFlavor.isPresent()) { return ImmutableSortedSet.of(platformFlavor.get()); } else { // To avoid changing the output path of binaries built without a flavor, // we'll default to no flavor, which implicitly builds the default platform. return ImmutableSortedSet.of(); } }
private String getJobArgs(SourcePathResolver resolver, Path outputPath) { ImmutableSortedSet<Flavor> flavors = getBuildTarget().getFlavors(); return JsonBuilder.object() .addString("command", "library-files") .addBoolean("release", flavors.contains(JsFlavors.RELEASE)) .addString("rootPath", getProjectFilesystem().getRootPath().toString()) .addString("platform", JsUtil.getPlatformString(flavors)) .addString("outputFilePath", outputPath.toString()) .addArray( "sourceFilePaths", sources .stream() .map(resolver::getAbsolutePath) .map(Path::toString) .collect(JsonBuilder.toArrayOfStrings())) .toString(); }
private static AbstractCachingBuildRuleWithInputs createInputBasedRule( ProjectFilesystem filesystem, BuildRuleResolver ruleResolver, ImmutableSortedSet<BuildRule> deps, List<Step> buildSteps, ImmutableList<Step> postBuildSteps, @Nullable String pathToOutputFile, ImmutableList<Flavor> flavors, ImmutableSortedSet<SourcePath> inputs, ImmutableSortedSet<SourcePath> depfileInputs) { BuildTarget buildTarget = BUILD_TARGET.withFlavors(flavors); AbstractCachingBuildRuleWithInputs rule = new AbstractCachingBuildRuleWithInputs( buildTarget, filesystem, pathToOutputFile, buildSteps, postBuildSteps, deps, inputs, depfileInputs); ruleResolver.addToIndex(rule); return rule; }
private <T extends BuildRule> ImmutableSet<T> requireTransitiveDependentLibraries( final CxxPlatform cxxPlatform, final Iterable<? extends BuildRule> deps, final Flavor requiredFlavor, final Class<T> ruleClass) { final ImmutableSet.Builder<T> depsBuilder = ImmutableSet.builder(); new AbstractBreadthFirstTraversal<BuildRule>(deps) { @Override public Iterable<BuildRule> visit(BuildRule buildRule) { if (buildRule instanceof CxxLibrary) { CxxLibrary library = (CxxLibrary) buildRule; depsBuilder.add( (ruleClass.cast(library.requireBuildRule(requiredFlavor, cxxPlatform.getFlavor())))); return buildRule.getBuildDeps(); } return ImmutableSet.of(); } }.start(); return depsBuilder.build(); }
@Override public boolean hasFlavors(final ImmutableSet<Flavor> flavors) { if (appleLibraryDescription.hasFlavors(flavors)) { return true; } ImmutableSet.Builder<Flavor> flavorBuilder = ImmutableSet.builder(); for (Flavor flavor : flavors) { if (AppleDebugFormat.FLAVOR_DOMAIN.getFlavors().contains(flavor)) { continue; } if (AppleDescriptions.INCLUDE_FRAMEWORKS.getFlavors().contains(flavor)) { continue; } flavorBuilder.add(flavor); } return appleBinaryDescription.hasFlavors(flavorBuilder.build()); }
public LibraryFilesBuilder( BuildRuleResolver resolver, BuildTarget baseTarget, BuildRuleParams baseParams, ImmutableBiMap<Either<SourcePath, Pair<SourcePath, String>>, Flavor> sourcesToFlavors) { this.resolver = resolver; this.baseTarget = baseTarget; this.sourcesToFlavors = sourcesToFlavors; // Platform information is only relevant when building release-optimized files. // Stripping platform targets from individual files allows us to use the base version of // every file in the build for all supported platforms, leading to improved cache reuse. this.fileBaseTarget = !baseTarget.getFlavors().contains(JsFlavors.RELEASE) ? baseTarget.withFlavors() : baseTarget; this.baseParams = baseParams; }
private void runAndAssertSpinningTestTimesOutWithPerRuleTimeout( ImmutableSet<Flavor> targetFlavors) throws IOException { assumeThat(Platform.detect(), Matchers.oneOf(Platform.LINUX, Platform.MACOS)); ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario( this, "slow_cxx_tests_per_rule_timeout", temp); workspace.setUp(); BuildTarget target = BuildTargetFactory.newInstance("//:spinning"); target = target.withFlavors(targetFlavors); ProcessResult result = workspace.runBuckCommand("test", target.getFullyQualifiedName()); result.assertSpecialExitCode("test should fail", ExitCode.TEST_ERROR); String stderr = result.getStderr(); assertThat(stderr, Matchers.containsString("Timed out after 100 ms running test command")); }
private Optional<ApplePlatform> getApplePlatformForTarget( BuildTarget buildTarget, FlavorDomain<AppleCxxPlatform> appleCxxPlatformsFlavorDomain) { CxxPlatformsProvider cxxPlatformsProvider = getCxxPlatformsProvider(); FlavorDomain<CxxPlatform> cxxPlatforms = cxxPlatformsProvider.getCxxPlatforms(); Flavor defaultCxxFlavor = cxxPlatformsProvider.getDefaultCxxPlatform().getFlavor(); CxxPlatform cxxPlatform = cxxPlatforms.getValue(buildTarget).orElse(cxxPlatforms.getValue(defaultCxxFlavor)); if (!appleCxxPlatformsFlavorDomain.contains(cxxPlatform.getFlavor())) { return Optional.empty(); } return Optional.of( appleCxxPlatformsFlavorDomain .getValue(cxxPlatform.getFlavor()) .getAppleSdk() .getApplePlatform()); }
/** * Expand flavors representing a fat binary into its thin binary equivalents. * * <p>Useful when dealing with functions unaware of fat binaries. * * <p>This does not actually check that the particular flavor set is valid. */ public static ImmutableList<ImmutableSortedSet<Flavor>> generateThinFlavors( Set<Flavor> platformFlavors, SortedSet<Flavor> flavors) { Set<Flavor> platformFreeFlavors = Sets.difference(flavors, platformFlavors); ImmutableList.Builder<ImmutableSortedSet<Flavor>> thinTargetsBuilder = ImmutableList.builder(); for (Flavor flavor : flavors) { if (platformFlavors.contains(flavor)) { thinTargetsBuilder.add( ImmutableSortedSet.<Flavor>naturalOrder() .addAll(platformFreeFlavors) .add(flavor) .build()); } } return thinTargetsBuilder.build(); }
/** * @return the {@link BuildTarget} to use in the resolved target graph, formed by adding a flavor * generated from the given version selections. */ private Optional<BuildTarget> getTranslateBuildTarget( TargetNode<?, ?> node, ImmutableMap<BuildTarget, Version> selectedVersions) { BuildTarget originalTarget = node.getBuildTarget(); node = resolveVersions(node, selectedVersions); BuildTarget newTarget = node.getBuildTarget(); if (TargetGraphVersionTransformations.isVersionPropagator(node)) { VersionInfo info = getVersionInfo(node); Collection<BuildTarget> versionedDeps = info.getVersionDomain().keySet(); TreeMap<BuildTarget, Version> versions = new TreeMap<>(); for (BuildTarget depTarget : versionedDeps) { versions.put(depTarget, selectedVersions.get(depTarget)); } if (!versions.isEmpty()) { Flavor versionedFlavor = getVersionedFlavor(versions); newTarget = node.getBuildTarget().withAppendedFlavors(versionedFlavor); } } return newTarget.equals(originalTarget) ? Optional.empty() : Optional.of(newTarget); }
private String getJobArgs(SourcePathResolver resolver, Path outputPath) { ImmutableSortedSet<Flavor> flavors = getBuildTarget().getFlavors(); return JsonBuilder.object() .addString("command", "library-dependencies") .addBoolean("release", flavors.contains(JsFlavors.RELEASE)) .addString("rootPath", getProjectFilesystem().getRootPath().toString()) .addString("platform", JsUtil.getPlatformString(flavors)) .addString("outputPath", outputPath.toString()) .addArray( "dependencyLibraryFilePaths", libraryDependencies .stream() .map(resolver::getAbsolutePath) .map(Path::toString) .collect(JsonBuilder.toArrayOfStrings())) .addString( "aggregatedSourceFilesFilePath", resolver.getAbsolutePath(filesDependency).toString()) .toString(); }
/** * @return a build target for a {@link CxxCompile} rule for the source with the given name. */ public static BuildTarget createCompileBuildTarget( BuildTarget target, String name) { return BuildTargets.extendFlavoredBuildTarget( target, new Flavor(String.format( "compile-%s", getOutputName(name).replace('/', '-').replace('.', '-')))); }
@Override public Path getPathToOutputFile() { BuildTarget target = getBuildTarget(); if (!target.getFlavor().equals(Flavor.DEFAULT)) { // TODO(grp): Consider putting this path format logic in BuildTargets.getBinPath() directly. return Paths.get(String.format("%s/%s/%s/" + getOutputFileNameFormat(), BuckConstant.BIN_DIR, target.getBasePathWithSlash(), target.getFlavorPostfix(), target.getShortNameOnly())); } else { return BuildTargets.getBinPath(target, getOutputFileNameFormat()); } }
/** * Creates a {@link BuildRule} with the {@link JavaLibrary#GWT_MODULE_FLAVOR}, if appropriate. * <p> * If {@code arg.srcs} or {@code arg.resources} is non-empty, then the return value will not be * absent. */ @VisibleForTesting static Optional<GwtModule> tryCreateGwtModule( BuildTarget originalBuildTarget, ProjectFilesystem projectFilesystem, RuleKeyBuilderFactory ruleKeyBuilderFactory, Arg arg) { if (arg.srcs.get().isEmpty() && arg.resources.get().isEmpty() && Flavor.DEFAULT.equals(originalBuildTarget.getFlavor())) { return Optional.absent(); } BuildTarget gwtModuleBuildTarget = BuildTargets.createFlavoredBuildTarget( originalBuildTarget.getUnflavoredTarget(), JavaLibrary.GWT_MODULE_FLAVOR); ImmutableSortedSet<SourcePath> filesForGwtModule = ImmutableSortedSet .<SourcePath>naturalOrder() .addAll(arg.srcs.get()) .addAll(arg.resources.get()) .build(); // If any of the srcs or resources are BuildRuleSourcePaths, then their respective BuildRules // must be included as deps. ImmutableSortedSet<BuildRule> deps = ImmutableSortedSet.copyOf(SourcePaths.filterBuildRuleInputs(filesForGwtModule)); GwtModule gwtModule = new GwtModule( new BuildRuleParams( gwtModuleBuildTarget, deps, /* inferredDeps */ ImmutableSortedSet.<BuildRule>of(), BuildTargetPattern.PUBLIC, projectFilesystem, ruleKeyBuilderFactory, BuildRuleType.GWT_MODULE), filesForGwtModule); return Optional.of(gwtModule); }
@Override public boolean hasFlavors(ImmutableSet<Flavor> flavors) { if (getCxxPlatformsProvider().getCxxPlatforms().containsAnyOf(flavors)) { return true; } for (RustDescriptionEnhancer.Type type : RustDescriptionEnhancer.Type.values()) { if (flavors.contains(type.getFlavor())) { return true; } } return false; }
public static Flavor fileFlavorForSourcePath(final Path path) { final String hash = Hashing.sha1() .hashString(MorePaths.pathWithUnixSeparators(path), Charsets.UTF_8) .toString() .substring(0, 10); final String safeFileName = Flavor.replaceInvalidCharacters(path.getFileName().toString()); return InternalFlavor.of(fileFlavorPrefix + safeFileName + "-" + hash); }
@Override public boolean hasFlavors(ImmutableSet<Flavor> flavors) { if (getCxxPlatformsProvider().getCxxPlatforms().containsAnyOf(flavors)) { return true; } for (Type type : Type.values()) { if (flavors.contains(type.getFlavor())) { return true; } } return false; }
public static Flavor flavorForLinkableDepType(Linker.LinkableDepType linkableDepType) { switch (linkableDepType) { case STATIC: return STATIC_FLAVOR; case STATIC_PIC: return STATIC_PIC_FLAVOR; case SHARED: return SHARED_FLAVOR; } throw new RuntimeException(String.format("Unsupported LinkableDepType: '%s'", linkableDepType)); }
private BuildTarget findPchTarget() throws IOException { for (BuildTarget target : workspace.getBuildLog().getAllTargets()) { for (Flavor flavor : target.getFlavors()) { if (flavor.getName().startsWith("pch-")) { return target; } } } fail("should have generated a pch target"); return null; }
/** @return {@link CxxPlatform} of all {@link NdkCxxPlatform}s */ @Override public ImmutableMap<Flavor, CxxPlatform> getCxxPlatforms() { ImmutableMap.Builder<Flavor, CxxPlatform> cxxSystemPlatformsBuilder = ImmutableMap.builder(); for (NdkCxxPlatform ndkCxxPlatform : getNdkCxxPlatforms().values()) { cxxSystemPlatformsBuilder.put( ndkCxxPlatform.getCxxPlatform().getFlavor(), ndkCxxPlatform.getCxxPlatform()); } return cxxSystemPlatformsBuilder.build(); }
/** * Retrieve the transitive CxxPreprocessorInput from the CxxLibrary rule. * * <p>This is used by CxxLibrary and AppleLibrary. Rules that do not generate a CxxLibrary rule * (namely AppleTest) cannot use this. */ static TransitiveCxxPreprocessorInputFunction fromLibraryRule() { return (target, ruleResolver, cxxPlatform, ignored, privateDeps) -> { BuildTarget rawTarget = target.withoutFlavors( ImmutableSet.<Flavor>builder() .addAll(LIBRARY_TYPE.getFlavors()) .add(cxxPlatform.getFlavor()) .build()); BuildRule rawRule = ruleResolver.requireRule(rawTarget); CxxLibrary rule = (CxxLibrary) rawRule; ImmutableMap<BuildTarget, CxxPreprocessorInput> inputs = rule.getTransitiveCxxPreprocessorInput(cxxPlatform); ImmutableList<CxxPreprocessorDep> privateDepsForPlatform = RichStream.from(privateDeps.get(ruleResolver, cxxPlatform)) .filter(CxxPreprocessorDep.class) .toImmutableList(); if (privateDepsForPlatform.isEmpty()) { // Nothing to add. return inputs.values().stream(); } else { Map<BuildTarget, CxxPreprocessorInput> result = new LinkedHashMap<>(); result.putAll(inputs); for (CxxPreprocessorDep dep : privateDepsForPlatform) { result.putAll(dep.getTransitiveCxxPreprocessorInput(cxxPlatform)); } return result.values().stream(); } }; }
private static void checkNoInferFlavors(ImmutableSet<Flavor> flavors) { for (InferFlavors f : InferFlavors.values()) { Preconditions.checkArgument( !flavors.contains(f.getFlavor()), "Unexpected infer-related flavor found: %s", f.toString()); } }
/** @return {@link CxxPlatform} of all {@link AppleCxxPlatform}s */ @Override public ImmutableMap<Flavor, CxxPlatform> getCxxPlatforms() { ImmutableMap.Builder<Flavor, CxxPlatform> cxxSystemPlatformsBuilder = ImmutableMap.builder(); for (AppleCxxPlatform appleCxxPlatform : getAppleCxxPlatforms().getValues()) { cxxSystemPlatformsBuilder.put( appleCxxPlatform.getCxxPlatform().getFlavor(), appleCxxPlatform.getCxxPlatform()); } return cxxSystemPlatformsBuilder.build(); }
@Test public void testFlavoredReleaseBundleDoesNotPropagateRamBundleFlavors() throws NoSuchBuildTargetException { Flavor[] bundleFlavors = {JsFlavors.IOS, JsFlavors.RAM_BUNDLE_INDEXED, JsFlavors.RELEASE}; Flavor[] flavorsToBePropagated = {JsFlavors.IOS, JsFlavors.RELEASE}; BuildRule jsBundle = scenario.resolver.requireRule((bundleTarget.withFlavors(bundleFlavors))); assertThat(allLibaryTargets(flavorsToBePropagated), everyItem(in(dependencyTargets(jsBundle)))); assertThat(allLibaryTargets(bundleFlavors), everyItem(not(in(dependencyTargets(jsBundle))))); }
@Override public BuildRule createBuildRule( TargetGraph targetGraph, BuildTarget buildTarget, ProjectFilesystem projectFilesystem, BuildRuleParams params, BuildRuleResolver resolver, CellPathResolver cellRoots, AppleLibraryDescriptionArg args) { Optional<Map.Entry<Flavor, Type>> type = LIBRARY_TYPE.getFlavorAndValue(buildTarget); if (type.isPresent() && type.get().getValue().equals(Type.FRAMEWORK)) { return createFrameworkBundleBuildRule( targetGraph, buildTarget, projectFilesystem, params, resolver, args); } Optional<BuildRule> swiftRule = createSwiftBuildRule( buildTarget, projectFilesystem, params, resolver, cellRoots, args, Optional.empty()); if (swiftRule.isPresent()) { return swiftRule.get(); } return createLibraryBuildRule( targetGraph, buildTarget, projectFilesystem, params, resolver, cellRoots, args, args.getLinkStyle(), Optional.empty(), ImmutableSet.of(), ImmutableSortedSet.of(), CxxLibraryDescription.TransitiveCxxPreprocessorInputFunction.fromLibraryRule()); }
@Override public boolean hasFlavors(ImmutableSet<Flavor> flavors) { if (getHaskellPlatformsProvider().getHaskellPlatforms().containsAnyOf(flavors)) { return true; } for (Type type : Type.values()) { if (flavors.contains(type.getFlavor())) { return true; } } return false; }
public static Iterable<BuildTarget> findDepsForTargetFromConstructorArgs( CxxPlatformsProvider cxxPlatformsProvider, BuildTarget buildTarget, Optional<Flavor> defaultCxxPlatformFlavor) { ImmutableSet.Builder<BuildTarget> deps = ImmutableSet.builder(); // Get any parse time deps from the C/C++ platforms. deps.addAll( getParseTimeDeps( getCxxPlatform(cxxPlatformsProvider, buildTarget, defaultCxxPlatformFlavor))); return deps.build(); }
public static AppleCxxPlatform getAppleCxxPlatformForBuildTarget( FlavorDomain<CxxPlatform> cxxPlatformFlavorDomain, Flavor defaultCxxFlavor, FlavorDomain<AppleCxxPlatform> appleCxxPlatformFlavorDomain, BuildTarget target, Optional<MultiarchFileInfo> fatBinaryInfo) { AppleCxxPlatform appleCxxPlatform; if (fatBinaryInfo.isPresent()) { appleCxxPlatform = fatBinaryInfo.get().getRepresentativePlatform(); } else { CxxPlatform cxxPlatform = getCxxPlatformForBuildTarget(cxxPlatformFlavorDomain, defaultCxxFlavor, target); try { appleCxxPlatform = appleCxxPlatformFlavorDomain.getValue(cxxPlatform.getFlavor()); } catch (FlavorDomainException e) { throw new HumanReadableException( e, "%s: Apple bundle requires an Apple platform, found '%s'\n\n" + "A common cause of this error is that the required SDK is missing.\n" + "Please check whether it's installed and retry.", target, cxxPlatform.getFlavor().getName()); } } return appleCxxPlatform; }
@Override public boolean hasFlavors(ImmutableSet<Flavor> flavors) { if (getCxxPlatformsProvider().getCxxPlatforms().containsAnyOf(flavors)) { return true; } for (RustBinaryDescription.Type type : RustBinaryDescription.Type.values()) { if (flavors.contains(type.getFlavor())) { return true; } } return false; }
@Override public boolean hasFlavors(ImmutableSet<Flavor> flavors) { return getCxxPlatformsProvider().getCxxPlatforms().containsAnyOf(flavors) || flavors.contains(HALIDE_COMPILE_FLAVOR) || flavors.contains(HALIDE_COMPILER_FLAVOR) || StripStyle.FLAVOR_DOMAIN.containsAnyOf(flavors); }
@Override public ImmutableSortedSet<Flavor> addImplicitFlavors( ImmutableSortedSet<Flavor> argDefaultFlavors) { // Use defaults.apple_library if present, but fall back to defaults.cxx_library otherwise. return cxxLibraryImplicitFlavors.addImplicitFlavorsForRuleTypes( argDefaultFlavors, Description.getBuildRuleType(this), Description.getBuildRuleType(CxxLibraryDescription.class)); }
/** @return the list of flavors that buck will consider valid when building the target graph. */ public ImmutableSet<Flavor> getDeclaredPlatforms() { return delegate .getListWithoutComments(cxxSection, DECLARED_PLATFORMS) .stream() .map(s -> UserFlavor.of(s, String.format("Declared platform: %s", s))) .collect(ImmutableSet.toImmutableSet()); }
private RelinkerRule makeRelinkerRule( TargetCpuType cpuType, SourcePath source, ImmutableList<RelinkerRule> relinkerDeps) { Function<RelinkerRule, SourcePath> getSymbolsNeeded = RelinkerRule::getSymbolsNeededPath; String libname = resolver.getAbsolutePath(source).getFileName().toString(); BuildRuleParams relinkerParams = buildRuleParams.copyAppendingExtraDeps(relinkerDeps); BuildRule baseRule = ruleFinder.getRule(source).orElse(null); ImmutableList<Arg> linkerArgs = ImmutableList.of(); Linker linker = null; if (baseRule != null && baseRule instanceof CxxLink) { CxxLink link = (CxxLink) baseRule; linkerArgs = link.getArgs(); linker = link.getLinker(); } return new RelinkerRule( buildTarget.withAppendedFlavors( InternalFlavor.of("xdso-dce"), InternalFlavor.of(Flavor.replaceInvalidCharacters(cpuType.toString())), InternalFlavor.of(Flavor.replaceInvalidCharacters(libname))), projectFilesystem, relinkerParams, resolver, cellPathResolver, ruleFinder, ImmutableSortedSet.copyOf(Lists.transform(relinkerDeps, getSymbolsNeeded::apply)), cpuType, Preconditions.checkNotNull(nativePlatforms.get(cpuType)).getObjdump(), cxxBuckConfig, source, linker, linkerArgs, symbolPatternWhitelist); }
@Override public ImmutableSortedSet<Flavor> addImplicitFlavors( ImmutableSortedSet<Flavor> argDefaultFlavors) { // Use defaults.apple_binary if present, but fall back to defaults.cxx_binary otherwise. return cxxBinaryImplicitFlavors.addImplicitFlavorsForRuleTypes( argDefaultFlavors, Description.getBuildRuleType(this), Description.getBuildRuleType(CxxBinaryDescription.class)); }
@Override @Value.Derived default ImmutableSortedSet<Flavor> getDefaultFlavors() { // We don't (yet) use the keys in the default_flavors map, but we // plan to eventually support key-value flavors. return ImmutableSortedSet.copyOf(getDefaults().values()); }