Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-MX authored Mar 23, 2024
0 parents commit a9736c1
Show file tree
Hide file tree
Showing 20 changed files with 623 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
29 changes: 29 additions & 0 deletions .github/workflows/build-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build and output artifacts

on:
push:

jobs:
build-gradle-project:
runs-on: ubuntu-latest
env:
PVPHUB_MAVEN_USERNAME: "mattmx"
PVPHUB_MAVEN_SECRET: ${{ secrets.PVPHUB_MAVEN_SECRET }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Checkout project sources
uses: actions/checkout@v3
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Run build with Gradle Wrapper
run: ./gradlew build
# - uses: actions/upload-artifact@v3
# with:
# name: build-outputs
# path: build/libs/*-*.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
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

105 changes: 105 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.20"
id("org.ajoberstar.grgit") version "4.1.0"
id("io.papermc.paperweight.userdev") version "1.5.10"
`maven-publish`
}

group = "co.pvphub"
version = "1.0-SNAPSHOT"

// The Maven Publishing endpoint
val mavenEndpoint: PublishingEndpoint = PublishingEndpoint.PRIVATE

// Should we include the commit short in plugin.yml version
val containCommitInPluginVersionString = true

repositories {
mavenCentral()
maven("https://repo.dmulloy2.net/repository/public/")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven("https://maven.pvphub.me/releases")
maven {
url = uri("https://maven.pvphub.me/private")
credentials {
username = System.getenv("PVPHUB_MAVEN_USERNAME")
password = System.getenv("PVPHUB_MAVEN_SECRET")
}
}
}

dependencies {
testImplementation(kotlin("test"))
paperweight.paperDevBundle("1.20.2-R0.1-SNAPSHOT")

compileOnly("me.clip:placeholderapi:2.11.3")

compileOnly("com.mattmx:ktgui:2.2")

compileOnly("co.pvphub:pvphub-core-api:1.3")
compileOnly("co.pvphub:pvphub-core-backend:1.3")
compileOnly("org.mongodb:mongodb-driver-kotlin-coroutine:4.10.1")
compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.7.1")
}

tasks.test {
useJUnitPlatform()
}

sourceSets["main"].resources.srcDir("src/resources/")

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}

tasks.withType<ProcessResources> {
val props = hashMapOf(
"version" to if (containCommitInPluginVersionString) "$version-${getCheckedOutGitCommitHash()}" else version,
"name" to rootProject.name
)
inputs.properties(props)
filteringCharset = "UTF-8"
filesMatching("plugin.yml") {
expand(props)
}
}

java {
withJavadocJar()
withSourcesJar()
}

fun getCheckedOutGitCommitHash(): String = grgit.head().abbreviatedId

publishing {
repositories {
maven {
name = "pvphub-$mavenEndpoint"
url = uri("https://maven.pvphub.me/$mavenEndpoint")
credentials {
username = System.getenv("PVPHUB_MAVEN_USERNAME")
password = System.getenv("PVPHUB_MAVEN_SECRET")
}
}
}
publications {
create<MavenPublication>(rootProject.name) {
from(components["java"])
groupId = group.toString()
artifactId = rootProject.name
version = rootProject.version.toString()
}
}
}

enum class PublishingEndpoint(
private val id: String
) {
PRIVATE("private"),
PUBLIC("releases")
;

override fun toString() = id
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kotlin.code.style=official
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-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit a9736c1

Please sign in to comment.