Skip to content

Commit a896996

Browse files
committed
Merge branch 'master' into barracks
2 parents 0b0f09e + 899eefe commit a896996

File tree

5 files changed

+87
-98
lines changed

5 files changed

+87
-98
lines changed

.github/workflows/ci.yml

+10-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: MekHQ CI with Gradle
22

33
on:
44
pull_request:
5-
branches: [master]
5+
branches: [ master ]
66

77
env:
88
GRADLE_OPTS: "-Dscan.link.VCS=${{ github.event.pull_request.html_url }}"
@@ -19,9 +19,9 @@ jobs:
1919

2020
strategy:
2121
matrix:
22-
os: [ubuntu-latest]
23-
java-distribution: [temurin]
24-
java-version: [17]
22+
os: [ ubuntu-latest ]
23+
java-distribution: [ temurin ]
24+
java-version: [ 17 ]
2525
fail-fast: false
2626

2727
steps:
@@ -91,9 +91,9 @@ jobs:
9191
run: |
9292
echo ${{ github.sha }} >> mekhq/MekHQ/mhq-revision.txt
9393
94-
- name: Build with Gradle
94+
- name: Test All
9595
working-directory: mekhq
96-
run: ./gradlew build -x checkstyleMain -x checkstyleTest --stacktrace --scan
96+
run: ./gradlew testAll --stacktrace --scan
9797

9898
- name: Upload Test Logs on Failure
9999
uses: actions/upload-artifact@v4
@@ -102,6 +102,10 @@ jobs:
102102
name: cd-failure-logs
103103
path: ./mekhq/MekHQ/build/reports/
104104

105+
- name: Build with Gradle
106+
working-directory: mekhq
107+
run: ./gradlew build -x test
108+
105109
- name: CodeCov.io Coverage Report
106110
uses: codecov/codecov-action@v5
107111
with:

MekHQ/build.gradle

+65-84
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@ import java.time.LocalDateTime
22

33
plugins {
44
id 'application'
5-
id 'checkstyle'
65
id 'com.palantir.git-version' version '3.1.0'
76
id 'edu.sc.seis.launch4j' version '3.0.6'
8-
id "io.sentry.jvm.gradle" version '5.2.0'
7+
id "io.sentry.jvm.gradle" version '5.3.0'
98
id 'jacoco'
109
id 'java'
11-
id 'org.ec4j.editorconfig' version '0.1.0'
1210
}
1311

1412
java {
15-
sourceCompatibility = JavaVersion.VERSION_17
16-
targetCompatibility = JavaVersion.VERSION_17
13+
toolchain {
14+
languageVersion = JavaLanguageVersion.of(17)
15+
}
1716
}
1817

1918
sourceSets {
@@ -37,41 +36,30 @@ sourceSets {
3736

3837
ext {
3938
mhqJvmOptions = [
40-
'-Xmx4096m',
41-
'--add-opens',
42-
'java.base/java.util=ALL-UNNAMED',
43-
'--add-opens',
44-
'java.base/java.util.concurrent=ALL-UNNAMED',
45-
'-Dsun.awt.disablegrab=true'
39+
'-Xmx4096m',
40+
'--add-opens',
41+
'java.base/java.util=ALL-UNNAMED',
42+
'--add-opens',
43+
'java.base/java.util.concurrent=ALL-UNNAMED',
44+
'-Dsun.awt.disablegrab=true'
4645
]
4746
campaigns = 'campaigns'
4847
data = 'data'
4948
docs = 'docs'
5049
lib = 'lib'
5150
log = 'logs'
5251
mmconf = 'mmconf'
53-
plugins = 'plugins'
5452
userdata = 'userdata'
55-
fileStagingDir = "${buildDir}/files"
53+
fileStagingDir = "${layout.buildDirectory.get()}/files"
5654
scriptsDir = "${projectDir}/scripts"
57-
scriptTemplate = "${scriptsDir}/startScriptTemplate.txt"
58-
59-
// Allows setting a dependency on a different MM branch.
60-
mmBranch = 'master'
61-
mmBranchTag = mmBranch.equals('master') ? '' : '-' + mmBranch
62-
mmlBranch = 'master'
63-
mmlBranchTag = mmlBranch.equals('master') ? '' : '-' + mmlBranch
6455

6556
mmDir = "${rootDir}/../megamek"
6657
mmlDir = "${rootDir}/../megameklab"
6758
}
6859

6960
dependencies {
70-
implementation "org.megamek:megamek${mmBranchTag}:${version}"
71-
implementation ("org.megamek:megameklab${mmlBranchTag}:${version}") {
72-
// We may want to specify different branches for MM and MML, so we need to exclude the transitive MM dependency
73-
exclude group: 'org.megamek', module: "megamek${mmBranchTag}:${version}"
74-
61+
implementation "org.megamek:megamek:${version}"
62+
implementation("org.megamek:megameklab:${version}") {
7563
// We don't need the python and javascript engine taking up space
7664
exclude group: 'org.python', module: 'jython'
7765
exclude group: 'org.mozilla', module: 'rhino'
@@ -101,6 +89,7 @@ dependencies {
10189
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2'
10290

10391
runtimeOnly 'org.glassfish.jaxb:jaxb-runtime:4.0.5'
92+
10493
// Required for mml printing scaled vector graphics (SVG) - Eclipse IDE Compatibility.
10594
runtimeOnly 'xml-apis:xml-apis-ext:1.3.04'
10695

@@ -116,12 +105,6 @@ application {
116105
mainClass = 'mekhq.MekHQ'
117106
}
118107

119-
checkstyle {
120-
toolVersion = '10.18.1'
121-
configFile = file("config/checkstyle/checkstyle.xml")
122-
ignoreFailures = false
123-
}
124-
125108
run {
126109
jvmArgs = mhqJvmOptions
127110
}
@@ -130,16 +113,16 @@ jar {
130113
archiveFileName = "MekHQ.jar"
131114

132115
manifest {
133-
attributes "Main-Class" : application.mainClass
134-
attributes "Class-Path" : "MegaMek.jar MegaMekLab.jar " + (project.sourceSets.main.runtimeClasspath.files
135-
.findAll { it.name.endsWith(".jar") && !it.name.toLowerCase().startsWith("megamek") }
136-
.collect { "${lib}/${it.name}" }.join(' '))
137-
attributes "Add-Opens" : 'java.base/java.util java.base/java.util.concurrent'
138-
attributes "Build-Date" : LocalDateTime.now()
116+
attributes "Main-Class": application.mainClass
117+
attributes "Class-Path": "MegaMek.jar MegaMekLab.jar " + (project.sourceSets.main.runtimeClasspath.files
118+
.findAll { it.name.endsWith(".jar") && !it.name.toLowerCase().startsWith("megamek") }
119+
.collect { "${lib}/${it.name}" }.join(' '))
120+
attributes "Add-Opens": 'java.base/java.util java.base/java.util.concurrent'
121+
attributes "Build-Date": LocalDateTime.now()
139122
}
140123
}
141124

142-
task generateDynamicFiles() {
125+
tasks.register('generateDynamicFiles') {
143126
def jvmOptions = project.ext.mhqJvmOptions.join('\n')
144127

145128
doLast {
@@ -151,7 +134,7 @@ ${jvmOptions}
151134
}
152135
}
153136

154-
task canonSystemZip (type: Zip) {
137+
tasks.register('canonSystemZip', Zip) {
155138
description = 'Creates a zip archive of canon planetary systems.'
156139
from "${data}/universe/planetary_systems/canon_systems/"
157140

@@ -161,7 +144,7 @@ task canonSystemZip (type: Zip) {
161144
outputs.dir "${fileStagingDir}/${data}/universe/planetary_systems"
162145
}
163146

164-
task connectorSystemZip (type: Zip) {
147+
tasks.register('connectorSystemZip', Zip) {
165148
description = 'Creates a zip archive of connector systems planetary systems.'
166149
from "${data}/universe/planetary_systems/connector_systems/"
167150

@@ -171,7 +154,7 @@ task connectorSystemZip (type: Zip) {
171154
outputs.dir "${fileStagingDir}/${data}/universe/planetary_systems"
172155
}
173156

174-
task stageFiles(type: Copy) {
157+
tasks.register('stageFiles', Copy) {
175158
description = 'Stages files that are to be copied into the distribution.'
176159

177160
dependsOn generateDynamicFiles
@@ -205,7 +188,6 @@ task stageFiles(type: Copy) {
205188
include "${data}/terrainconditionsodds/"
206189
include "${docs}/**"
207190
include "${mmconf}/**"
208-
include "${project.ext.plugins}/"
209191
include "${userdata}"
210192
include "${userdata}/data/universe/"
211193
include 'license.txt'
@@ -234,7 +216,7 @@ task stageFiles(type: Copy) {
234216
}
235217
}
236218

237-
task createStartScripts (type: CreateStartScripts) {
219+
tasks.register('createStartScripts', CreateStartScripts) {
238220
description = 'Create shell script for generic distribution.'
239221

240222
applicationName = 'MekHQ'
@@ -250,87 +232,87 @@ distributions {
250232
distributionBaseName = 'MekHQ'
251233
contents {
252234
// MegaMek Includes
253-
from ("${mmDir}/megamek/build/files")
254-
from ("${mmDir}/megamek/build/scripts") {
235+
from("${mmDir}/megamek/build/files")
236+
from("${mmDir}/megamek/build/scripts") {
255237
into "bin"
256238
}
257-
from ("${mmDir}/megamek/scripts") {
239+
from("${mmDir}/megamek/scripts") {
258240
include "shell.sh"
259241
rename "shell.sh", "MegaMek.sh"
260242
}
261-
from ("${mmDir}/megamek/docs") {
243+
from("${mmDir}/megamek/docs") {
262244
rename 'history.txt', 'mm-history.txt'
263245
into 'docs'
264246
}
265-
from ("${mmDir}/megamek/mmconf/log4j2.xml") {
247+
from("${mmDir}/megamek/mmconf/log4j2.xml") {
266248
exclude 'log4j2.xml'
267249
}
268-
from ("${mmDir}/megamek/build/launch4j/lib") {
250+
from("${mmDir}/megamek/build/launch4j/lib") {
269251
into "${lib}"
270252
}
271-
from ("${mmDir}/megamek/build/launch4j") {
253+
from("${mmDir}/megamek/build/launch4j") {
272254
include '*.exe'
273255
}
274-
from ("${mmDir}/megamek/build/libs/MegaMek.jar") {
256+
from("${mmDir}/megamek/build/libs/MegaMek.jar") {
275257
into "${lib}"
276258
}
277-
from ("${mmDir}/megamek/build/libs/MegaMek.jar")
278-
from ("${mmDir}/megamek/") {
259+
from("${mmDir}/megamek/build/libs/MegaMek.jar")
260+
from("${mmDir}/megamek/") {
279261
include '*.ini'
280262
}
281263

282264
// MegaMekLab Includes
283-
from ("${mmlDir}/megameklab/build/files") {
265+
from("${mmlDir}/megameklab/build/files") {
284266
exclude 'data/mekfiles'
285267
}
286-
from ("${mmlDir}/megameklab/build/launch4j/lib") {
268+
from("${mmlDir}/megameklab/build/launch4j/lib") {
287269
into "${lib}"
288270
}
289-
from ("${mmlDir}/megameklab/build/files/${data}/images") {
271+
from("${mmlDir}/megameklab/build/files/${data}/images") {
290272
into "${data}/images"
291273
}
292-
from ("${mmlDir}/megameklab/build/scripts") {
274+
from("${mmlDir}/megameklab/build/scripts") {
293275
into "bin"
294276
}
295-
from ("${mmlDir}/megameklab/scripts") {
277+
from("${mmlDir}/megameklab/scripts") {
296278
include "shell.sh"
297279
rename "shell.sh", "MegaMekLab.sh"
298280
}
299-
from ("${mmlDir}/megameklab/docs") {
281+
from("${mmlDir}/megameklab/docs") {
300282
rename 'history.txt', 'mml-history.txt'
301283
into "${docs}"
302284
}
303-
from ("${mmlDir}/megameklab/mmconf/log4j2.xml") {
285+
from("${mmlDir}/megameklab/mmconf/log4j2.xml") {
304286
exclude 'log4j2.xml'
305287
}
306-
from ("${mmlDir}/megameklab/build/launch4j") {
288+
from("${mmlDir}/megameklab/build/launch4j") {
307289
include '*.exe'
308290
}
309-
from ("${mmlDir}/megameklab/build/libs/MegaMekLab.jar") {
291+
from("${mmlDir}/megameklab/build/libs/MegaMekLab.jar") {
310292
into "${lib}"
311293
}
312-
from ("${mmlDir}/megameklab/build/libs/MegaMekLab.jar")
313-
from ("${mmlDir}/megameklab/") {
294+
from("${mmlDir}/megameklab/build/libs/MegaMekLab.jar")
295+
from("${mmlDir}/megameklab/") {
314296
include '*.ini'
315297
}
316298

317299
// MekHQ Includes
318-
from ("docs/history.txt") {
300+
from("docs/history.txt") {
319301
rename 'history.txt', 'mhq-history.txt'
320302
into 'docs'
321303
}
322-
from (fileStagingDir) {
304+
from(fileStagingDir) {
323305
exclude 'history.txt'
324306
}
325-
from ("${projectDir}/scripts") {
307+
from("${projectDir}/scripts") {
326308
include 'shell.sh'
327309
rename 'shell.sh', 'MekHQ.sh'
328310
}
329-
from ("${buildDir}/launch4j") {
311+
from("${buildDir}/launch4j") {
330312
include '*.exe'
331313
}
332314

333-
from (project.sourceSets.main.runtimeClasspath.files
315+
from(project.sourceSets.main.runtimeClasspath.files
334316
.findAll { it.name.endsWith(".jar") && !it.name.toLowerCase().startsWith("megamek") }) {
335317
into "${lib}"
336318
}
@@ -365,6 +347,7 @@ launch4j {
365347

366348
tasks.register("packagePrepWork") {
367349
description = 'General Catch All for all distributions'
350+
dependsOn jar
368351
dependsOn stageFiles
369352
dependsOn startScripts
370353
dependsOn createStartScripts
@@ -396,18 +379,14 @@ distZip {
396379
dependsOn packagePrepWork
397380
}
398381

399-
// The distribution plugin adds the distribution packages to the assemble task, which causes the build task
400-
// to run all the packaging tasks.
401-
task assemble(overwrite: true) {
382+
assemble {
402383
dependsOn jar
403384
}
404385

405-
// Replace the assembleDist task created by the distributions plugin to create the packages we want to
406-
task assembleDist(overwrite: true) {
386+
assembleDist {
407387
description = 'Build unix, Windows, and source packages'
408388
group = 'distribution'
409389
dependsOn stageFiles
410-
dependsOn test
411390
dependsOn distTar
412391
}
413392

@@ -434,6 +413,17 @@ tasks.register("cleanAll") {
434413
dependsOn clean
435414
}
436415

416+
tasks.register("testAll") {
417+
description = "Cleans all build projects to ensure a clean slate then runs all tests"
418+
group = "verification"
419+
dependsOn cleanAll
420+
421+
dependsOn gradle.includedBuild('megamek').task(':megamek:test')
422+
dependsOn gradle.includedBuild('megameklab').task(':megameklab:test')
423+
dependsOn test
424+
}
425+
426+
437427
test {
438428
useJUnitPlatform()
439429
// report is always generated after tests run
@@ -448,12 +438,3 @@ jacocoTestReport {
448438
html.required = true
449439
}
450440
}
451-
452-
tasks.withType(Checkstyle) {
453-
minHeapSize = "200m"
454-
maxHeapSize = "1g"
455-
reports {
456-
xml.required = false
457-
html.required = true
458-
}
459-
}

MekHQ/docs/history.txt

+3
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ MEKHQ VERSION HISTORY:
117117
+ PR #6504: Removed Unofficial Multiplier From Contract Pay Calculation
118118
+ PR #6506: Celebration Event Fixes
119119
+ PR #6283: Added Blood Group Tracking For Personnel
120+
+ Fix #2368: Added GM Methods to Warehouse: remove x parts and toggle newness
121+
+ Fix #6507: Fixed Missing Dates from Past Scenarios
122+
+ Fix #6510: Fixed NPE In Armor Repair
120123
+ Fix #6515, #6516: Allow Dynamically Priced Parts to be Replaced in Repair Bay
121124

122125
0.50.04 (2025-03-22 1600 UTC)

0 commit comments

Comments
 (0)