Search in sources :

Example 1 with Builder

use of com.google.devtools.build.android.ParsedAndroidData.Builder in project bazel by bazelbuild.

the class AndroidResourceProcessor method deserializeSymbolsToData.

/** Deserializes a list of serialized resource paths to a {@link ParsedAndroidData}. */
public ParsedAndroidData deserializeSymbolsToData(List<Path> symbolPaths) throws IOException, MergingException {
    AndroidDataDeserializer deserializer = AndroidDataDeserializer.create();
    final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(15));
    final Builder deserializedDataBuilder = ParsedAndroidData.Builder.newBuilder();
    try (Closeable closeable = ExecutorServiceCloser.createWith(executorService)) {
        List<ListenableFuture<Boolean>> deserializing = new ArrayList<>();
        for (final Path symbolPath : symbolPaths) {
            deserializing.add(executorService.submit(new Deserialize(deserializer, symbolPath, deserializedDataBuilder)));
        }
        FailedFutureAggregator<MergingException> aggregator = FailedFutureAggregator.createForMergingExceptionWithMessage("Failure(s) during dependency parsing");
        aggregator.aggregateAndMaybeThrow(deserializing);
    }
    return deserializedDataBuilder.build();
}
Also used : Path(java.nio.file.Path) MergingException(com.android.ide.common.res2.MergingException) Builder(com.google.devtools.build.android.ParsedAndroidData.Builder) Closeable(java.io.Closeable) ArrayList(java.util.ArrayList) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService)

Aggregations

MergingException (com.android.ide.common.res2.MergingException)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 ListeningExecutorService (com.google.common.util.concurrent.ListeningExecutorService)1 Builder (com.google.devtools.build.android.ParsedAndroidData.Builder)1 Closeable (java.io.Closeable)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1