-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
190 lines (172 loc) · 5.44 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
plugins {
id 'idea'
id 'eclipse'
id 'maven-publish'
id 'org.ec4j.editorconfig'
id 'net.minecraftforge.gradle'
id 'org.parchmentmc.librarian.forgegradle'
}
//=============================================
editorconfig {
excludes = ['**/run/**', '**/out/**', '**/.idea/**', '**/gradlew*']
excludeNonSourceFiles = true
}
group = "${project.lib_group}"
version = "${project.mc_version}-${project.lib_version}"
archivesBaseName = "${project.lib_name}"
if (System.getenv('RELEASE_TYPE') != null) {
status = System.getenv('RELEASE_TYPE').toLowerCase()
if (status == 'snapshot') status = status.toUpperCase()
version = "${version}-${status}"
}
java {
withSourcesJar()
withJavadocJar()
archivesBaseName = project.archivesBaseName
toolchain {
languageVersion = JavaLanguageVersion.of(project.java_version)
vendor = JvmVendorSpec.ADOPTOPENJDK
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
minecraft {
mappings channel: "${project.mappings_channel}", version: "${project.mappings_version}"
}
configurations {
deobfJar {
canBeConsumed = true
canBeResolved = false
}
}
repositories {
mavenLocal()
mavenCentral()
maven {
name = 'Minecraftschurli Maven'
url = 'https://minecraftschurli.ddns.net/repository/maven-public'
}
}
dependencies {
minecraft group: 'net.minecraftforge', name: 'forge', version: "${project.mc_version}-${project.forge_version}"
compileOnly 'org.jetbrains:annotations:23.0.0'
}
javadoc {
options.encoding = 'UTF-8'
options.tags = [
'side:a:Side:',
'apiNote:a:API Note:',
'implSpec:a:Implementation Requirements:',
'implNote:a:Implementation Note:'
]
if(JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
jar {
finalizedBy('reobfJar')
}
task deobfJar(type: Jar, dependsOn: classes) {
archiveClassifier.set('deobf')
from sourceSets.main.output
}
tasks.withType(Jar) {
from 'LICENSE'
manifest {
attributes([
'Specification-Title' : archivesBaseName,
'Specification-Vendor' : "${project.lib_vendor}",
'Specification-Version' : '1',
'Implementation-Title' : archivesBaseName,
'Implementation-Version': "${project.lib_version}",
'Implementation-Vendor' : "${project.lib_vendor}",
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
'Built-On' : "${project.mc_version}-${project.forge_version}",
'Timestamp' : new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'FMLModType' : 'GAMELIBRARY',
'LICENSE' : 'MIT'
])
}
}
artifacts {
archives jar
archives deobfJar
archives sourcesJar
archives javadocJar
deobfJar(deobfJar)
}
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
publishing {
publications.create(project.archivesBaseName+'ToMaven', MavenPublication) {
artifacts = [deobfJar]
groupId = project.group
artifactId = project.archivesBaseName
version = project.version
from components.java
pom {
name = project.name
url = project.url
packaging = 'jar'
scm {
connection = "scm:git:git://github.com/${project.github}.git"
developerConnection = "scm:git:[email protected]:${project.github}.git"
url = "https://github.com/${project.github}"
}
issueManagement {
system = 'github'
url = "https://github.com/${project.github}.git/issues"
}
organization {
name = 'Minecraftschurli Mods'
url = 'https://github.com/Minecraftschurli'
}
developers {
developer {
id = 'minecraftschurli'
name = 'Minecraftschurli'
email = '[email protected]'
organization = 'Minecraftschurli Mods'
organizationUrl = 'https://github.com/Minecraftschurli'
timezone = 'Europe/Vienna'
}
}
licenses {
license {
name = 'MIT'
url = "https://github.com/${project.github}/blob/main/LICENSE"
distribution = 'repo'
}
}
withXml {
asNode().dependencies.dependency.each { dep ->
if(dep.version.last().value().last().contains('_mapped_')) {
assert dep.parent().remove(dep)
}
}
}
}
}
repositories {
maven {
if (
(System.getenv("MAVEN_USER") != null) &&
(System.getenv("MAVEN_PASSWORD") != null) &&
(System.getenv("MAVEN_URL") != null)
) {
url System.getenv("MAVEN_URL")
credentials {
username System.getenv("MAVEN_USER")
password System.getenv("MAVEN_PASSWORD")
}
} else {
url "$buildDir/repo"
}
}
}
}
publish {
dependsOn check
}