-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.gradle
More file actions
90 lines (79 loc) · 2.37 KB
/
build.gradle
File metadata and controls
90 lines (79 loc) · 2.37 KB
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
plugins {
id 'java-library'
id 'maven-publish'
id 'io.papermc.paperweight.userdev' version '2.0.0-beta.19'
}
ext.majorVersion = 7
ext.minorVersion = 0
ext.minecraftVersion = "1.21.8"
java {
toolchain.languageVersion = JavaLanguageVersion.of(21)
}
// Suppiled by Jenkins
ext.buildNumber = System.env.BUILD_NUMBER == null ? "x" : "$System.env.BUILD_NUMBER"
ext.mavenDirectory = System.env.MAVEN_DIR == null ? "$projectDir/repo" : "$System.env.MAVEN_DIR"
// Version used for distribution. Different from maven repo
group = "cat.nyaa"
version = "$majorVersion.$minorVersion.$buildNumber"
// Base name for archives (Gradle 9 compatible)
base {
archivesName = "Yasui-mc$minecraftVersion"
}
repositories {
mavenCentral()
maven { name 'PaperMC'; url 'https://repo.papermc.io/repository/maven-public/' }
}
dependencies {
// Paper development bundle - includes API + NMS with Mojang mappings
// Do NOT add Paper API separately - dev bundle includes it
paperweight.paperDevBundle("$minecraftVersion-R0.1-SNAPSHOT")
// ASM is required by the agent at runtime; bundle into the plugin jar
implementation "org.ow2.asm:asm:9.7.1"
}
compileJava {
options.compilerArgs += ["-Xlint:deprecation"]
options.encoding = 'UTF-8'
}
// Reobfuscate for production - converts Mojang mappings to Spigot for server compatibility
assemble {
dependsOn(reobfJar)
}
// publications
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes(
'Agent-Class': 'cat.nyaa.yasui.agent.YasuiAgent',
'Can-Redefine-Classes': 'true',
'Can-Retransform-Classes': 'true'
)
}
from {
configurations.runtimeClasspath.findAll { it.name.startsWith("asm-") }.collect { it.isDirectory() ? it : zipTree(it) }
}
}
processResources { // modify version string
filesMatching("**/plugin.yml") {
expand 'version': project.version
}
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact sourcesJar
groupId "cat.nyaa"
artifactId "yasui"
version "$majorVersion.$minorVersion-SNAPSHOT"
from components.java
}
}
repositories {
maven {
url "${mavenDirectory}"
}
}
}