public final class JsBundleGenrule extends BaseGenrule<com.facebook.buck.features.js.JsBundleGenrule.Buildable> implements AndroidPackageable, HasRuntimeDeps, JsBundleOutputs, JsDependenciesOutputs
JsBundleGenrule produces four outputs:
Bundles can rewrite the misc, source map, and deps file outputs with the
rewriteSourcemap
rewriteMisc
, and rewriteDepsFile
arguments.
Doing so causes this genrule to create these files and folders in the output directory; otherwise
the outputs will be exported verbatim from the bundles that this bundle depends on.
JS_DIR_NAME
Constructor and Description |
---|
JsBundleGenrule(BuildTarget buildTarget,
ProjectFilesystem projectFilesystem,
BuildRuleResolver resolver,
SandboxExecutionStrategy sandboxExecutionStrategy,
JsBundleGenruleDescriptionArg args,
Optional<Arg> cmd,
Optional<Arg> bash,
Optional<Arg> cmdExe,
Optional<String> environmentExpansionSeparator,
Optional<AndroidTools> androidTools,
JsBundleOutputs jsBundle,
JsDependenciesOutputs jsDependencies,
String bundleName) |
Modifier and Type | Method and Description |
---|---|
void |
addToCollector(AndroidPackageableCollector collector)
Add concrete resources to the given collector.
|
String |
getBundleName() |
JsDependenciesOutputs |
getJsDependenciesOutputs(ActionGraphBuilder graphBuilder) |
Iterable<AndroidPackageable> |
getRequiredPackageables(BuildRuleResolver ruleResolver)
Get the set of packagables that need to be included in any package that includes this object.
|
java.util.stream.Stream<BuildTarget> |
getRuntimeDeps(BuildRuleResolver buildRuleResolver) |
SourcePath |
getSourcePathToDepsFile() |
SourcePath |
getSourcePathToMisc() |
SourcePath |
getSourcePathToOutput()
Returns the output defined in 'out'.
|
SourcePath |
getSourcePathToResources() |
SourcePath |
getSourcePathToSourceMap() |
getOutputLabels, getOutputName, getSourcePathToOutput, getType, isCacheable
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, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compareTo, getBuildDeps, getBuildSteps, getBuildTarget, getFullyQualifiedName, getProjectFilesystem, hasBuildSteps, isCacheable, outputFileCanBeCopied, shouldRespectInputSizeLimitForRemoteExecution, toString, updateBuildRuleResolver
getDependencies, getSourcePathOutputs
getType
isSupported
public JsBundleGenrule(BuildTarget buildTarget, ProjectFilesystem projectFilesystem, BuildRuleResolver resolver, SandboxExecutionStrategy sandboxExecutionStrategy, JsBundleGenruleDescriptionArg args, Optional<Arg> cmd, Optional<Arg> bash, Optional<Arg> cmdExe, Optional<String> environmentExpansionSeparator, Optional<AndroidTools> androidTools, JsBundleOutputs jsBundle, JsDependenciesOutputs jsDependencies, String bundleName)
public SourcePath getSourcePathToOutput()
BaseGenrule
BaseGenrule.getSourcePathToOutput(OutputLabel)
instead.getSourcePathToOutput
in interface HasMultipleOutputs
getSourcePathToOutput
in interface BuildRule
getSourcePathToOutput
in interface JsBundleOutputs
getSourcePathToOutput
in class BaseGenrule<com.facebook.buck.features.js.JsBundleGenrule.Buildable>
SourcePath
to the directory containing the built JavaScript.public SourcePath getSourcePathToSourceMap()
getSourcePathToSourceMap
in interface JsBundleOutputs
SourcePath
to a source map belonging to the built JavaScript. Typically a
single file.public SourcePath getSourcePathToResources()
getSourcePathToResources
in interface JsBundleOutputs
SourcePath
to a directory containing the resources (or assets) used by the
bundled JavaScript source code.public SourcePath getSourcePathToMisc()
getSourcePathToMisc
in interface JsBundleOutputs
SourcePath
to a directory containing various metadata that can be used by
dependent rules but are not meant to be shipped with the application.public SourcePath getSourcePathToDepsFile()
getSourcePathToDepsFile
in interface JsDependenciesOutputs
SourcePath
to a dependencies graph file associated with a built JavaScript.public Iterable<AndroidPackageable> getRequiredPackageables(BuildRuleResolver ruleResolver)
AndroidPackageable
For example, an android_library will need all of its Java deps (except provided_deps), its resource deps, and its native library deps (even though it doesn't need the native library as a build-time dependency). An android_resource might need an android_library that declares a custom view that it references, as well as other android_resource rules that it references directly.
TODO(natthu): Once build rules and buildables are merged, replace this method with another
interface that lets an AndroidPackageable
override the default set which is all deps of
the type AndroidPackageable
.
getRequiredPackageables
in interface AndroidPackageable
AndroidPackageable
s that must be included along with this one.public void addToCollector(AndroidPackageableCollector collector)
AndroidPackageable
Implementations should call methods on the collector specify what concrete content must be included in an Android package that includes this object. For example, an android_library will add Java classes, an ndk_library will add native libraries, and android_resource will add resource directories.
addToCollector
in interface AndroidPackageable
collector
- The AndroidPackageableCollector
that will receive the content.public String getBundleName()
getBundleName
in interface JsBundleOutputs
public java.util.stream.Stream<BuildTarget> getRuntimeDeps(BuildRuleResolver buildRuleResolver)
getRuntimeDeps
in interface HasRuntimeDeps
public JsDependenciesOutputs getJsDependenciesOutputs(ActionGraphBuilder graphBuilder)
getJsDependenciesOutputs
in interface JsBundleOutputs
JsDependenciesOutputs
rule which is responsible for building the
dependencies file.