Skip to content

Commit

Permalink
Change publishing in build.gradle.kts
Browse files Browse the repository at this point in the history
  • Loading branch information
mrapplexz committed Jul 5, 2020
1 parent e104ca3 commit 883d252
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ configure<UserBaseExtension> {
replaceIn("Jehc.java")
}

val sourcesJar by tasks.registering(Jar::class) {
classifier = "sources"
from(sourceSets["main"].allSource)
}

artifacts {
add("archives", sourcesJar)
}

publishing {
repositories {
fun AuthenticationSupported.pearxCredentials() {
Expand All @@ -88,7 +97,8 @@ publishing {

publications {
register<MavenPublication>("maven") {
artifact(tasks.getByName<Jar>("jar"))
from(components["java"])
artifact(sourcesJar.get())
}
}
}
Expand All @@ -103,9 +113,15 @@ configure<CurseExtension> {
requiredDependency("jei")
requiredDependency("pams-harvestcraft")
})
mainArtifact(tasks.named("jar").get(), closureOf<CurseArtifact> {

val arts = (publishing.publications["maven"] as MavenPublication).artifacts
val mainArt = arts.first { it.classifier == null }
val additionalArts = arts.filter { it.classifier != null }
mainArtifact(mainArt.file, closureOf<CurseArtifact> {
displayName = "[$minecraftVersion] Just Enough HarvestCraft $version"
})
additionalArts.forEach { addArtifact(it.file) }

options(closureOf<Options> {
detectNewerJava = true
})
Expand All @@ -123,6 +139,9 @@ configure<GithubReleaseExtension> {
}

tasks {
"jar" {
finalizedBy("reobfJar")
}
register("publishDevelop") {
group = "publishing"
dependsOn(withType<PublishToMavenRepository>().matching { it.repository == publishing.repositories["develop"] })
Expand Down

0 comments on commit 883d252

Please sign in to comment.