forked from fraenkelc/amidst-forge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
223 lines (183 loc) · 6.54 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.4'
}
}
plugins {
id 'com.palantir.git-version' version '0.5.3'
}
apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'com.github.johnrengelman.shadow'
group = "net.lessqq.minecraft.amidstbridge" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "amidst-forge"
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
ext {
mc_version = '1.14.4'
forge_version = '28.1.0'
}
version = project.mc_version + '-' + gitVersion()
minecraft {
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'snapshot', version: '20190719-1.14.3'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
//accessTransformer = file('src/main/resources/META-INF/amidst-forge_at.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
mods {
examplemod {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
mods {
examplemod {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/')
mods {
examplemod {
source sourceSets.main
}
}
}
}
}
ext.sharedManifest = manifest {
attributes('Implementation-Version': project.version)
}
configurations {
jarIncludes
shade
compile { extendsFrom shade }
}
def embeddedJarDir = file("$buildDir/tmp/amidst-embed")
task copyAmidstJar(type: Sync) {
group = "Build"
from(configurations.jarIncludes).rename { "amidst-forge_amidst.jar.zip" }
destinationDir = embeddedJarDir
}
sourceSets.main.output.dir embeddedJarDir, builtBy: tasks["copyAmidstJar"]
jar {
manifest {
from sharedManifest
}
doFirst {
manifest {
attributes(
'Implementation-Version': project.version,
'FMLAT': sourceSets.main.resources.files.collect { it.getName() }.findAll {
it.endsWith("_at.cfg")
}.join(" ")
)
}
}
}
dependencies {
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
jarIncludes project(path: ':amidst', configuration: 'shadow')
shade project(':interface')
testImplementation 'org.hdrhistogram:HdrHistogram:2.1.12'
}
project(':amidst') {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'com.github.johnrengelman.shadow'
repositories {
jcenter()
maven { url file("m2") }
}
def props = new Properties()
file('src/main/resources/amidst/metadata.properties').withInputStream { props.load(it) }
version = "${props['amidst.version.major']}.${props['amidst.version.minor']}${props['amidst.version.preReleaseSuffix']?.trim() ? "-" + props['amidst.version.preReleaseSuffix']?.trim() : ''}"
jar {
manifest {
attributes "Main-Class": "amidst.Amidst", "Amidst-Version": "$version"
}
}
shadowJar {
relocate 'org.jnbt', 'amidst.shadow.org.jnbt'
relocate 'com.google.gson', 'amidst.shadow.com.google.gson'
relocate 'org.kohsuke.args4j', 'amidst.shadow.org.kohsuke.args4j'
relocate 'net.miginfocom', 'amidst.shadow.net.miginfocom'
}
dependencies {
compile 'com.google.code.gson:gson:2.5'
compile 'com.miglayout:miglayout-swing:4.2'
compile 'args4j:args4j:2.32'
compile 'jnbt:jnbt:1.3'
compile project(':interface')
testCompile 'junit:junit:4.11'
}
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
}
shadowJar {
relocate 'com.google.flatbuffers', 'relocated.flatbufffers'
exclude 'META-INF/versions/**/*'
configurations = [project.configurations.shade]
}
artifacts {
shadow shadowJar
}
// Example configuration to allow publishing using the maven-publish task
// we define a custom artifact that is sourced from the reobfJar output task
// and then declare that to be published
// Note you'll need to add a repository here
def reobfFile = file("$buildDir/reobfJar/output.jar")
def reobfArtifact = artifacts.add('default', reobfFile) {
type 'jar'
builtBy 'reobfJar'
}
gradle.projectsEvaluated {
reobfJar {
dependsOn "shadowJar"
input = shadowJar.archivePath
}
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact reobfArtifact
}
}
repositories {
maven {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}