public class RustCompileUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
addFeatures(BuildTarget buildTarget,
Iterable<String> features,
com.google.common.collect.ImmutableList.Builder<Arg> args) |
static void |
addTargetTripleForFlavor(Flavor flavor,
com.google.common.collect.ImmutableList.Builder<Arg> args)
Add the appropriate --target option to the given rustc args if the given flavor is known.
|
static BinaryWrapperRule |
createBinaryBuildRule(BuildTarget buildTarget,
ProjectFilesystem projectFilesystem,
BuildRuleParams params,
ActionGraphBuilder graphBuilder,
RustBuckConfig rustBuckConfig,
com.facebook.buck.features.rust.RustPlatform rustPlatform,
Optional<String> crateName,
Optional<String> edition,
com.google.common.collect.ImmutableSortedSet<String> features,
com.google.common.collect.ImmutableSortedMap<String,Arg> environment,
Iterator<Arg> rustcFlags,
Iterator<Arg> linkerFlags,
Linker.LinkableDepType linkStyle,
boolean rpath,
com.google.common.collect.ImmutableSortedSet<SourcePath> sources,
com.google.common.collect.ImmutableSortedMap<SourcePath,String> mappedSources,
Optional<String> crateRoot,
com.google.common.collect.ImmutableSet<String> defaultRoots,
CrateType crateType,
Iterable<BuildRule> deps,
com.google.common.collect.ImmutableMap<String,BuildTarget> depsAliases) |
protected static BuildTarget |
getCompileBuildTarget(BuildTarget target,
CxxPlatform cxxPlatform,
CrateType crateType) |
static Optional<String> |
getCrateRoot(SourcePathResolverAdapter resolver,
String crate,
com.google.common.collect.ImmutableSet<String> defaults,
java.util.stream.Stream<Path> sources)
Given a list of sources, return the one which is the root based on the defaults and user
parameters.
|
static Linker.LinkableDepType |
getLinkStyle(BuildTarget target,
Optional<Linker.LinkableDepType> linkStyle) |
static StringWithMacrosConverter |
getMacroExpander(BuildRuleCreationContextWithTargetGraph context,
BuildTarget buildTarget,
CxxPlatform cxxPlatform)
Return a macro expander for a string with macros
|
static Iterable<BuildTarget> |
getPlatformParseTimeDeps(RustToolchain rustToolchain,
BuildTarget buildTarget,
HasDefaultPlatform hasDefaultPlatform) |
static UnresolvedRustPlatform |
getRustPlatform(RustToolchain rustToolchain,
BuildTarget target,
HasDefaultPlatform hasDefaultPlatform)
Gets the
UnresolvedRustPlatform for a target. |
static Map<String,SourcePath> |
getTransitiveRustSharedLibraries(com.facebook.buck.features.rust.RustPlatform rustPlatform,
Iterable<? extends BuildRule> inputs,
boolean forceRlib)
Collect all the shared libraries generated by
RustLinkable s found by transitively
traversing all unbroken dependency chains of RustLinkable objects found via the passed in BuildRule
roots. |
static RustCompileRule |
requireBuild(BuildTarget buildTarget,
ProjectFilesystem projectFilesystem,
ActionGraphBuilder graphBuilder,
com.facebook.buck.features.rust.RustPlatform rustPlatform,
RustBuckConfig rustConfig,
com.google.common.collect.ImmutableSortedMap<String,Arg> environment,
com.google.common.collect.ImmutableList<Arg> extraFlags,
com.google.common.collect.ImmutableList<Arg> extraLinkerFlags,
Iterable<Arg> linkerInputs,
String crateName,
CrateType crateType,
Optional<String> edition,
Linker.LinkableDepType depType,
com.google.common.collect.ImmutableSortedMap<SourcePath,Optional<String>> mappedSources,
String rootModule,
boolean forceRlib,
boolean preferStatic,
Iterable<BuildRule> deps,
com.google.common.collect.ImmutableMap<String,BuildTarget> depsAliases,
Optional<String> incremental) |
static String |
ruleToCrateName(String rulename) |
static String |
targetTripleForFlavor(Flavor flavor)
Given a Rust flavor, return a target triple or null if none known.
|
protected static BuildTarget getCompileBuildTarget(BuildTarget target, CxxPlatform cxxPlatform, CrateType crateType)
public static RustCompileRule requireBuild(BuildTarget buildTarget, ProjectFilesystem projectFilesystem, ActionGraphBuilder graphBuilder, com.facebook.buck.features.rust.RustPlatform rustPlatform, RustBuckConfig rustConfig, com.google.common.collect.ImmutableSortedMap<String,Arg> environment, com.google.common.collect.ImmutableList<Arg> extraFlags, com.google.common.collect.ImmutableList<Arg> extraLinkerFlags, Iterable<Arg> linkerInputs, String crateName, CrateType crateType, Optional<String> edition, Linker.LinkableDepType depType, com.google.common.collect.ImmutableSortedMap<SourcePath,Optional<String>> mappedSources, String rootModule, boolean forceRlib, boolean preferStatic, Iterable<BuildRule> deps, com.google.common.collect.ImmutableMap<String,BuildTarget> depsAliases, Optional<String> incremental)
public static Linker.LinkableDepType getLinkStyle(BuildTarget target, Optional<Linker.LinkableDepType> linkStyle)
public static UnresolvedRustPlatform getRustPlatform(RustToolchain rustToolchain, BuildTarget target, HasDefaultPlatform hasDefaultPlatform)
UnresolvedRustPlatform
for a target.public static Iterable<BuildTarget> getPlatformParseTimeDeps(RustToolchain rustToolchain, BuildTarget buildTarget, HasDefaultPlatform hasDefaultPlatform)
public static BinaryWrapperRule createBinaryBuildRule(BuildTarget buildTarget, ProjectFilesystem projectFilesystem, BuildRuleParams params, ActionGraphBuilder graphBuilder, RustBuckConfig rustBuckConfig, com.facebook.buck.features.rust.RustPlatform rustPlatform, Optional<String> crateName, Optional<String> edition, com.google.common.collect.ImmutableSortedSet<String> features, com.google.common.collect.ImmutableSortedMap<String,Arg> environment, Iterator<Arg> rustcFlags, Iterator<Arg> linkerFlags, Linker.LinkableDepType linkStyle, boolean rpath, com.google.common.collect.ImmutableSortedSet<SourcePath> sources, com.google.common.collect.ImmutableSortedMap<SourcePath,String> mappedSources, Optional<String> crateRoot, com.google.common.collect.ImmutableSet<String> defaultRoots, CrateType crateType, Iterable<BuildRule> deps, com.google.common.collect.ImmutableMap<String,BuildTarget> depsAliases)
public static void addFeatures(BuildTarget buildTarget, Iterable<String> features, com.google.common.collect.ImmutableList.Builder<Arg> args)
public static Map<String,SourcePath> getTransitiveRustSharedLibraries(com.facebook.buck.features.rust.RustPlatform rustPlatform, Iterable<? extends BuildRule> inputs, boolean forceRlib)
RustLinkable
s found by transitively
traversing all unbroken dependency chains of RustLinkable
objects found via the passed in BuildRule
roots.SourcePath
.public static Optional<String> getCrateRoot(SourcePathResolverAdapter resolver, String crate, com.google.common.collect.ImmutableSet<String> defaults, java.util.stream.Stream<Path> sources)
resolver
- SourcePathResolverAdapter for rulecrate
- Name of cratedefaults
- Default names for this rule (library, binary, etc)sources
- List of sources@Nullable public static String targetTripleForFlavor(Flavor flavor)
public static void addTargetTripleForFlavor(Flavor flavor, com.google.common.collect.ImmutableList.Builder<Arg> args)
public static StringWithMacrosConverter getMacroExpander(BuildRuleCreationContextWithTargetGraph context, BuildTarget buildTarget, CxxPlatform cxxPlatform)