From 8b15b99bce06ae9540a796d10f152667aacc9051 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Thu, 6 May 2021 14:33:37 +0200 Subject: [PATCH] chore(gradle): update to gradle 7 Migrate maven to maven-publish --- gradle/build.gradle.kts | 34 +++++++++++++++--------- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/gradle/build.gradle.kts b/gradle/build.gradle.kts index 904f1a7ae..d73dd1ff7 100644 --- a/gradle/build.gradle.kts +++ b/gradle/build.gradle.kts @@ -5,10 +5,10 @@ import sc.gradle.ScriptsTask import java.util.concurrent.atomic.AtomicBoolean plugins { - maven kotlin("jvm") version "1.4.30" id("org.jetbrains.dokka") version "0.10.1" id("scripts-task") + `maven-publish` id("com.github.ben-manes.versions") version "0.38.0" id("se.patrikerdes.use-latest-versions") version "0.2.15" @@ -261,8 +261,21 @@ allprojects { } if (this.name in documentedProjects) { - apply(plugin = "maven") + apply(plugin = "maven-publish") apply(plugin = "org.jetbrains.dokka") + publishing { + publications { + create(name) { + println(components.joinToString()) + from(components["java"]) + version = rootProject.version.toString() + } + } + } + java { + withSourcesJar() + withJavadocJar() + } tasks { val doc by creating(DokkaTask::class) { group = "documentation" @@ -277,17 +290,14 @@ allprojects { archiveClassifier.set("javadoc") from(doc.outputDirectory) } - val sourcesJar by creating(Jar::class) { - group = "build" - archiveBaseName.set(jar.get().archiveBaseName) - archiveClassifier.set("sources") - from(sourceSets.main.get().allSource) - } - install { - dependsOn(docJar, sourcesJar) - } + //val sourcesJar by creating(Jar::class) { + // group = "build" + // archiveBaseName.set(jar.get().archiveBaseName) + // archiveClassifier.set("sources") + // from(sourceSets.main.get().allSource) + //} artifacts { - archives(sourcesJar.archiveFile) { classifier = "sources" } + //archives(sourcesJar.archiveFile) { classifier = "sources" } archives(docJar.archiveFile) { classifier = "javadoc" } } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8cf6eb5ad..3c4101c3e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists