Skip to content

Commit c7d9b5d

Browse files
authored
Merge pull request #2 from MCDxAI/legacy-followup
Support profile-specific fixture suites
2 parents 3912bf6 + 024af3d commit c7d9b5d

60 files changed

Lines changed: 596 additions & 1042 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- master
99
paths:
1010
- 'src/**'
11+
- 'fixtures/**'
1112
- 'build.gradle*'
1213
- 'settings.gradle*'
1314
- 'gradle/**'
@@ -16,6 +17,7 @@ on:
1617
pull_request:
1718
paths:
1819
- 'src/**'
20+
- 'fixtures/**'
1921
- 'build.gradle*'
2022
- 'settings.gradle*'
2123
- 'gradle/**'
@@ -31,11 +33,13 @@ concurrency:
3133

3234
jobs:
3335
test:
34-
name: Download Fixtures And Run Tests
36+
name: Test (${{ matrix.profile }})
3537
runs-on: ubuntu-latest
36-
timeout-minutes: 45
37-
env:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
timeout-minutes: 30
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
profile: [26x, legacy]
3943

4044
steps:
4145
- name: Check out repository
@@ -52,42 +56,19 @@ jobs:
5256
with:
5357
gradle-version: "9.4.1"
5458

55-
- name: Set up Python
56-
uses: actions/setup-python@v5
57-
with:
58-
python-version: "3.12"
59-
60-
- name: Sync addon source repos
61-
run: python tools/download_latest_release_jars.py --update
62-
63-
- name: Download latest release fixture jars
64-
run: gradle downloadLatestReleaseJars --no-daemon
59+
- name: Run test suite
60+
run: gradle test --no-daemon -PautoGenerateStubs -PparserProfile=${{ matrix.profile }}
6561

66-
- name: Run 26x test suite
67-
run: gradle test --no-daemon -PautoGenerateStubs -PparserProfile=26x
68-
69-
- name: Generate 26x JSON output
62+
- name: Generate JSON output
7063
run: >
71-
gradle run --no-daemon -PparserProfile=26x
72-
--args="--input fixtures/addons/jars --output output/poc-scan --summary output/poc-scan/summary.json --profile 26x"
73-
74-
- name: Upload release summaries
75-
if: always()
76-
uses: actions/upload-artifact@v4
77-
with:
78-
name: release-summaries
79-
if-no-files-found: warn
80-
path: |
81-
ai_reference/addons/clone-summary.json
82-
fixtures/addons/jars/release-summary.json
83-
fixtures/addons/jars/release-summary.csv
84-
fixtures/addons/jars/release-summary.txt
64+
gradle run --no-daemon -PparserProfile=${{ matrix.profile }}
65+
--args="--input fixtures/addons/jars/${{ matrix.profile }} --output output/poc-scan --summary output/poc-scan/summary.json --profile ${{ matrix.profile }}"
8566
8667
- name: Upload test reports
8768
if: failure()
8869
uses: actions/upload-artifact@v4
8970
with:
90-
name: test-reports
71+
name: test-reports-${{ matrix.profile }}
9172
if-no-files-found: warn
9273
path: |
9374
build/reports/tests/test/**

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@ output/
66
# Temporary files
77
tmp/
88

9-
# AI reference materials
9+
# AI reference materials (kept local; not part of project sources)
1010
ai_reference/
1111

1212
# Mappings
1313
mappings/
1414

15-
# Local fixture jars
16-
fixtures/addons/jars/
17-
1815
# Generated source
1916
src/generated/
2017

build.gradle

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
id 'java'
33
id 'application'
4-
id 'com.diffplug.spotless' version '7.0.2'
4+
id 'com.diffplug.spotless' version '8.4.0'
55
}
66

77
group = 'com.cope.addonparser'
@@ -20,6 +20,7 @@ if (parserProfile != 'legacy' && parserProfile != '26x') {
2020
throw new GradleException("Unknown parserProfile: ${parserProfile} (expected 'legacy' or '26x')")
2121
}
2222
def profileSourceDir = parserProfile == 'legacy' ? 'src/profile-legacy/java' : 'src/profile-26x/java'
23+
def profileFixtureJarsDir = "fixtures/addons/jars/${parserProfile}"
2324

2425
repositories {
2526
mavenCentral()
@@ -46,6 +47,7 @@ tasks.withType(Test).configureEach {
4647
useJUnitPlatform()
4748
jvmArgs '-noverify'
4849
systemProperty 'addonparser.profile', parserProfile
50+
systemProperty 'addonparser.fixtureJarsDir', profileFixtureJarsDir
4951
}
5052

5153
application {
@@ -80,35 +82,21 @@ dependencies {
8082
tasks.register('generateStubs', JavaExec) {
8183
classpath = sourceSets.stubgen.runtimeClasspath
8284
mainClass = 'com.cope.addonparser.tools.StubGenerator'
83-
args '--input-dir', 'fixtures/addons/jars',
85+
args '--input-dir', profileFixtureJarsDir,
8486
'--output-dir', 'src/generated/java',
8587
'--manual-class-list', 'tools/manual_classes.txt',
8688
'--manual-source-dirs', files('src/main/java', profileSourceDir).asPath,
8789
'--profile', parserProfile
8890

8991
// Incremental support: declare inputs and outputs
90-
inputs.dir('fixtures/addons/jars')
92+
inputs.dir(profileFixtureJarsDir)
9193
inputs.file('tools/manual_classes.txt')
9294
inputs.dir('src/main/java')
9395
inputs.dir(profileSourceDir)
9496
inputs.files(sourceSets.stubgen.output)
9597
outputs.dir('src/generated/java')
9698
}
9799

98-
tasks.register('downloadLatestReleaseJars', JavaExec) {
99-
group = 'build setup'
100-
description = 'Downloads latest GitHub release jar assets for repos under ai_reference/addons.'
101-
classpath = sourceSets.stubgen.runtimeClasspath
102-
mainClass = 'com.cope.addonparser.tools.ReleaseJarDownloader'
103-
args '--addons-dir', 'ai_reference/addons',
104-
'--jars-dir', 'fixtures/addons/jars',
105-
'--fail-on-error'
106-
107-
inputs.dir('ai_reference/addons')
108-
outputs.dir('fixtures/addons/jars')
109-
outputs.upToDateWhen { false }
110-
}
111-
112100
tasks.named('compileJava') {
113101
mustRunAfter tasks.named('generateStubs')
114102
}
@@ -153,11 +141,13 @@ tasks.named('clean') {
153141

154142
// AP-009: Spotless configuration for Google Java Style on manual sources
155143
spotless {
144+
ratchetFrom 'master'
145+
156146
java {
157147
target 'src/main/java/**/*.java', 'src/test/java/**/*.java', 'src/stubgen/java/**/*.java',
158148
'src/profile-legacy/java/**/*.java', 'src/profile-26x/java/**/*.java'
159149
targetExclude 'src/generated/java/**'
160-
googleJavaFormat()
150+
googleJavaFormat('1.35.0')
161151
removeUnusedImports()
162152
trimTrailingWhitespace()
163153
endWithNewline()
Binary file not shown.
Binary file not shown.
76.3 KB
Binary file not shown.
351 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)