-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
159 lines (135 loc) · 4.04 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
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardCopyOption
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://plugins.gradle.org/m2' }
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath ('com.anatawa12.forge:ForgeGradle:1.2-1.1.1') {
changing = true
}
}
}
plugins {
id "com.modrinth.minotaur" version "2.8.7"
// It's safest to have this on 2.+ to get the latest features and
// bug fixes without having to worry about breaking changes.
}
apply plugin: 'forge'
version = mod_version
compileJava.options.encoding = 'UTF-8'
java.sourceCompatibility = java.targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
minecraft {
version = "1.7.10-10.13.4.1614-1.7.10"
runDir = "run"
replace "@@VERSION@@", project.version
if(project.gradle.startParameter.taskNames.size() > 0 && project.gradle.startParameter.taskNames.first().startsWith("run"))
replace "@@ENVIRONMENT@@", "deobf"
else
replace "@@ENVIRONMENT@@", "obf"
}
repositories {
gradlePluginPortal()
maven {
name = 'ModMaven'
url = 'https://modmaven.dev'
}
maven {
url = 'https://www.cursemaven.com/'
}
}
dependencies {
compileOnly 'curse.maven:baubles-227083:2224857'
compileOnly 'curse.maven:thaumcraft-223628:2227552'
implementation 'codechicken:CodeChickenCore:1.7.10-1.0.4.29:dev'
compileOnly 'codechicken:CodeChickenCore:1.7.10-1.0.4.29:src'
implementation 'codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev'
compileOnly 'codechicken:CodeChickenLib:1.7.10-1.1.3.140:src'
implementation 'codechicken:NotEnoughItems:1.7.10-1.0.3.74:dev'
compileOnly 'codechicken:NotEnoughItems:1.7.10-1.0.3.74:src'
compileOnly 'curse.maven:TravellersGear-224440:2262113'
}
processResources {
inputs.property "version", mod_version
inputs.property "credits", credits
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand (
mod_id: mod_id,
version: mod_version,
credits: credits
)
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
jar {
manifest {
attributes([
"Implementation-Title" : project.name,
"Implementation-Version" : project.version,
"FMLCorePluginContainsFMLMod": "true",
"FMLCorePlugin": "net.toshayo.tokanocreations.TokanoCreationsPlugin",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
build {
doLast {
if(project.hasProperty("TOSHAYO_JKS")) {
println "Using Project properties for jar signing."
def jks_file = TOSHAYO_JKS
def passwd = TOSHAYO_PWD
if (jks_file != null && passwd != null) {
//noinspection HttpUrlsUsage
def exec_line = [
"jarsigner",
"-sigalg", "SHA256withECDSA",
"-digestalg", "SHA-256",
"-keystore", jks_file,
"-storepass", passwd,
"-tsa", "http://timestamp.digicert.com",
jar.archiveFile.get(), TOSHAYO_APP_ALIAS
].execute()
exec_line.waitFor()
if(exec_line.exitValue() != 0) {
throw new RuntimeException("Signing failed!")
}
}
} else {
println 'No signing secrets found, build will not be signed.'
}
}
}
modrinth {
token = project.TOSHAYO_MODRINTH
projectId = "tokanocreations"
versionName = project.archivesBaseName + "_1.7.10_" + project.mod_version
versionNumber = project.mod_version
versionType = "release"
uploadFile = jar.archiveFile.get()
gameVersions = ["1.7.10"]
loaders = ["forge"]
if (Files.exists(Paths.get("changelog"))) {
changelog = String.join("\r\n", Files.readAllLines(Paths.get("changelog")))
tasks.modrinth.doLast {
Files.move(Paths.get("changelog"), Paths.get("changelog.bak"), StandardCopyOption.REPLACE_EXISTING)
Files.createFile(Paths.get("changelog"))
}
}
}
tasks.modrinth {
doFirst {
def tag_checker = ["git", "tag", "-l", "v" + mod_version].execute()
tag_checker.waitFor()
if(tag_checker.text.trim() != "v" + mod_version) {
throw new RuntimeException("Version not tagged!")
}
}
}
tasks.modrinth.dependsOn(build)