Skip to content

Commit

Permalink
Gradle build tool support
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbata committed Sep 27, 2023
1 parent aee9212 commit 80ee7ea
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Java CI with Gradle

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
gradle-version: 8.3
arguments: build

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ dist/
*.dsg
build.xml
nbproject/
.gradle
mochadoom.cfg

# Intellij
*.iml
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ On Linux, two different scripts can be used.
1. `build-and-run.sh` which will build Mocha Doom and run it. You can use it as such: `./build-and-run.sh -iwad ~/DOOM2.WAD`. This is the preferred way to quickly test changes for developers.
2. `build-jar.sh` which will build a JAR file. You can then run the JAR file as such: `java -jar mochadoom.jar -iwad ~/DOOM2.WAD`. This is the preferred way for distributing a Mocha Doom executable.

### Build with Gradle

[Gradle](https://gradle.org/) is a cross-platform build tool, which can be also used to run and build Mocha Doom.
First of all, you have to install Gradle following its [installation notes](https://gradle.org/install/). After that you can use the following commands:

* Run Mocha Doom: `gradle clean run`
* Build a JAR file: `gradle clean build`
This creates a JAR file in the `build/libs/` folder.
You can then run the JAR file as such: `java -jar build/libs/mochadoom.jar -iwad ~/DOOM.WAD`.

# License

Mocha Doom contains work from many contributors. Here are the main contributors, but it's no limited to this list. Others are listed in the copyright headers of the files where they own copyright.
Expand Down
29 changes: 29 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
plugins {
id 'application'
}

apply plugin: 'java'

sourceSets {
main {
java {
srcDirs = ['src']
}
}
}

ext {
javaMainClass = 'mochadoom.Engine'
}

jar {
archiveBaseName = 'mochadoom'
manifest {
attributes('Main-Class': javaMainClass)
}
}

application {
mainClass.set(javaMainClass)
}

0 comments on commit 80ee7ea

Please sign in to comment.