@@ -9,10 +9,18 @@ version = '0.1.0'
99
1010java {
1111 toolchain {
12- languageVersion = JavaLanguageVersion . of(21 )
12+ languageVersion = JavaLanguageVersion . of(25 )
1313 }
1414}
1515
16+ // Mapping profile: selects which shim source dir is included in the main sourceSet.
17+ // Run gradle with -PparserProfile=legacy to build the 1.21.x flavor; default is 26x.
18+ ext. parserProfile = (project. findProperty(' parserProfile' ) ?: ' 26x' ). toString(). toLowerCase()
19+ if (parserProfile != ' legacy' && parserProfile != ' 26x' ) {
20+ throw new GradleException (" Unknown parserProfile: ${ parserProfile} (expected 'legacy' or '26x')" )
21+ }
22+ def profileSourceDir = parserProfile == ' legacy' ? ' src/profile-legacy/java' : ' src/profile-26x/java'
23+
1624repositories {
1725 mavenCentral()
1826 maven { url = uri(' https://libraries.minecraft.net' ) }
@@ -21,8 +29,8 @@ repositories {
2129
2230dependencies {
2331 implementation ' com.fasterxml.jackson.core:jackson-databind:2.18.3'
24- implementation ' org.ow2.asm:asm:9.7.1 '
25- implementation ' org.ow2.asm:asm-commons:9.7.1 '
32+ implementation ' org.ow2.asm:asm:9.9 '
33+ implementation ' org.ow2.asm:asm-commons:9.9 '
2634 implementation ' org.slf4j:slf4j-api:2.0.16'
2735 runtimeOnly ' org.slf4j:slf4j-simple:2.0.16'
2836 implementation ' org.apache.logging.log4j:log4j-api:2.24.3'
@@ -31,20 +39,23 @@ dependencies {
3139 implementation ' com.mojang:brigadier:1.0.18'
3240 implementation ' org.spongepowered:mixin:0.8.5'
3341 testImplementation ' org.junit.jupiter:junit-jupiter:5.11.4'
42+ testRuntimeOnly ' org.junit.platform:junit-platform-launcher'
3443}
3544
3645tasks. withType(Test ). configureEach {
3746 useJUnitPlatform()
3847 jvmArgs ' -noverify'
48+ systemProperty ' addonparser.profile' , parserProfile
3949}
4050
4151application {
4252 mainClass = ' com.cope.addonparser.cli.Main'
43- applicationDefaultJvmArgs = [' -noverify' ]
53+ applicationDefaultJvmArgs = [' -noverify' , " -Daddonparser.profile= ${ project.parserProfile } " ]
4454}
4555
4656tasks. named(' run' ) {
4757 jvmArgs ' -noverify'
58+ systemProperty ' addonparser.profile' , parserProfile
4859}
4960
5061sourceSets {
@@ -56,13 +67,13 @@ sourceSets {
5667
5768 main {
5869 java {
59- srcDirs + = [' src/generated/java' ]
70+ srcDirs + = [' src/generated/java' , profileSourceDir ]
6071 }
6172 }
6273}
6374
6475dependencies {
65- stubgenImplementation ' org.ow2.asm:asm:9.7.1 '
76+ stubgenImplementation ' org.ow2.asm:asm:9.9 '
6677 stubgenImplementation ' com.google.code.gson:gson:2.11.0'
6778}
6879
@@ -71,11 +82,15 @@ tasks.register('generateStubs', JavaExec) {
7182 mainClass = ' com.cope.addonparser.tools.StubGenerator'
7283 args ' --input-dir' , ' fixtures/addons/jars' ,
7384 ' --output-dir' , ' src/generated/java' ,
74- ' --manual-class-list' , ' tools/manual_classes.txt'
85+ ' --manual-class-list' , ' tools/manual_classes.txt' ,
86+ ' --manual-source-dirs' , files(' src/main/java' , profileSourceDir). asPath,
87+ ' --profile' , parserProfile
7588
7689 // Incremental support: declare inputs and outputs
7790 inputs. dir(' fixtures/addons/jars' )
7891 inputs. file(' tools/manual_classes.txt' )
92+ inputs. dir(' src/main/java' )
93+ inputs. dir(profileSourceDir)
7994 inputs. files(sourceSets. stubgen. output)
8095 outputs. dir(' src/generated/java' )
8196}
@@ -139,7 +154,8 @@ tasks.named('clean') {
139154// AP-009: Spotless configuration for Google Java Style on manual sources
140155spotless {
141156 java {
142- target ' src/main/java/**/*.java' , ' src/test/java/**/*.java' , ' src/stubgen/java/**/*.java'
157+ target ' src/main/java/**/*.java' , ' src/test/java/**/*.java' , ' src/stubgen/java/**/*.java' ,
158+ ' src/profile-legacy/java/**/*.java' , ' src/profile-26x/java/**/*.java'
143159 targetExclude ' src/generated/java/**'
144160 googleJavaFormat()
145161 removeUnusedImports()
0 commit comments