public class RustCompileRule extends ModernBuildRule<com.facebook.buck.features.rust.RustCompileRule.Impl>
Modifier | Constructor and Description |
---|---|
protected |
RustCompileRule(BuildTarget buildTarget,
ProjectFilesystem projectFilesystem,
SourcePathRuleFinder ruleFinder,
String filename,
Tool compiler,
Linker linker,
com.google.common.collect.ImmutableList<Arg> args,
com.google.common.collect.ImmutableList<Arg> depArgs,
com.google.common.collect.ImmutableList<Arg> linkerArgs,
com.google.common.collect.ImmutableSortedMap<String,Arg> environment,
com.google.common.collect.ImmutableSortedMap<SourcePath,Optional<String>> mappedSources,
String rootModule,
com.facebook.buck.features.rust.RustBuckConfig.RemapSrcPaths remapSrcPaths,
Optional<String> xcrunSdkPath)
Work out how to invoke the Rust compiler, rustc.
|
Modifier and Type | Method and Description |
---|---|
static RustCompileRule |
from(SourcePathRuleFinder ruleFinder,
BuildTarget buildTarget,
ProjectFilesystem projectFilesystem,
String filename,
Tool compiler,
Linker linker,
com.google.common.collect.ImmutableList<Arg> args,
com.google.common.collect.ImmutableList<Arg> depArgs,
com.google.common.collect.ImmutableList<Arg> linkerArgs,
com.google.common.collect.ImmutableSortedMap<String,Arg> environment,
com.google.common.collect.ImmutableSortedMap<SourcePath,Optional<String>> mappedSources,
String rootModule,
com.facebook.buck.features.rust.RustBuckConfig.RemapSrcPaths remapSrcPaths,
Optional<String> xcrunSdkPath) |
protected static Path |
getOutputDir(BuildTarget target,
ProjectFilesystem filesystem) |
SourcePath |
getSourcePathToOutput() |
compareTo, getBuildable, getBuildCellPathFactory, getBuildDeps, getBuildSteps, getOutputPathResolver, getSetupStepsForBuildable, getSourcePath, getSourcePaths, injectFieldsIfNecessary, inputBasedRuleKeyIsEnabled, recordOutputs, recordOutputs, recordOutputs, stepsForBuildable, stepsForBuildable, updateBuildRuleResolver
equals, getBuildTarget, getDependencies, getProjectFilesystem, getSourcePathOutputs, getType, hasBuildSteps, hashCode, injectFields, isCacheable, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isSupported
getBuildTarget, getFullyQualifiedName, getProjectFilesystem, hasBuildSteps, isCacheable, outputFileCanBeCopied, shouldRespectInputSizeLimitForRemoteExecution, toString
getDependencies, getSourcePathOutputs
getType
protected RustCompileRule(BuildTarget buildTarget, ProjectFilesystem projectFilesystem, SourcePathRuleFinder ruleFinder, String filename, Tool compiler, Linker linker, com.google.common.collect.ImmutableList<Arg> args, com.google.common.collect.ImmutableList<Arg> depArgs, com.google.common.collect.ImmutableList<Arg> linkerArgs, com.google.common.collect.ImmutableSortedMap<String,Arg> environment, com.google.common.collect.ImmutableSortedMap<SourcePath,Optional<String>> mappedSources, String rootModule, com.facebook.buck.features.rust.RustBuckConfig.RemapSrcPaths remapSrcPaths, Optional<String> xcrunSdkPath)
In Rust, a crate is the equivalent of a package in other languages. It's also the basic unit of compilation.
A crate can either be a "binary crate" - which generates an executable - or a "library crate", which makes an .rlib file. .rlib files contain both interface details (function signatures, inline functions, macros, etc) and compiled object code, and so are equivalent to both header files and library archives. There are also dynamic crates which compile to .so files.
All crates are compiled from at least one source file, which is its main (or top, or root) module. It may have references to other modules, which may be in other source files. Rustc only needs the main module filename and will find the rest of the source files from there (akin to #include in C/C++). If the crate also has dependencies on other crates, then those .rlib files must also be passed to rustc for the interface details, and to be linked if its a binary crate.
public static RustCompileRule from(SourcePathRuleFinder ruleFinder, BuildTarget buildTarget, ProjectFilesystem projectFilesystem, String filename, Tool compiler, Linker linker, com.google.common.collect.ImmutableList<Arg> args, com.google.common.collect.ImmutableList<Arg> depArgs, com.google.common.collect.ImmutableList<Arg> linkerArgs, com.google.common.collect.ImmutableSortedMap<String,Arg> environment, com.google.common.collect.ImmutableSortedMap<SourcePath,Optional<String>> mappedSources, String rootModule, com.facebook.buck.features.rust.RustBuckConfig.RemapSrcPaths remapSrcPaths, Optional<String> xcrunSdkPath)
protected static Path getOutputDir(BuildTarget target, ProjectFilesystem filesystem)
public SourcePath getSourcePathToOutput()
getSourcePathToOutput
in interface BuildRule
getSourcePathToOutput
in class ModernBuildRule<com.facebook.buck.features.rust.RustCompileRule.Impl>