diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000000..60d4a95d05c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +root = true +charset = "utf-8" + +[*.java] +indent_style = "space" +indent_size = 4 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 100 # Google Style Guide +curly_bracket_next_line = false +spaces_around_operators = true +spaces_around_brackets = "both" +indent_brace_style = "K&R" +wildcard_import_limit = 10 +continuation_indent_size = 4 # Google Style Guid diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66b8bcc464d..aeda53f415c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,12 +55,6 @@ jobs: fail_ci_if_error: false verbose: true - # - name: Upload Zip Artifacts - # uses: actions/upload-artifact@v4 - # with: - # name: mm-release-zip-${{ matrix.java-distribution }}-jdk${{ matrix.java-version }} - # path: ./megamek/megamek/build/distributions/*.zip - - name: Upload TarGZ Release uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/java-doc.yml b/.github/workflows/java-doc.yml new file mode 100644 index 00000000000..9fca8dfb312 --- /dev/null +++ b/.github/workflows/java-doc.yml @@ -0,0 +1,38 @@ +name: MegaMek CI with Gradle + +on: + pull_request: + branches: [master] + +env: + GRADLE_OPTS: "-Dscan.link.VCS=${{ github.event.pull_request.html_url }}" + +jobs: + ci_cd: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + java-distribution: [temurin] + java-version: [17] + fail-fast: false + + steps: + - name: "Check out MegaMek" + uses: actions/checkout@v4 + with: + path: megamek + + - name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }} + uses: actions/setup-java@v4 + with: + distribution: ${{ matrix.java-distribution }} + java-version: ${{ matrix.java-version }} + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build with Gradle + working-directory: megamek + run: ./gradlew javadoc diff --git a/megamek/build.gradle b/megamek/build.gradle index 176ff1b9ada..47755c0cb2e 100644 --- a/megamek/build.gradle +++ b/megamek/build.gradle @@ -2,11 +2,14 @@ import java.time.LocalDateTime plugins { id 'application' + id 'checkstyle' id 'edu.sc.seis.launch4j' version '3.0.6' id 'jacoco' id 'java' + id 'org.ec4j.editorconfig' version '0.1.0' id "io.sentry.jvm.gradle" version '4.11.0' id 'com.palantir.git-version' version '3.1.0' + } java { @@ -82,6 +85,12 @@ ext { atlasedImages = "${fileStagingDir}/atlasedImages.txt" } +checkstyle { + toolVersion '10.18.1' + configFile file("config/checkstyle/checkstyle.xml") + ignoreFailures false +} + run { jvmArgs = mmJvmOptions } @@ -389,3 +398,12 @@ task unitFileMigrationTool(type: JavaExec, dependsOn: jar) { classpath = sourceSets.main.runtimeClasspath mainClass = 'megamek.utilities.UnitFileMigrationTool' } + +tasks.withType(Checkstyle) { + minHeapSize = "200m" + maxHeapSize = "1g" + reports { + xml.required = false + html.required = true + } +} diff --git a/megamek/config/checkstyle/checkstyle.xml b/megamek/config/checkstyle/checkstyle.xml new file mode 100644 index 00000000000..36a790e38d5 --- /dev/null +++ b/megamek/config/checkstyle/checkstyle.xml @@ -0,0 +1,427 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/megamek/config/checkstyle/suppressions.xml b/megamek/config/checkstyle/suppressions.xml new file mode 100644 index 00000000000..e69de29bb2d