-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
102 lines (89 loc) · 3.21 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
plugins {
id 'java-library'
id 'maven-publish'
id 'idea'
id 'checkstyle'
id 'net.neoforged.moddev' version '0.1.+'
}
if (file('../.etc/srscode-MC.gradle').exists()) { apply from:'../.etc/srscode-MC.gradle' }
base.archivesName.set lib_name
java{
withSourcesJar()
toolchain.languageVersion = JavaLanguageVersion.of(21)
}
checkstyle {
setConfig resources.text.fromUri('https://srscode.github.io/checkstyle/srsCode-NF-checkstyle-J11+.xml')
setReportsDir layout.buildDirectory.get().dir('reports').dir('checkstyle').asFile
setToolVersion '10.12.5'
}
tasks.withType(Checkstyle).configureEach {
it.reports.xml.required = false
it.reports.html.required = true
}
repositories {mavenLocal()}
neoForge.version = project.neo_version
tasks.withType(JavaCompile).configureEach {options.encoding = 'UTF-8'}
tasks.withType(Jar).configureEach {
from 'LICENCE.txt'
manifest.attributes([
'Implementation-Vendor' : "srsCode",
'Implementation-Title' : "${base.archivesName.get()}",
'Implementation-Version' : "${project.version}",
'Build-Jdk' : "${System.properties['java.vendor']} ${System.properties['java.vm.version']}",
'Build-Timestamp' : java.time.OffsetDateTime.now() as String,
"FMLModType" : "GAMELIBRARY"
])
}
// A task to partially clean build outputs while leaving cached artifacts alone
tasks.create('cleanOutputs', Delete).configure {cotask ->
tasks.getByName('assemble').configure {mustRunAfter(cotask)}
doFirst {targetFiles.each {project.logger.lifecycle "cleaning: $it.canonicalPath"}}
delete(tasks.withType(JavaCompile).collect {it.outputs.files.files}.flatten())
var libs = layout.buildDirectory.get().getAsFile().toPath().resolve("libs").toFile()
if (libs.exists()) {delete(libs.listFiles())}
}
// A task to execute a clean build
tasks.create('cleanBuild') {
dependsOn 'cleanOutputs', 'build'
}
idea.module {
downloadSources = true
downloadJavadoc = true
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
artifact sourcesJar
version project.version
groupId = project.group
artifactId = base.archivesName.get()
pom {
name = base.archivesName.get()
description = 'A common Minecraft mod library for srsCode mods.'
url = 'https://github.com/srsCode/srsLib'
licenses {
license {
name = 'MIT license'
url = 'https://mit-license.org/'
distribution = 'repo'
}
}
scm {
url = 'https://github.com/srsCode/srsLib'
connection = 'scm:git:https://github.com/srsCode/srsLib.git'
developerConnection = 'scm:git:[email protected]:srsCode/srsLib.git'
}
issueManagement {
system = 'GitHub Issues'
url = 'https://github.com/srsCode/srsLib/issues'
}
}
}
}
repositories {
maven {
mavenLocal()
}
}
}