Skip to content

Commit fa577bd

Browse files
committed
update: add library publication improvements to whatsnew220.md
1 parent 69dbeee commit fa577bd

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

docs/topics/whatsnew/whatsnew2220.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,67 @@ the previous version of the lambda, which could cause unexpected behavior.
12381238

12391239
In Kotlin 2.2.20, the compiler now detects changes in lambdas of inline functions and automatically recompiles their call sites.
12401240

1241+
### Improvements for library publication
1242+
1243+
Kotlin 2.2.20 adds new Gradle tasks that make library publication easier. These tasks help you generate key pairs, upload
1244+
public keys, and run local checks to ensure the verification process succeeds before uploading to the Maven Central repository.
1245+
1246+
For more information about how to use these tasks as part of the publication process, see [Publish your library to Maven Central](https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-publish-libraries.html).
1247+
1248+
#### New Gradle tasks for generating and uploading PGP keys
1249+
1250+
Before Kotlin 2.2.20, if you wanted to publish a multiplatform library to the Maven Central repository, you had to install
1251+
a third-party program like `gpg` to generate a key pair for signing your publications. Now, the Kotlin Gradle plugin comes
1252+
with Gradle tasks that let you generate a key pair and upload the public key so you don't have to install another program.
1253+
1254+
##### Generate a key pair
1255+
1256+
The `generatePgpKeys` task generates a key pair. When you run it, you must provide a password for the private keystore
1257+
and your name in the following format:
1258+
1259+
```bash
1260+
./gradlew -Psigning.password=example-password generatePgpKeys --name "John Smith <[email protected]>"
1261+
```
1262+
1263+
The task stores the key pair in the `build/pgp` directory.
1264+
1265+
> Move your key pair to a secure location to prevent accidental deletion or unauthorized access.
1266+
>
1267+
{style="warning"}
1268+
1269+
##### Upload the public key
1270+
1271+
The `uploadPublicPgpKey` task uploads the public key to Ubuntu's key server: `keyserver.ubuntu.com`. When you run it,
1272+
provide the path to the public key in `.asc` format:
1273+
1274+
```bash
1275+
./gradlew uploadPublicPgpKey --keyring /path_to/build/pgp/public_KEY_ID.asc
1276+
```
1277+
1278+
#### New Gradle tasks to test verification locally
1279+
1280+
Kotlin 2.2.20 also adds Gradle tasks for testing verification locally before uploading your library to the Maven Central repository.
1281+
1282+
If you're using the Kotlin Gradle plugin along with Gradle's [Signing Plugin](https://docs.gradle.org/current/userguide/signing_plugin.html) and [Maven Publish Plugin](https://docs.gradle.org/current/userguide/publishing_maven.html), you can run the `checkSigningConfiguration` and `checkPomFileFor<PUBLICATION_NAME>Publication` tasks to verify that your setup meets Maven Central’s requirements. Replace `<PUBLICATION_NAME>` with the name of your publication.
1283+
1284+
These tasks aren't automatically run as part of the `build` or `check` Gradle tasks, so you need to run them manually.
1285+
For example, if you have a `KotlinMultiplatform` publication:
1286+
1287+
```bash
1288+
./gradlew checkSigningConfiguration checkPomFileForKotlinMultiplatformPublication
1289+
```
1290+
1291+
The `checkSigningConfiguration` task checks that:
1292+
1293+
* The Signing Plugin has keys configured.
1294+
* The configured public key has been uploaded to either `keyserver.ubuntu.com` or `keys.openpgp.org` key servers.
1295+
* All publications have signing enabled.
1296+
1297+
If any of these checks fail, the task returns an error with information on how to fix the issue.
1298+
1299+
The `checkPomFileFor<PUBLICATION_NAME>Publication` task checks whether the `pom.xml` file meets Maven Central's [requirements](https://central.sonatype.org/publish/requirements/#required-pom-metadata).
1300+
If it doesn't, the task returns an error with details about which parts of the `pom.xml` file are non-compliant.
1301+
12411302
## Maven: Support for the Kotlin daemon in the `kotlin-maven-plugin`
12421303
12431304
Kotlin 2.2.20 takes the [build tools API introduced in Kotlin 2.2.0](whatsnew22.md#new-experimental-build-tools-api) one

0 commit comments

Comments
 (0)