forked from p455w0rd/FabricMagnet
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
53 lines (44 loc) · 1.22 KB
/
build.gradle
File metadata and controls
53 lines (44 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
plugins {
id 'fabric-loom' version '0.4-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
archivesBaseName = "FabricMagnet"
version = "1.14-" + getVersion()
minecraft {
}
dependencies {
minecraft "com.mojang:minecraft:1.15.2"
mappings "net.fabricmc:yarn:1.15.2+build.17:v2"
modCompile "net.fabricmc:fabric-loader:0.8.9+build.203"
// Fabric API. This is technically optional, but you probably want it anyway.
modCompile "net.fabricmc.fabric-api:fabric-api:0.14.0+build.317-1.15"
}
processResources {
inputs.property "modversion", project.version
from (sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
expand "version": project.version
}
from (sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}
String getVersion() {
String major = "0";
String revision = "0";
String patch = "0";
String prefix = "public static final String VERSION = \"";
File file = file("src/main/java/p455w0rd/fmagnet/init/ModGlobals.java")
file.eachLine { String s ->
s = s.trim();
if (s.startsWith(prefix)) {
s = s.substring(prefix.length(), s.length() - 2);
String[] pts = s.split("\\.");
major = pts[0];
revision = pts[1];
patch = pts[2];
}
}
return "$major.$revision.$patch";
}