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

Setting up Utility classes with Gradle build #5750

Merged
merged 17 commits into from
Jul 20, 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
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ 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/megamek/mm-revision.txt

- name: Build with Gradle
working-directory: megamek
run: ./gradlew build --stacktrace --scan
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/nightly-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ 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/megamek/mm-revision.txt

- name: Build with Gradle
working-directory: megamek
run: ./gradlew clean build --stacktrace --scan
Expand Down
31 changes: 12 additions & 19 deletions .github/workflows/validate-boards.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# Validates Boards
#
# Jobs:
# - board_validator: Validate boards in MM
name: Validate Boards

# This Action Definition should be triggered only on master being updated or Pull Requests being added or updated against master.
on:
push:
branches: [master]
Expand All @@ -26,22 +21,25 @@ on:
- "megamek/src/megamek/common/Building.java"
- "megamek/src/megamek/common/Terrains.java"
- "megamek/src/megamek/utilities/BoardsValidator.java"
env:
GRADLE_OPTS: "-Dscan.link.VCS=${{ github.event.pull_request.html_url }}"

jobs:
board_validator:
runs-on: ${{ matrix.os }}

# Run this job once for each combination in the matrix below.
strategy:
matrix:
os: [ubuntu-latest] # For Board Validation running on *nix is sufficient
os: [ubuntu-latest]
java-distribution: [temurin]
java-version: [17]

steps:
- uses: actions/checkout@v4
- name: "Check out MegaMek"
uses: actions/checkout@v4
with:
path: megamek

# Setup the requested Java Distribution and Version from the matrix
- name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
Expand All @@ -50,16 +48,11 @@ jobs:

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
build-scan-publish: false
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"

- name: Build with Gradle
working-directory: megamek
run: ./gradlew jar

# Run the Boards Validator
- name: Validate Boards
working-directory: megamek
# Runs the BoardsValidator in default mode, which rips through
# the ./data directory of the current working directory.
#
# The -q flag tells the validator to only print the filenames that are invalid.
run: java -cp build/libs/MegaMek.jar megamek.utilities.BoardsValidator -q
run: ./gradlew boardsValidator
21 changes: 11 additions & 10 deletions .github/workflows/validate-namechanges.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Validate Name Changes List

# This Action Definition should be triggered only on master being updated or Pull Requests being added or updated against master.
on:
push:
branches: [master]
Expand All @@ -16,19 +15,21 @@ on:
- "megamek/data/mechfiles/**.mtf"
- "megamek/data/mechfiles/name_changes.txt"

env:
GRADLE_OPTS: "-Dscan.link.VCS=${{ github.event.pull_request.html_url }}"

jobs:
name_changes_validator:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest] # For CI/CD running on *nix is sufficient
os: [ubuntu-latest]
java-distribution: [temurin]
java-version: [17]
fail-fast: false

steps:
- name: "Checkout MegaMek"
- name: "Check out MegaMek"
uses: actions/checkout@v4
with:
path: megamek
Expand All @@ -41,11 +42,11 @@ jobs:

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
build-scan-publish: false
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"

- name: Build with Gradle
working-directory: megamek
run: ./gradlew build

- name: Validate Name Changes
- name: Validate Boards
working-directory: megamek
run: java -cp build/libs/MegaMek.jar megamek.utilities.NameChangesValidator
run: ./gradlew nameChangesValidator
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,8 @@ megamek/userdata/**
/megamek/Entity Issues.txt
/megamek/apidocs/
#End MegaMek Other Outputs

/megamek/docs/mm-revision.txt
/megamek/MegaMek.l4j.ini
OfficialUnitList.txt
equipment.txt
10 changes: 0 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
plugins {
id 'org.ajoberstar.grgit' version '5.2.2'
id 'java'
}

Expand All @@ -19,15 +18,6 @@ subprojects {
version = '0.50.0-SNAPSHOT'
}

ext {
mmGitRoot = 'https://github.com/MegaMek/megamek.git'
// Work on MML or MHQ sometimes requires changes in MM as well. The maven publishing tasks use
// these properties to append the branch name to the artifact id if the repo is not in the master
// branch, making it available separately to the child project.
mmBranch = grgit.branch.current().name
mmBranchTag = mmBranch.equals('master') ? '' : '-' + mmBranch
}

// A properties_local.gradle file can be used to override any of the above options. For instance,
// rootProject.ext.mmGitRoot = 'file:///path/to/local/repo' will cause the release target to clone a
// local copy of the repository rather than downloading it.
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a generated file? This change would get overwritten when generated right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It gets updated when Gradle gets updated, no other time.

Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down
Loading