use of com.facebook.buck.android.aapt.MiniAapt in project buck by facebook.
the class AndroidResource method getBuildSteps.
@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, final BuildableContext buildableContext) {
buildableContext.recordArtifact(Preconditions.checkNotNull(pathToTextSymbolsFile));
buildableContext.recordArtifact(Preconditions.checkNotNull(pathToRDotJavaPackageFile));
ImmutableList.Builder<Step> steps = ImmutableList.builder();
steps.add(new MakeCleanDirectoryStep(getProjectFilesystem(), Preconditions.checkNotNull(pathToTextSymbolsDir)));
if (getRes() == null) {
return steps.add(new TouchStep(getProjectFilesystem(), pathToTextSymbolsFile)).add(new WriteFileStep(getProjectFilesystem(), rDotJavaPackageArgument == null ? "" : rDotJavaPackageArgument, pathToRDotJavaPackageFile, false)).build();
}
// from the AndroidManifest.xml.
if (rDotJavaPackageArgument == null) {
Preconditions.checkNotNull(manifestFile, "manifestFile cannot be null when res is non-null and rDotJavaPackageArgument is " + "null. This should already be enforced by the constructor.");
steps.add(new ExtractFromAndroidManifestStep(context.getSourcePathResolver().getAbsolutePath(manifestFile), getProjectFilesystem(), buildableContext, METADATA_KEY_FOR_R_DOT_JAVA_PACKAGE, Preconditions.checkNotNull(pathToRDotJavaPackageFile)));
} else {
steps.add(new WriteFileStep(getProjectFilesystem(), rDotJavaPackageArgument, pathToRDotJavaPackageFile, false));
}
ImmutableSet<Path> pathsToSymbolsOfDeps = symbolsOfDeps.get().stream().map(context.getSourcePathResolver()::getAbsolutePath).collect(MoreCollectors.toImmutableSet());
steps.add(new MiniAapt(context.getSourcePathResolver(), getProjectFilesystem(), Preconditions.checkNotNull(res), Preconditions.checkNotNull(pathToTextSymbolsFile), pathsToSymbolsOfDeps, resourceUnion, isGrayscaleImageProcessingEnabled));
return steps.build();
}
Aggregations