Skip to content

Commit

Permalink
Merge pull request #13 from Protonull/fix-gradle-configs
Browse files Browse the repository at this point in the history
Fixup Gradle configs
  • Loading branch information
okx-code authored Mar 12, 2024
2 parents 649bae2 + bb3be65 commit 675b841
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 80 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// See Gradle's releases here: https://gradle.org/releases/

plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false
id("architectury-plugin") version "3.4-SNAPSHOT"
id("dev.architectury.loom") version "1.5-SNAPSHOT" apply false
}

architectury {
Expand All @@ -18,8 +18,8 @@ subprojects {
}

dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings loom.officialMojangMappings()
minecraft("com.mojang:minecraft:${rootProject.minecraft_version}")
mappings(loom.officialMojangMappings())
}
}

Expand All @@ -40,7 +40,7 @@ allprojects {
// for more information about repositories.
}

tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.release = 17
}
Expand Down
6 changes: 3 additions & 3 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
dependencies {
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modImplementation("net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}")
// Remove the next line if you don't want to depend on the API
//modApi "me.shedaniel:architectury:${rootProject.architectury_version}"
//modApi("me.shedaniel:architectury:${rootProject.architectury_version}")
}

architectury {
common()
common(rootProject.enabled_platforms.split(","))
}

java {
Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/civmodern.mixins.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"required": true,
"minVersion": "0.8",
"package": "sh.okx.civmodern.common.mixins",
"compatibilityLevel": "JAVA_17",
"mixins": [],
Expand Down
43 changes: 23 additions & 20 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id("com.github.johnrengelman.shadow") version "7.1.2"
}

architectury {
Expand All @@ -16,22 +16,25 @@ configurations {
}

dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
modImplementation("net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}")
modApi("net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}")

common(project(path: ":common", configuration: "namedElements")) {
transitive = false
}
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) {
transitive = false
}
common(project(path: ":common", configuration: "namedElements")) { transitive = false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive = false }
}

processResources {
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
expand([
"mod_version": rootProject.mod_version,
"mod_description": rootProject.mod_description,
"mod_home_url": rootProject.mod_home_url,
"mod_source_url": rootProject.mod_source_url,
"copyright_licence": rootProject.copyright_licence,

"minecraft_version": rootProject.minecraft_version,
"fabric_loader_version": rootProject.fabric_loader_version
])
}
}

Expand Down Expand Up @@ -74,24 +77,24 @@ publishing {

import net.fabricmc.loom.task.RemapJarTask

task remapCivMc(type: RemapJarTask) {
tasks.register("remapCivMc", RemapJarTask) {
inputFile.set shadowJar.archiveFile
dependsOn shadowJar
archiveClassifier = "civmc-fabric"
from sourceSets.main.output
from '../civmc'
from "../civmc"
}

task cleanJar(type: Delete) {
delete fileTree('../dist') {
include "*-fabric*.jar"
tasks.register("cleanJar", Delete) {
delete fileTree("../dist") {
include "*-fabric.jar"
}
}

task copyJar(type: Copy) {
tasks.register("copyJar", Copy) {
dependsOn cleanJar
from remapJar, remapCivMc
into '../dist'
into "../dist"
}

build.dependsOn copyJar
build.dependsOn copyJar
1 change: 1 addition & 0 deletions fabric/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
loom.platform=fabric
18 changes: 11 additions & 7 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{
"schemaVersion": 1,
"id": "civmodern",
"version": "${version}",
"name": "Civ Modern",
"description": "Civ Modern",
"version": "${mod_version}",
"name": "CivModern",
"description": "${mod_description}",
"authors": [
"Okx"
],
"license": "Copyright",
"contact": {
"homepage": "${mod_home_url}",
"sources": "${mod_source_url}"
},
"license": "${copyright_licence}",
"icon": "assets/civmodern/icon.png",
"environment": "client",
"entrypoints": {
Expand All @@ -16,9 +20,9 @@
]
},
"depends": {
"fabricloader": ">=0.12.0",
"fabric": "*",
"minecraft": "1.20.x"
"minecraft": "${minecraft_version}",
"fabricloader": ">=${fabric_loader_version}",
"fabric": "*"
},
"mixins": [
"civmodern.mixins.json"
Expand Down
52 changes: 27 additions & 25 deletions forge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id("com.github.johnrengelman.shadow") version "7.1.2"
}

architectury {
platformSetupLoomIde()
forge()
}

loom {
Expand All @@ -8,11 +13,6 @@ loom {
}
}

architectury {
platformSetupLoomIde()
forge()
}

configurations {
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
Expand All @@ -21,23 +21,25 @@ configurations {
developmentForge.extendsFrom common
}


dependencies {
forge "net.minecraftforge:forge:${rootProject.forge_version}"
forge("net.minecraftforge:forge:${rootProject.forge_version}")

common(project(path: ":common", configuration: "namedElements")) {
transitive = false
}
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) {
transitive = false
}
common(project(path: ":common", configuration: "namedElements")) { transitive = false }
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }
}

processResources {
inputs.property "version", project.version

filesMatching("META-INF/mods.toml") {
expand "version": project.version
expand([
"mod_issues_url": rootProject.mod_issues_url,
"copyright_licence": rootProject.copyright_licence,

"mod_version": rootProject.mod_version,
"mod_description": rootProject.mod_description,
"mod_home_url": rootProject.mod_home_url,

"minecraft_version": rootProject.minecraft_version
])
}
}

Expand Down Expand Up @@ -82,24 +84,24 @@ publishing {

import net.fabricmc.loom.task.RemapJarTask

task remapCivMc(type: RemapJarTask) {
tasks.register("remapCivMc", RemapJarTask) {
inputFile.set shadowJar.archiveFile
dependsOn shadowJar
archiveClassifier = "civmc-forge"
from sourceSets.main.output
from '../civmc'
from "../civmc"
}

task cleanJar(type: Delete) {
delete fileTree('../dist') {
include "*-forge*.jar"
tasks.register("cleanJar", Delete) {
delete fileTree("../dist") {
include "*-forge.jar"
}
}

task copyJar(type: Copy) {
tasks.register("copyJar", Copy) {
dependsOn cleanJar
from remapJar, remapCivMc
into '../dist'
into "../dist"
}

build.dependsOn copyJar
build.dependsOn copyJar
2 changes: 1 addition & 1 deletion forge/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
loom.platform=forge
loom.platform=forge
19 changes: 9 additions & 10 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
modLoader = "javafml"
loaderVersion = "[32,)"
#issueTrackerURL = ""
license = "GPL"
loaderVersion = "[49,)"
issueTrackerURL = "${mod_issues_url}"
license = "${copyright_licence}"

[[mods]]
modId = "civmodern"
version = "${version}"
displayName = "Civ Modern"
version = "${mod_version}"
displayName = "CivModern"
description = "${mod_description}"
displayURL = "${mod_home_url}"
authors = "Okx"
description = '''
Civ Modern
'''
#logoFile = ""

[[dependencies.civmodern]]
modId = "forge"
mandatory = true
versionRange = "[32,)"
versionRange = "[49,)"
ordering = "NONE"
side = "CLIENT"

[[dependencies.civmodern]]
modId = "minecraft"
mandatory = true
versionRange = "[1.16.1,)"
versionRange = "[${minecraft_version}]"
ordering = "NONE"
side = "CLIENT"
2 changes: 1 addition & 1 deletion forge/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"description": "Example Mod",
"description": "CivModern",
"pack_format": 6
}
}
14 changes: 9 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
org.gradle.jvmargs=-Xmx3072M

minecraft_version=1.20.4
enabled_platforms=fabric,forge

archives_base_name=civmodern
mod_version=1.6.1
maven_group=sh.okx.civmodern
mod_version=1.6.1
mod_description=Civ Modern
copyright_licence=GPLv3
mod_home_url=https://github.com/okx-code/civmodern
mod_source_url=https://github.com/okx-code/civmodern
mod_issues_url=https://github.com/okx-code/civmodern/issues

minecraft_version=1.20.4
architectury_version=11.1.13
enabled_platforms=fabric,forge

# https://fabricmc.net/versions.html
fabric_loader_version=0.15.7
fabric_api_version=0.96.4+1.20.4

forge_version=1.20.4-49.0.31
forge_version=1.20.4-49.0.31
6 changes: 3 additions & 3 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ pluginManagement {
}
}

include("common")
include("fabric")
include("forge")
include(":common")
include(":fabric")
include(":forge")

rootProject.name = "civmodern"

0 comments on commit 675b841

Please sign in to comment.