Search in sources :

Example 1 with KeystoreProperties

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();
    }
}
Also used : Path(java.nio.file.Path) KeystoreProperties(com.android.tools.build.bundletool.model.KeystoreProperties)

Aggregations

KeystoreProperties (com.android.tools.build.bundletool.model.KeystoreProperties)1 Path (java.nio.file.Path)1