Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 103 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ def setUpJar(project) {
project.apply plugin: 'ploceus'

project.base {
archivesName = "${project.rootProject.root_archives_base_name}"
archivesName = "${project.rootProject.mod_id_long}"
}
project.version = "${project.rootProject.root_version}"
project.group = "${project.rootProject.root_maven_group}"
project.version = "${project.rootProject.mod_version}"
project.group = "${project.rootProject.mod_maven_group}"

project.ploceus {
setIntermediaryGeneration(2)
Expand All @@ -66,9 +66,18 @@ def setUpJar(project) {
modImplementation "net.fabricmc:fabric-loader:${project.rootProject.loader_version}"
}

project.processResources {
filesMatching('fabric.mod.json') {
expand project.properties
project.tasks.register('generateModJson', net.fabricmc.loom.task.FabricModJsonV1Task) {
fillModJson(project, it)

json {
modId = "${project.rootProject.mod_id_short}" // use short id for backwards compat
name = "${project.rootProject.mod_name_long}"
description = "${project.rootProject.mod_description}"

icon "assets/${project.rootProject.mod_id_long}/icon.png"

environment = "*"
depends "minecraft", "*"
}
}

Expand All @@ -87,9 +96,9 @@ def addPomDependency(project) {
def depsNode = asNode().get("dependencies")[0]
def depNode = depsNode.appendNode("dependency")

depNode.appendNode("groupId", project.group)
depNode.appendNode("artifactId", project.name)
depNode.appendNode("version", project.version)
depNode.appendNode("groupId", project.mod_maven_group)
depNode.appendNode("artifactId", project.mod_artifact_id)
depNode.appendNode("version", project.mod_version)
depNode.appendNode("scope", "compile")
}
}
Expand Down Expand Up @@ -121,16 +130,41 @@ def setUpJavadoc(project) {
}
}

// fill common elements of mod.json like authors, contact info, license
def fillModJson(project, task) {
task.outputFile = project.file("src/main/resources/fabric.mod.json")

task.json {
version = "${project.version}"

contactInformation = [
"homepage": "${project.rootProject.mod_contact_homepage}",
"issues": "${project.rootProject.mod_contact_issues}",
"sources": "${project.rootProject.mod_contact_sources}"
]

author "OrnitheMC"

licenses = [
"${project.rootProject.mod_license}"
]

depends "fabricloader", "${project.rootProject.mod_loader_dependency}"
}

project.tasks.build.dependsOn task
}

def setUpLibrary(project) {
project.apply plugin: 'java-library'
project.apply plugin: 'eclipse'
project.apply plugin: 'idea'

project.base {
archivesName = "${project.rootProject.archives_base_name}-${project.archives_base_name}"
archivesName = "${project.rootProject.mod_id_short}-${project.library_id}"
}
project.version = "${project.version}"
project.group = "${project.rootProject.root_maven_group}.${project.rootProject.maven_group}"
project.version = "${project.library_version}"
project.group = "${project.rootProject.library_maven_group}"

project.repositories {
// needed for loader in subprojects without a mc dep
Expand Down Expand Up @@ -164,6 +198,7 @@ def setUpModule(project, String... dependencies) {
// for different mc version ranges
// the Core API is the only exception to this
def isCore = (project.path == ':libraries:core')
def library = (isCore) ? project : project.parent

project.apply plugin: 'java-library'
project.apply plugin: 'eclipse'
Expand All @@ -172,24 +207,21 @@ def setUpModule(project, String... dependencies) {
project.apply plugin: 'fabric-loom'
project.apply plugin: 'ploceus'

if (isCore) {
project.base {
archivesName = "${project.rootProject.archives_base_name}-${project.archives_base_name}"
}
project.version = "${project.version}"
} else {
project.base {
archivesName = "${project.rootProject.archives_base_name}-${project.parent.archives_base_name}"
}
project.version = "${project.parent.version}+mc${project.min_mc_version}-mc${project.max_mc_version}"
project.base {
archivesName = "${project.rootProject.mod_id_short}-${library.library_id}"
}
project.version = "${library.library_version}"
project.group = "${project.rootProject.library_maven_group}"

if (!isCore) {
project.version += "+mc${project.min_mc_version}-mc${project.max_mc_version}"
}
project.group = "${project.rootProject.root_maven_group}.${project.rootProject.maven_group}"

project.loom {
if (!isCore && project.environment == 'client') {
if (project.hasProperty('environment') && project.environment == 'client') {
clientOnlyMinecraftJar()
}
if (!isCore && project.environment == 'server') {
if (project.hasProperty('environment') && project.environment == 'server') {
serverOnlyMinecraftJar()
}
}
Expand Down Expand Up @@ -268,9 +300,52 @@ def setUpModule(project, String... dependencies) {
}
}

project.processResources {
filesMatching('fabric.mod.json') {
expand project.properties
project.tasks.register('generateModJson', net.fabricmc.loom.task.FabricModJsonV1Task) {
fillModJson(project, it)

json {
modId = "${project.rootProject.mod_id_short}-${library.library_id}"
name = "${project.rootProject.mod_name_short} ${library.library_name}"
description = "${library.library_description}"

icon "assets/${project.rootProject.mod_id_long}/${library.library_id}/icon.png"
mixin "${project.rootProject.mod_id_short}.${library.library_id}.mixins.json"

if (library.hasProperty('entrypoint_init')) {
entrypoint 'init', library.entrypoint_init
} else if (project.hasProperty('entrypoint_init')) {
entrypoint 'init', project.entrypoint_init
}
if (library.hasProperty('entrypoint_client_init')) {
entrypoint 'client-init', library.entrypoint_client_init
} else if (project.hasProperty('entrypoint_client_init')) {
entrypoint 'client-init', project.entrypoint_client_init
}
if (library.hasProperty('entrypoint_server_init')) {
entrypoint 'server-init', library.entrypoint_server_init
} else if (project.hasProperty('entrypoint_server_init')) {
entrypoint 'server-init', project.entrypoint_server_init
}

if (project.hasProperty('environment')) {
environment = "${project.environment}"
} else {
environment = '*'
}

if (!isCore) {
depends "minecraft", "${project.minecraft_dependency}"
}

if (!isCore && library.hasProperty('osl_dependencies')) {
for (def dependency : library.osl_dependencies.split(',')) {
def parts = dependency.split(':')
def library_id = parts[0]
def library_versions = parts[1]

depends "${project.rootProject.mod_id_short}-${library_id}", library_versions
}
}
}
}

Expand Down
21 changes: 16 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@ quilt_parsers_version = 0.2.1
minecraft_version = 1.7.2
feather_build = 1

root_version = 0.16.1
root_maven_group = net.ornithemc
maven_group = osl
root_archives_base_name = ornithe-standard-libraries
archives_base_name = osl
mod_version = 0.16.1
mod_artifact_id = osl-gen2
mod_maven_group = net.ornithemc
library_maven_group = net.ornithemc.osl-gen2

# mod.json
mod_id_short = osl
mod_id_long = ornithe-standard-libraries
mod_name_short = OSL
mod_name_long = Ornithe Standard Libraries
mod_description = Libraries and APIs for modding with Ornithe.
mod_contact_homepage = https://ornithemc.net/
mod_contact_issues = https://github.com/OrnitheMC/ornithe-standard-libraries/issues
mod_contact_sources = https://github.com/OrnitheMC/ornithe-standard-libraries
mod_license = Apache-2.0
mod_loader_dependency = >=0.16.0
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
environment = client
min_mc_version = 14w30a
max_mc_version = 16w05a
mc_version_range = >=1.8-alpha.14.30.a <=1.9-alpha.16.5.a
minecraft_dependency = >=1.8-alpha.14.30.a <=1.9-alpha.16.5.a

minecraft_version = 16w05a
feather_build = 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"schemaVersion": 1,
"id": "osl-branding",
"version": "0.3.2+mc14w30a-mc16w05a",
"environment": "client",
"entrypoints": {
"client-init": [
"net.ornithemc.osl.branding.impl.BrandingPatchImpl"
]
},
"mixins": [
"osl.branding.mixins.json"
],
"depends": {
"fabricloader": "\u003e\u003d0.16.0",
"minecraft": "\u003e\u003d1.8-alpha.14.30.a \u003c\u003d1.9-alpha.16.5.a",
"osl-core": "\u003e\u003d0.4.0",
"osl-entrypoints": "\u003e\u003d0.4.0",
"osl-lifecycle-events": "\u003e\u003d0.5.0"
},
"name": "OSL Branding",
"description": "Branding API for patching the title screen and debug overlay.",
"authors": [
"OrnitheMC"
],
"contact": {
"homepage": "https://ornithemc.net/",
"issues": "https://github.com/OrnitheMC/ornithe-standard-libraries/issues",
"sources": "https://github.com/OrnitheMC/ornithe-standard-libraries"
},
"license": "Apache-2.0",
"icon": "assets/ornithe-standard-libraries/branding/icon.png"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
environment = client
min_mc_version = 16w05b
max_mc_version = 1.12.2
mc_version_range = >=1.9-alpha.16.5.b <=1.12.2
minecraft_dependency = >=1.9-alpha.16.5.b <=1.12.2

minecraft_version = 1.12.2
feather_build = 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"schemaVersion": 1,
"id": "osl-branding",
"version": "0.3.2+mc16w05b-mc1.12.2",
"environment": "client",
"entrypoints": {
"client-init": [
"net.ornithemc.osl.branding.impl.BrandingPatchImpl"
]
},
"mixins": [
"osl.branding.mixins.json"
],
"depends": {
"fabricloader": "\u003e\u003d0.16.0",
"minecraft": "\u003e\u003d1.9-alpha.16.5.b \u003c\u003d1.12.2",
"osl-core": "\u003e\u003d0.4.0",
"osl-entrypoints": "\u003e\u003d0.4.0",
"osl-lifecycle-events": "\u003e\u003d0.5.0"
},
"name": "OSL Branding",
"description": "Branding API for patching the title screen and debug overlay.",
"authors": [
"OrnitheMC"
],
"contact": {
"homepage": "https://ornithemc.net/",
"issues": "https://github.com/OrnitheMC/ornithe-standard-libraries/issues",
"sources": "https://github.com/OrnitheMC/ornithe-standard-libraries"
},
"license": "Apache-2.0",
"icon": "assets/ornithe-standard-libraries/branding/icon.png"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
environment = client
min_mc_version = a1.2.2
max_mc_version = 14w29b
mc_version_range = >=1.0.0-alpha.2.2 <=1.8-alpha.14.29.b
minecraft_dependency = >=1.0.0-alpha.2.2 <=1.8-alpha.14.29.b

minecraft_version = 14w29b
feather_build = 1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"schemaVersion": 1,
"id": "osl-branding",
"version": "0.3.2+mca1.2.2-mc14w29b",
"environment": "client",
"entrypoints": {
"client-init": [
"net.ornithemc.osl.branding.impl.BrandingPatchImpl"
]
},
"mixins": [
"osl.branding.mixins.json"
],
"depends": {
"fabricloader": "\u003e\u003d0.16.0",
"minecraft": "\u003e\u003d1.0.0-alpha.2.2 \u003c\u003d1.8-alpha.14.29.b",
"osl-core": "\u003e\u003d0.4.0",
"osl-entrypoints": "\u003e\u003d0.4.0",
"osl-lifecycle-events": "\u003e\u003d0.5.0"
},
"name": "OSL Branding",
"description": "Branding API for patching the title screen and debug overlay.",
"authors": [
"OrnitheMC"
],
"contact": {
"homepage": "https://ornithemc.net/",
"issues": "https://github.com/OrnitheMC/ornithe-standard-libraries/issues",
"sources": "https://github.com/OrnitheMC/ornithe-standard-libraries"
},
"license": "Apache-2.0",
"icon": "assets/ornithe-standard-libraries/branding/icon.png"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
environment = client
min_mc_version = in-20100206-2103
max_mc_version = a1.2.1_01
mc_version_range = >=0.31.20100206 <=1.0.0-alpha.2.1.1
minecraft_dependency = >=0.31.20100206 <=1.0.0-alpha.2.1.1

minecraft_version = a1.2.1_01
feather_build = 1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"schemaVersion": 1,
"id": "osl-branding",
"version": "0.3.2+mcin-20100206-2103-mca1.2.1_01",
"environment": "client",
"entrypoints": {
"client-init": [
"net.ornithemc.osl.branding.impl.BrandingPatchImpl"
]
},
"mixins": [
"osl.branding.mixins.json"
],
"depends": {
"fabricloader": "\u003e\u003d0.16.0",
"minecraft": "\u003e\u003d0.31.20100206 \u003c\u003d1.0.0-alpha.2.1.1",
"osl-core": "\u003e\u003d0.4.0",
"osl-entrypoints": "\u003e\u003d0.4.0",
"osl-lifecycle-events": "\u003e\u003d0.5.0"
},
"name": "OSL Branding",
"description": "Branding API for patching the title screen and debug overlay.",
"authors": [
"OrnitheMC"
],
"contact": {
"homepage": "https://ornithemc.net/",
"issues": "https://github.com/OrnitheMC/ornithe-standard-libraries/issues",
"sources": "https://github.com/OrnitheMC/ornithe-standard-libraries"
},
"license": "Apache-2.0",
"icon": "assets/ornithe-standard-libraries/branding/icon.png"
}
Loading
Loading