Skip to content

Commit

Permalink
fix artifact names. (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
portlek authored Aug 26, 2024
1 parent acef754 commit 2739abb
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 71 deletions.
4 changes: 2 additions & 2 deletions blank/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import net.infumia.gradle.publish
import net.infumia.gradle.applyPublish

publish("blank")
applyPublish("blank")

dependencies {
compileOnly(project(":common"))
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import net.infumia.gradle.spotless
import net.infumia.gradle.applySpotless

plugins { java }

subprojects { apply<JavaPlugin>() }

spotless()
applySpotless()
41 changes: 0 additions & 41 deletions buildSrc/src/main/kotlin/net/infumia/gradle/common.kt

This file was deleted.

21 changes: 21 additions & 0 deletions buildSrc/src/main/kotlin/net/infumia/gradle/java.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package net.infumia.gradle

import org.gradle.api.Project
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.jvm.toolchain.JvmVendorSpec
import org.gradle.kotlin.dsl.*

fun Project.applyJava(javaVersion: Int = 8) {
apply<JavaPlugin>()

repositories.mavenCentral()

extensions.configure<JavaPluginExtension> {
toolchain {
languageVersion = JavaLanguageVersion.of(javaVersion)
vendor = JvmVendorSpec.ADOPTIUM
}
}
}
43 changes: 25 additions & 18 deletions buildSrc/src/main/kotlin/net/infumia/gradle/publish.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,28 @@ package net.infumia.gradle
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.MavenPublishPlugin
import com.vanniktech.maven.publish.SonatypeHost
import com.vanniktech.maven.publish.tasks.JavadocJar
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.*

fun Project.publish(
moduleName: String? = null,
javaVersion: Int = 8,
sources: Boolean = true,
javadoc: Boolean = true
) {
applyCommon(javaVersion, sources, javadoc)
fun Project.applyPublish(moduleName: String? = null, javaVersion: Int = 8) {
applyJava(javaVersion)
apply<MavenPublishPlugin>()

val projectName = "pack${if (moduleName == null) "" else "-$moduleName"}"
val signRequired = project.hasProperty("sign-required")

val sourceSets = extensions.getByType<JavaPluginExtension>().sourceSets
tasks.register("sourcesJar", Jar::class) {
dependsOn("classes")
archiveClassifier = "sources"
from(sourceSets["main"].allSource)
}

tasks.withType<JavadocJar> { afterEvaluate { archiveBaseName = name } }

extensions.configure<MavenPublishBaseExtension> {
coordinates(project.group.toString(), projectName, project.version.toString())
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true)
Expand All @@ -26,26 +33,26 @@ fun Project.publish(
}

pom {
name.set(projectName)
description.set("Minecraft resource pack generator.")
url.set("https://github.com/Infumia/pack")
name = projectName
description = "Minecraft resource pack generator."
url = "https://github.com/Infumia/pack"
licenses {
license {
name.set("MIT License")
url.set("https://mit-license.org/license.txt")
name = "MIT License"
url = "https://mit-license.org/license.txt"
}
}
developers {
developer {
id.set("portlek")
name.set("Hasan Demirtaş")
email.set("[email protected]")
id = "portlek"
name = "Hasan Demirtaş"
email = "[email protected]"
}
}
scm {
connection.set("scm:git:git://github.com/infumia/pack.git")
developerConnection.set("scm:git:ssh://github.com/infumia/pack.git")
url.set("https://github.com/infumia/pack/")
connection = "scm:git:git://github.com/infumia/pack.git"
developerConnection = "scm:git:ssh://github.com/infumia/pack.git"
url = "https://github.com/infumia/pack/"
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions buildSrc/src/main/kotlin/net/infumia/gradle/spotless.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package net.infumia.gradle

import com.diffplug.gradle.spotless.SpotlessExtension
import com.diffplug.gradle.spotless.SpotlessPlugin
import com.diffplug.spotless.LineEnding
import org.gradle.api.Project
import org.gradle.kotlin.dsl.*

fun Project.spotless() {
fun Project.applySpotless() {
val subProjects = subprojects.map { it.projectDir.toRelativeString(projectDir) }

repositories.mavenCentral()
Expand All @@ -14,7 +15,7 @@ fun Project.spotless() {

extensions.configure<SpotlessExtension> {
isEnforceCheck = false
lineEndings = com.diffplug.spotless.LineEnding.UNIX
lineEndings = LineEnding.UNIX

val prettierConfig =
mapOf(
Expand Down
4 changes: 2 additions & 2 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import net.infumia.gradle.publish
import net.infumia.gradle.applyPublish

publish()
applyPublish()

dependencies { compileOnly(libs.creative.api) }
4 changes: 2 additions & 2 deletions generator/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import net.infumia.gradle.publish
import net.infumia.gradle.applyPublish

publish("generator")
applyPublish("generator")

dependencies {
compileOnly(project(":common"))
Expand Down
4 changes: 2 additions & 2 deletions language/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import net.infumia.gradle.publish
import net.infumia.gradle.applyPublish

publish("language")
applyPublish("language")

dependencies {
compileOnly(project(":common"))
Expand Down

0 comments on commit 2739abb

Please sign in to comment.