-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
124 lines (101 loc) · 3.02 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
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceSets.main{
java{
srcDirs = ['src/main/java']
}
resources{
srcDirs = ['src/main/resources']
}
}
ext.configFile = file "build.properties"
configFile.withReader {
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}
version = config.mod_version
group= "me.superckl.biometweakercore"
archivesBaseName = "BiomeTweakerCore"
minecraft {
version = config.minecraft_version + "-" + config.forge_version
mappings = config.mcp_mappings
replaceIn "util/ModData.java"
replace "@VERSION@", "${config.mod_version}.${System.env.BUILD_NUMBER ?: 0}"
replace "@FINGERPRINT@", "${System.env.sha1_fingerprint ?: "N/A"}"
runDir = "eclipse"
}
version = "${config.minecraft_version}-${config.mod_version}.${System.getenv("BUILD_NUMBER") ?: 0}"
dependencies {
compile "org.projectlombok:lombok:" + config.lombok_version
}
processResources
{
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
task devJar(type: Jar, dependsOn: 'classes') {
from(sourceSets.main.output) {
include '**'
}
extension = 'jar'
classifier = 'dev'
manifest {
attributes 'FMLCorePlugin': config.core_path
}
}
artifacts {
archives devJar
}
jar {
manifest {
attributes 'FMLCorePlugin': config.core_path
}
}
tasks.build.dependsOn('signJar')
ext.keystore_location = "${System.env.keystore_location ?: "."}"
ext.keystore_password = "${System.env.keystore_password ?: ""}"
ext.keystore_alias = "${System.env.keystore_alias ?: ""}"
task signJar(dependsOn: ["reobfJar"]) {
inputs.dir jar.destinationDir
inputs.file keystore_location
inputs.property "keystore_alias", keystore_alias
inputs.property "keystore_password", keystore_password
outputs.dir jar.destinationDir
// only sign if the keystore exists
onlyIf {
return keystore_location != "." && keystore_password != ""
}
// the actual action.. sign the jar.
doLast {
jar.destinationDir.eachFile { file ->
if (!file.getPath().endsWith(".${System.env.BUILD_NUMBER ?: 0}.jar") && !file.getPath().endsWith(".${System.env.BUILD_NUMBER ?: 0}-dev.jar"))
return; // skip non-jars
logger.lifecycle "signing $file"
ant.signjar(
destDir: file.getParentFile(), // same place it came from
jar: file,
keystore: keystore_location,
alias: keystore_alias,
storepass: keystore_password
)
}
}
}