public class CxxPreprocessAndCompile extends ModernBuildRule<com.facebook.buck.cxx.CxxPreprocessAndCompile.Impl> implements SupportsDependencyFileRuleKey, CxxIntermediateBuildProduct
Modifier and Type | Method and Description |
---|---|
static CxxPreprocessAndCompile |
compile(BuildTarget buildTarget,
ProjectFilesystem projectFilesystem,
SourcePathRuleFinder ruleFinder,
com.facebook.buck.cxx.CompilerDelegate compilerDelegate,
String outputName,
SourcePath input,
CxxSource.Type inputType,
DebugPathSanitizer sanitizer) |
com.google.common.collect.ImmutableList<String> |
getCommand(BuildContext context)
Returns the compilation command (used for compdb).
|
java.util.function.Predicate<SourcePath> |
getCoveredByDepFilePredicate(SourcePathResolverAdapter pathResolver)
Returns a predicate that can tell whether a given path is covered by dep-file or not.
|
java.util.function.Predicate<SourcePath> |
getExistenceOfInterestPredicate(SourcePathResolverAdapter pathResolver)
Returns a predicate that can tell whether the existence of a given path may be of interest to
compiler.
|
SourcePath |
getInput() |
com.google.common.collect.ImmutableList<SourcePath> |
getInputsAfterBuildingLocally(BuildContext context,
CellPathResolver cellPathResolver)
Returns a list of source paths that were actually used for the rule.
|
String |
getSourceInputPath(SourcePathResolverAdapter resolver)
Returns the original path of the source file relative to its own project root
|
SourcePath |
getSourcePathToOutput() |
String |
getType() |
com.facebook.buck.cxx.CxxPreprocessAndCompileStep |
makeMainStep(BuildContext context,
boolean useArgFile) |
static CxxPreprocessAndCompile |
preprocessAndCompile(BuildTarget buildTarget,
ProjectFilesystem projectFilesystem,
SourcePathRuleFinder ruleFinder,
com.facebook.buck.cxx.PreprocessorDelegate preprocessorDelegate,
com.facebook.buck.cxx.CompilerDelegate compilerDelegate,
String outputName,
SourcePath input,
CxxSource.Type inputType,
Optional<com.facebook.buck.cxx.CxxPrecompiledHeader> precompiledHeaderRule,
DebugPathSanitizer sanitizer) |
boolean |
shouldRespectInputSizeLimitForRemoteExecution() |
boolean |
useDependencyFileRuleKeys() |
compareTo, getBuildable, getBuildCellPathFactory, getBuildDeps, getBuildSteps, getOutputPathResolver, getSetupStepsForBuildable, getSourcePath, getSourcePaths, injectFieldsIfNecessary, inputBasedRuleKeyIsEnabled, recordOutputs, recordOutputs, recordOutputs, stepsForBuildable, stepsForBuildable, updateBuildRuleResolver
equals, getBuildTarget, getDependencies, getProjectFilesystem, getSourcePathOutputs, hasBuildSteps, hashCode, injectFields, isCacheable, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compareTo, getBuildDeps, getBuildSteps, getBuildTarget, getFullyQualifiedName, getProjectFilesystem, hasBuildSteps, isCacheable, outputFileCanBeCopied, toString, updateBuildRuleResolver
getDependencies, getSourcePathOutputs
isSupported
public String getType()
getType
in interface HasNameAndType
getType
in class AbstractBuildRule
public static CxxPreprocessAndCompile compile(BuildTarget buildTarget, ProjectFilesystem projectFilesystem, SourcePathRuleFinder ruleFinder, com.facebook.buck.cxx.CompilerDelegate compilerDelegate, String outputName, SourcePath input, CxxSource.Type inputType, DebugPathSanitizer sanitizer)
CxxPreprocessAndCompile
step that compiles the given preprocessed source.public static CxxPreprocessAndCompile preprocessAndCompile(BuildTarget buildTarget, ProjectFilesystem projectFilesystem, SourcePathRuleFinder ruleFinder, com.facebook.buck.cxx.PreprocessorDelegate preprocessorDelegate, com.facebook.buck.cxx.CompilerDelegate compilerDelegate, String outputName, SourcePath input, CxxSource.Type inputType, Optional<com.facebook.buck.cxx.CxxPrecompiledHeader> precompiledHeaderRule, DebugPathSanitizer sanitizer)
CxxPreprocessAndCompile
step that preprocesses and compiles the given source.public String getSourceInputPath(SourcePathResolverAdapter resolver)
public com.google.common.collect.ImmutableList<String> getCommand(BuildContext context)
public SourcePath getSourcePathToOutput()
getSourcePathToOutput
in interface BuildRule
getSourcePathToOutput
in class ModernBuildRule<com.facebook.buck.cxx.CxxPreprocessAndCompile.Impl>
public SourcePath getInput()
public boolean useDependencyFileRuleKeys()
useDependencyFileRuleKeys
in interface SupportsDependencyFileRuleKey
public java.util.function.Predicate<SourcePath> getCoveredByDepFilePredicate(SourcePathResolverAdapter pathResolver)
SupportsDependencyFileRuleKey
I.e. this predicate should return true only for source paths that *may* be returned from
SupportsDependencyFileRuleKey.getInputsAfterBuildingLocally(BuildContext, CellPathResolver)
. This information is
used by the rule key builder to infer that inputs *not* in this list should be included
unconditionally in the rule key. Inputs that *are* in this list should be included in the rule
key if and only if they are actually being used for the rule. I.e. if they are present in the
dep-file listed by SupportsDependencyFileRuleKey.getInputsAfterBuildingLocally(BuildContext, CellPathResolver)
.
getCoveredByDepFilePredicate
in interface SupportsDependencyFileRuleKey
public java.util.function.Predicate<SourcePath> getExistenceOfInterestPredicate(SourcePathResolverAdapter pathResolver)
SupportsDependencyFileRuleKey
The main purpose of this predicate is to support scenarios where compiler decides whether to use a file or not solely based on its path. Of course, if compiler decides to use the file, it should list it in the dep-file in which case both the path and the content will be included in the rule key. However, relying only on presence in the dep-file for such paths is not sufficient. The problem occurs when a new such file just gets added, in which case it won't be present in the dep-file produced in the previous build, and yet if we run a local build now the compiler may decide to use it. For that reason rule key needs to reflect existence of all such files and change when a such a file gets added or removed.
getExistenceOfInterestPredicate
in interface SupportsDependencyFileRuleKey
public com.google.common.collect.ImmutableList<SourcePath> getInputsAfterBuildingLocally(BuildContext context, CellPathResolver cellPathResolver) throws IOException
SupportsDependencyFileRuleKey
getInputsAfterBuildingLocally
in interface SupportsDependencyFileRuleKey
IOException
public final boolean shouldRespectInputSizeLimitForRemoteExecution()
shouldRespectInputSizeLimitForRemoteExecution
in interface BuildEngineAction
shouldRespectInputSizeLimitForRemoteExecution
in interface BuildRule
public com.facebook.buck.cxx.CxxPreprocessAndCompileStep makeMainStep(BuildContext context, boolean useArgFile)