Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachesMLG committed May 4, 2024
0 parents commit 30a52b0
Show file tree
Hide file tree
Showing 16 changed files with 682 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"
target-branch: "master"
29 changes: 29 additions & 0 deletions .github/workflows/dependabot-approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Dependabot approve & merge
on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
55 changes: 55 additions & 0 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Java CI with Gradle
on: [ push, pull_request ]

jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.commits[0].message, '[ci-skip]')"
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 17
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Test with Gradle
run: ./gradlew test
- name: Build with Gradle
run: ./gradlew build
- name: Upload artifacts
uses: "actions/[email protected]"
with:
name: "MockNBTApi"
path: "build/libs/MockNBTApi-*.jar"
upload:
needs: build
runs-on: ubuntu-latest
if: "contains(github.event.commits[0].message, 'Version Increment')"
steps:
- uses: actions/checkout@v2
- uses: thecodemonkey/action-get-gradle-version@master
id: version
with:
file: "build.gradle.kts"
- uses: actions/[email protected]
with:
name: "MockNBTApi"
path: "./"
- name: Publish to Nexus
uses: sonatype-nexus-community/nexus-repo-github-action@master
with:
serverUrl: "https://nexus.iridiumdevelopment.net/"
username: "${{ secrets.NEXUS_USERNAME }}"
password: "${{ secrets.NEXUS_PASSWORD }}"
format: "maven2"
repository: "maven-releases"
coordinates: "groupId=com.iridium artifactId=MockNBTApi version=${{steps.version.outputs.version}} generate-pom=on"
assets: "extension=jar"
filename: "MockNBTApi-*.jar"
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
68 changes: 68 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
plugins {
java
`maven-publish`
id("com.github.johnrengelman.shadow") version "8.1.1"
}

group = "com.iridium"
version = "1.0.0"
description = "MockNBTApi"

repositories {
mavenCentral()
maven("https://repo.codemc.org/repository/maven-public/")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}

dependencies {
// Dependencies that we want to shade in
implementation("org.jetbrains:annotations:24.1.0")
implementation("de.tr7zw:item-nbt-api:2.12.2")

// Other dependencies that are not required or already available at runtime
compileOnly("org.projectlombok:lombok:1.18.32")
compileOnly("org.spigotmc:spigot-api:1.20.6-R0.1-SNAPSHOT")

// Enable lombok annotation processing
annotationProcessor("org.projectlombok:lombok:1.18.32")

// Test dependencies
testImplementation(platform("org.junit:junit-bom:5.10.2"))
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("com.github.seeseemelk:MockBukkit-v1.18:2.85.2")
}

tasks {
// "Replace" the build task with the shadowJar task (probably bad but who cares)
jar {
dependsOn("shadowJar")
enabled = false
}

shadowJar {
// Remove the archive classifier suffix
archiveClassifier.set("")
relocate("de.tr7zw.changeme.nbtapi", "com.iridium.mocknbtapi.dependencies.nbtapi")

minimize()
}

// Set UTF-8 as the encoding
compileJava {
options.encoding = "UTF-8"
}

test {
useJUnitPlatform()
}

compileJava {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}

compileTestJava {
sourceCompatibility = JavaVersion.VERSION_17.toString()
targetCompatibility = JavaVersion.VERSION_17.toString()
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Sat May 04 19:32:24 BST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 30a52b0

Please sign in to comment.