Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-MX committed May 13, 2024
0 parents commit 14df74f
Show file tree
Hide file tree
Showing 19 changed files with 615 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
28 changes: 28 additions & 0 deletions .github/workflows/build-and-archive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Will build your gradle project and archive the output jar files.
name: Build and Archive Gradle Project

# This action will run every time you push to the "main" branch.
on:
push:
branches:
- "main"

jobs:
build-and-release:
runs-on: ubuntu-latest
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: Run build with Gradle Wrapper
run: ./gradlew build
- uses: actions/upload-artifact@v3
with:
name: build-outputs
path: build/libs/*.jar
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Will simply build your gradle project.
name: Build Gradle Project

# This action will run every time you push to the "dev" branch.
on:
push:
branches:
- "dev"

jobs:
build-project:
runs-on: ubuntu-latest
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: Run build with Gradle Wrapper
run: ./gradlew build
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.

7 changes: 7 additions & 0 deletions .idea/discord.xml

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

15 changes: 15 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.

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

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

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

plugins {
kotlin("jvm") version "1.7.10"
id("com.github.johnrengelman.shadow") version "7.0.0"
id("org.ajoberstar.grgit") version "4.1.0"

// Check for new versions at https://plugins.gradle.org/plugin/io.papermc.paperweight.userdev
id("io.papermc.paperweight.userdev") version "1.7.1"
`maven-publish`
}

group = project.properties["group"].toString()
version = project.properties["version"].toString()
val id: String by project

val plugin_name: String by project
val plugin_main_class_name: String by project
val plugin_author: String by project
val include_commit_hash: Boolean by project

val ktgui_version: String by project
val paper_version: String by project

repositories {
mavenCentral()
maven("https://maven.pvphub.me")
}

dependencies {
testImplementation(kotlin("test"))
compileOnly(kotlin("stdlib"))

compileOnly("com.mattmx:ktgui:${ktgui_version}")
paperweight.paperDevBundle(paper_version)
}

tasks {
withType<ProcessResources> {
val props = mapOf(
"name" to plugin_name,
"main" to "${group}.${id}.${plugin_main_class_name}",
"author" to plugin_author,
"version" to if (include_commit_hash) "${rootProject.version}-commit-${grgit.head().abbreviatedId}" else rootProject.version.toString()
)
inputs.properties(props)
filteringCharset = "UTF-8"
filesMatching("plugin.yml") {
expand(props)
}
}

shadowJar {
mergeServiceFiles()
}

test {
useJUnitPlatform()
}

assemble {
dependsOn("reobfJar")
}

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

java {
withJavadocJar()
withSourcesJar()
}

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

kotlin {
jvmToolchain(17)
}

publishing {
repositories {
maven {
name = "pvphub-releases"
url = uri("https://maven.pvphub.me/releases")
credentials {
username = System.getenv("PVPHUB_MAVEN_USERNAME")
password = System.getenv("PVPHUB_MAVEN_SECRET")
}
}
}
publications {
create<MavenPublication>(id) {
from(components["java"])
groupId = group
artifactId = id
version = rootProject.version.toString()
}
}
}
16 changes: 16 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
kotlin.code.style=official

# Project configuration
group = "com.mattmx"
id = "template"
version = "1.0"

plugin_name = "Template"
plugin_main_class_name = "TemplatePlugin"
plugin_author = "MattMX"

include_commit_hash = true

# Dependenices
paper_version = "1.20.4-R0.1-SNAPSHOT"
ktgui_version = "2.3.2"
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 14df74f

Please sign in to comment.