diff --git a/README.md b/README.md index 9b82927..0b99126 100644 --- a/README.md +++ b/README.md @@ -325,8 +325,9 @@ in existing-bundle mode: normal uploads rebuild and re-sign artifacts, so an ear digest generally cannot match. Digest properties also come from project/user `gradle.properties` and `ORG_GRADLE_PROJECT_*` environment variables; remove or clear them before a normal release. Upload evidence is ignored when `releaseAll` is absent from the -task graph, including plain checks, signing checks and bundle-only runs. Source/version -and saved manifest hashes are rechecked. +task graph, including plain checks, signing checks and bundle-only runs; when such a run +schedules `releaseAllGuard`, an info-level message (`--info`) says the evidence was not +checked. Source/version and saved manifest hashes are rechecked. The uploader hashes and parses the same manifest bytes, and sends a private ZIP snapshot checked against the verified digest. The bundle directory must be writable for snapshot diff --git a/src/main/groovy/se/alipsa/gradle/plugin/release/CombinedReleaseRegistrar.groovy b/src/main/groovy/se/alipsa/gradle/plugin/release/CombinedReleaseRegistrar.groovy index ca5deaf..af36271 100644 --- a/src/main/groovy/se/alipsa/gradle/plugin/release/CombinedReleaseRegistrar.groovy +++ b/src/main/groovy/se/alipsa/gradle/plugin/release/CombinedReleaseRegistrar.groovy @@ -77,7 +77,15 @@ final class CombinedReleaseRegistrar { String planPath = project.absoluteProjectPath('releaseAllPlan') String releasePath = project.absoluteProjectPath('releaseAll') String bundlePath = project.absoluteProjectPath('bundleAll') + String guardPath = project.absoluteProjectPath('releaseAllGuard') project.gradle.taskGraph.whenReady { TaskExecutionGraph graph -> + if (!graph.hasTask(releasePath) && graph.hasTask(guardPath)) { + // Only release-preparation graphs realize releaseAll for this diagnostic. + ReleaseAllTask release = releaseAllTask.get() + if (release.expectedBundleSha256.getOrElse('') || release.expectedManifestSha256.getOrElse('')) { + project.logger.info('Upload evidence ignored: releaseAll is not scheduled, so expectedBundleSha256 and expectedManifestSha256 are not checked') + } + } if (graph.hasTask(planPath) && graph.hasTask(releasePath)) { throw new GradleException('Do not request releaseAllPlan and releaseAll in the same invocation; review the saved manifest, then run :releaseAll separately') } diff --git a/src/test/groovy/se/alipsa/gradle/plugin/release/ModuleReleaseTest.groovy b/src/test/groovy/se/alipsa/gradle/plugin/release/ModuleReleaseTest.groovy index 0fe39ba..c98b32e 100644 --- a/src/test/groovy/se/alipsa/gradle/plugin/release/ModuleReleaseTest.groovy +++ b/src/test/groovy/se/alipsa/gradle/plugin/release/ModuleReleaseTest.groovy @@ -6,6 +6,7 @@ import org.junit.jupiter.api.Timeout import org.junit.jupiter.api.io.TempDir import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.ValueSource +import org.gradle.testkit.runner.TaskOutcome import java.util.zip.ZipFile import static org.junit.jupiter.api.Assertions.* @@ -727,16 +728,22 @@ nexusReleasePlugin { } @ParameterizedTest - @ValueSource(strings = ['bundleAll', 'releaseAllSigningCheck', 'releaseAllGuard', ':core:check']) + @ValueSource(strings = ['bundleAll', 'releaseAllSigningCheck', 'releaseAllGuard']) void nonUploadGraphsIgnoreExportedUploadEvidence(String task) { withServer { String base, List requests -> existingFixture(base) run('releaseAllPlan') - String[] args = ['-Pexisting', '-Pexpected=not-an-upload-digest', '-PexpectedManifest=not-a-manifest-digest'] + // Every case schedules the guard, so passing proves it ignored the malformed evidence. + String[] args = ['-Pexisting', '-Pexpected=not-an-upload-digest', '-PexpectedManifest=not-a-manifest-digest', '--info'] def first = run(task, *args) assertNull(first.task(':releaseAll')) + assertEquals(TaskOutcome.SUCCESS, first.task(':releaseAllGuard')?.outcome) + // bundleAll stages modules, whose check tasks depend on the guard. + if (task == 'bundleAll') assertEquals(TaskOutcome.SUCCESS, first.task(':core:check')?.outcome) + assertTrue(first.output.contains('Upload evidence ignored: releaseAll is not scheduled'), first.output) def cached = run(task, *args) assertNull(cached.task(':releaseAll')) + assertEquals(TaskOutcome.SUCCESS, cached.task(':releaseAllGuard')?.outcome) assertTrue(cached.output.contains('Reusing configuration cache.')) assertFalse(requests.any { it.contains('/publisher/upload') }) }