Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
- Updated minimum supported JDK, Gradle, Android Gradle Plugin and Kotlin versions.
- Removed support for Dokka v1, it's now required to use Dokka in v2 mode.
- Removed deprecated option of selecting which Android variant to publish for KMP libraries.
- Deprecate some `MavenPublishBaseExtension.configureBasedOnAppliedPlugins(...)` overloads.
- Deprecate constructors of `Platform` subclasses, you can use the new overloads instead.
- Support configuring `SourcesJar` and `JavadocJar` options as parameters.

**BREAKING**
- Mark `DirectorySignatureType` internal.
Expand Down
222 changes: 110 additions & 112 deletions docs/what.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,50 +24,43 @@ For projects using the `com.android.library` plugin. This will publish all varia

```groovy
import com.vanniktech.maven.publish.AndroidMultiVariantLibrary
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.SourcesJar

mavenPublishing {
// the first parameter represents whether to publish a sources jar
// the second whether to publish a javadoc jar
configure(new AndroidMultiVariantLibrary(true, true))
// or to limit which build types to include
configure(new AndroidMultiVariantLibrary(true, true, ["beta", "release"] as Set))
// or to limit which flavors to include, the map key is a flavor dimension, the set contains the flavors
configure(new AndroidMultiVariantLibrary(true, true, ["beta", "release"] as Set, ["store": ["google", "samsung"] as Set]))
configure(
// there are multiple overloads for the constructor
new AndroidMultiVariantLibrary(
new JavadocJar.Empty(),
SourcesJar.Sources.INSTANCE,
// which build types to include
["beta", "release"] as Set),
// which flavors to include, the map key is a flavor dimension, the set contains the flavors
["store": ["google", "samsung"] as Set],
)
)
}
```

=== "build.gradle.kts"

```kotlin
import com.vanniktech.maven.publish.AndroidMultiVariantLibrary
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.SourcesJar

mavenPublishing {
configure(AndroidMultiVariantLibrary(
// whether to publish a sources jar
sourcesJar = true,
// whether to publish a javadoc jar
publishJavadocJar = true,
))
// or
configure(AndroidMultiVariantLibrary(
// whether to publish a sources jar
sourcesJar = true,
// whether to publish a javadoc jar
publishJavadocJar = true,
// limit which build types to include
includedBuildTypeValues = setOf("beta", "release"),
))
// or
configure(AndroidMultiVariantLibrary(
// whether to publish a sources jar
sourcesJar = true,
// whether to publish a javadoc jar
publishJavadocJar = true,
// limit which build types to include
includedBuildTypeValues = setOf("beta", "release"),
// limit which flavors to include, the map key is a flavor dimension, the set contains the flavors
includedFlavorDimensionsAndValues = mapOf("store" to setOf("google", "samsung")),
))
configure(
// there are multiple overloads for the constructor
AndroidMultiVariantLibrary(
javadocJar = JavadocJar.Empty(),
sourcesJar = SourcesJar.Sources,
// which build types to include
includedBuildTypeValues = setOf("beta", "release"),
// which flavors to include, the map key is a flavor dimension, the set contains the flavors
includedFlavorDimensionsAndValues = mapOf("store" to setOf("google", "samsung")),
)
)
}
```

Expand All @@ -80,29 +73,39 @@ the specified variant instead of publishing all of them.

```groovy
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.SourcesJar

mavenPublishing {
// the first parameter represennts which variant is published
// the second whether to publish a sources jar
// the third whether to publish a javadoc jar
configure(new AndroidSingleVariantLibrary("release", true, true))
configure(
// there are multiple overloads for the constructor
new AndroidSingleVariantLibrary(
new JavadocJar.Empty(),
SourcesJar.Sources.INSTANCE,
// which variant is published
"release",
)
)
}
```

=== "build.gradle.kts"

```kotlin
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.SourcesJar

mavenPublishing {
configure(AndroidSingleVariantLibrary(
// the published variant
variant = "release",
// whether to publish a sources jar
sourcesJar = true,
// whether to publish a javadoc jar
publishJavadocJar = true,
))
configure(
// there are multiple overloads for the constructor
AndroidSingleVariantLibrary(
javadocJar = JavadocJar.Empty(),
sourcesJar = SourcesJar.Sources,
// which variant is published
variant = "release",
)
)
}
```

Expand Down Expand Up @@ -155,14 +158,15 @@ For projects using the `java-library` plugin.
```groovy
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.SourcesJar

mavenPublishing {
// the first parameter configures the -javadoc artifact, possible values:
// - `JavadocJar.None()` don't publish this artifact
// - `JavadocJar.Empty()` publish an empty jar
// - `JavadocJar.Javadoc()` to publish standard javadocs
// the second whether to publish a sources jar
configure(new JavaLibrary(new JavadocJar.Javadoc(), true))
configure(
new JavaLibrary(
new JavadocJar.Empty(),
SourcesJar.Sources.INSTANCE,
)
)
}
```

Expand All @@ -171,17 +175,15 @@ For projects using the `java-library` plugin.
```kotlin
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.SourcesJar

mavenPublishing {
configure(JavaLibrary(
// configures the -javadoc artifact, possible values:
// - `JavadocJar.None()` don't publish this artifact
// - `JavadocJar.Empty()` publish an empty jar
// - `JavadocJar.Javadoc()` to publish standard javadocs
javadocJar = JavadocJar.Javadoc(),
// whether to publish a sources jar
sourcesJar = true,
))
configure(
JavaLibrary(
javadocJar = JavadocJar.Empty(),
sourcesJar = SourcesJar.Sources,
)
)
}
```

Expand All @@ -194,14 +196,15 @@ For projects using the `org.jetbrains.kotlin.jvm` plugin.
```groovy
import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.SourcesJar

mavenPublishing {
// the first parameter configures the -javadoc artifact, possible values:
// - `JavadocJar.None()` don't publish this artifact
// - `JavadocJar.Empty()` publish an empty jar
// - `JavadocJar.Dokka("dokkaHtml")` when using Kotlin with Dokka, where `dokkaHtml` is the name of the Dokka task that should be used as input
// the second whether to publish a sources jar
configure(new KotlinJvm(new JavadocJar.Dokka("dokkaHtml"), true))
configure(
new KotlinJvm(
new JavadocJar.Empty(),
SourcesJar.Sources.INSTANCE,
)
)
}
```

Expand All @@ -210,17 +213,15 @@ For projects using the `org.jetbrains.kotlin.jvm` plugin.
```kotlin
import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.SourcesJar

mavenPublishing {
configure(KotlinJvm(
// configures the -javadoc artifact, possible values:
// - `JavadocJar.None()` don't publish this artifact
// - `JavadocJar.Empty()` publish an empty jar
// - `JavadocJar.Dokka("dokkaHtml")` when using Kotlin with Dokka, where `dokkaHtml` is the name of the Dokka task that should be used as input
javadocJar = JavadocJar.Dokka("dokkaHtml"),
// whether to publish a sources jar
sourcesJar = true,
))
configure(
KotlinJvm(
javadocJar = JavadocJar.Empty(),
sourcesJar = SourcesJar.Sources,
)
)
}
```

Expand All @@ -233,16 +234,18 @@ For projects using the `org.jetbrains.kotlin.multiplatform` plugin.
```groovy
import com.vanniktech.maven.publish.KotlinMultiplatform
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.SourcesJar

mavenPublishing {
// the parameter configures the -javadoc artifact, possible values:
// - `JavadocJar.None()` don't publish this artifact
// - `JavadocJar.Empty()` publish an empty jar
// - `JavadocJar.Dokka("dokkaHtml")` when using Kotlin with Dokka, where `dokkaHtml` is the name of the Dokka task that should be used as input
// the second whether to publish a sources jar
// the third parameters configures which Android library variants to publish if this project has an Android target
// defaults to "release" when using the main plugin and nothing for the base plugin
configure(new KotlinMultiplatform(new JavadocJar.Dokka("dokkaHtml"), true, ["debug", "release"]))
configure(
// there are multiple overloads for the constructor
new KotlinMultiplatform(
new JavadocJar.Empty(),
SourcesJar.Sources.INSTANCE,
// which Android library variants to publish if this project has an Android target
["release"],
)
)
}
```

Expand All @@ -251,21 +254,18 @@ For projects using the `org.jetbrains.kotlin.multiplatform` plugin.
```kotlin
import com.vanniktech.maven.publish.KotlinMultiplatform
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.SourcesJar

mavenPublishing {
// sources publishing is always enabled by the Kotlin Multiplatform plugin
configure(KotlinMultiplatform(
// configures the -javadoc artifact, possible values:
// - `JavadocJar.None()` don't publish this artifact
// - `JavadocJar.Empty()` publish an empty jar
// - `JavadocJar.Dokka("dokkaHtml")` when using Kotlin with Dokka, where `dokkaHtml` is the name of the Dokka task that should be used as input
javadocJar = JavadocJar.Dokka("dokkaHtml"),
// whether to publish a sources jar
sourcesJar = true,
// configure which Android library variants to publish if this project has an Android target
// defaults to "release" when using the main plugin and nothing for the base plugin
androidVariantsToPublish = listOf("debug", "release"),
))
// there are multiple overloads for the constructor
configure(
KotlinMultiplatform(
javadocJar = JavadocJar.Empty(),
sourcesJar = SourcesJar.Sources,
// which Android library variants to publish if this project has an Android target
androidVariantsToPublish = listOf("release"),
)
)
}
```

Expand All @@ -284,14 +284,15 @@ use [GradlePublishPlugin](#gradle-publish-plugin)
```groovy
import com.vanniktech.maven.publish.GradlePlugin
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.SourcesJar

mavenPublishing {
// the first parameter configures the -javadoc artifact, possible values:
// - `JavadocJar.None()` don't publish this artifact
// - `JavadocJar.Empty()` publish an empty jar
// - `JavadocJar.Javadoc()` to publish standard javadocs
// the second whether to publish a sources jar
configure(new GradlePlugin(new JavadocJar.Javadoc(), true))
configure(
new GradlePlugin(
new JavadocJar.Empty(),
SourcesJar.Sources.INSTANCE,
)
)
}
```

Expand All @@ -300,18 +301,15 @@ use [GradlePublishPlugin](#gradle-publish-plugin)
```kotlin
import com.vanniktech.maven.publish.GradlePlugin
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.SourcesJar

mavenPublishing {
configure(GradlePlugin(
// configures the -javadoc artifact, possible values:
// - `JavadocJar.None()` don't publish this artifact
// - `JavadocJar.Empty()` publish an empty jar
// - `JavadocJar.Javadoc()` to publish standard javadocs
// - `JavadocJar.Dokka("dokkaHtml")` when using Kotlin with Dokka, where `dokkaHtml` is the name of the Dokka task that should be used as input
javadocJar = JavadocJar.Javadoc(),
// whether to publish a sources jar
sourcesJar = true,
))
configure(
GradlePlugin(
javadocJar = JavadocJar.Empty(),
sourcesJar = SourcesJar.Sources,
)
)
}
```

Expand Down
Loading
Loading