diff --git a/tycho-gpg-plugin/src/main/java/org/eclipse/tycho/gpg/SignRepositoryArtifactsMojo.java b/tycho-gpg-plugin/src/main/java/org/eclipse/tycho/gpg/SignRepositoryArtifactsMojo.java index 62639d8486..ae6e7ddc59 100644 --- a/tycho-gpg-plugin/src/main/java/org/eclipse/tycho/gpg/SignRepositoryArtifactsMojo.java +++ b/tycho-gpg-plugin/src/main/java/org/eclipse/tycho/gpg/SignRepositoryArtifactsMojo.java @@ -16,6 +16,7 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; @@ -231,11 +232,13 @@ public void execute() throws MojoExecutionException, MojoFailureException { private void handle(IArtifactDescriptor artifactDescriptor, File artifact, ProxySignerWithPublicKeyAccess signer, KeyStore allKeys) { + Log log = getLog(); if (artifact != null) { var existingKeys = artifactDescriptor.getProperty(PGPSignatureVerifier.PGP_SIGNER_KEYS_PROPERTY_NAME); var existingSignatures = artifactDescriptor.getProperty(PGPSignatureVerifier.PGP_SIGNATURES_PROPERTY_NAME); if (existingSignatures != null && pgpKeyBehavior == PGPKeyBehavior.skip) { + log.debug(artifact + " is already pgp signed and these should be skipped!"); return; } @@ -245,6 +248,7 @@ private void handle(IArtifactDescriptor artifactDescriptor, File artifact, Proxy var classifier = artifactKey.getClassifier(); var isBinary = "binary".equals(classifier); if (skipBinaries && isBinary) { + log.debug(artifact + " is a binary and these should be skipped!"); return; } @@ -253,11 +257,14 @@ private void handle(IArtifactDescriptor artifactDescriptor, File artifact, Proxy var signedContent = signedContentFactory.getSignedContent(artifact); if (signedContent.isSigned()) { if (skipIfJarsigned) { + log.debug(artifact + " is already signed and signed jars should be skipped!"); return; } if (skipIfJarsignedAndAnchored) { for (var signerInfo : signedContent.getSignerInfos()) { if (signerInfo.getTrustAnchor() != null) { + log.debug(artifact + + " is already signed and signed jars should be skipped if anchored!"); return; } } @@ -265,6 +272,7 @@ private void handle(IArtifactDescriptor artifactDescriptor, File artifact, Proxy } } catch (Exception e) { //$FALL-THROUGH$ Treat as unsigned. + log.error("Can't check signature " + artifact + " :: " + e); } } } @@ -294,6 +302,8 @@ private void handle(IArtifactDescriptor artifactDescriptor, File artifact, Proxy } catch (MojoExecutionException | IOException e) { throw new RuntimeException(e.getMessage(), e); } + } else { + log.error("No artifact file for " + artifactDescriptor); } } } diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/pgp/TestPGPSigning.java b/tycho-its/src/test/java/org/eclipse/tycho/test/pgp/TestPGPSigning.java index fc93e0992a..cb798f654b 100644 --- a/tycho-its/src/test/java/org/eclipse/tycho/test/pgp/TestPGPSigning.java +++ b/tycho-its/src/test/java/org/eclipse/tycho/test/pgp/TestPGPSigning.java @@ -229,7 +229,8 @@ public void testSigningSkipIfJarSignedAndAnchored() throws Exception { assertEquals( "[org.eclipse.equinox.common, org.eclipse.equinox.common.source, org.eclipse.osgi, org.eclipse.osgi.source, org.eclipse.platform_root]", - data.unsignedIUs.toString(), "Unexpected unsigned IUs."); + data.unsignedIUs.toString(), "Unexpected unsigned IUs, log follows: " + System.lineSeparator() + + getLogLines(verifier).stream().collect(Collectors.joining(System.lineSeparator()))); Set signedIUs = data.signedIUs.keySet(); assertEquals( diff --git a/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java b/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java index 31ba59f72a..7fece5692f 100644 --- a/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java +++ b/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java @@ -249,7 +249,7 @@ protected String toURI(File file) throws IOException { } public static void verifyTextInLogMatches(Verifier verifier, Pattern pattern) throws VerificationException { - List lines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + List lines = getLogLines(verifier); for (String line : lines) { if (pattern.matcher(Verifier.stripAnsi(line)).find()) { @@ -260,7 +260,7 @@ public static void verifyTextInLogMatches(Verifier verifier, Pattern pattern) th } public static void verifyTextNotInLog(Verifier verifier, String text) throws VerificationException { - List lines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + List lines = getLogLines(verifier); for (String line : lines) { if (Verifier.stripAnsi(line).contains(text)) { @@ -269,6 +269,10 @@ public static void verifyTextNotInLog(Verifier verifier, String text) throws Ver } } + public static List getLogLines(Verifier verifier) throws VerificationException { + return verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + } + /** * Variant of verifyErrorFreeLog that do not skip stacktraces * @@ -276,7 +280,7 @@ public static void verifyTextNotInLog(Verifier verifier, String text) throws Ver * @throws VerificationException */ protected static void verifyErrorFreeLog(Verifier verifier) throws VerificationException { - List lines = verifier.loadFile(verifier.getBasedir(), verifier.getLogFileName(), false); + List lines = getLogLines(verifier); int size = lines.size(); Pattern pattern = Pattern.compile("\\[\\w+\\]"); for (int i = 0; i < size; i++) {