This repository has been archived by the owner on Nov 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
155 lines (124 loc) · 4.47 KB
/
build.gradle
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
buildscript {
repositories {
mavenCentral()
maven { url 'https://files.minecraftforge.net/maven' }
maven { url 'https://repo.spongepowered.org/maven' }
maven { url 'https://plugins.gradle.org/m2' }
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '2.1-SNAPSHOT'
classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.6-SNAPSHOT'
classpath group: 'com.github.jengelman.gradle.plugins', name: 'shadow', version: '4.0.4'
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'com.github.johnrengelman.shadow'
def getGitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
def getGitBranch = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
def getGitTag = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags', '--abbrev=0'
standardOutput = stdout
}
return stdout.toString().trim()
}
def release = false
version = release ? "${getGitTag}" : "${getGitBranch}-${getGitHash}"
group = mod_group
archivesBaseName = mod_id
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
compileJava.options.encoding = 'UTF-8'
minecraft {
version = minecraft_version + '-' + forge_version
runDir = 'run'
mappings = mappings_version
makeObfSourceJar = true
String resolved_core_mod = mod_core_plugin.replace('${mod_group}', mod_group).replace('${mod_id}', mod_id)
clientJvmArgs += '-Dfml.coreMods.load=' + resolved_core_mod
serverJvmArgs += '-Dfml.coreMods.load=' + resolved_core_mod
String resolved_mixin_configs = mod_mixin_configs.replace('${mod_id}', mod_id)
clientRunArgs += '--mixin ' + resolved_mixin_configs
serverRunArgs += '--mixin ' + resolved_mixin_configs
clientRunArgs += '-Dmixin.hotSwap=true'
serverRunArgs += '-Dmixin.hotSwap=true'
clientRunArgs += '-Dmixin.checks.interfaces=true'
serverRunArgs += '-Dmixin.checks.interfaces=true'
}
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://repo.spongepowered.org/maven/' }
}
dependencies {
compile('org.spongepowered:mixin:0.7.10-SNAPSHOT') { exclude module: 'launchwrapper' }
compile 'com.jagrosh:DiscordIPC:0.4'
}
processResources {
inputs.property 'version', project.version
inputs.property 'mcversion', project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'mod_id': mod_id, 'mod_name': mod_name, 'version': project.version,
'mcversion': project.minecraft.version, 'mod_description': mod_description,
'mod_author': mod_author
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
rename '(.+_at.cfg)', 'META-INF/$1'
}
mixin {
add sourceSets.main, mod_mixin_configs.replace('${mod_id}', mod_id).replace('.json', '.refmap.json')
}
jar {
manifest {
attributes(
'Manifest-Version': 1.0,
'ModSide': 'CLIENT',
'FMLCorePluginContainsFMLMod': 'Yes, yes it does',
'FMLAT': mod_access_transformer.replace('${mod_id}', mod_id),
'FMLCorePlugin': mod_core_plugin.replace('${mod_group}', mod_group).replace('${mod_id}', mod_id),
'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
'TweakOrder': '0',
'MixinConfigs': mod_mixin_configs.replace('${mod_id}', mod_id),
'Implementation-Title': getRootProject().getName(),
'Implementation-Version': getProject().getVersion(),
'Implementation-Vendor': 'booky10',
)
}
}
shadowJar {
dependencies {
include(dependency('org.spongepowered:mixin'))
include(dependency('com.jagrosh:DiscordIPC'))
}
exclude 'dummyThing'
exclude 'LICENSE.txt'
classifier = ''
}
reobf { shadowJar { mappingType = 'SEARGE' } }
build { dependsOn shadowJar }
tasks.reobfShadowJar.mustRunAfter shadowJar
configurations {
external
compile.extendsFrom external
}