Skip to content

Commit

Permalink
Gradle (#3)
Browse files Browse the repository at this point in the history
* Initial gradle import

* Update CI

* Finishing conversion to gradle

* Update build scripts

* Update publish.yml

* Update README.md
  • Loading branch information
TylerS1066 authored Jul 4, 2024
1 parent df72ac4 commit d0324bf
Show file tree
Hide file tree
Showing 17 changed files with 529 additions and 178 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Java CI

on:
workflow_dispatch:
push:
pull_request:

jobs:
# Build Movecraft-CoreProtect
build:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout Movecraft-CoreProtect
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: Stage jar
run: mkdir staging && cp build/libs/Movecraft-CoreProtect.jar staging && mv staging/Movecraft-CoreProtect.jar staging/Movecraft-CoreProtect_$GITHUB_SHA.jar
- name: Upload jar
uses: actions/upload-artifact@v4
with:
name: Movecraft-CoreProtect_Dev-Build
path: staging/Movecraft-CoreProtect_*.jar
42 changes: 0 additions & 42 deletions .github/workflows/maven.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish package to GitHub Packages

on:
workflow_dispatch:
release:
types: [created, prereleased]

jobs:
# Build Movecraft-CoreProtect
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout Movecraft-CoreProtect
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 publish --parallel
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,26 @@ buildNumber.properties

# Common working directory
run/

### 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
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
# Movecraft CoreProtect Addon
![CoreProtect](https://github.com/TylerS1066/Movecraft-CoreProtect/actions/workflows/maven.yml/badge.svg)
![CoreProtect](https://github.com/APDevTeam/Movecraft-CoreProtect/actions/workflows/gradle.yml/badge.svg)

Home of the code for the following features:
- CoreProtect logging support

## Version support
The `main` branch is coded for 1.14.4 to 1.18.1 and Movecraft 8.x.
The `main` branch is coded for 1.14.4+ and Movecraft 8.x.

## Download
Devevlopment builds can be found on the [GitHub Actions tab](https://github.com/TylerS1066/Movecraft-CoreProtect/actions) of this repository.
Releases can be found on the [releases tab](https://github.com/APDevTeam/Movecraft-CoreProtect/releases).

Stable builds can be found on [our SpigotMC page](TBD).
Development builds can be found on the [GitHub Actions tab](https://github.com/APDevTeam/Movecraft-CoreProtect/actions) of this repository.

## Building
This plugin requires that the user setup their GitHub token in maven to authenticate with GitHub Packages, as described in [this wiki page](https://github.com/APDevTeam/Movecraft/wiki/Documentation).

Then, run the following to build Movecraft-CoreProtect through `maven`.
Run the following to build Movecraft-CoreProtect:
```
mvn clean install
./gradlew clean build --parallel
```
Jars are located in `/target`.

Jars are located in `/build/libs` directory.

## Support
[Github Issues](https://github.com/TylerS1066/Movecraft-CoreProtect/issues)
[Github Issues](https://github.com/APDevTeam/Movecraft-CoreProtect/issues)

[Discord](http://bit.ly/JoinAP-Dev)

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

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

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.coreprotect:coreprotect:22.4")
}

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

tasks.jar {
archiveBaseName.set("Movecraft-CoreProtect")
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.coreprotect"
artifactId = "movecraft-coreprotect"
version = "${project.version}"

artifact(tasks.jar)
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/apdevteam/movecraft-coreprotect")
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 d0324bf

Please sign in to comment.