-
Notifications
You must be signed in to change notification settings - Fork 344
Add copyright header support for board files (Fixes #7936) #7942
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
base: main
Are you sure you want to change the base?
Conversation
Summary - Adds CC BY-NC-SA 4.0 license header support when saving board files - Header format matches existing mm-data board headers - Year is dynamically set to current year when saving Changes GUIPreferences.java - Added BOARD_SAVE_INCLUDE_LICENSE preference (default: true) - Added getter/setter methods for the preference Board.java - Added LICENSE_HEADER constant with CC BY-NC-SA 4.0 text - Added overloaded save(OutputStream, boolean) method to optionally include license - Modified save(OutputStream) to check GUI preference BoardsTagger.java - Added runCopyrightHeaderUpdater() for batch processing all boards - Added helper methods for recursive directory scanning and individual file updates Test plan - Save a new board from the board editor - verify header is included - Load and re-save an existing board - verify header is added/updated - Run BoardsTagger.runCopyrightHeaderUpdater() - verify batch processing works - Verify boards with existing headers get updated (not duplicated) - Toggle BoardSaveIncludeLicense preference to false - verify header is omitted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds optional CC BY-NC-SA 4.0 license headers to .board files when saving, with a GUI preference controlling inclusion and a utility method intended for batch-updating existing boards (Fixes #7936).
Changes:
- Introduces a new GUI preference (
BOARD_SAVE_INCLUDE_LICENSE, defaulttrue) to control license-header inclusion. - Extends
Board.save(...)with an overload to include/exclude the license header and updates the default save path to consult the preference. - Adds a batch updater method in
BoardsTaggerand a new unit test suite covering header inclusion and round-trip load/save.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| megamek/unittests/megamek/common/board/BoardLicenseHeaderTest.java | Adds tests validating header inclusion/exclusion, current-year insertion, and round-trip behavior. |
| megamek/src/megamek/utilities/BoardsTagger.java | Adds batch header updater + recursive scan helper for .board files. |
| megamek/src/megamek/common/board/Board.java | Adds the CC BY-NC-SA 4.0 header template and save overload; default save now uses GUI preference. |
| megamek/src/megamek/client/ui/clientGUI/GUIPreferences.java | Adds the new BOARD_SAVE_INCLUDE_LICENSE preference with default + getter/setter. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Changes
GUIPreferences.java
Board.java
BoardsTagger.java
Test plan
Fixes #7936