-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminecraft.gradle
88 lines (74 loc) · 2.57 KB
/
minecraft.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
// We need shared to be evaluated before we access anything from it
project.evaluationDependsOn(":shared")
// Shared configuration across the version specific projects
configurations {
// Gradle approved way depending on cross project task output
sharedJar {
canBeConsumed = false
canBeResolved = true
}
}
dependencies {
// Depend on the 'arquives' configuration, it is the configuration the task jar outputs to by default
implementation project(path: ':shared', configuration: 'archives')
sharedJar project(path: ':shared', configuration: 'shareJar') // Required to embed the api jar within the mod jar
}
tasks.register('devJar', Jar) {
archiveBaseName = rootProject.name
archiveClassifier = project.name + '-dev'
from sourceSets.main.output
}
tasks.register('sourcesJar', Jar) {
archiveBaseName = rootProject.name
archiveClassifier = project.name + '-dev-sources'
from sourceSets.main.allSource
from project(':shared').sourceSets.main.allSource // TODO: Not depend on sourceSet directly
}
javadoc {
source project(':shared').sourceSets.main.allSource // TODO: Not depend on sourceSet directly
options.addStringOption('Xdoclint:none', '-quiet')
}
tasks.register('javadocJar', Jar) {
dependsOn javadoc
archiveBaseName = rootProject.name
archiveClassifier = project.name + '-dev-javadoc'
from javadoc.destinationDir
}
['jar', 'devJar'].each {
tasks.named(it).configure {
// Embed the "api" jar contents into the mod jar
from configurations.named('sharedJar').map {
zipTree(it.singleFile)
}
}
}
jar {
archiveBaseName = rootProject.name
archiveClassifier = project.name
manifest {
attributes([
"ForceLoadAsMod" : 'true',
'FMLCorePluginContainsFMLMod' : 'true',
'FMLCorePlugin' : 'io.github.cruciblemc.omniconfig.'+ project.name.replace('.', '_') +'.OmniconfigCoremod'
])
}
}
// Copy the normal jar manifest into the dev jar
afterEvaluate {
devJar.manifest.attributes(jar.manifest.attributes)
}
artifacts {
archives devJar
archives sourcesJar
archives javadocJar
}
processResources {
inputs.property 'version', project.version
inputs.property 'mod_id', project.property('mod_id')
inputs.property 'mod_name', project.property('mod_name')
filesMatching('mcmod.info') {
expand 'version' : project.version,
'mod_id' : project.property('mod_id'),
'mod_name' : project.property('mod_name')
}
}