forked from TerminatorNL/LagGoggles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
128 lines (103 loc) · 3.34 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
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath "com.wynprice.cursemaven:CurseMaven:1.1.0"
}
}
String LagGogglesVersion = "1.12.2-5.8-LP"
boolean installIntoServer = hasProperty("isServer")
String version_file = "./build/last_version.txt"
String last_file_name = "./build/last_file_name.txt"
String last_file_path = "./build/last_file_path.txt"
if(project.gradle.startParameter.taskNames.contains("build")) {
delete version_file
delete last_file_name
delete last_file_path
}
apply plugin: 'net.minecraftforge.gradle.forge'
// EZ testing of compatibility! Nice!
apply plugin: "com.wynprice.cursemaven"
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
idea{
module{
inheritOutputDirs = false
outputDir = compileJava.destinationDir
testOutputDir = compileTestJava.destinationDir
}
}
ext.GetCommitCount = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-list', '--all', '--count'
standardOutput = stdout
}
return stdout.toString().trim()
}
version = LagGogglesVersion + "-" + GetCommitCount.call()
group= "com.github.terminatornl.laggoggles" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "LagGoggles"
sourceCompatibility = targetCompatibility = "1.8" // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = "1.8"
options.fork = true
options.forkOptions.executable = 'javac'
options.compilerArgs << "-XDignore.symbol.file"
}
minecraft {
version = "1.12.2-14.23.5.2847"
runDir = "run"
replaceIn "Main.java"
replace '${version}', project.version
mappings = "snapshot_20180808"
}
configurations {
compileOnly.transitive = false
}
repositories {
mavenLocal() // developers can run the publishToMavenLocal task on TickCentral to use it here
mavenCentral()
flatDir {
dirs 'libs'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
}
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
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
task finalize << {
new File(projectDir, version_file).text = version
new File(projectDir, last_file_name).text = jar.archiveName
new File(projectDir, last_file_path).text = jar.archivePath
if(installIntoServer) {
delete fileTree('run_server_obf/mods') {
include 'LagGoggles*'
}
println("Copying " + jar.archivePath + " into run_server_obf/mods")
copy {
from jar.archivePath
into "run_server_obf/mods"
}
}
}
build.finalizedBy(finalize)