-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle
161 lines (132 loc) · 4.68 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
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
maven { url = "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'com.wynprice.cursemaven:CurseMaven:1.2.3'
classpath "com.github.jengelman.gradle.plugins:shadow:1.2.3"
classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.4.0"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.15.1"
}
}
apply plugin: "com.jfrog.artifactory"
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: "com.wynprice.cursemaven"
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: "com.matthewprenger.cursegradle"
repositories {
maven { url = "http://artifactory.terasology.org/artifactory/virtual-repo-live" }
}
artifactory {
contextUrl = 'http://artifactory.terasology.org/artifactory/virtual-repo-live'
}
version = mod_version
group = "gliby.minecraft.physics"
archivesBaseName = "glibysphysics"
sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
version = "1.12.2-14.23.5.2768"
runDir = "run"
mappings = "snapshot_20171003"
makeObfSourceJar = false
replace "@VERSION@", project.version
replace "@MC_VERSION@", version
}
dependencies {
compileOnly curse.resolve("dynamic-lights", "2563244")
compile group: 'org.apache.commons', name: 'commons-math3', version: '3.0'
compile(group: 'org.terasology', name: 'TeraMath', version: '1.5.1-20181008.021553-1') {
exclude group: 'com.google.guava', module: 'guava'
}
compile(group: 'org.terasology', name: 'native-bullet', version: '0.2.13-20200106.050344-1') {
exclude group: 'com.google.guava', module: 'guava'
}
compile files('lib/nativebullet-natives.jar')
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version': project.version, 'mcversion': project.minecraft.version
}
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
jar {
manifest {
attributes 'FMLAT': 'GlibysPhysics_at.cfg'
}
}
// Shading
shadowJar {
classifier = ''
relocate 'org.apache.commons.math3', "${project.group}.shadow.org.apache.commons.math3"
relocate 'org.slf4j', "${project.group}.shadow.org.slf4j"
}
reobf {
shadowJar { mappingType = 'SEARGE' }
}
tasks.build.dependsOn reobfShadowJar
artifacts {
archives shadowJar
archives sourceJar
}
curseforge {
if (project.hasProperty('curseforge_key')) {
apiKey = project.curseforge_key
}
//noinspection GroovyAssignabilityCheck
project {
id = project.projectId
releaseType = project.curse_type
changelog = "Changes."
if (project.hasProperty("curseforge_key")) {
changelog = getChanges()
changelogType = "markdown"
}
mainArtifact(jar) {
displayName = String.format("%s %s", getModName(), mod_version)
logger.lifecycle("Prepared CurseForge artifact: " + displayName)
relations {
optionalDependency 'dynamic-lights'
}
}
}
}
def getChanges() {
String patchNotesDir = '.patchnotes'
File changesFile = new File(patchNotesDir + File.separator + mod_version + ".MD")
if (changesFile.exists()) {
String text = changesFile.getText("UTF-8")
logger.lifecycle(String.format("Processed changes from %s", patchNotesDir))
logger.lifecycle(text)
return text
}
return ""
}
def getModName() {
// Get mod name
def modInfoLocation = sourceSets.main.resources.srcDirs.iterator().next().toString() + File.separator + "mcmod.info"
println modInfoLocation
def modInfo = new File(modInfoLocation)
if (modInfo.exists()) {
def parsedJson = new groovy.json.JsonSlurper().parseText(modInfo.getText("UTF-8"))
return parsedJson.name[0]
}
return ""
}
// For users using IntelliJ IDEA
// Quoting Tamaized#7311
// "Forge has an issue with a default setting that came with 2019.2. go to Settings -> Build, Execution, Deployment -> Build Tools -> Gradle: and change build and run to use Intellij not Gradle. This fixes your resources."