Skip to content

Commit d567218

Browse files
committed
Remove most compat apis
KeylessSignature is gone, just use Bundle now. Most APIs are changed to treat Bundle as the primary signing material object. Signed-off-by: Appu Goundan <[email protected]>
1 parent ae475ca commit d567218

File tree

13 files changed

+20
-134
lines changed

13 files changed

+20
-134
lines changed

build-logic/publishing/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ dependencies {
1010
implementation(project(":basics"))
1111
implementation(project(":jvm"))
1212
implementation("dev.sigstore.build-logic:gradle-plugin")
13-
implementation("dev.sigstore:sigstore-gradle-sign-plugin:0.8.0")
13+
implementation("dev.sigstore:sigstore-gradle-sign-plugin:0.9.0")
1414
implementation("com.gradle.plugin-publish:com.gradle.plugin-publish.gradle.plugin:1.2.1")
1515
}

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ org.gradle.jvmargs=-XX:MaxMetaspaceSize=768m
33
systemProp.org.gradle.kotlin.dsl.precompiled.accessors.strict=true
44

55
group=dev.sigstore
6-
# remember to update SigstoreSignExtension.kt and build-logic/publishing/build.gradle.kts when updating this
6+
# remember to also update
7+
# - SigstoreSignExtension.kt
8+
# - build-logic/publishing/build.gradle.kts
79
version=0.10.0

sigstore-cli/src/main/java/dev/sigstore/cli/Sign.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public Integer call() throws Exception {
6565
signerBuilder.oidcClients(OidcClients.of(new TokenStringOidcClient(identityToken)));
6666
}
6767
var signer = signerBuilder.build();
68-
var bundle = signer.signFile2(artifact);
68+
var bundle = signer.signFile(artifact);
6969
if (signatureFiles.sigAndCert != null) {
7070
Files.write(
7171
signatureFiles.sigAndCert.signatureFile,

sigstore-cli/src/main/java/dev/sigstore/cli/Verify.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package dev.sigstore.cli;
1717

1818
import static com.google.common.io.Files.asByteSource;
19-
import static com.google.common.io.Files.newReader;
2019

2120
import com.google.common.hash.Hashing;
2221
import dev.sigstore.KeylessVerifier;
@@ -114,7 +113,8 @@ public Integer call() throws Exception {
114113
fetcher.getEntryFromRekor(digest, Certificates.getLeaf(certPath), signature))
115114
.build();
116115
} else {
117-
bundle = Bundle.from(newReader(signatureFiles.bundleFile.toFile(), StandardCharsets.UTF_8));
116+
bundle =
117+
Bundle.from(Files.newBufferedReader(signatureFiles.bundleFile, StandardCharsets.UTF_8));
118118
}
119119

120120
var verificationOptionsBuilder = VerificationOptions.builder();

sigstore-gradle/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Provides `SigstoreSignFilesTask` task for signing files in Sigstore.
134134
The plugin adds no tasks by default.
135135

136136
Properties:
137-
* `dev.sigstore.sign.remove.sigstore.asc` (since 0.6.0, default: `true`). Removes `.sigstore.json.asc` files from the publication.
137+
* `dev.sigstore.sign.remove.sigstore.json.asc` (since 0.6.0, default: `true`). Removes `.sigstore.json.asc` files from the publication.
138138
Sonatype OSSRH supports publishing `.sigstore.json` signatures, and it does not require `.sigstore.json.asc` files, so
139139
`dev.sigstore.sign` plugin removes them by default. If you need to sign all the files, set this property to `false`.
140140

sigstore-gradle/sigstore-gradle-sign-base-plugin/src/main/kotlin/dev/sigstore/sign/SigstoreSignExtension.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ abstract class SigstoreSignExtension(private val project: Project) {
8484
}
8585

8686
val removeSigstoreAsc =
87-
project.findProperty("dev.sigstore.sign.remove.sigstore.asc")?.toString()?.toBoolean() != false
87+
project.findProperty("dev.sigstore.sign.remove.sigstore.json.asc")?.toString()?.toBoolean() != false
8888

8989
val publicationName = publication.name
9090

sigstore-gradle/sigstore-gradle-sign-base-plugin/src/main/kotlin/dev/sigstore/sign/work/SignWorkAction.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ abstract class SignWorkAction : WorkAction<SignWorkParameters> {
5555
}.build()
5656
}
5757

58-
val result = signer.signFile2(inputFile.toPath())
58+
val result = signer.signFile(inputFile.toPath())
5959
val bundleJson = result.toJson()
6060
parameters.outputSignature.get().asFile.writeText(bundleJson)
6161
}

sigstore-gradle/sigstore-gradle-sign-plugin/src/test/kotlin/dev/sigstore/gradle/RemoveSigstoreAscTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class RemoveSigstoreAscTest : BaseGradleTest() {
8888
8989
# By default, dev.sigstore.sign asks Gradle to avoid signing .sigstore.json as
9090
# .sigstore.json.asc This is an opt-out hatch for those who need .sigstore.json.asc
91-
dev.sigstore.sign.remove.sigstore.asc=false
91+
dev.sigstore.sign.remove.sigstore.json.asc=false
9292
""".trimIndent()
9393
)
9494
prepare(case.gradle.version, "publishAllPublicationsToTmpRepository", "-s")

sigstore-java/src/main/java/dev/sigstore/KeylessSignature.java

Lines changed: 0 additions & 47 deletions
This file was deleted.

sigstore-java/src/main/java/dev/sigstore/KeylessSigner.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -445,23 +445,21 @@ public Map<Path, Bundle> signFiles(List<Path> artifacts) throws KeylessSignerExc
445445
}
446446

447447
/**
448-
* Convenience wrapper around {@link #sign(List)} to accept a single file This is a compat method
449-
* and will be switched out with signFile2
448+
* Convenience wrapper around {@link #sign(List)} to accept a single file
450449
*
451-
* @param artifact the artifacts to sign.
452-
* @return a keyless singing results.
450+
* @param artifact the artifacts to sign
451+
* @return a sigstore bundle
453452
*/
454453
@CheckReturnValue
455-
public KeylessSignature signFile(Path artifact) throws KeylessSignerException {
456-
return signFiles(List.of(artifact)).get(artifact).toKeylessSignature();
454+
public Bundle signFile(Path artifact) throws KeylessSignerException {
455+
return signFiles(List.of(artifact)).get(artifact);
457456
}
458457

459458
/**
460-
* Convenience wrapper around {@link #sign(List)} to accept a signe file
461-
*
462-
* @param artifact the artifacts to sign
463-
* @return a sigstore bundle
459+
* Convenience wrapper around {@link #sign(List)} to accept a single file Compat - to be removed
460+
* before 1.0.0
464461
*/
462+
@Deprecated
465463
public Bundle signFile2(Path artifact) throws KeylessSignerException {
466464
return signFiles(List.of(artifact)).get(artifact);
467465
}

0 commit comments

Comments
 (0)