Skip to content

Conversation

@HammerGS
Copy link
Member

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

  • Ran the test,
  • Made some boards and was able to add and tag them.

Fixes #7936

  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
Copilot AI review requested due to automatic review settings January 29, 2026 22:28
@HammerGS HammerGS requested a review from a team as a code owner January 29, 2026 22:28
@HammerGS HammerGS added AI Generated Fix AI-generated fix. Requires human testing and review before merging. AI ready for Review Indicates that is has been in game tested and is ready for review as it can be labels Jan 29, 2026
Copy link
Contributor

Copilot AI left a 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, default true) 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 BoardsTagger and 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Fix AI-generated fix. Requires human testing and review before merging. AI ready for Review Indicates that is has been in game tested and is ready for review as it can be

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFE] Add copyright header at board save or through board tagger function.

3 participants