-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle
152 lines (131 loc) · 4.42 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
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url = "https://maven.minecraftforge.net/" }
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'scala'
apply plugin: 'idea'
version = project.mod_ver
group = project.mod_group
archivesBaseName = project.mod_name
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
compileJava.options.encoding = "UTF-8"
compileScala.options.encoding = "UTF-8"
compileJava.options.deprecation = false
compileScala.options.deprecation = false
minecraft {
version = "1.12.2-14.23.5.2847"
runDir = "run"
mappings = "snapshot_20180814"
}
repositories {
mavenCentral()
mavenLocal()
maven {
name = "chickenbones"
url = "http://chickenbones.net/maven"
}
maven {
name = "private"
url = "https://jitpack.io"
}
maven {
// location of the maven that hosts JEI files
name = "Progwml6 maven"
url = "http://dvs1.progwml6.com/files/maven"
}
maven {
// The main host of CraftTweaker related libs
name = "jared"
url = "http://maven.blamejared.com"
}
maven { url 'https://maven.mohistmc.com/' }
}
configurations {
provided
shade
deobfCompile.extendsFrom shade
}
dependencies {
// Shade dependencies
shade "com.github.LambdaInnovation:LambdaLib2:${project.lambdalib_ver}"
// Optional dependencies
deobfCompile "codechicken:CodeChickenLib:1.12.2-${project.ccl_ver}:universal"
deobfCompile "mezz.jei:jei_1.12.2:4.16.1.302"
deobfCompile "cofh:RedstoneFlux:1.12-2.0.0.1:universal"
deobfCompile "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.1.20.685"
deobfCompile "CraftTweaker2:CraftTweaker2-API:4.1.20.685"
deobfCompile "CraftTweaker2:ZenScript:4.1.20.685"
deobfCompile "net.industrial-craft:industrialcraft-2:2.8.222-ex112"
}
//sourceSets.main.compileClasspath += [configurations.provided]
sourceSets.main {
java.srcDirs = []
scala.srcDirs = ['src/main/scala', 'src/main/java']
}
idea {
module {
scopes.PROVIDED.plus += [configurations.provided]
sourceDirs = [file('src/main/java'), file('src/main/scala')]
}
}
task deobfJar(type: Jar, dependsOn: 'jar') {
classifier 'dev'
from sourceSets.main.output
manifest {
attributes 'FMLCorePluginContainsFMLMod': 'true'
attributes 'FMLCorePlugin': 'cn.lambdalib2.CorePlugin'
}
}
jar {
configurations.shade.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
exclude 'mcmod.info'
exclude 'pack.mcmeta'
}
}
manifest {
attributes 'FMLCorePluginContainsFMLMod': 'true'
attributes 'FMLCorePlugin': 'cn.lambdalib2.CorePlugin'
}
}
// http://www.minecraftforge.net/forum/topic/36791-trying-to-shade-dependencies-into-jar/
reobf {
jar {
// WARN: You can't shade apache httplib for several reasons
// 1. it introduces some transitive dependencies, including logging, which is no good
// 2. logging exploits a bug for srg (all .class calls' package names aren't transformed at all)
// extraLines "PK: org/apache/commons/codec cn/academy/shade/org/apache/commons/codec"
// extraLines "PK: org/apache/http cn/academy/shade/org/apache/http"
// extraLines "PK: org/apache/commons/logging cn/academy/shade/org/apache/commons/logging"
}
}
import org.apache.tools.ant.filters.ReplaceTokens
// see: https://stackoverflow.com/questions/30038540/replace-token-in-file-before-building-but-keep-token-in-sources
// Currently scala compilation task doesn't respect minecraft.replace options. We have to manually replace the tokens by ourselves.
// That also mean currently minecraft { replace ... } are all useless, but they are kept for future reference.
task mySourcesJava(type: Copy) {
from 'src/main/java'
into 'build/tempSourcesJava'
filteringCharset = 'UTF-8'
}
compileScala.dependsOn mySourcesJava
retromapReplacedMain.dependsOn compileScala
extractRangemapReplacedMain.dependsOn compileScala
artifacts {
archives deobfJar
}