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

Added Sentry to project #5689

Merged
merged 7 commits into from
Jul 7, 2024
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ jobs:
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"

- name: Add MMRevision file
run: |
echo ${{ github.sha }} >> megamek/mm-revision.txt

- name: Build with Gradle
working-directory: megamek
run: ./gradlew build --stacktrace --scan
Expand All @@ -55,14 +59,14 @@ jobs:
fail_ci_if_error: false
verbose: true

- name: Upload Windows Release
- name: Upload Zip Artifacts
uses: actions/upload-artifact@v4
with:
name: mm-release-win-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: ./megamek/megamek/build/distributions/megamek-windows-*.zip
name: mm-release-zip-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: ./megamek/megamek/build/distributions/MegaMek-*.zip

- name: Upload Nix/Mac Release
- name: Upload TarGZ Release
uses: actions/upload-artifact@v4
with:
name: mm-release-nix-mac-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: ./megamek/megamek/build/distributions/megamek-unix-*.tar.gz
name: mm-release-tar-gz-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: ./megamek/megamek/build/distributions/MegaMek-*.tar.gz
16 changes: 10 additions & 6 deletions .github/workflows/nightly-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ jobs:
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"

- name: Add MMRevision file
run: |
echo ${{ github.sha }} >> megamek/mm-revision.txt

- name: Build with Gradle
working-directory: megamek
run: ./gradlew clean build --stacktrace --scan
Expand All @@ -49,14 +53,14 @@ jobs:
name: ${{ matrix.os }}-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}-ci-failure-logs
path: megamek/megamek/build/reports/

- name: Upload Windows Release
- name: Upload Zip Artifacts
uses: actions/upload-artifact@v4
with:
name: mm-release-win-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: ./megamek/megamek/build/distributions/megamek-windows-*.zip
name: mm-release-zip-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: ./megamek/megamek/build/distributions/MegaMek-*.zip

- name: Upload Nix/Mac Release
- name: Upload TarGZ Release
uses: actions/upload-artifact@v4
with:
name: mm-release-nix-mac-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: ./megamek/megamek/build/distributions/megamek-unix-*.tar.gz
name: mm-release-tar-gz-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }}
path: ./megamek/megamek/build/distributions/MegaMek-*.tar.gz
81 changes: 11 additions & 70 deletions megamek/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
id 'edu.sc.seis.launch4j' version '3.0.5'
id 'jacoco'
id 'java'
id "io.sentry.jvm.gradle" version "4.9.0"
}

java {
Expand Down Expand Up @@ -132,6 +133,8 @@ task copyFiles(type: Copy) {
include "${mmconf}/**"
include "SubmitBug.html"
include "license.txt"
include "sentry.properties"
include "mm-revision.txt"
exclude "**/*.psd"
// No need to copy the files that are going to be zipped
exclude { it.file.isDirectory() && (it.file in file(unitFiles).listFiles()) }
Expand All @@ -143,7 +146,7 @@ task copyFiles(type: Copy) {
inputs.dir "${data}"
inputs.dir "${docs}"
inputs.dir "${mmconf}"
inputs.files 'license.txt', 'SubmitBug.html'
inputs.files 'license.txt', 'SubmitBug.html', 'sentry.properties', 'mm-revision.txt'
outputs.dir fileStagingDir
}

Expand Down Expand Up @@ -226,23 +229,8 @@ task createStartScripts (type: CreateStartScripts) {
}

distributions {
unix {
distributionBaseName = 'megamek-unix'
contents {
from fileStagingDir
from(createStartScripts.outputs.files) {
include "mm*"
}
from(jar)
from (project.sourceSets.main.runtimeClasspath.files
.findAll { it.name.endsWith(".jar") }) {
into "${lib}"
}
}
}

windows {
distributionBaseName = 'megamek-windows'
main {
distributionBaseName = 'MegaMek'
contents {
from ("${buildDir}/launch4j") {
include '*.exe'
Expand All @@ -260,6 +248,7 @@ distributions {
.findAll { it.name.endsWith(".jar") }) {
into "${lib}"
}
duplicatesStrategy 'exclude'
}
}
}
Expand Down Expand Up @@ -294,41 +283,16 @@ tasks.register("packagePrepWork") {
dependsOn equipmentList
dependsOn officialUnitList
dependsOn ratZip
}

windowsDistZip {
description = 'Creates Windows distribution packaged as a zip archive'
dependsOn packagePrepWork
dependsOn createAllExecutables
}

windowsDistTar {
description = 'Creates Windows distribution packaged as a tar.gz archive'
dependsOn packagePrepWork
dependsOn createAllExecutables
archiveExtension = 'tar.gz'
compression = Compression.GZIP
}

unixDistZip {
description = 'Creates *nix distribution packaged as a tar ball'
dependsOn packagePrepWork
}

unixDistTar {
description = 'Creates *nix distribution packaged as a tar ball'
dependsOn packagePrepWork
archiveExtension = 'tar.gz'
compression = Compression.GZIP
}

distZip {
description = 'Creates *nix distribution packaged as a Zip file'
description = 'Creates a Zip file for distribution'
dependsOn packagePrepWork
}

distTar {
description = 'Creates *nix distribution packaged as a gziped tar ball'
description = 'Creates a gziped tar ball for distribution'
dependsOn packagePrepWork
archiveExtension = 'tar.gz'
compression = Compression.GZIP
Expand Down Expand Up @@ -380,8 +344,8 @@ task assembleDist(overwrite: true) {
description = 'Build unix, Windows, and source packages'
group = 'distribution'
dependsOn test
dependsOn unixDistTar
dependsOn windowsDistZip
dependsOn distTar
dependsOn distZip
}

task buildFromRepo (type: GradleBuild) {
Expand Down Expand Up @@ -414,29 +378,6 @@ task javadocJar(type: Jar) {
archiveClassifier = 'javadoc'
}

publishing {
publications {
publishMMLibrary(MavenPublication) {
artifactId = "megamek${mmBranchTag}"
from components.java
artifact sourcesJar
// artifact javadocJar

pom {
name = "MegaMek"
description = "MegaMek"
url = "https://megamek.org"
licenses {
license {
name = "GNU General Public License, version 2"
url = "https://www.gnu.org/licenses/gpl-2.0.html"
}
}
}
}
}
}

test {
useJUnitPlatform()
finalizedBy jacocoTestReport
Expand Down
1 change: 1 addition & 0 deletions megamek/sentry.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enabled=false
47 changes: 27 additions & 20 deletions megamek/src/megamek/MMConstants.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 - The MegaMek Team. All Rights Reserved.
* Copyright (c) 2021-2024 - The MegaMek Team. All Rights Reserved.
*
* This file is part of MegaMek.
*
Expand All @@ -22,25 +22,32 @@
* These are constants that hold across MegaMek.
*/
public final class MMConstants extends SuiteConstants {
//region General Constants
private MMConstants() {
throw new IllegalStateException("MMConstants Utility Class");
}

// region General Constants
public static final String PROJECT_NAME = "MegaMek";
public static final String MUL_URL_PREFIX = "http://www.masterunitlist.info/Unit/Details/";
public static final String BT_URL_SHRAPNEL = "https://bg.battletech.com/shrapnel/";
/** When this text is found in the source field, the Mek View will display a link to {@link #BT_URL_SHRAPNEL} */
/**
* When this text is found in the source field, the Mek View will display a link
* to {@link #BT_URL_SHRAPNEL}
*/
public static final String SOURCE_TEXT_SHRAPNEL = "Shrapnel";
//endregion General Constants
// endregion General Constants

//region GUI Constants
//endregion GUI Constants
// region GUI Constants
// endregion GUI Constants

//region MMOptions
//region Nag Tab
// region MMOptions
// region Nag Tab
public static final String NAG_NODE = "megamek/prefs/nags";
public static final String NAG_BOT_README = "nagBotReadme";
//endregion Nag Tab
//endregion MMOptions
// endregion Nag Tab
// endregion MMOptions

//region File Paths
// region File Paths
// This holds all required file paths not saved as part of MegaMek Options
public static final String NAME_FACTIONS_DIRECTORY_PATH = "data/names/factions/";
public static final String CALLSIGN_FILE_PATH = "data/names/callsigns.csv";
Expand All @@ -59,36 +66,36 @@ public final class MMConstants extends SuiteConstants {
public static final String USER_SURNAME_FILE = "userdata/data/names/surnames.csv";
public static final String ERAS_FILE_PATH = "data/universe/eras.xml";
public static final String USER_LOADOUTS_DIR = "userdata/data/";
//endregion File Paths
// endregion File Paths

//region ClientServer
// region ClientServer
public static final int DEFAULT_PORT = 2346;
public static final int MIN_PORT = 1024;
public static final int MAX_PORT = 65535;
public static final String DEFAULT_PLAYERNAME = "Player";
public static final String LOCALHOST = "localhost";
//endregion ClientServer
// endregion ClientServer

//region SaveGame
// region SaveGame
public static final String SAVEGAME_DIR = "savegames";
public static final String DEFAULT_SAVEGAME_NAME = "savegame.sav";
public static final String QUICKSAVE_FILE = "quicksave";
public static final String QUICKSAVE_PATH = "./" + SAVEGAME_DIR;
public static final String SAVE_FILE_EXT = ".sav";
public static final String GZ_FILE_EXT = ".gz";
public static final String SAVE_FILE_GZ_EXT = SAVE_FILE_EXT + GZ_FILE_EXT;
//endregion SaveGame
// endregion SaveGame

//region Unsorted Constants
// region Unsorted Constants
public static final int DIVE_BOMB_MIN_ALTITUDE = 3;
public static final int DIVE_BOMB_MAX_ALTITUDE = 5;
public static final double INFANTRY_PRIMARY_WEAPON_DAMAGE_CAP = 0.6;
//endregion Unsorted Constants
// endregion Unsorted Constants

//region Magic Numbers That Should Be Enums
// region Magic Numbers That Should Be Enums
// FIXME : TSEMP Constants
public static final int TSEMP_EFFECT_NONE = 0;
public static final int TSEMP_EFFECT_INTERFERENCE = 1;
public static final int TSEMP_EFFECT_SHUTDOWN = 2;
//endregion Magic Numbers That Should Be Enums
// endregion Magic Numbers That Should Be Enums
}
45 changes: 45 additions & 0 deletions megamek/src/megamek/MMLoggingConstants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2024 - The MegaMek Team. All Rights Reserved.
*
* This file is part of MegaMek.
*
* MegaMek is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MegaMek is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MegaMek. If not, see <http://www.gnu.org/licenses/>.
*/

package megamek;

/**
* These are constants related to logging messages to for output.
*/
public final class MMLoggingConstants {
private MMLoggingConstants() {
throw new IllegalStateException("MMLoggingConstants");
}

// region General Constants
public static final String UNHANDLED_EXCEPTION = "Uncaught %s detected. Please open up an issue containing all logs, the game save file, and customs at https://github.com/MegaMek/megamek/issues . If Sentry is enabled, the error has also been logged.";
public static final String UNHANDLED_EXCEPTION_TITLE = "Uncaught Exception %s";
public static final String VERSION_PARSE_FAILURE = "Version Parsing Failure";
// endregion General Constants

// region Argument Parser
public static final String AP_INCORRECT_ARGUMENTS = "Incorrect arguments: %s%n%s";
// endregion Argument Parser

// region Starting Servers/Clients
public static final String SC_STARTING_DEDICATED_SERVER = "Starting Dedicated Server. %s";
public static final String SC_STARTING_HOST_SERVER = "Starting Host Server. %s";
public static final String SC_STARTING_CLIENT_SERVER = "Starting Client Server. %s";
// endregion Starting Servers/Clients
}
Loading