Skip to content

Commit

Permalink
Update setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrbysco committed Nov 21, 2023
1 parent f53cd28 commit b355f96
Show file tree
Hide file tree
Showing 31 changed files with 109 additions and 97 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ build
# other
eclipse
run
runs
run-data

repo
33 changes: 0 additions & 33 deletions Common/build.gradle

This file was deleted.

23 changes: 18 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT' apply(false)
id 'net.minecraftforge.gradle' version '[6.0,6.2)' apply(false)
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' apply(false)
id("org.spongepowered.mixin") version "0.7-SNAPSHOT" apply(false)
id("com.matthewprenger.cursegradle") version "1.4.0" apply(false)
id("com.modrinth.minotaur") version "2.+" apply(false)
}

subprojects {
apply plugin: 'java'

Expand Down Expand Up @@ -32,23 +41,27 @@ subprojects {

repositories {
mavenCentral()

maven {
name = 'Sponge / Mixin'
url = 'https://repo.spongepowered.org/repository/maven-public/'
}
}


tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
it.options.release = 17
it.options.getRelease().set(17)
}

processResources {
filesMatching(['pack.mcmeta', 'fabric.mod.json', 'mods.toml', '*.mixins.json']) {
expand project.properties
}
}

// Disables Gradle's custom module metadata from being published to maven. The
// metadata includes mapped dependencies which are not reasonably consumable by
// other mod developers.
tasks.withType(GenerateModuleMetadata) {
tasks.withType(GenerateModuleMetadata).configureEach {
enabled = false
}
}
}
20 changes: 20 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
id 'idea'
id 'java'
id 'maven-publish'
id 'org.spongepowered.gradle.vanilla'
}

archivesBaseName = "${mod_name}-common-${minecraft_version}"

minecraft {
version(minecraft_version)
if (file("src/main/resources/${mod_id}.accesswidener").exists()) {
accessWideners(file("src/main/resources/${mod_id}.accesswidener"))
}
}

dependencies {
compileOnly group: 'org.spongepowered', name: 'mixin', version: '0.8.5'
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
}
File renamed without changes.
47 changes: 26 additions & 21 deletions Fabric/build.gradle → fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'maven-publish'
id 'java'
id 'idea'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'com.modrinth.minotaur' version "2.+"
id 'maven-publish'
id 'fabric-loom'
id 'com.matthewprenger.cursegradle'
id 'com.modrinth.minotaur'
}

archivesBaseName = "${mod_name}-fabric-${minecraft_version}"
base {
archivesName = "${mod_name}-fabric-${minecraft_version}"
}

repositories {
maven {
Expand All @@ -25,7 +28,7 @@ dependencies {
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
implementation project(":Common")
implementation project(":common")

modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
Expand All @@ -34,6 +37,12 @@ dependencies {
}

loom {
if (project(":common").file("src/main/resources/${mod_id}.accesswidener").exists()) {
accessWidenerPath.set(project(":common").file("src/main/resources/${mod_id}.accesswidener"))
}
mixin {
defaultRefmapName.set("${mod_id}.refmap.json")
}
runs {
client {
client()
Expand All @@ -50,29 +59,25 @@ loom {
}
}


processResources {
from project(":Common").sourceSets.main.resources
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
}

filesMatching('*.mixins.json') {
expand "refmap_target": "${archivesBaseName}-"
}
tasks.withType(JavaCompile).configureEach {
source(project(":common").sourceSets.main.allSource)
}
tasks.withType(Javadoc).configureEach {
source(project(":common").sourceSets.main.allJava)
}
tasks.named("sourcesJar", Jar) {
from(project(":common").sourceSets.main.allSource)
}

tasks.withType(JavaCompile) {
source(project(":Common").sourceSets.main.allSource)
processResources {
from project(":common").sourceSets.main.resources
}

publishing {
publications {
mavenJava(MavenPublication) {
groupId project.group
artifactId project.archivesBaseName
artifactId base.archivesName.get()
version project.version
from components.java
}
Expand Down
File renamed without changes.
57 changes: 31 additions & 26 deletions Forge/build.gradle → forge/build.gradle
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
buildscript {
dependencies {
classpath 'org.spongepowered:mixingradle:0.7.+'
}
}

plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'com.modrinth.minotaur' version "2.+"
id 'net.minecraftforge.gradle'
id 'com.matthewprenger.cursegradle'
id 'com.modrinth.minotaur'
}
apply plugin: 'org.spongepowered.mixin'

archivesBaseName = "${mod_name}-forge-${minecraft_version}"
base {
archivesName = "${mod_name}-forge-${minecraft_version}"
}

minecraft {
mappings channel: 'official', version: minecraft_version

copyIdeResources = true

if (project.hasProperty('forge_ats_enabled') && project.findProperty('forge_ats_enabled').toBoolean()) {
// This location is hardcoded in Forge and can not be changed.
// https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123
// Automatically enable forge AccessTransformers if the file exists
// This location is hardcoded in Forge and can not be changed.
// https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123
if (file('src/main/resources/META-INF/accesstransformer.cfg').exists()) {
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
project.logger.debug('Forge Access Transformers are enabled for this project.')
}

runs {
client {
workingDirectory project.file('run')
ideaModule "${rootProject.name}.${project.name}.main"
taskName 'Client'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
modClientRun {
source sourceSets.main
source project(":Common").sourceSets.main
source project(":common").sourceSets.main
}
}
}
Expand All @@ -45,10 +39,12 @@ minecraft {
workingDirectory project.file('run')
ideaModule "${rootProject.name}.${project.name}.main"
taskName 'Server'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
modServerRun {
source sourceSets.main
source project(":Common").sourceSets.main
source project(":common").sourceSets.main
}
}
}
Expand All @@ -58,10 +54,12 @@ minecraft {
ideaModule "${rootProject.name}.${project.name}.main"
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
taskName 'Data'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
modDataRun {
source sourceSets.main
source project(":Common").sourceSets.main
source project(":common").sourceSets.main
}
}
}
Expand All @@ -72,15 +70,21 @@ sourceSets.main.resources.srcDir 'src/generated/resources'

dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
compileOnly project(":Common")
compileOnly project(":common")
}

tasks.withType(JavaCompile) {
source(project(":Common").sourceSets.main.allSource)
tasks.withType(JavaCompile).configureEach {
source(project(":common").sourceSets.main.allSource)
}
tasks.withType(Javadoc).configureEach {
source(project(":common").sourceSets.main.allJava)
}
tasks.named("sourcesJar", Jar) {
from(project(":common").sourceSets.main.allSource)
}

processResources {
from project(":Common").sourceSets.main.resources
from project(":common").sourceSets.main.resources
}


Expand All @@ -90,9 +94,10 @@ publishing {
publications {
mavenJava(MavenPublication) {
groupId project.group
artifactId project.archivesBaseName
artifactId base.archivesName.get()
version project.version
from components.java
fg.component(it)
}
}
repositories {
Expand Down
File renamed without changes.
15 changes: 5 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@ version=1.4.0
group=com.mrbysco.dailydadserver

# Common
minecraft_version=1.20
common_runs_enabled=false
common_client_run_name=Common Client
common_server_run_name=Common Server

minecraft_version=1.20.1

# Forge
forge_version=46.0.12
//forge_ats_enabled=true
forge_version=47.1.3

# Fabric
fabric_version=0.83.0+1.20
fabric_version=0.85.0+1.20.1
fabric_loader_version=0.14.21
cloth_config_version=11.0.99
mod_menu_version=7.0.1
cloth_config_version=11.1.106
mod_menu_version=7.1.0

# Mod options
mod_name=DailyDad-Server
Expand Down
7 changes: 5 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@ pluginManagement {
}
}

rootProject.name = 'DailyDadServer'
include("Common", "Fabric", "Forge")
// This should match the folder name of the project, or else IDEA may complain (see https://youtrack.jetbrains.com/issue/IDEA-317606)
rootProject.name = 'DailyDad-Server'
include("common")
include("fabric")
include("forge")

0 comments on commit b355f96

Please sign in to comment.