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

Data Removal Project - * DO NOT MERGE * #6723

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
ci_cd:
runs-on: ${{ matrix.os }}

outputs:
mmDataRepo: ${{ steps.find_mm_data.outputs.mmRepo }}
mmDataBranch: ${{ steps.find_mm_data.outputs.mmBranch }}

strategy:
matrix:
os: [ ubuntu-latest ]
Expand All @@ -24,6 +28,28 @@ jobs:
with:
path: megamek

- name: "Find the Right MegaMek Data Branch"
id: "find_mm_data"
shell: bash {0}
run: |
git ls-remote --exit-code --heads ${{ github.event.pull_request.head.repo.owner.html_url }}/mm-data.git ${{ github.event.pull_request.head.ref }}
if [ "$?" == "0" ]
then
echo "mmDataRepo=${{ github.event.pull_request.head.repo.owner.login }}/mm-data" >> $GITHUB_OUTPUT
echo "mmDataBranch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
else
echo "mmDataRepo=MegaMek/mm-data" >> $GITHUB_OUTPUT
echo "mmDataBranch=main" >> $GITHUB_OUTPUT
fi
exit 0

- name: Checkout MegaMek Data
uses: actions/checkout@v4
with:
repository: ${{ steps.find_mm_data.outputs.mmDataRepo }}
ref: ${{ steps.find_mm_data.outputs.mmDataBranch }}
path: mm-data

- name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ jobs:
with:
path: megamek

- name: Checkout MegaMek Data
uses: actions/checkout@v4
with:
repository: megamek/mm-data
ref: main
path: mm-data

- name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/java-doc-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ jobs:
with:
path: megamek

- name: Checkout MegaMek Data
uses: actions/checkout@v4
with:
repository: megamek/mm-data
ref: main
path: mm-data

- name: Set up Temurin JDK 17
uses: actions/setup-java@v4
with:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/java-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ jobs:
with:
path: megamek

- name: Checkout MegaMek Data
uses: actions/checkout@v4
with:
repository: megamek/mm-data
ref: main
path: mm-data

- name: Set up Temurin JDK 17
uses: actions/setup-java@v4
with:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/nightly-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ jobs:
with:
path: megamek

- name: Checkout MegaMek Data
uses: actions/checkout@v4
with:
repository: megamek/mm-data
ref: main
path: mm-data

- name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/validate-boards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ jobs:
with:
path: megamek

- name: Checkout MegaMek Data
uses: actions/checkout@v4
with:
repository: megamek/mm-data
ref: main
path: mm-data

- name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/validate-namechanges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ jobs:
uses: actions/checkout@v4
with:
path: megamek
- name: Checkout MegaMek Data
uses: actions/checkout@v4
with:
repository: megamek/mm-data
ref: main
path: mm-data

- name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
Expand Down
26 changes: 2 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,7 @@ megamek/userdata/**
/megamek/docs/mhq-revision.txt

#MegaMek/data Folders
/megamek/data/misc/
/megamek/data/recordsheets/
/megamek/data/splash/

# mekfiles
/megamek/data/mekfiles/units.cache
/megamek/data/mekfiles/IrTech/
/megamek/data/mekfiles/Special/
/megamek/data/mekfiles/customs/

# Images
/megamek/data/images/*_atlas.png
/megamek/data/images/imgFileAtlasMap.xml
#Portraits
/megamek/data/images/portraits/*
!/megamek/data/images/portraits/Female
!/megamek/data/images/portraits/Male
/megamek/data/images/temp/
!/megamek/data/images/portraits/default.gif


# Boards
#End MegaMek/data Folders
#End MegaMek data Folders
/megamek/data

#MegaMek Other Outputs
/megamek/mechs.csv
Expand All @@ -104,3 +81,4 @@ equipment.txt
# Testing Temp Folder
/megamek/testresources/tmp/*
!/megamek/testresources/tmp/.keep
units.cache
91 changes: 58 additions & 33 deletions megamek/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ ext {
'java.base/java.util.concurrent=ALL-UNNAMED',
'-Dsun.awt.disablegrab=true'
]
data = 'data'
unitFiles = "${data}/mekfiles"
rats = "${data}/rat"
docs = "docs"
lib = "lib"
log = "logs"
Expand All @@ -112,6 +109,15 @@ jar {
}
}

tasks.register('handleDataDirectory', Sync) {
description = 'Update MM Data'
group = 'build'

from "${projectDir}/../../mm-data/data"
into "${layout.buildDirectory.get()}/data"
include '**/*'
}

tasks.register('generateDynamicFiles') {
def jvmOptions = project.ext.mmJvmOptions.join('\n')

Expand All @@ -124,14 +130,52 @@ ${jvmOptions}
}
}

tasks.register('copyDataFiles', Copy) {
description = 'Copy data files into Staging directory'
group = 'build'

dependsOn handleDataDirectory

from("${layout.buildDirectory.get()}/data") {
include '**/*'
exclude "mekfiles"
exclude "rat"
}

into "${fileStagingDir}/data"
}

task unitFilesZip(dependsOn: handleDataDirectory) {
description = 'Creates zip archives of all the unit file folders.'

def sourceFolder = "${layout.buildDirectory.get()}/data/mekfiles"

if (file(sourceFolder).exists()) {
file(sourceFolder).eachDir { subDir ->
dependsOn tasks.create("${name}${subDir.name}", Zip) {
dependsOn handleDataDirectory
from subDir
archiveFileName = "${subDir.name}.zip"
destinationDirectory = file("${fileStagingDir}/data/mekfiles")
}
}
} else {
logger.warn("No unit files found in ${sourceFolder}")
}

outputs.dir "${fileStagingDir}/data/mekfiles"
}

tasks.register('copyFiles', Copy) {
description = 'Stages files that are to be copied into the distribution.'
group = 'build'

dependsOn copyDataFiles
dependsOn generateDynamicFiles
dependsOn unitFilesZip
dependsOn ratZip

from projectDir
include "${data}/**"
include "${docs}/**"
include "${mmconf}/**"
include "SubmitBug.html"
Expand All @@ -140,9 +184,6 @@ tasks.register('copyFiles', Copy) {
include "*.ini"
exclude "**/*.psd"

// No need to copy the files that are going to be zipped
exclude { it.file.isDirectory() && (it.file in file(unitFiles).listFiles()) }

// User Config Files
exclude "${mmconf}/clientsettings.xml"
exclude "${mmconf}/gameoptions.xml"
Expand All @@ -151,8 +192,6 @@ tasks.register('copyFiles', Copy) {
exclude "${mmconf}/mhq.preferences"
exclude "${mmconf}/mm.preferences"
exclude "${mmconf}/mml.preferences"

exclude "${rats}/**"
include "${userdata}/"

into fileStagingDir
Expand Down Expand Up @@ -187,37 +226,25 @@ tasks.register('officialUnitList', JavaExec) {
args = ['-oul', "${projectDir}/docs/OfficialUnitList.txt"]
}

task unitFilesZip(dependsOn: copyFiles) {
description = 'Creates zip archives of all the unit file folders.'
file(unitFiles).eachDir { subDir ->
dependsOn tasks.create("${name}${subDir.name}", Zip) {
from subDir
archiveFileName = "${subDir.name}.zip"
destinationDirectory = file("${fileStagingDir}/${unitFiles}")
}
}
inputs.dir "${projectDir}/${unitFiles}"
outputs.dir "${fileStagingDir}/${unitFiles}"
}

tasks.register('ratZip', Zip) {
description = 'Creates a zip archive of all the random assignment tables.'
from rats
dependsOn handleDataDirectory

from "${layout.buildDirectory.get()}/data/rat"

archiveFileName = "rat_default.zip"
destinationDirectory = file("${fileStagingDir}/${rats}")
destinationDirectory = file("${fileStagingDir}/data/rat")
doFirst {
mkdir "${fileStagingDir}/${rats}"
mkdir "${fileStagingDir}/data/rat"
}
inputs.dir "${projectDir}/${rats}"
outputs.dir "${fileStagingDir}/${rats}"
inputs.dir "${layout.buildDirectory.get()}/data/rat"
outputs.dir "${fileStagingDir}/data/rat"
}

tasks.register('stageFiles') {
description = 'Process data files to be included in distribution'
group = 'distribution'
dependsOn officialUnitList
dependsOn unitFilesZip
dependsOn ratZip
dependsOn deleteAtlasedImages

doLast {
Expand All @@ -239,7 +266,7 @@ distributions {
main {
distributionBaseName = 'MegaMek'
contents {
from("${buildDir}/launch4j") {
from("${layout.buildDirectory.get()}/launch4j") {
include '*.exe'
}
from(jar) {
Expand All @@ -264,7 +291,7 @@ launch4j {
description = 'Create Windows executable for Megamek'
mainClassName = application.mainClass
outfile = 'MegaMek.exe'
icon = "${projectDir}/data/images/misc/megamek.ico"
icon = "${layout.buildDirectory.get()}/data/images/misc/megamek.ico"
jarTask = project.tasks.jar
windowTitle = 'MegaMek'
internalName = 'MegaMek'
Expand All @@ -281,12 +308,10 @@ launch4j {

tasks.register("packagePrepWork") {
description = 'General Catch All for all distributions'
dependsOn stageFiles
dependsOn startScripts
dependsOn createStartScripts
dependsOn copyFiles
dependsOn createImageAtlases
dependsOn ratZip
dependsOn createAllExecutables
}

Expand Down
Loading