Skip to content

Commit 5fa03aa

Browse files
committed
Add image checksum and signing, remove JReleaser
1 parent 494ddef commit 5fa03aa

File tree

2 files changed

+34
-108
lines changed

2 files changed

+34
-108
lines changed

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ shadow = "8.3.5"
1717
api-guardian = "1.1.2"
1818
jreleaser = "1.15.0"
1919
runtime = "1.13.1"
20+
gradle-checksum = "1.4.0"
2021

2122
[libraries]
2223
prettier4j = { module = "com.opencastsoftware:prettier4j", version.ref = "prettier4j" }
@@ -55,3 +56,4 @@ smithy-jar = { id = "software.amazon.smithy.gradle.smithy-jar", version.ref = "s
5556
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
5657
jreleaser = { id = "org.jreleaser", version.ref = "jreleaser" }
5758
runtime = { id = "org.beryx.runtime", version.ref = "runtime"}
59+
checksum = { id = "org.gradle.crypto.checksum", version.ref = "gradle-checksum" }

smithy-cli/build.gradle.kts

Lines changed: 32 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@ import org.apache.tools.ant.taskdefs.condition.Os
66
import org.beryx.runtime.RuntimeTask
77
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
88
import org.gradle.api.tasks.testing.logging.TestLogEvent
9-
import org.jreleaser.gradle.plugin.JReleaserExtension
10-
import org.jreleaser.model.Active
11-
import org.jreleaser.model.Distribution
12-
import org.jreleaser.model.Stereotype
9+
import org.gradle.crypto.checksum.Checksum
1310

1411
plugins {
1512
application
16-
alias(libs.plugins.jreleaser) apply false
13+
alias(libs.plugins.checksum)
1714
alias(libs.plugins.runtime)
1815
alias(libs.plugins.shadow)
1916
id("smithy.module-conventions")
@@ -260,113 +257,40 @@ tasks {
260257
// Runtime images need to be created before integration tests can run.
261258
dependsOn(runtime)
262259
}
263-
}
264-
265-
// ------ Setup Jreleaser -------
266-
if (project.hasProperty("release.cli")) {
267-
apply(plugin = "org.jreleaser")
268260

269-
tasks.named("assembleDist") {
270-
doFirst {
271-
// This is a workaround for a weird behavior.
272-
// https://github.com/jreleaser/jreleaser/issues/1292
273-
mkdir("$buildDir/jreleaser")
274-
}
275-
dependsOn("runtimeZip")
261+
signing {
262+
val signingKey: String? by project
263+
val signingPassword: String? by project
264+
useInMemoryPgpKeys(signingKey, signingPassword)
276265
}
277266

278-
configure<JReleaserExtension> {
279-
gitRootSearch = true
280-
dryrun = false
281-
282-
project {
283-
website = "https://smithy.io"
284-
authors = listOf("Smithy")
285-
vendor = "Smithy"
286-
license = "Apache-2.0"
287-
description = "Smithy CLI - A CLI for building, validating, querying, and iterating on Smithy models"
288-
copyright = "2019"
289-
}
290-
291-
checksum {
292-
individual = true
293-
files = false
294-
}
295-
296-
release {
297-
github {
298-
overwrite = true
299-
tagName = "{{projectVersion}}"
300-
skipTag = true
301-
releaseName = "Smithy CLI v{{{projectVersion}}}"
302-
changelog {
303-
// For now, we won't have a changelog added to the release. In the future, we could create a changelog-snippet
304-
// from the real changelog as part of a command hook prior to the release step
305-
enabled = false
306-
}
307-
commitAuthor {
308-
name = "smithy-automation"
309-
email = "github-smithy-automation@amazon.com"
310-
}
311-
}
312-
}
313-
314-
files {
315-
active = Active.ALWAYS
316-
artifact {
317-
// We'll include the VERSION file in the release artifacts so that the version can be easily
318-
// retrieving by hitting the GitHub `releases/latest` url
319-
setPath("../VERSION")
320-
extraProperties.put("skipSigning", true)
321-
}
322-
}
323-
324-
platform {
325-
// These replacements are for the names of files that are released, *not* for names within this build config
326-
replacements =
327-
mapOf(
328-
"osx" to "darwin",
329-
"aarch_64" to "aarch64",
330-
"windows_x86_64" to "windows_x64",
331-
)
332-
}
333-
334-
distributions {
335-
create("smithy") {
336-
distributionType = Distribution.DistributionType.JLINK
337-
stereotype = Stereotype.CLI
338-
339-
artifact {
340-
path = layout.buildDirectory.file("image/smithy-cli-linux-x86_64.zip")
341-
platform = ("linux-x86_64")
342-
}
343-
344-
artifact {
345-
path = layout.buildDirectory.file("image/smithy-cli-linux-aarch64.zip")
346-
platform = ("linux-aarch_64")
347-
}
348-
349-
artifact {
350-
path = layout.buildDirectory.file("image/smithy-cli-darwin-x86_64.zip")
351-
platform = ("osx-x86_64")
352-
}
353-
354-
artifact {
355-
path = layout.buildDirectory.file("image/smithy-cli-darwin-aarch64.zip")
356-
platform = ("osx-aarch_64")
357-
}
267+
// Unfortunately, runtime plugin doesn't model the images as outputs, so we have to hardcode this
268+
val imageZips =
269+
runtime.imageDir.files(
270+
"smithy-cli-darwin-aarch64.zip",
271+
"smithy-cli-darwin-x86-64.zip",
272+
"smithy-cli-linux-aarch64.zip",
273+
"smithy-cli-linux-x86-64.zip",
274+
"smithy-cli-windows-x64.zip",
275+
)
276+
277+
// Generate a sha256 checksum file for each zip
278+
val checksumImages by registering(Checksum::class) {
279+
dependsOn(runtimeZip)
280+
checksumAlgorithm = Checksum.Algorithm.SHA256
281+
outputDirectory = runtime.imageDir
282+
inputFiles.setFrom(imageZips)
283+
}
358284

359-
artifact {
360-
path = layout.buildDirectory.file("image/smithy-cli-windows-x64.zip")
361-
platform = ("windows-x86_64")
362-
}
363-
}
364-
}
285+
// Generate an ascii-armored sig file for each zip
286+
val signImages by registering(Sign::class) {
287+
dependsOn(checksumImages)
288+
sign(*imageZips.files.toTypedArray())
289+
}
365290

366-
signing {
367-
active = Active.RELEASE
368-
armored = true
369-
verify = true
370-
}
291+
// A wrapper task generates, checksums, and signs the image zipfiles
292+
// Not necessary, but a little clearer than just signImages
293+
val images by registering {
294+
dependsOn(runtimeZip, checksumImages, signImages)
371295
}
372296
}

0 commit comments

Comments
 (0)