use of com.android.tools.build.bundletool.validation.BundleConfigValidator in project bundletool by google.
the class AppBundleRecompressor method extractBundleConfig.
private static BundleConfig extractBundleConfig(ZipReader zipReader) {
// The bundle hasn't been validated yet, therefore selected validations need to be run manually.
if (!zipReader.getEntry(AppBundle.BUNDLE_CONFIG_FILE_NAME).isPresent()) {
throw InvalidBundleException.builder().withUserMessage("The archive doesn't seem to be an App Bundle, it is missing required file '%s'.", AppBundle.BUNDLE_CONFIG_FILE_NAME).build();
}
try (InputStream inputStream = zipReader.getUncompressedPayload(AppBundle.BUNDLE_CONFIG_FILE_NAME)) {
BundleConfig bundleConfig = BundleConfig.parseFrom(inputStream, ExtensionRegistryLite.getEmptyRegistry());
new BundleConfigValidator().validateCompression(bundleConfig.getCompression());
return bundleConfig;
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
Aggregations