Skip to content

Commit

Permalink
further improve build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Player005 committed Oct 13, 2024
1 parent 0184ac1 commit 225db87
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .idea/runConfigurations/Fabric_Server___fabric__fabric.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 25 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,36 @@ val FABRIC_API_VERSION by extra { "0.105.0+1.21.1" }

plugins {
id("java")
id("fabric-loom") version("1.7.3") apply false
id("fabric-loom") version "1.7.3" apply false
}

allprojects {
subprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")
}

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
}

jar {
// put all built jars in the same dir (build/libs)
destinationDirectory = rootDir.resolve("build").resolve("libs")

// add license file to jars
from(rootDir.resolve("LICENSE.md"))

// required because apparently some classes are duplicated
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
}

version = MOD_VERSION
group = "net.player005.vegandelightfabric"

base {
archivesName = "vegan-delight-${project.name}-${MINECRAFT_VERSION}"
}
}

tasks.jar {
Expand Down
4 changes: 0 additions & 4 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ repositories {
}
}

base {
archivesName.set("vegan-delight-fabric-${MINECRAFT_VERSION}")
}

dependencies {
minecraft("com.mojang:minecraft:${MINECRAFT_VERSION}")
mappings(loom.layered {
Expand Down
25 changes: 9 additions & 16 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
plugins {
id("java")
id("idea")
id("fabric-loom") version "1.7.3"
}

val MINECRAFT_VERSION: String by rootProject.extra
val PARCHMENT_VERSION: String by rootProject.extra
val PARCHMENT_MC_VERSION: String by rootProject.extra
Expand All @@ -13,6 +7,13 @@ val FABRIC_API_VERSION: String by rootProject.extra

val FDRF_VERSION: String by rootProject.extra


plugins {
id("java")
id("idea")
id("fabric-loom") version "1.7.3"
}

repositories {
maven("https://maven.parchmentmc.org/") // Parchment mappings

Expand All @@ -33,10 +34,6 @@ repositories {
}
}

base {
archivesName.set("vegan-delight-fabric-${MINECRAFT_VERSION}")
}

loom {
runs {
named("client") {
Expand All @@ -60,6 +57,8 @@ tasks {
source(project(":common").sourceSets.main.get().allSource)
}

remapJar.get().destinationDirectory = rootDir.resolve("build").resolve("libs")

javadoc { source(project(":common").sourceSets.main.get().allJava) }

processResources {
Expand All @@ -78,12 +77,6 @@ tasks {
}
}

jar {
from(rootDir.resolve("LICENSE.md"))

duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

named("compileTestJava").configure {
enabled = false
}
Expand Down
16 changes: 0 additions & 16 deletions neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ val NEOFORGE_VERSION_RANGE: String by rootProject.extra

val FD_NEO_VERSION: String by rootProject.extra

version = MOD_VERSION
group = "net.player005.vegandelightfabric"

repositories {
mavenLocal()

Expand All @@ -36,10 +33,6 @@ repositories {
}
}

base {
archivesName = MOD_ID
}

subsystems {
parchment {
minecraftVersion = PARCHMENT_MC_VERSION
Expand All @@ -53,15 +46,6 @@ tasks {
val main = project.project(":common").sourceSets.getByName("main")
from(main.output.classesDirs)
from(main.output.resourcesDir)

// add license file to jar
from(rootDir.resolve("LICENSE.md"))

// put jar in /build/libs instead of /neoforge/build/jars
destinationDirectory = rootDir.resolve("build").resolve("libs")

// required because apparently some classes are duplicated
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

named("compileTestJava").configure {
Expand Down
16 changes: 0 additions & 16 deletions settings.gradle

This file was deleted.

15 changes: 15 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pluginManagement {
repositories {
maven("https://maven.fabricmc.net/") {
name = "Fabric"
}
gradlePluginPortal()
maven("https://maven.neoforged.net/releases")
}
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}

include("common", "fabric", "neoforge")

0 comments on commit 225db87

Please sign in to comment.