Skip to content

Commit

Permalink
Merge pull request #6 from TylerS1066/gradle
Browse files Browse the repository at this point in the history
Switch over to Gradle
  • Loading branch information
drfiveminusmint authored Jul 6, 2024
2 parents 2e4c148 + 3143130 commit 2317cb0
Show file tree
Hide file tree
Showing 11 changed files with 657 additions and 179 deletions.
105 changes: 48 additions & 57 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,58 @@
# This workflow will build a Java project with Maven, 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-maven
name: Gradle CI

# 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.

name: Java CI with Maven

on:
on:
workflow_dispatch:
push:
pull_request:
schedule:
- cron: '22 14 * * 6'
release:
types: [created, prereleased]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- name: Checkout Movecraft-Overheat
uses: actions/checkout@v3
with:
path: movecraft-overheat
- name: Checkout Movecraft-Combat
uses: actions/checkout@v2
with:
repository: 'APDevTeam/Movecraft-Combat'
path: Movecraft-Combat
ref: main
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Cache Maven packages
id: cacheMain
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2
restore-keys: ${{ runner.os }}-m2

# Build Movecraft-Combat
- name: Build Movecraft-Combat
run: mvn -B package -T 1C --file Movecraft-Combat/pom.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Build Movecraft-Overheat
- name: Build Movecraft-Overheat
run: mvn -B package -T 1C --file movecraft-overheat/pom.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Stage jar
run: mkdir staging && cp movecraft-overheat/target/Movecraft-Overheat*.jar staging
- name: Rename jar
run: mv staging/Movecraft-Overheat*.jar staging/Movecraft-Overheat_$GITHUB_SHA.jar
- name: Upload jar
uses: actions/upload-artifact@v3
with:
name: Movecraft-Overheat_Dev-Build
path: staging/Movecraft-Overheat_*.jar
- name: Checkout Movecraft-Overheat
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"

- name: Build with Gradle
run: ./gradlew clean build --parallel

- name: Publish to GitHub Packages
if: ${{ github.event_name == 'release' }}
run: ./gradlew publish --parallel
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Stage jar for Actions
if: ${{ github.event_name != 'release' }}
run: mkdir staging && cp build/libs/Movecraft-Overheat.jar staging && mv staging/Movecraft-Overheat.jar staging/Movecraft-Overheat_$GITHUB_SHA.jar
- name: Upload jar to Actions
if: ${{ github.event_name != 'release' }}
uses: actions/upload-artifact@v4
with:
name: Movecraft-Overheat_Dev-Build
path: staging/Movecraft-Overheat_*.jar

- name: Stage jar for Release
if: ${{ github.event_name == 'release' }}
run: mkdir staging && cp build/libs/Movecraft-Overheat.jar staging && mv staging/Movecraft-Overheat.jar staging/Movecraft-Overheat_${{ github.event.release.tag_name }}.jar
- name: Upload jar to Release
if: ${{ github.event_name == 'release' }}
uses: softprops/action-gh-release@v2
with:
files: staging/Movecraft-Overheat_${{ github.event.release.tag_name }}.jar
206 changes: 198 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,199 @@
### Java template
*.class

.idea/vcs.xml
.idea/modules.xml
.idea/misc.xml
.idea/jarRepositories.xml
.idea/encodings.xml
.idea/compiler.xml
/target
Movecraft-Overheat.iml
# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*


### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm

*.iml

## Directory-based project format:
.idea/
.vscode/

## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties


### Maven template
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
.flattened-pom.xml

### Eclipse template
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath

# Eclipse Core
.project

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# JDT-specific (Eclipse Java Development Tools)
.classpath

# PDT-specific
.buildpath

# sbteclipse plugin
.target

# TeXlipse plugin
.texlipse


### OSX template
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon��

# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


### SublimeText template
# cache files for sublime text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache

# workspace files are user-specific
*.sublime-workspace

# project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using SublimeText
# *.sublime-project

# sftp configuration file
sftp-config.json


### Linux template
*~

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*


### Vim template
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist


### Windows template
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

### GitHub example for gradle
.gradle
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties

# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

# dependency reduced POMs
*dependency-reduced-pom.xml

# datapack output
/target-datapack/
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

61 changes: 61 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
plugins {
`java-library`
`maven-publish`
id("io.github.0ffz.github-packages") version "1.2.1"
id("io.papermc.hangar-publish-plugin") version "0.1.2"
}

repositories {
gradlePluginPortal()
mavenLocal()
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
maven { githubPackage("apdevteam/movecraft")(this) }
}

dependencies {
api("org.jetbrains:annotations-java5:24.1.0")
compileOnly("io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT")
compileOnly("net.countercraft:movecraft:+")
compileOnly("net.countercraft.movecraft.combat:movecraft-combat:+")
}

group = "net.countercraft.movecraft"
version = "1.0.0_gradle"
description = "Movecraft-Overheat"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

tasks.jar {
archiveBaseName.set("Movecraft-Overheat")
archiveClassifier.set("")
archiveVersion.set("")
}

tasks.processResources {
from(rootProject.file("LICENSE.md"))
filesMatching("*.yml") {
expand(mapOf("projectVersion" to project.version))
}
}

publishing {
publications {
create<MavenPublication>("maven") {
groupId = "net.countercraft.movecraft"
artifactId = "movecraft-overheat"
version = "${project.version}"

artifact(tasks.jar)
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/drfiveminusmint/movecraft-overheat")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 2317cb0

Please sign in to comment.