-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In the `1.0.0` release, the maven coordinates of some modules were changed. To support migration to the new coordinates a special relocatation `pom.xml`s (with version `0.51.0-FINAL`) are created. Builds running on a release up until `0.50.x` that will upgrade to the `0.51.0-FINAL` release will then get a message with the new maven coordinates. Closes #2280
- Loading branch information
1 parent
04dde90
commit 2acdeeb
Showing
11 changed files
with
455 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Release artifacts are signed. This is handled by the GitHub workflow. | ||
|
||
To test the creation of signed artifacts on the local machine, follow steps below: | ||
|
||
* Change property `VERSION_NAME` in `gradle.properties` so that it does not end with `-SNAPSHOT`. Whenever the version ends with `-SNAPSHOT`, the artifacts are never signed. Make sure that this change is not committed. | ||
* Use [GPG](https://infra.apache.org/openpgp.html#key-gen-generate-key) to generate a key. Maven requires a RSA key of at least 4096 bits. Most likely it does not matter for local publication whether this is used. Execute command: | ||
``` | ||
gpg --full-gen-key | ||
``` | ||
* Please select what kind of key you want: 1) RSA - RSA | ||
* What keysize do you want? 4096 | ||
* Key is valid for? 0 (does not expire) | ||
* Real-name: ktlint-test | ||
* Email address: ktlint-test@nowhere.com | ||
* Comment: Test signing of ktlint artifacts on local machine only | ||
* Passphrase: i-will-try-no-to-forget-this-passphrase | ||
* The output ends with something like | ||
```text | ||
pub rsa4096 2023-10-08 [SC] | ||
5B0ABB03277D2FEB46FE7E8E22D6006063A5D3C3 | ||
uid ktlint-test (Test signing of ktlint artifacts on local machine only) <ktlint-test@nowhere.com> | ||
sub rsa4096 2023-10-08 [E] | ||
``` | ||
* Execute all commands below in the same terminal | ||
```shell | ||
export ORG_GRADLE_PROJECT_signingKeyId="63A5D3C3" # Last 8 characters of full id of the public key generated by gpg command above | ||
export ORG_GRADLE_PROJECT_signingKeyPassword="i-will-try-no-to-forget-this-passphrase" | ||
# Command below will export the armored GPG signing key and store it in an environment variable. Note that this command will ask for the password (see ORG_GRADLE_PROJECT_signingKeyPassword). | ||
export ORG_GRADLE_PROJECT_signingKey="$(gpg --export-secret-keys --armor $GPG_FULL_KEY_ID | tail -r | tail -n +3 | tail -r | tail -n +3 | tr -d '\n')" | ||
``` | ||
* Execute the Gradle publication (this can not be combined with the export statements above because of the manual input of the passphrase) | ||
``` | ||
./gradlew publishToMavenLocal | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,45 @@ | ||
plugins { | ||
id("ktlint-publication-library") | ||
} | ||
|
||
// TODO: Remove in release after ktlint 1.0.1 | ||
publishing { | ||
publications { | ||
create<MavenPublication>("relocation-ktlint-cli-reporter-core") { | ||
pom { | ||
// Old artifact coordinates | ||
groupId = "com.pinterest.ktlint" | ||
artifactId = "ktlint-cli-reporter" | ||
version = "0.51.0-FINAL" | ||
|
||
distributionManagement { | ||
relocation { | ||
// New artifact coordinates | ||
artifactId.set("ktlint-cli-reporter-core") | ||
version.set("1.0.0") | ||
message.set("artifactId has been changed") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
// TODO: Remove in release after ktlint 1.0.1 | ||
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() | ||
|
||
val signingKeyId = System.getenv("ORG_GRADLE_PROJECT_signingKeyId") | ||
val signingKey = System.getenv("ORG_GRADLE_PROJECT_signingKey") | ||
val signingPassword = System.getenv("ORG_GRADLE_PROJECT_signingKeyPassword") | ||
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) | ||
|
||
// This property allows OS package maintainers to disable signing | ||
val enableSigning = providers.gradleProperty("ktlint.publication.signing.enable").orNull != "false" | ||
|
||
sign(publishing.publications["relocation-ktlint-cli-reporter-core"]) | ||
|
||
isRequired = enableSigning && !version.toString().endsWith("SNAPSHOT") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.