Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for conflicting RUL2 overrides #494

Merged
merged 4 commits into from
Jan 1, 2025

Conversation

memo33
Copy link
Collaborator

@memo33 memo33 commented Dec 31, 2024

This PR adds a script for detecting conflicting RUL2 overrides, and runs the script continually as part of the GH actions workflow.

There are two modes of operation:

1.
SBT_OPTS="-Xmx2G" sbt "conflictingOverridesCheck --update"

to update the files in Controller/RUL2 in place by tagging all lines with ; conflicting-override where conflicts are found. The tag is removed from lines that are not conflicting anymore. (The first rule in a pair of conflicts is never tagged, as it is the one that will have an effect in the game, following the load order semantics of the game and the controller compiler.)

This PR contains the results of running the above command once, thereby tagging conflicts in the entire repository (about 96k lines). Having these tags as inline comments directly in the RUL2 files helps us resolve these conflicts whenever we work on related functionality in the RUL2 files.

2.
SBT_OPTS="-Xmx2G" sbt -no-color conflictingOverridesCheck

to check all code in Controller/RUL2 for new conflicting overrides (that are not tagged yet). This is executed as part of the GH actions workflow, which helps us avoid introducing new conflicts moving forward. The GH action workflow will indicate a failure if a future commit introduces new conflicts.

Sample output:

[info] running com.sc4nam.scripts.ConflictingOverridesChecker
[info] Loading all RUL2 code for RHD and LHD from "Controller/RUL2" and checking for conflicts
[info] ==> Controller/RUL2/07_RHW/Sec7h_Flex_Transition/Sec7h3_FlexHT-DOST-Cross.txt
[warn] 26: 0x57107A00,3,0,0x57000500,1,0=0x57107A00,3,0,0x57100200,1,0 conflicts with 0x57107A00,1,1,0x57000500,3,1=0x57107A00,1,1,0x57100200,2,0
[warn] 48: 0x57207A00,3,0,0x57000500,1,0=0x57207A00,3,0,0x57200200,1,0 conflicts with 0x57207A00,1,1,0x57000500,3,1=0x57207A00,1,1,0x57200200,2,0
[error] Found 2 new conflicting RUL2 overrides. Please avoid introducing new conflicts. Instead verify whether these overrides really have the intended effect and consider rewriting or removing them.

This is the initial run of:

    sbt conflictingOverridesCheck --update

It tags all conflicting overrides with an inline comment. It does not
remove or modify any functionality.
@memo33 memo33 force-pushed the conflicting-overrides-checker branch from dd7fbda to 2bb9b49 Compare December 31, 2024 16:28
@memo33
Copy link
Collaborator Author

memo33 commented Dec 31, 2024

This PR shares a commit with #493, but does not depend on it. In fact, this PR does not alter the functionality of any RUL2 code (only comments), so can be merged as is.

@jflann
Copy link
Member

jflann commented Jan 1, 2025

I'd be in favor of merging this in now. I imagine it will cause merge conflict with #493 though. Is that going to be a bit of a mess, or is it manageable?

@memo33
Copy link
Collaborator Author

memo33 commented Jan 1, 2025

It should be manageable if we merge this PR now. Then I'll just rebase #493 and re-run the scripts from scratch there.

@jflann jflann merged commit 23a61cd into NAMTeam:staging Jan 1, 2025
2 checks passed
@memo33 memo33 deleted the conflicting-overrides-checker branch January 1, 2025 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants