Skip to content

Commit

Permalink
First working implementation
Browse files Browse the repository at this point in the history
Adjust building
  • Loading branch information
rainbowdashlabs committed May 12, 2022
1 parent daf1053 commit c76e8b6
Show file tree
Hide file tree
Showing 17 changed files with 849 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: RainbowDashLabs
patreon: eldoriaplugins
open_collective: # Replace with a single Open Collective username
ko_fi: eldoriaplugins
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
33 changes: 33 additions & 0 deletions .github/workflows/publish_to_nexus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish to Nexus

on:
workflow_dispatch:
push:
branches:
- main
- dev*
- feature/*
- release/*
- fix/*

jobs:
build:
environment: build
runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 17
- name: Build with Gradle
run: ./gradlew --build-cache build
- name: Test with Gradle
run: ./gradlew test
- name: Publish to eldonexus
run: ./gradlew publishMavenPublicationToEldoNexusRepository
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
22 changes: 22 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Verify state

on:
push:
pull_request:
types: [opened, ready_for_review, review_requested, edited]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 17
- name: Build with Gradle
run: ./gradlew --build-cache build
- name: Test with Gradle
run: ./gradlew test
3 changes: 3 additions & 0 deletions HEADER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-License-Identifier: AGPL-3.0-only

Copyright (C) 2021 EldoriaRPG Team and Contributor
114 changes: 114 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import de.chojo.Repo

plugins {
id("org.cadixdev.licenser") version "0.6.1"
id("com.github.johnrengelman.shadow") version "7.1.2"
id("de.chojo.publishdata") version "1.0.4"
java
`maven-publish`
}

group = "de.eldoria"
version = "1.0.0"

repositories {
maven("https://eldonexus.de/repository/maven-public/")
maven("https://eldonexus.de/repository/maven-proxies/")
}

dependencies {
compileOnly("de.eldoria", "schematicbrushreborn-api", "2.1.8-SNAPSHOT")
compileOnly("org.spigotmc", "spigot-api", "1.13.2-R0.1-SNAPSHOT")
compileOnly("com.sk89q.worldedit", "worldedit-bukkit", "7.2.10")

testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1")
}

license {
header(rootProject.file("HEADER.txt"))
include("**/*.java")
}

java {
withSourcesJar()
withJavadocJar()
sourceCompatibility = JavaVersion.VERSION_17
}

publishData {
addRepo(Repo.main("", "https://eldonexus.de/repository/maven-releases/", false))
addRepo(Repo.dev("DEV", "https://eldonexus.de/repository/maven-dev/", true))
addRepo(Repo.snapshot("SNAPSHOT", "https://eldonexus.de/repository/maven-snapshots/", true))
publishComponent("java")
}

publishing {
publications.create<MavenPublication>("maven") {
publishData.configurePublication(this)
}

repositories {
maven {
authentication {
credentials(PasswordCredentials::class) {
username = System.getenv("NEXUS_USERNAME")
password = System.getenv("NEXUS_PASSWORD")
}
}

setUrl(publishData.getRepository())
name = "EldoNexus"
}
}
}

tasks {
compileJava {
options.encoding = "UTF-8"
}

compileTestJava {
options.encoding = "UTF-8"
}

test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}

shadowJar {
relocate("de.eldoria.eldoutilities", "de.eldoria.schematicbrush.libs.eldoutilities")
relocate("de.eldoria.messageblocker", "de.eldoria.schematicbrush.libs.messageblocker")
relocate("net.kyori", "de.eldoria.schematicbrush.libs.kyori")
mergeServiceFiles()
}

processResources {
from(sourceSets.main.get().resources.srcDirs) {
filesMatching("plugin.yml") {
expand(
"version" to publishData.getVersion(true)
)
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}

register<Copy>("copyToServer") {
val path = project.property("targetDir") ?: "";
if (path.toString().isEmpty()) {
println("targetDir is not set in gradle properties")
return@register
}
println("Copying jar to $path")
from(shadowJar)
destinationDir = File(path.toString())
}

build {
dependsOn(shadowJar)
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit c76e8b6

Please sign in to comment.