use of com.android.tools.build.bundletool.model.KeystoreProperties in project bundletool by google.
the class BuildApksCommand method populateLineageFromFlags.
private static void populateLineageFromFlags(SigningConfiguration.Builder signingConfiguration, ParsedFlags flags) {
// Key-rotation-related arguments.
Optional<Path> lineagePath = LINEAGE_FLAG.getValue(flags);
Optional<Path> oldestSignerPropertiesPath = OLDEST_SIGNER_FLAG.getValue(flags);
if (lineagePath.isPresent() && oldestSignerPropertiesPath.isPresent()) {
signingConfiguration.setSigningCertificateLineage(getLineageFromInputFile(lineagePath.get().toFile()));
KeystoreProperties oldestSignerProperties = KeystoreProperties.readFromFile(oldestSignerPropertiesPath.get());
signingConfiguration.setOldestSigner(SignerConfig.extractFromKeystore(oldestSignerProperties.getKeystorePath(), oldestSignerProperties.getKeyAlias(), oldestSignerProperties.getKeystorePassword(), oldestSignerProperties.getKeyPassword()));
} else if (lineagePath.isPresent() && !oldestSignerPropertiesPath.isPresent()) {
throw InvalidCommandException.builder().withInternalMessage("Flag '%s' is required when '%s' is set.", OLDEST_SIGNER_FLAG, LINEAGE_FLAG).build();
} else if (!lineagePath.isPresent() && oldestSignerPropertiesPath.isPresent()) {
throw InvalidCommandException.builder().withInternalMessage("Flag '%s' is required when '%s' is set.", LINEAGE_FLAG, OLDEST_SIGNER_FLAG).build();
}
}
Aggregations