use of org.gradle.api.internal.artifacts.verification.model.IgnoredKey in project gradle by gradle.
the class WriteDependencyVerificationFile method postProcessPgpResults.
private void postProcessPgpResults(Set<String> collectedIgnoredKeys) {
for (String ignoredKey : collectedIgnoredKeys) {
verificationsBuilder.addIgnoredKey(new IgnoredKey(ignoredKey, KEY_NOT_DOWNLOADED));
}
PgpKeyGrouper grouper = new PgpKeyGrouper(verificationsBuilder, entriesToBeWritten);
grouper.performPgpKeyGrouping();
}
use of org.gradle.api.internal.artifacts.verification.model.IgnoredKey in project gradle by gradle.
the class DependencyVerificationsXmlWriter method writIgnoredKeys.
private void writIgnoredKeys(DependencyVerificationConfiguration configuration) throws IOException {
Set<IgnoredKey> ignoredKeys = configuration.getIgnoredKeys();
if (!ignoredKeys.isEmpty()) {
writer.startElement(IGNORED_KEYS);
for (IgnoredKey ignoredKey : ignoredKeys) {
writeIgnoredKey(ignoredKey);
}
writer.endElement();
}
}
use of org.gradle.api.internal.artifacts.verification.model.IgnoredKey in project gradle by gradle.
the class DependencyVerificationsXmlWriter method writeIgnoredKeys.
private void writeIgnoredKeys(Set<IgnoredKey> ignoredPgpKeys) throws IOException {
if (ignoredPgpKeys.isEmpty()) {
return;
}
writer.startElement(IGNORED_KEYS);
for (IgnoredKey ignoredPgpKey : ignoredPgpKeys) {
writeIgnoredKey(ignoredPgpKey);
}
writer.endElement();
}
use of org.gradle.api.internal.artifacts.verification.model.IgnoredKey in project gradle by gradle.
the class WriteDependencyVerificationFile method registerEntryToBuilder.
private void registerEntryToBuilder(VerificationEntry entry, AtomicReference<PgpEntry> previousEntry) {
// checksums are written _after_ PGP, so if the previous entry was PGP and
// that it matches the artifact id we don't always need to write the checksum
PgpEntry pgpEntry = previousEntry.get();
if (pgpEntry != null && !pgpEntry.id.equals(entry.id)) {
// previous entry was on unrelated module
pgpEntry = null;
previousEntry.set(null);
}
if (entry instanceof ChecksumEntry) {
ChecksumEntry checksum = (ChecksumEntry) entry;
if (pgpEntry == null || (entry.id.equals(pgpEntry.id) && pgpEntry.isRequiringChecksums())) {
String label = "Generated by Gradle";
if (pgpEntry != null) {
if (pgpEntry.isFailed()) {
hasFailedVerification = true;
label += " because PGP signature verification failed!";
} else {
if (pgpEntry.hasSignatureFile()) {
hasMissingKeys = true;
label += " because a key couldn't be downloaded";
} else {
hasMissingSignatures = true;
label += " because artifact wasn't signed";
}
}
}
verificationsBuilder.addChecksum(entry.id, checksum.getChecksumKind(), checksum.getChecksum(), label);
}
} else {
PgpEntry pgp = (PgpEntry) entry;
previousEntry.set(pgp);
Set<String> failedKeys = Sets.newTreeSet(pgp.getFailed());
for (String failedKey : failedKeys) {
verificationsBuilder.addIgnoredKey(pgp.id, new IgnoredKey(failedKey, PGP_VERIFICATION_FAILED));
}
if (pgp.hasArtifactLevelKeys()) {
for (String key : pgp.getArtifactLevelKeys()) {
if (!failedKeys.contains(key)) {
verificationsBuilder.addTrustedKey(pgp.id, key);
}
}
}
}
}
use of org.gradle.api.internal.artifacts.verification.model.IgnoredKey in project gradle by gradle.
the class WriteDependencyVerificationFile method exportKeys.
private void exportKeys(SignatureVerificationService signatureVerificationService, DependencyVerifier verifier) throws IOException {
BuildTreeDefinedKeys keys = isDryRun ? keyrings.dryRun() : keyrings;
Set<String> keysToExport = Sets.newHashSet();
verifier.getConfiguration().getTrustedKeys().stream().map(DependencyVerificationConfiguration.TrustedKey::getKeyId).forEach(keysToExport::add);
verifier.getConfiguration().getIgnoredKeys().stream().map(IgnoredKey::getKeyId).forEach(keysToExport::add);
verifier.getVerificationMetadata().stream().flatMap(md -> md.getArtifactVerifications().stream()).flatMap(avm -> Stream.concat(avm.getTrustedPgpKeys().stream(), avm.getIgnoredPgpKeys().stream().map(IgnoredKey::getKeyId))).forEach(keysToExport::add);
exportKeyRingCollection(signatureVerificationService.getPublicKeyService(), keys, keysToExport);
}
Aggregations