Skip to content

Commit

Permalink
remove licenseUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin committed Nov 7, 2024
1 parent b364bb8 commit f8bbf49
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 85 deletions.
75 changes: 11 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,18 @@
Librarian is a library to help building Kotlin libraries.
[![Slack](https://img.shields.io/static/v1?label=gradle-community&message=gradleup&color=A97BFF&logo=slack&style=flat-square)](https://gradle-community.slack.com/archives/C07GJEMUZDH)

Features:
[![Maven Central](https://img.shields.io/maven-central/v/com.gradleup.librarian/librarian-gradle-plugin?style=flat-square)](https://central.sonatype.com/namespace/com.gradleup.librarian)
[![OSS Snapshots](https://img.shields.io/nexus/s/com.gradleup.librarian/librarian-gradle-plugin?server=https%3A%2F%2Foss.sonatype.org&label=oss-snapshots&style=flat-square)](https://oss.sonatype.org/content/repositories/snapshots/com/gradleup/librarian/)

- Java/Kotlin compatibility flags
- [Maven Central](https://central.sonatype.com/) publishing
- [Dokkatoo](https://github.com/adamko-dev/dokkatoo) configuration
- [BCV](https://github.com/Kotlin/binary-compatibility-validator) configuration
- Maven pom compatibility for KMP projects
- [Maven sympathy for transitive dependencies](https://jakewharton.com/nonsensical-maven-is-still-a-gradle-problem/)
- Autogenerated lib version constant
</div>

## Quickstart
## 🚀 Librarian

Work in progress...
An opiniated toolkit to help you build libraries.

Add `librarian` to your Gradle buildscript classpath:
## 📚 Documentation

```kotlin
plugins {
id("com.gradleup.librarian").version("0.0.6")
}
```

Call `librarianRoot` in your root module:

```kotlin
librarianRoot()
```

And `librarianModule` in each library module:

```kotlin
librarianModule()
```

Librarian uses Gradle properties for configuration options and environment variables for secrets:

```properties
# gradle properties

# compatibility
librarian.javaCompatibility=8
librarian.kotlinCompatibility=2.0.0

# kdoc
librarian.kdoc.aggregator=kdoc
librarian.kdoc.olderVersions=

# version
librarian.version.packageName=com.apollographql.mockserver

# publishing
librarian.sonatype.backend=S01
librarian.pom.groupId=com.apollographql.mockserver
librarian.pom.version=0.0.1
librarian.pom.description=Apollo Mockserver
librarian.pom.vcsUrl=https://github.com/apollographql/apollo-kotlin-mockserver
librarian.pom.developer=Apollo Kotlin Mockserver contributors
librarian.pom.license=MIT License
librarian.pom.licenseUrl=https://raw.githubusercontent.com/apollographql/apollo-kotlin-mockserver/main/LICENSE
```

```shell
export LIBRARIAN_SIGNING_PRIVATE_KEY=your_gpg_key
export LIBRARIAN_SIGNING_PRIVATE_KEY_PASSWORD=your_gpg_key_password

export LIBRARIAN_SONATYPE_USERNAME=your_sonatype_username
export LIBRARIAN_SONATYPE_PASSWORD=your_sonatype_password
```
See the project website for documentation:<br/>
[https://gradleup.github.io/librarian/](https://apollographql.github.io/librarian/)

The Kdoc API reference can be found at:<br/>
[https://gradleup.github.io/librarian/kdoc](https://apollographql.github.io/librarian/kdoc)
1 change: 0 additions & 1 deletion Writerside/topics/welcome.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ pom.description=Librarian
pom.vcsUrl=https://github.com/gradleup/librarian
pom.developer=GradleUp authors
pom.license=MIT License
pom.licenseUrl=https://raw.githubusercontent.com/gradleup/librarian/main/LICENSE
# Optional: publish to Google Cloud Storage
gcs.bucket=gradleup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ internal class Create : CliktCommand() {
sonatypeBackend = backend,
groupId = groupId,
projectUrl = repository.url(),
licenseUrl = repository.rawUrl("LICENSE"),
license = SupportedLicense.MIT,
pomDescription = pomDescription,
pomDeveloper = pomDeveloper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ internal class Init : CliktCommand(invokeWithoutSubcommand = true) {
val pomDescription = KInquirer.promptInput("Maven pom description")
val pomDeveloper = KInquirer.promptInput("Maven pom developer", defaultDevelopers)
val projectUrl = gitHubRepository?.url() ?: KInquirer.promptInput("Maven pom project url")
val licenseUrl = gitHubRepository?.rawUrl("LICENSE") ?: KInquirer.promptInput("Maven pom license url")
val sonatypeBackend = KInquirer.promptList("Sonatype backend", SonatypeBackend.entries.map { it.name })
val javaCompatibility = KInquirer.promptInput("Java compatibility", "8")
val kotlinCompatibility = KInquirer.promptInput("Kotlin compatibility", kotlinPluginVersion)
Expand All @@ -109,7 +108,6 @@ internal class Init : CliktCommand(invokeWithoutSubcommand = true) {
groupId = groupId,
projectUrl = projectUrl,
license = license,
licenseUrl = licenseUrl,
pomDescription = pomDescription,
pomDeveloper = pomDeveloper
)
Expand Down
4 changes: 2 additions & 2 deletions librarian-core/api/librarian-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public final class com/gradleup/librarian/core/tooling/init/Gradle_wrapperKt {
public final class com/gradleup/librarian/core/tooling/init/LibrarianKt {
public static final fun getModulePropertiesFilename ()Ljava/lang/String;
public static final fun getRootPropertiesFilename ()Ljava/lang/String;
public static final fun initLibrarian (Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;Lcom/gradleup/librarian/core/tooling/init/SonatypeBackend;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/gradleup/librarian/core/tooling/init/SupportedLicense;Ljava/lang/String;Ljava/lang/String;)V
public static final fun initLibrarian (Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;Lcom/gradleup/librarian/core/tooling/init/SonatypeBackend;Ljava/lang/String;Ljava/lang/String;Lcom/gradleup/librarian/core/tooling/init/SupportedLicense;Ljava/lang/String;Ljava/lang/String;)V
public static final fun toBaseUrl (Lcom/gradleup/librarian/core/tooling/init/SonatypeBackend;)Ljava/lang/String;
}

Expand Down Expand Up @@ -197,8 +197,8 @@ public final class com/gradleup/librarian/core/tooling/init/SonatypeRelease : ja

public final class com/gradleup/librarian/core/tooling/init/SupportedLicense : java/lang/Enum {
public static final field MIT Lcom/gradleup/librarian/core/tooling/init/SupportedLicense;
public final fun getDisplayName ()Ljava/lang/String;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public final fun getSpdxIdentifier ()Ljava/lang/String;
public static fun valueOf (Ljava/lang/String;)Lcom/gradleup/librarian/core/tooling/init/SupportedLicense;
public static fun values ()[Lcom/gradleup/librarian/core/tooling/init/SupportedLicense;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ fun Path.initLibrarian(
sonatypeBackend: SonatypeBackend,
groupId: String,
projectUrl: String,
licenseUrl: String,
license: SupportedLicense,
pomDescription: String,
pomDeveloper: String
Expand All @@ -31,8 +30,7 @@ fun Path.initLibrarian(
pom.description=$pomDescription
pom.vcsUrl=$projectUrl
pom.developer=$pomDeveloper
pom.license=${license.displayName}
pom.licenseUrl=${licenseUrl}
pom.license=${license.spdxIdentifier}
""".trimIndent()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ fun String.toSupportedLicense(): SupportedLicense {


// See https://spdx.org/licenses/
enum class SupportedLicense(val displayName: String) {
MIT("MIT License")
enum class SupportedLicense(val spdxIdentifier: String) {
MIT("MIT")
}

fun Path.initLicense(license: SupportedLicense, year: String, copyright: String) {
Expand Down
12 changes: 6 additions & 6 deletions librarian-gradle-plugin/api/librarian-gradle-plugin.api
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ public final class com/gradleup/librarian/gradle/DokkatooKt {
}

public final class com/gradleup/librarian/gradle/Gcp {
public fun <init> (Ljava/lang/String;)V
public final fun getBucketUrl ()Ljava/lang/String;
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public final fun getBucket ()Ljava/lang/String;
public final fun getPrefix ()Ljava/lang/String;
}

public abstract class com/gradleup/librarian/gradle/GeneratePluginVersion : org/gradle/api/DefaultTask {
Expand Down Expand Up @@ -94,13 +95,12 @@ public final class com/gradleup/librarian/gradle/ModuleKt {
}

public final class com/gradleup/librarian/gradle/PomMetadata {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public final fun getArtifactId ()Ljava/lang/String;
public final fun getDescription ()Ljava/lang/String;
public final fun getDeveloper ()Ljava/lang/String;
public final fun getGroupId ()Ljava/lang/String;
public final fun getLicense ()Ljava/lang/String;
public final fun getLicenseUrl ()Ljava/lang/String;
public final fun getVcsUrl ()Ljava/lang/String;
public final fun getVersion ()Ljava/lang/String;
}
Expand All @@ -111,10 +111,10 @@ public final class com/gradleup/librarian/gradle/Project_kotlinKt {
}

public final class com/gradleup/librarian/gradle/PublishingKt {
public static final fun Gcp (Ljava/util/Properties;)Lcom/gradleup/librarian/gradle/Gcp;
public static final fun Gcs (Ljava/util/Properties;)Lcom/gradleup/librarian/gradle/Gcp;
public static final fun PomMetadata (Lorg/gradle/api/Project;Ljava/lang/String;Ljava/util/Properties;)Lcom/gradleup/librarian/gradle/PomMetadata;
public static final fun configurePom (Lorg/gradle/api/Project;Lcom/gradleup/librarian/gradle/PomMetadata;)V
public static final fun configurePublishing (Lorg/gradle/api/Project;ZZLcom/gradleup/librarian/gradle/PomMetadata;Lcom/gradleup/librarian/gradle/Signing;Lcom/gradleup/librarian/gradle/Gcp;)V
public static final fun configurePublishing (Lorg/gradle/api/Project;ZZLcom/gradleup/librarian/gradle/PomMetadata;Lcom/gradleup/librarian/gradle/Signing;)V
public static final fun createMissingPublications (Lorg/gradle/api/Project;Ljava/lang/String;)V
public static synthetic fun createMissingPublications$default (Lorg/gradle/api/Project;Ljava/lang/String;ILjava/lang/Object;)V
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ fun PomMetadata(project: Project, artifactId: String, properties: Properties): P
description = properties.getRequiredProperty("pom.description"),
vcsUrl = properties.getRequiredProperty("pom.vcsUrl"),
developer = properties.getRequiredProperty("pom.developer"),
licenseUrl = properties.getRequiredProperty("pom.licenseUrl"),
license = properties.getRequiredProperty("pom.license"),
)
}
Expand All @@ -78,7 +77,6 @@ class PomMetadata(
val vcsUrl: String,
val developer: String,
val license: String,
val licenseUrl: String,
)

fun Project.configurePublishing(
Expand Down Expand Up @@ -264,8 +262,12 @@ fun Project.configurePom(
}
it.licenses {
it.license {
/**
* We set the license name to the SPDX identifier
* We omit the licenseUrl to play nice with licensee
* See https://github.com/cashapp/licensee/issues/374
*/
it.name.set(pomMetadata.license)
it.url.set(pomMetadata.licenseUrl)
}
}
it.developers {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ pom.description=librarian
pom.vcsUrl=https://github.com/GradleUp/librarian
pom.developer=librarian authors
pom.license=MIT License
pom.licenseUrl=https://raw.githubusercontent.com/GradleUp/librarian/main/LICENSE

0 comments on commit f8bbf49

Please sign in to comment.