-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
executable file
·129 lines (110 loc) · 3.45 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
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
apply plugin: 'forge'
apply plugin: 'maven'
// Extended project information
ext.projectName = 'ModPatcher'
ext.inceptionYear = '2014'
ext.packaging = 'jar'
ext.url = 'http://nallar.me/minecraft'
ext.description = 'Mod Patcher'
ext.organization = 'nallar.me'
ext.mcVersion = '1.7.10'
ext.forgeVersion = "10.13.4.1481"
ext.fullForgeVersion = mcVersion + "-" + forgeVersion + "-" + mcVersion
minecraft {
version = fullForgeVersion
runDir = "eclipse/assets"
}
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
version = mcVersion + '-SNAPSHOT'
group = 'me.nallar'
archivesBaseName = 'ModPatcher'
// Define variables
ext.buildNumber = System.getenv("BUILD_NUMBER") ?: 0
ext.ciSystem = System.getenv("JENKINS_URL") ? 'Jenkins' : 'unknown'
ext.commit = System.getenv("GIT_COMMIT") ?: 'unknown'
repositories {
mavenCentral()
maven { url 'https://repo.nallar.me/' }
}
configurations {
all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
provided
compile.extendsFrom provided
}
dependencies {
compile group: 'me.nallar', name: 'JavaPatcher', version: '1.3', changing: false
compile 'org.javassist:javassist:3.18.2-GA'
}
if (System.env.GRADLE_USER_HOME) {
ext.homeDir = System.env.GRADLE_USER_HOME + '/'
} else {
ext.homeDir = System.properties['user.home'] + '/.gradle/'
}
ext.mappingsPath = homeDir + 'caches/minecraft/net/minecraftforge/forge/' + fullForgeVersion + '/unpacked/conf/'
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from((configurations.runtime - configurations.provided).filter { it.exists() }.collect {
it.isDirectory() ? it : zipTree(it)
}) {
exclude "META-INF/**"
}
from mappingsPath + 'packaged.srg'
from mappingsPath + 'methods.csv'
from mappingsPath + 'fields.csv'
from './generated/extendsMap.obj'
}
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, 'name': project.projectName
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' }
}
// Source compiler configuration
tasks.withType(JavaCompile) {
options.compilerArgs += ['-Xlint:all', '-Xlint:-path']
options.deprecation = true
options.encoding = 'utf8'
}
import me.nallar.mappingsgenerator.Main;
afterEvaluate {
project.tasks.deobfBinJar.doLast { task ->
Main.generateMappings(task.getOutJar(), false)
}
project.tasks.extractMinecraftSrc.doLast { task ->
Main.generateMappings(file("./build/tmp/recompSrc"), true)
}
}
jar.manifest.mainAttributes(
"Built-By": System.properties['user.name'],
"Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
"Implementation-Title": name,
"Implementation-Version": version + "+" + ciSystem + "-b" + buildNumber + ".git-" + commit,
"Implementation-Vendor": url,
"FMLCorePlugin": "me.nallar.modpatcher.CoreMod"
)