Search in sources :

Example 1 with MiniAapt

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();
}
Also used : SourcePath(com.facebook.buck.rules.SourcePath) Path(java.nio.file.Path) ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath) ImmutableList(com.google.common.collect.ImmutableList) MakeCleanDirectoryStep(com.facebook.buck.step.fs.MakeCleanDirectoryStep) Step(com.facebook.buck.step.Step) MakeCleanDirectoryStep(com.facebook.buck.step.fs.MakeCleanDirectoryStep) TouchStep(com.facebook.buck.step.fs.TouchStep) WriteFileStep(com.facebook.buck.step.fs.WriteFileStep) TouchStep(com.facebook.buck.step.fs.TouchStep) WriteFileStep(com.facebook.buck.step.fs.WriteFileStep) MiniAapt(com.facebook.buck.android.aapt.MiniAapt)

Aggregations

MiniAapt (com.facebook.buck.android.aapt.MiniAapt)1 ExplicitBuildTargetSourcePath (com.facebook.buck.rules.ExplicitBuildTargetSourcePath)1 SourcePath (com.facebook.buck.rules.SourcePath)1 Step (com.facebook.buck.step.Step)1 MakeCleanDirectoryStep (com.facebook.buck.step.fs.MakeCleanDirectoryStep)1 TouchStep (com.facebook.buck.step.fs.TouchStep)1 WriteFileStep (com.facebook.buck.step.fs.WriteFileStep)1 ImmutableList (com.google.common.collect.ImmutableList)1 Path (java.nio.file.Path)1