Skip to content

Commit

Permalink
use source set configuration from helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Minecraftschurli committed Feb 17, 2024
1 parent be657a0 commit e149643
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 48 deletions.
63 changes: 16 additions & 47 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,60 +1,29 @@
plugins {
idea
id ("com.github.minecraftschurlimods.helperplugin")
}

sourceSets.register("api")

val neo by configurations.creating
configurations.implementation.configure { extendsFrom(neo) }
configurations.named("apiCompileOnly").configure { extendsFrom(neo) }
helper.withApiSourceSet()

dependencies {
neo(helper.neoforge())
implementation(sourceSets.api.output)
implementation(helper.neoforge())
compileOnly("org.jetbrains:annotations:23.0.0")
"apiCompileOnly"("org.jetbrains:annotations:23.0.0")
}

tasks.jar {
from(sourceSets.main.output)
from(sourceSets.api.output)
}

tasks.named<Jar>("sourcesJar") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(sourceSets.main.allSource)
from(sourceSets.api.allSource)
}

val apiJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
dependsOn(tasks.named("apiClasses"))
archiveClassifier.set("api")
from(sourceSets.api.allSource)
from(sourceSets.api.output)
}

artifacts.archives(apiJar)

helper.publication.apply {
artifact(apiJar)
pom {
organization {
name = "Minecraftschurli Mods"
url = "https://github.com/MinecraftschurliMods"
}
developers {
developer {
id = "minecraftschurli"
name = "Minecraftschurli"
email = "[email protected]"
organization = "Minecraftschurli Mods"
organizationUrl = "https://github.com/Minecraftschurli"
timezone = "Europe/Vienna"
}
helper.publication.pom {
organization {
name = "Minecraftschurli Mods"
url = "https://github.com/MinecraftschurliMods"
}
developers {
developer {
id = "minecraftschurli"
name = "Minecraftschurli"
email = "[email protected]"
organization = "Minecraftschurli Mods"
organizationUrl = "https://github.com/Minecraftschurli"
timezone = "Europe/Vienna"
}
}
}

val SourceSetContainer.api: Provider<SourceSet> get() = named("api")
val Provider<SourceSet>.allSource: Provider<SourceDirectorySet> get() = map { it.allSource }
val Provider<SourceSet>.output: Provider<SourceSetOutput> get() = map { it.output }
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pluginManagement {
plugins {
id("org.ec4j.editorconfig") version "0.0.3"
id("net.neoforged.gradle.userdev") version "7.0.80"
id("com.github.minecraftschurlimods.helperplugin") version "1.1"
id("com.github.minecraftschurlimods.helperplugin") version "1.2"
}
repositories {
mavenLocal()
Expand Down

0 comments on commit e149643

Please sign in to comment.