Skip to content

Commit c4694c7

Browse files
committed
Update to target java 25
1 parent 46b6af7 commit c4694c7

2 files changed

Lines changed: 31 additions & 23 deletions

File tree

build.gradle

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group = 'org.moddingx'
9-
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
9+
java.toolchain.languageVersion = JavaLanguageVersion.of(25)
1010

1111
configurations {
1212
lib
@@ -33,8 +33,8 @@ repositories {
3333
}
3434

3535
dependencies {
36-
lib 'org.ow2.asm:asm:9.8'
37-
lib 'org.ow2.asm:asm-tree:9.8'
36+
lib 'org.ow2.asm:asm:9.9.1'
37+
lib 'org.ow2.asm:asm-tree:9.9.1'
3838
libImpl 'jakarta.annotation:jakarta.annotation-api:3.0.0'
3939
libImpl 'net.sf.jopt-simple:jopt-simple:5.0.4'
4040
implementation sourceSets.lib.output
@@ -51,39 +51,46 @@ gradlePlugin {
5151
}
5252
}
5353

54-
jar {
54+
tasks.named('jar', Jar).configure { task ->
5555
from sourceSets.lib.output
56-
manifest {
56+
task.manifest {
5757
attributes 'Main-Class': application.mainClass.get()
5858
}
5959
}
6060

61-
task fatjar(type: Jar) {
61+
var fatJar = tasks.register('fatjar', Jar) { task ->
6262
archiveClassifier = 'fatjar'
63-
manifest = jar.manifest
64-
with jar
65-
}
66-
build.dependsOn fatjar
63+
manifest = tasks.named('jar', Jar).get().manifest
64+
with tasks.named('jar', Jar).get()
6765

68-
task configureFatJar {
69-
doLast {
70-
configurations.libResolvable.each { dep ->
71-
fatjar.from(project.zipTree(dep)) {
72-
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'module-info.class'
73-
duplicatesStrategy DuplicatesStrategy.INCLUDE
74-
}
66+
configurations.runtimeClasspath.each { dep ->
67+
task.from(project.zipTree(dep)) {
68+
exclude 'META-INF/MANIFEST.MF', 'META-INF/INDEX.LIST'
69+
exclude 'module-info.class', 'META-INF/versions/*/module-info.class'
70+
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/SIG-*'
71+
exclude 'META-INF/README*', 'META-INF/LICENSE*', 'META-INF/NOTICE*'
72+
exclude 'META-INF/readme*', 'META-INF/license*', 'META-INF/notice*'
73+
duplicatesStrategy DuplicatesStrategy.FAIL
74+
}
75+
task.from(project.zipTree(dep)) {
76+
include 'META-INF', 'META-INF/**', 'module-info.class'
77+
into "META-INF/libraries/${dep.name.replaceAll('\\.jar$', '')}/"
78+
duplicatesStrategy DuplicatesStrategy.FAIL
7579
}
7680
}
77-
outputs.upToDateWhen { false }
7881
}
79-
fatjar.dependsOn configureFatJar
8082

81-
task sourcesJar(type: Jar, dependsOn: classes) {
83+
var sourcesJar = tasks.register('sourcesJar', Jar) {
8284
archiveClassifier = 'sources'
8385
from sourceSets.lib.allSource
8486
from sourceSets.main.allSource
87+
dependsOn tasks.named('classes')
88+
}
89+
90+
tasks.named('build').configure { task ->
91+
task.dependsOn fatJar
92+
task.dependsOn sourcesJar
8593
}
86-
build.dependsOn sourcesJar
8794

8895
publishing {
8996
publications {

src/main/java/org/moddingx/ljc/LanguageLevel.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ public enum LanguageLevel {
3333
JAVA_21(21, Opcodes.ASM9, Opcodes.V21, 'L', DynamicSwitchPatterns::new, MatchExceptionFixer::new),
3434
JAVA_22(22, Opcodes.ASM9, Opcodes.V22, 'M'),
3535
JAVA_23(23, Opcodes.ASM9, Opcodes.V23, 'N'),
36-
JAVA_24(24, Opcodes.ASM9, Opcodes.V24, 'O');
37-
36+
JAVA_24(24, Opcodes.ASM9, Opcodes.V24, 'O'),
37+
JAVA_25(25, Opcodes.ASM9, Opcodes.V25, 'P');
38+
3839
private static final int TARGET_ASM = Opcodes.ASM9;
3940

4041
public final int version;

0 commit comments

Comments
 (0)