Skip to content

Commit fead417

Browse files
Merge pull request #52 from OrnitheMC/fmj-generation-task
make generateModJson task to generate the FMJs
2 parents 4d09b57 + c13187e commit fead417

File tree

157 files changed

+2270
-469
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+2270
-469
lines changed

build.gradle

Lines changed: 103 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ def setUpJar(project) {
4343
project.apply plugin: 'ploceus'
4444

4545
project.base {
46-
archivesName = "${project.rootProject.root_archives_base_name}"
46+
archivesName = "${project.rootProject.mod_id_long}"
4747
}
48-
project.version = "${project.rootProject.root_version}"
49-
project.group = "${project.rootProject.root_maven_group}"
48+
project.version = "${project.rootProject.mod_version}"
49+
project.group = "${project.rootProject.mod_maven_group}"
5050

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

69-
project.processResources {
70-
filesMatching('fabric.mod.json') {
71-
expand project.properties
69+
project.tasks.register('generateModJson', net.fabricmc.loom.task.FabricModJsonV1Task) {
70+
fillModJson(project, it)
71+
72+
json {
73+
modId = "${project.rootProject.mod_id_short}" // use short id for backwards compat
74+
name = "${project.rootProject.mod_name_long}"
75+
description = "${project.rootProject.mod_description}"
76+
77+
icon "assets/${project.rootProject.mod_id_long}/icon.png"
78+
79+
environment = "*"
80+
depends "minecraft", "*"
7281
}
7382
}
7483

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

90-
depNode.appendNode("groupId", project.group)
91-
depNode.appendNode("artifactId", project.name)
92-
depNode.appendNode("version", project.version)
99+
depNode.appendNode("groupId", project.mod_maven_group)
100+
depNode.appendNode("artifactId", project.mod_artifact_id)
101+
depNode.appendNode("version", project.mod_version)
93102
depNode.appendNode("scope", "compile")
94103
}
95104
}
@@ -121,16 +130,41 @@ def setUpJavadoc(project) {
121130
}
122131
}
123132

133+
// fill common elements of mod.json like authors, contact info, license
134+
def fillModJson(project, task) {
135+
task.outputFile = project.file("src/main/resources/fabric.mod.json")
136+
137+
task.json {
138+
version = "${project.version}"
139+
140+
contactInformation = [
141+
"homepage": "${project.rootProject.mod_contact_homepage}",
142+
"issues": "${project.rootProject.mod_contact_issues}",
143+
"sources": "${project.rootProject.mod_contact_sources}"
144+
]
145+
146+
author "OrnitheMC"
147+
148+
licenses = [
149+
"${project.rootProject.mod_license}"
150+
]
151+
152+
depends "fabricloader", "${project.rootProject.mod_loader_dependency}"
153+
}
154+
155+
project.tasks.build.dependsOn task
156+
}
157+
124158
def setUpLibrary(project) {
125159
project.apply plugin: 'java-library'
126160
project.apply plugin: 'eclipse'
127161
project.apply plugin: 'idea'
128162

129163
project.base {
130-
archivesName = "${project.rootProject.archives_base_name}-${project.archives_base_name}"
164+
archivesName = "${project.rootProject.mod_id_short}-${project.library_id}"
131165
}
132-
project.version = "${project.version}"
133-
project.group = "${project.rootProject.root_maven_group}.${project.rootProject.maven_group}"
166+
project.version = "${project.library_version}"
167+
project.group = "${project.rootProject.library_maven_group}"
134168

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

168203
project.apply plugin: 'java-library'
169204
project.apply plugin: 'eclipse'
@@ -172,24 +207,21 @@ def setUpModule(project, String... dependencies) {
172207
project.apply plugin: 'fabric-loom'
173208
project.apply plugin: 'ploceus'
174209

175-
if (isCore) {
176-
project.base {
177-
archivesName = "${project.rootProject.archives_base_name}-${project.archives_base_name}"
178-
}
179-
project.version = "${project.version}"
180-
} else {
181-
project.base {
182-
archivesName = "${project.rootProject.archives_base_name}-${project.parent.archives_base_name}"
183-
}
184-
project.version = "${project.parent.version}+mc${project.min_mc_version}-mc${project.max_mc_version}"
210+
project.base {
211+
archivesName = "${project.rootProject.mod_id_short}-${library.library_id}"
212+
}
213+
project.version = "${library.library_version}"
214+
project.group = "${project.rootProject.library_maven_group}"
215+
216+
if (!isCore) {
217+
project.version += "+mc${project.min_mc_version}-mc${project.max_mc_version}"
185218
}
186-
project.group = "${project.rootProject.root_maven_group}.${project.rootProject.maven_group}"
187219

188220
project.loom {
189-
if (!isCore && project.environment == 'client') {
221+
if (project.hasProperty('environment') && project.environment == 'client') {
190222
clientOnlyMinecraftJar()
191223
}
192-
if (!isCore && project.environment == 'server') {
224+
if (project.hasProperty('environment') && project.environment == 'server') {
193225
serverOnlyMinecraftJar()
194226
}
195227
}
@@ -268,9 +300,52 @@ def setUpModule(project, String... dependencies) {
268300
}
269301
}
270302

271-
project.processResources {
272-
filesMatching('fabric.mod.json') {
273-
expand project.properties
303+
project.tasks.register('generateModJson', net.fabricmc.loom.task.FabricModJsonV1Task) {
304+
fillModJson(project, it)
305+
306+
json {
307+
modId = "${project.rootProject.mod_id_short}-${library.library_id}"
308+
name = "${project.rootProject.mod_name_short} ${library.library_name}"
309+
description = "${library.library_description}"
310+
311+
icon "assets/${project.rootProject.mod_id_long}/${library.library_id}/icon.png"
312+
mixin "${project.rootProject.mod_id_short}.${library.library_id}.mixins.json"
313+
314+
if (library.hasProperty('entrypoint_init')) {
315+
entrypoint 'init', library.entrypoint_init
316+
} else if (project.hasProperty('entrypoint_init')) {
317+
entrypoint 'init', project.entrypoint_init
318+
}
319+
if (library.hasProperty('entrypoint_client_init')) {
320+
entrypoint 'client-init', library.entrypoint_client_init
321+
} else if (project.hasProperty('entrypoint_client_init')) {
322+
entrypoint 'client-init', project.entrypoint_client_init
323+
}
324+
if (library.hasProperty('entrypoint_server_init')) {
325+
entrypoint 'server-init', library.entrypoint_server_init
326+
} else if (project.hasProperty('entrypoint_server_init')) {
327+
entrypoint 'server-init', project.entrypoint_server_init
328+
}
329+
330+
if (project.hasProperty('environment')) {
331+
environment = "${project.environment}"
332+
} else {
333+
environment = '*'
334+
}
335+
336+
if (!isCore) {
337+
depends "minecraft", "${project.minecraft_dependency}"
338+
}
339+
340+
if (!isCore && library.hasProperty('osl_dependencies')) {
341+
for (def dependency : library.osl_dependencies.split(',')) {
342+
def parts = dependency.split(':')
343+
def library_id = parts[0]
344+
def library_versions = parts[1]
345+
346+
depends "${project.rootProject.mod_id_short}-${library_id}", library_versions
347+
}
348+
}
274349
}
275350
}
276351

gradle.properties

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,19 @@ quilt_parsers_version = 0.2.1
77
minecraft_version = 1.7.2
88
feather_build = 1
99

10-
root_version = 0.16.1
11-
root_maven_group = net.ornithemc
12-
maven_group = osl
13-
root_archives_base_name = ornithe-standard-libraries
14-
archives_base_name = osl
10+
mod_version = 0.16.1
11+
mod_artifact_id = osl-gen2
12+
mod_maven_group = net.ornithemc
13+
library_maven_group = net.ornithemc.osl-gen2
14+
15+
# mod.json
16+
mod_id_short = osl
17+
mod_id_long = ornithe-standard-libraries
18+
mod_name_short = OSL
19+
mod_name_long = Ornithe Standard Libraries
20+
mod_description = Libraries and APIs for modding with Ornithe.
21+
mod_contact_homepage = https://ornithemc.net/
22+
mod_contact_issues = https://github.com/OrnitheMC/ornithe-standard-libraries/issues
23+
mod_contact_sources = https://github.com/OrnitheMC/ornithe-standard-libraries
24+
mod_license = Apache-2.0
25+
mod_loader_dependency = >=0.16.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
environment = client
22
min_mc_version = 14w30a
33
max_mc_version = 16w05a
4-
mc_version_range = >=1.8-alpha.14.30.a <=1.9-alpha.16.5.a
4+
minecraft_dependency = >=1.8-alpha.14.30.a <=1.9-alpha.16.5.a
55

66
minecraft_version = 16w05a
77
feather_build = 1
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"schemaVersion": 1,
3+
"id": "osl-branding",
4+
"version": "0.3.2+mc14w30a-mc16w05a",
5+
"environment": "client",
6+
"entrypoints": {
7+
"client-init": [
8+
"net.ornithemc.osl.branding.impl.BrandingPatchImpl"
9+
]
10+
},
11+
"mixins": [
12+
"osl.branding.mixins.json"
13+
],
14+
"depends": {
15+
"fabricloader": "\u003e\u003d0.16.0",
16+
"minecraft": "\u003e\u003d1.8-alpha.14.30.a \u003c\u003d1.9-alpha.16.5.a",
17+
"osl-core": "\u003e\u003d0.4.0",
18+
"osl-entrypoints": "\u003e\u003d0.4.0",
19+
"osl-lifecycle-events": "\u003e\u003d0.5.0"
20+
},
21+
"name": "OSL Branding",
22+
"description": "Branding API for patching the title screen and debug overlay.",
23+
"authors": [
24+
"OrnitheMC"
25+
],
26+
"contact": {
27+
"homepage": "https://ornithemc.net/",
28+
"issues": "https://github.com/OrnitheMC/ornithe-standard-libraries/issues",
29+
"sources": "https://github.com/OrnitheMC/ornithe-standard-libraries"
30+
},
31+
"license": "Apache-2.0",
32+
"icon": "assets/ornithe-standard-libraries/branding/icon.png"
33+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
environment = client
22
min_mc_version = 16w05b
33
max_mc_version = 1.12.2
4-
mc_version_range = >=1.9-alpha.16.5.b <=1.12.2
4+
minecraft_dependency = >=1.9-alpha.16.5.b <=1.12.2
55

66
minecraft_version = 1.12.2
77
feather_build = 1
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"schemaVersion": 1,
3+
"id": "osl-branding",
4+
"version": "0.3.2+mc16w05b-mc1.12.2",
5+
"environment": "client",
6+
"entrypoints": {
7+
"client-init": [
8+
"net.ornithemc.osl.branding.impl.BrandingPatchImpl"
9+
]
10+
},
11+
"mixins": [
12+
"osl.branding.mixins.json"
13+
],
14+
"depends": {
15+
"fabricloader": "\u003e\u003d0.16.0",
16+
"minecraft": "\u003e\u003d1.9-alpha.16.5.b \u003c\u003d1.12.2",
17+
"osl-core": "\u003e\u003d0.4.0",
18+
"osl-entrypoints": "\u003e\u003d0.4.0",
19+
"osl-lifecycle-events": "\u003e\u003d0.5.0"
20+
},
21+
"name": "OSL Branding",
22+
"description": "Branding API for patching the title screen and debug overlay.",
23+
"authors": [
24+
"OrnitheMC"
25+
],
26+
"contact": {
27+
"homepage": "https://ornithemc.net/",
28+
"issues": "https://github.com/OrnitheMC/ornithe-standard-libraries/issues",
29+
"sources": "https://github.com/OrnitheMC/ornithe-standard-libraries"
30+
},
31+
"license": "Apache-2.0",
32+
"icon": "assets/ornithe-standard-libraries/branding/icon.png"
33+
}

libraries/branding/branding-mca1.2.2-mc14w29b/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
environment = client
22
min_mc_version = a1.2.2
33
max_mc_version = 14w29b
4-
mc_version_range = >=1.0.0-alpha.2.2 <=1.8-alpha.14.29.b
4+
minecraft_dependency = >=1.0.0-alpha.2.2 <=1.8-alpha.14.29.b
55

66
minecraft_version = 14w29b
77
feather_build = 1
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"schemaVersion": 1,
3+
"id": "osl-branding",
4+
"version": "0.3.2+mca1.2.2-mc14w29b",
5+
"environment": "client",
6+
"entrypoints": {
7+
"client-init": [
8+
"net.ornithemc.osl.branding.impl.BrandingPatchImpl"
9+
]
10+
},
11+
"mixins": [
12+
"osl.branding.mixins.json"
13+
],
14+
"depends": {
15+
"fabricloader": "\u003e\u003d0.16.0",
16+
"minecraft": "\u003e\u003d1.0.0-alpha.2.2 \u003c\u003d1.8-alpha.14.29.b",
17+
"osl-core": "\u003e\u003d0.4.0",
18+
"osl-entrypoints": "\u003e\u003d0.4.0",
19+
"osl-lifecycle-events": "\u003e\u003d0.5.0"
20+
},
21+
"name": "OSL Branding",
22+
"description": "Branding API for patching the title screen and debug overlay.",
23+
"authors": [
24+
"OrnitheMC"
25+
],
26+
"contact": {
27+
"homepage": "https://ornithemc.net/",
28+
"issues": "https://github.com/OrnitheMC/ornithe-standard-libraries/issues",
29+
"sources": "https://github.com/OrnitheMC/ornithe-standard-libraries"
30+
},
31+
"license": "Apache-2.0",
32+
"icon": "assets/ornithe-standard-libraries/branding/icon.png"
33+
}

libraries/branding/branding-mcin-20100206-2103-mca1.2.1_01/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
environment = client
22
min_mc_version = in-20100206-2103
33
max_mc_version = a1.2.1_01
4-
mc_version_range = >=0.31.20100206 <=1.0.0-alpha.2.1.1
4+
minecraft_dependency = >=0.31.20100206 <=1.0.0-alpha.2.1.1
55

66
minecraft_version = a1.2.1_01
77
feather_build = 1
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"schemaVersion": 1,
3+
"id": "osl-branding",
4+
"version": "0.3.2+mcin-20100206-2103-mca1.2.1_01",
5+
"environment": "client",
6+
"entrypoints": {
7+
"client-init": [
8+
"net.ornithemc.osl.branding.impl.BrandingPatchImpl"
9+
]
10+
},
11+
"mixins": [
12+
"osl.branding.mixins.json"
13+
],
14+
"depends": {
15+
"fabricloader": "\u003e\u003d0.16.0",
16+
"minecraft": "\u003e\u003d0.31.20100206 \u003c\u003d1.0.0-alpha.2.1.1",
17+
"osl-core": "\u003e\u003d0.4.0",
18+
"osl-entrypoints": "\u003e\u003d0.4.0",
19+
"osl-lifecycle-events": "\u003e\u003d0.5.0"
20+
},
21+
"name": "OSL Branding",
22+
"description": "Branding API for patching the title screen and debug overlay.",
23+
"authors": [
24+
"OrnitheMC"
25+
],
26+
"contact": {
27+
"homepage": "https://ornithemc.net/",
28+
"issues": "https://github.com/OrnitheMC/ornithe-standard-libraries/issues",
29+
"sources": "https://github.com/OrnitheMC/ornithe-standard-libraries"
30+
},
31+
"license": "Apache-2.0",
32+
"icon": "assets/ornithe-standard-libraries/branding/icon.png"
33+
}

0 commit comments

Comments
 (0)