-
Notifications
You must be signed in to change notification settings - Fork 40
/
gruntle_common.gradle
executable file
·145 lines (119 loc) · 3.94 KB
/
gruntle_common.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
ext.minecraft_version = '1.19.2'
ext.release_version = '1.19.2'
project.archivesBaseName = project.mod_name + "-" + project.platform_name
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
repositories {
mavenLocal()
maven {url "https://maven.vram.io"}
maven {url "https://maven.shedaniel.me/"}
maven {url "https://maven.terraformersmc.com/releases/"}
}
if (project.hasProperty('mod_version') && grgit != null) {
if(grgit.status().isClean()) {
project.version = project.getProperty('mod_version') + '.' + grgit.log().size()
} else {
project.version = project.getProperty('mod_version') + '.' + (grgit.log().size() + 1) + '-SNAPSHOT'
}
} else {
project.version = '99.0.0-LOCAL'
}
println "Building: ${group}:${project.archivesBaseName}:${project.version}"
if (!project.hasProperty('license_file')) {
ext.license_file = '../HEADER'
}
license {
header rootProject.file(project.license_file)
include '**/*.java'
}
if (!project.hasProperty('checkstyle_config')) {
ext.checkstyle_config = '../checkstyle.xml'
}
checkstyle {
configFile = rootProject.file(project.checkstyle_config)
toolVersion = "8.44"
}
tasks.withType(JavaCompile) {
it.options.encoding = "UTF-8"
it.options.release = 17
}
// We define this outside of the eclipse block because eclipse has it's own "project" instance
def eclipseName = project.mod_name + " " + project.platform_name + " " + project.minecraft_version
eclipse {
project {
name = eclipseName
}
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
jar {
// copy license notice to jar
from "LICENSE"
manifest {
attributes([
"Specification-Title": "${project.title}",
"Specification-Vendor": "${project.author}",
"Specification-Version": "${project.version}",
"Implementation-Title": "${project.archivesBaseName}",
"Implementation-Version": "${project.version}",
"Implementation-Vendor" : "${project.author}",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
curseforge {
if (project.hasProperty("curseforge_api_key") && project.hasProperty('curseforge_id')) {
apiKey = project.properties.curseforge_api_key
project {
id = project.properties.curseforge_id
releaseType = project.release_type
addGameVersion project.release_version
addGameVersion project.platform_name.capitalize()
if (project.platform_name.equals("fabric")) {
addGameVersion "Quilt"
}
changelog = "A changelog can be found at https://github.com/${github_repository_owner}/${github_repository}/commits"
mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"))
if (project.hasProperty("required_dep_slugs") || project.hasProperty("embedded_lib_slugs") || project.hasProperty("optional_dep_slugs") || project.hasProperty("compatible_tool_slugs") || project.hasProperty("incompatible_slugs")) {
relations {
if (project.hasProperty("required_dep_slugs")) {
project.required_dep_slugs.split(", ").each { String slug ->
requiredDependency slug
}
}
if (project.hasProperty("embedded_lib_slugs")) {
project.embedded_lib_slugs.split(", ").each { String slug ->
embeddedLibrary slug
}
}
if (project.hasProperty("optional_dep_slugs")) {
project.optional_dep_slugs.split(", ").each { String slug ->
optionalDependency slug
}
}
if (project.hasProperty("compatible_tool_slugs")) {
project.compatible_tool_slugs.split(", ").each { String slug ->
tool slug
}
}
if (project.hasProperty("incompatible_slugs")) {
project.incompatible_slugs.split(", ").each { String slug ->
incompatible slug
}
}
}
}
afterEvaluate {
uploadTask.dependsOn remapJar
}
}
options {
forgeGradleIntegration = false
javaVersionAutoDetect = false
}
}
}