This repository has been archived by the owner on Sep 16, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathbuild.gradle
191 lines (168 loc) · 5.98 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
plugins {
id 'scala'
id 'maven-publish'
id 'org.ajoberstar.grgit' version '5.0.0-rc.3'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'net.minecraftforge.gradle' version '5.1.+'
}
version = getVersion()
group = 'net.minecraftforge'
java {
toolchain.languageVersion = JavaLanguageVersion.of(17)
withSourcesJar()
}
sourceSets {
example {}
}
minecraft {
// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'official', version: "${mc_version}"
runs {
client {
// recommended logging data for a userdev environment
properties 'forge.logging.markers': 'REGISTRIES'
// recommended logging level for the console
properties 'forge.logging.console.level': 'debug'
workingDirectory project.file('run').canonicalPath
mods {
scorge {
source sourceSets.main
}
scorgetest {
source sourceSets.example
}
}
}
server {
// recommended logging data for a userdev environment
properties 'forge.logging.markers': 'REGISTRIES'
// recommended logging level for the console
properties 'forge.logging.console.level': 'debug'
workingDirectory project.file('run').canonicalPath
mods {
scorge {
source sourceSets.main
}
scorgetest {
source sourceSets.example
}
}
}
project.afterEvaluate {
// Fix scala's broken module artifacts
def path = configurations.minecraftLibrary.resolvedConfiguration
.resolvedArtifacts
.findAll { it.moduleVersion.id.group == 'org.scala-lang' }
.collect { it.file.name }
.join(',')
configureEach { run ->
run.property('mergeModules', path)
}
}
}
}
configurations {
shade
minecraftLibrary.extendsFrom shade
apiElements.extendsFrom shade
exampleImplementation.extendsFrom implementation
}
repositories {
mavenCentral()
}
dependencies {
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
shade "org.scala-lang:scala3-library_3:${scala_lib}"
}
jar {
archiveClassifier.set('slim')
manifest {
attributes([
'FMLModType': 'LANGPROVIDER',
'Automatic-Module-Name': 'scorge'
])
attributes(['Specification-Title': 'Mod Language Provider',
'Specification-Vendor': 'Forge',
'Specification-Version': '1.0',
'Implementation-Title': 'Scorge',
'Implementation-Version': getVersion(),
'Implementation-Vendor' :'Scorge',
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'Git-Commit': grgit.head().abbreviatedId,
'Git-Branch': grgit.branch.current().getName() ],
'net/minecraftforge/scorge/lang/')
}
}
shadowJar {
classifier = ''
configurations = [ project.configurations.shade ]
}
tasks.whenTaskAdded {
// Fight ForgeGradle and Forge crashing when MOD_CLASSES don't exist
if (name == "prepareRuns") {
doFirst {
sourceSets.main.output.files.forEach(File::mkdirs)
}
}
}
tasks.assemble.dependsOn shadowJar
afterEvaluate {
// ShadowRuntimeElements takes care of the runtime variant, we don't need the default one
components.java.withVariantsFromConfiguration(configurations.runtimeElements) { skip() }
}
publishing {
publications {
maven(MavenPublication) { publication ->
from components.java
pom {
name = 'Scorge'
description = 'The offical Scala language loader for Forge'
url = 'https://github.com/MinecraftForge/Scorge/'
scm {
url = 'https://github.com/MinecraftForge/Scorge'
connection = 'scm:git:git://github.com/MinecraftForge/scorge.git'
developerConnection = 'scm:git:git@github.com:MinecraftForge/scorge.git'
}
issueManagement {
system = 'github'
url = 'https://github.com/MinecraftForge/Scorge/issues'
}
licenses {
license {
name = 'LGPLv2.1'
url = 'https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt'
}
}
developers {
developer {
id = 'illyohs'
name = 'Anthony Anderson'
}
}
}
}
}
repositories {
maven {
credentials {
username project.properties.forgeMavenUser?:'fake'
password project.properties.forgeMavenPassword?:'news'
}
url 'http://maven.minecraftforge.net/manage/upload'
}
}
}
def getVersion()
{
String base_number = "${mod_version}"
if (System.hasProperty("BUILD_NUMBER").toString())
{
return base_number + "." + System.getenv("BUILD_NUMBER").toString()
} else {
return base_number + ".${grgit.head().abbreviatedId}"
}
}