use of com.android.ide.common.res2.MergedResourceWriter in project buck by facebook.
the class MergeAndroidResourceSourcesStep method execute.
@Override
public StepExecutionResult execute(ExecutionContext context) throws IOException, InterruptedException {
ResourceMerger merger = new ResourceMerger(1);
try {
for (Path resPath : resPaths) {
Preconditions.checkState(resPath.isAbsolute());
ResourceSet set = new ResourceSet(resPath.toString(), true);
set.setDontNormalizeQualifiers(true);
set.addSource(resPath.toFile());
set.loadFromFiles(new ResourcesSetLoadLogger(context.getBuckEventBus()));
merger.addDataSet(set);
}
MergedResourceWriter writer = MergedResourceWriter.createWriterWithoutPngCruncher(outFolderPath.toFile(), null, /*publicFile*/
null, /*blameLogFolder*/
new NoOpResourcePreprocessor(), tmpFolderPath.toFile());
merger.mergeData(writer, /* cleanUp */
false);
} catch (MergingException e) {
LOG.error(e, "Failed merging resources.");
return StepExecutionResult.ERROR;
}
return StepExecutionResult.SUCCESS;
}
Aggregations