-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* simplify gradle. * Update publish.kt
- Loading branch information
Showing
19 changed files
with
155 additions
and
82 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 |
---|---|---|
@@ -1,80 +1,7 @@ | ||
import com.vanniktech.maven.publish.MavenPublishBaseExtension | ||
import com.vanniktech.maven.publish.MavenPublishPlugin | ||
import com.vanniktech.maven.publish.SonatypeHost | ||
import org.jetbrains.dokka.gradle.DokkaPlugin | ||
|
||
plugins { | ||
java | ||
alias(libs.plugins.nexus) apply false | ||
alias(libs.plugins.kotlin) apply false | ||
alias(libs.plugins.dokka) apply false | ||
} | ||
|
||
repositories.mavenCentral() | ||
|
||
subprojects { | ||
apply<JavaPlugin>() | ||
apply<MavenPublishPlugin>() | ||
if (project.name.contains("kotlin")) { | ||
apply<DokkaPlugin>() | ||
apply(plugin = "org.jetbrains.kotlin.jvm") | ||
} | ||
|
||
repositories.mavenCentral() | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(8) | ||
} | ||
} | ||
|
||
tasks { | ||
val javadocJar by creating(Jar::class) { | ||
dependsOn("javadoc") | ||
archiveClassifier.set("javadoc") | ||
from(javadoc) | ||
} | ||
|
||
val sourcesJar by creating(Jar::class) { | ||
dependsOn("classes") | ||
archiveClassifier.set("sources") | ||
from(sourceSets["main"].allSource) | ||
} | ||
} | ||
|
||
val moduleName = project.findProperty("artifact-id") as String? | ||
val projectName = "pubsub${if (moduleName == null) "" else "-$moduleName"}" | ||
val signRequired = project.hasProperty("sign-required") | ||
|
||
extensions.configure<MavenPublishBaseExtension> { | ||
coordinates(project.group.toString(), projectName, project.version.toString()) | ||
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true) | ||
if (signRequired) { | ||
signAllPublications() | ||
} | ||
|
||
pom { | ||
name.set(projectName) | ||
description.set("Simplified pubsub library for Redis and various databases.") | ||
url.set("https://github.com/Infumia/pubsub") | ||
licenses { | ||
license { | ||
name.set("MIT License") | ||
url.set("https://mit-license.org/license.txt") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("portlek") | ||
name.set("Hasan Demirtaş") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:git:git://github.com/infumia/pubsub.git") | ||
developerConnection.set("scm:git:ssh://github.com/infumia/pubsub.git") | ||
url.set("https://github.com/infumia/pubsub/") | ||
} | ||
} | ||
} | ||
} |
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,18 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
|
||
dependencies { | ||
implementation(libs.nexus.plugin) | ||
implementation(libs.kotlin.plugin) | ||
implementation(libs.dokka.plugin) | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(11) | ||
} |
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,7 @@ | ||
dependencyResolutionManagement { | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} |
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,47 @@ | ||
package net.infumia.gradle | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.plugins.JavaPlugin | ||
import org.gradle.api.plugins.JavaPluginExtension | ||
import org.gradle.api.tasks.bundling.Jar | ||
import org.gradle.jvm.toolchain.JavaLanguageVersion | ||
import org.gradle.kotlin.dsl.* | ||
import org.jetbrains.dokka.gradle.DokkaPlugin | ||
|
||
fun Project.applyCommon( | ||
javaVersion: Int = 8, | ||
sources: Boolean = true, | ||
javadoc: Boolean = true | ||
) { | ||
apply<JavaPlugin>() | ||
|
||
if (name.contains("kotlin")) { | ||
apply<DokkaPlugin>() | ||
apply(plugin = "org.jetbrains.kotlin.jvm") | ||
} | ||
|
||
repositories.mavenCentral() | ||
|
||
extensions.configure<JavaPluginExtension> { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(javaVersion) | ||
} | ||
} | ||
|
||
if (javadoc) { | ||
val javadocJar by tasks.creating(Jar::class) { | ||
dependsOn("javadoc") | ||
archiveClassifier.set("javadoc") | ||
from(javadoc) | ||
} | ||
} | ||
|
||
if (sources) { | ||
val sourceSets = extensions.getByType<JavaPluginExtension>().sourceSets | ||
val sourcesJar by tasks.creating(Jar::class) { | ||
dependsOn("classes") | ||
archiveClassifier.set("sources") | ||
from(sourceSets["main"].allSource) | ||
} | ||
} | ||
} |
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,52 @@ | ||
package net.infumia.gradle | ||
|
||
import com.vanniktech.maven.publish.MavenPublishBaseExtension | ||
import com.vanniktech.maven.publish.MavenPublishPlugin | ||
import com.vanniktech.maven.publish.SonatypeHost | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.* | ||
|
||
fun Project.publish( | ||
moduleName: String? = null, | ||
javaVersion: Int = 8, | ||
sources: Boolean = true, | ||
javadoc: Boolean = true | ||
) { | ||
applyCommon(javaVersion, sources, javadoc) | ||
apply<MavenPublishPlugin>() | ||
|
||
val projectName = "pubsub${if (moduleName == null) "" else "-$moduleName"}" | ||
val signRequired = project.hasProperty("sign-required") | ||
|
||
extensions.configure<MavenPublishBaseExtension> { | ||
coordinates(project.group.toString(), projectName, project.version.toString()) | ||
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true) | ||
if (signRequired) { | ||
signAllPublications() | ||
} | ||
|
||
pom { | ||
name.set(projectName) | ||
description.set("") | ||
url.set("https://github.com/Infumia/pubsub") | ||
licenses { | ||
license { | ||
name.set("MIT License") | ||
url.set("https://mit-license.org/license.txt") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("portlek") | ||
name.set("Hasan Demirtaş") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:git:git://github.com/infumia/pubsub.git") | ||
developerConnection.set("scm:git:ssh://github.com/infumia/pubsub.git") | ||
url.set("https://github.com/infumia/pubsub/") | ||
} | ||
} | ||
} | ||
} |
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,3 @@ | ||
import net.infumia.gradle.publish | ||
|
||
publish("codec") |
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
import net.infumia.gradle.publish | ||
|
||
publish() | ||
|
||
dependencies { | ||
compileOnly(project(":codec")) | ||
|
||
|
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,7 @@ | ||
import net.infumia.gradle.publish | ||
|
||
publish("jackson") | ||
|
||
dependencies { | ||
compileOnly(project(":codec")) | ||
|
||
|
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
import net.infumia.gradle.publish | ||
|
||
publish("kotlin-coroutines") | ||
|
||
dependencies { | ||
compileOnly(project(":common")) | ||
|
||
|
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
import net.infumia.gradle.publish | ||
|
||
publish("kotlin") | ||
|
||
dependencies { | ||
compileOnly(project(":common")) | ||
} |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.