diff --git a/CHANGELOG.md b/CHANGELOG.md index ce414703cc..5b252f057f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Do not report when string-template expression is a keyword ([#883](https://github.com/pinterest/ktlint/issues/883)) - False positive for subclass imports in `no-unused-imports` ([#845](https://github.com/pinterest/ktlint/issues/845)) - False positive for static java function imports in `no-unused-imports` ([#872](https://github.com/pinterest/ktlint/issues/872)) +- Missing signature for KtLint CLI artifact published to Github release ([#895](https://github.com/pinterest/ktlint/issues/895)) ### Changed - `Ktlint` object internal code cleanup diff --git a/buildSrc/src/main/kotlin/ktlint-publication.gradle.kts b/buildSrc/src/main/kotlin/ktlint-publication.gradle.kts index 000e72e394..7ea16884c0 100644 --- a/buildSrc/src/main/kotlin/ktlint-publication.gradle.kts +++ b/buildSrc/src/main/kotlin/ktlint-publication.gradle.kts @@ -96,6 +96,10 @@ publishing { * ``` */ signing { + // Uncomment following line to use gpg-agent for signing + // See https://docs.gradle.org/current/userguide/signing_plugin.html#sec:using_gpg_agent how to configure it + //useGpgCmd() + sign(publishing.publications["maven"]) setRequired({ !version.toString().endsWith("SNAPSHOT") diff --git a/ktlint/build.gradle b/ktlint/build.gradle index f24540df62..2137a3b47d 100644 --- a/ktlint/build.gradle +++ b/ktlint/build.gradle @@ -5,6 +5,7 @@ plugins { id 'ktlint-publication' id 'com.github.johnrengelman.shadow' id 'org.gradle.crypto.checksum' + id 'signing' } jar { @@ -47,15 +48,23 @@ def shadowJarExecutableTask = tasks.register("shadowJarExecutable", DefaultTask. group = "Distribution" inputs.files tasks.named("shadowJar") - outputs.file "$buildDir/run/ktlint" + outputs.files( + "$buildDir/run/ktlint", + "$buildDir/run/ktlint.asc", + ) + + logger.warn("Signatory: ${signing.signatories}") doLast { - File execFile = outputs.files.singleFile + File execFile = outputs.files.getFiles().first() execFile.withOutputStream { it.write "#!/bin/sh\n\nexec java -Xmx512m -jar \"\$0\" \"\$@\"\n\n".bytes it.write inputs.files.singleFile.bytes } execFile.setExecutable(true, false) + if (!version.toString().endsWith("SNAPSHOT")) { + signing.sign(execFile) + } } finalizedBy tasks.named("shadowJarExecutableChecksum") }