Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin conversion #29

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
3632de6
started work on maven plugin which auto generates main plugin class a…
Joshbpls Mar 21, 2020
3e7ae01
fixed issue where generated main class was not compiling into final jar
Joshbpls Apr 6, 2020
e08e0e0
Replace annotation processor dep with plugin
kylepls Apr 7, 2020
62c34f3
fixed poms for mcspring-maven-plugin
Joshbpls Apr 7, 2020
531478a
now scans project source for @PluginDepend
Joshbpls May 2, 2020
aebb2cb
now properly compiles with plugin.yml
Joshbpls May 2, 2020
e9aad70
Start adding tests
kylepls May 2, 2020
6a93b28
Big change for mah boi josh
kylepls May 2, 2020
d20b252
removed private constructors on utility classes closes #24
Joshbpls May 2, 2020
5c4321c
fixed up README.md
Joshbpls May 2, 2020
399bb78
re-organized project structure and cleaned up some classes
Joshbpls May 4, 2020
0616c2a
FOR KYLE
Joshbpls May 4, 2020
28e9171
Start conversion
kylepls May 7, 2020
5cae866
Almost finished with command rewrite
kylepls May 10, 2020
d4c0a8a
Continue conversion
kylepls May 10, 2020
d5dfa41
Rename .java to .kt
kylepls May 12, 2020
ae43191
Continue conversion
kylepls May 12, 2020
8b554d5
Rename .java to .kt
kylepls May 12, 2020
9d8aa5b
Cleanup vault api
kylepls May 12, 2020
616150a
start orchid
kylepls May 13, 2020
ad23d9f
start orchid
kylepls May 13, 2020
c770f41
add gradle files
kylepls May 15, 2020
db3bb95
Remove subcommands api and replace with DSL
kylepls Jun 8, 2020
324d784
Start plugin load testing
kylepls Jun 14, 2020
c4aa3a1
Break out plugin to own project
kylepls Jun 15, 2020
8625592
Update travis and README.md
kylepls Jun 15, 2020
eeafb1b
Update travis
kylepls Jun 15, 2020
19cd27d
Update permission for travis
kylepls Jun 15, 2020
ee85721
Fix failing tests
kylepls Jun 15, 2020
22006cd
Remove unused import
kylepls Jun 15, 2020
b86328b
Add gradle enterprise plugin
kylepls Jun 15, 2020
9ccd5c8
Update command DSL tests and remove logging package
kylepls Jun 19, 2020
d3fce5f
More tests
kylepls Jun 20, 2020
7da8805
Added tests to gradle plugin and restructured project
kylepls Jun 21, 2020
10355d7
Add more memory to gradle for travis
kylepls Jun 21, 2020
0a3280f
add additional test gradle params
kylepls Jun 21, 2020
9a9302f
give gradle more memory
kylepls Jun 21, 2020
b55e9d2
gradle ee settings
kylepls Jun 21, 2020
0e6a1aa
Add more memory to child gradle processes
kylepls Jun 21, 2020
bc0a27a
Add more memory to child gradle processes
kylepls Jun 21, 2020
67a0787
More memory????
kylepls Jun 21, 2020
aa79d50
Remove env flags?
kylepls Jun 21, 2020
9beafc8
Close all ClassGraph resources
kylepls Jun 21, 2020
87081a8
Try removing heap size for tests
kylepls Jun 21, 2020
e894a59
Update commands
kylepls Jun 27, 2020
957e43a
Fix failing test
kylepls Jun 27, 2020
f1b3298
remove extra deps
kylepls Jun 27, 2020
e9ed019
Add api version support
kylepls Jun 30, 2020
d1064e6
start e2e, misc fixes
kylepls Jul 12, 2020
46a27f1
Updates to bean registration logic
kylepls Jul 30, 2020
83f6156
Updates to bean registration logic
kylepls Jul 30, 2020
331e5ab
Add additional mapper to MapParser
kylepls Jul 30, 2020
20a4cf9
Update inventory gui functionality
kylepls Sep 6, 2020
c604c79
Misc changes, make URLClassLoader 1.17 compatible
kylepls Feb 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.idea
*.iml
dependency-reduced-pom.xml
**/target/**
**/out/**
**/build/**
.gradle
pom.xml.versionsBackup
**/spigot/**
!**/archetype-resources/spigot/**
24 changes: 0 additions & 24 deletions .maven.xml

This file was deleted.

32 changes: 21 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
language: java
jdk: openjdk8
install: skip

before_install:
- echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import
- echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust
- export MAVEN_OPTS=-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
before_deploy:
- mvn help:evaluate -N -Dexpression=project.version|grep -v '\['
- export project_version=$(mvn help:evaluate -N -Dexpression=project.version|grep -v '\[')
- chmod +x gradlew

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/

cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/

script:
- ./gradlew build --scan -s

deploy:
provider: script
skip_cleanup: true
## Build and release to maven central on tagged version
script: mvn deploy --settings .maven.xml -DskipTests=true -B -U -Prelease
cleanup: false
script:
- ./gradlew bintrayPublish -Dorg.gradle.project.bintray.user=$BINTRAY_USER -Dorg.gradle.project.bintray.key=$BINTRAY_KEY
# TODO add in publishing for plugin
# - ./ -Dorg.gradle.project.gradle.publish.key=$PLUGIN_PORTAL_API_KEY -Dorg.gradle.project.gradle.publish.secret=$PLUGIN_PORTAL_API_SECRET
on:
tags: true
branch: master
name: $project_version
install:
mvn --settings .maven.xml clean install -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -B -V
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mcspring [![Build Status](https://travis-ci.org/kylepls/mcspring.svg?branch=master)](https://travis-ci.org/kylepls/mcspring) ![Maven Central](https://img.shields.io/maven-central/v/in.kyle.mcspring/mcspring)
# mcspring [![Build Status](https://travis-ci.org/kylepls/mcspring.svg?branch=master)](https://travis-ci.org/kylepls/mcspring) ![Bintray](https://img.shields.io/bintray/v/mcspring/maven/mcspring)

Writing Bukkit plugins is a nightmare. I often lay awake in my bed late at night unable to sleep
because Bukkit made events an annotation but commands are created by implementing a class.
Expand All @@ -9,7 +9,7 @@ Writing Bukkit plugins is a nightmare. I often lay awake in my bed late at night
These are solved problems. Spring Boot took care of this issue ages ago.
So how about we ditch this ridiculous programming model and hop on the Spring train.

```java
```kotlin
@Component
class Test { // We don't have to extend JavaPlugin. The plugin.yml is also generated for us.

Expand Down Expand Up @@ -69,15 +69,13 @@ class Test { // We don't have to extend JavaPlugin. The plugin.yml is also gener
* Schedulers are defined with `@Scheduler`. Another thing to schlep away somewhere.
* `@EventHandler` now registers itself. About damn time.
* Like money? Vault support is in the box `in.kyle.mcspring.economy.EconomyService`
* Want my hot take on sub-command handing? We've got you covered (see the wiki)
* Want my hot take on sub-command handling? We've got you covered (see the wiki)
* I've also added some other optionionated libraries to the project with some pretty neat functionality. Check out mcspring-chat-actions, mcspring-chat, mcspring-guis, mcspring-nms.

## Getting Started
I went ahead and wrote a full tutorial series for you newcomers. Get started [here](https://github.com/kylepls/mcspring/wiki/Getting-Setup)
Please use the simple-factions project as a reference. This can be found in the `/mcspring-examples` folder.

If you think you're too smart for the beginner tutorial; go to the
[wiki](https://github.com/kylepls/mcspring/wiki) and piece it together.

If you're really really smart; check out the example plugins in the `mcspring-example` folder.
Each subproject has attached documentation.

---

Expand Down
15 changes: 15 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
plugins {
`mcspring-docs`
}

allprojects {
group = "in.kyle.mcspring"
version = "0.1.0"
}

subprojects {
apply(plugin = "mcspring-build")
apply(plugin = "mcspring-publish")
}

defaultTasks("build")
26 changes: 26 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
plugins {
`kotlin-dsl`
}

configure<KotlinDslPluginOptions> {
experimentalWarning.set(false)
}

repositories {
jcenter()
mavenCentral()
}

dependencies {
implementation("org.springframework.boot:spring-boot-gradle-plugin:2.3.1.RELEASE")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72")
implementation("io.spring.gradle:dependency-management-plugin:1.0.9.RELEASE")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.10.1")
implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5")
implementation("gradle.plugin.com.eden:orchidPlugin:0.20.0") {
repositories {
maven("https://plugins.gradle.org/m2/")
}
}
}

41 changes: 41 additions & 0 deletions buildSrc/src/main/kotlin/mcspring-build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm")
}

repositories {
jcenter()
mavenCentral()
mavenLocal()
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://oss.sonatype.org/content/repositories/snapshots")
}

dependencies {
val spigotVersion = "1.15.2-R0.1-SNAPSHOT"
compileOnly("org.spigotmc:spigot-api:$spigotVersion")

implementation(kotlin("stdlib"))

testImplementation("org.mockito:mockito-core:2.+")
testImplementation("io.mockk:mockk:1.10.0")
testImplementation("org.junit.jupiter:junit-jupiter:5.6.2")
testImplementation("org.spigotmc:spigot-api:$spigotVersion")

val kotestVersion = "4.1.0.RC2"
testImplementation("io.kotest:kotest-runner-junit5-jvm:$kotestVersion")
testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion")
testImplementation("io.kotest:kotest-property-jvm:$kotestVersion")
testImplementation("io.kotest:kotest-runner-console-jvm:$kotestVersion")
testImplementation("io.kotest:kotest-extensions-spring:$kotestVersion")
}

tasks.test {
useJUnitPlatform()
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.suppressWarnings = true
kotlinOptions.jvmTarget = "1.8"
}
29 changes: 29 additions & 0 deletions buildSrc/src/main/kotlin/mcspring-docs.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
plugins {
id("org.jetbrains.dokka")
id("com.eden.orchidPlugin")
}

repositories {
jcenter()
}

dependencies {
orchidRuntimeOnly("io.github.javaeden.orchid:OrchidDocs:0.20.0")
orchidRuntimeOnly("io.github.javaeden.orchid:OrchidSourceDoc:0.20.0")
orchidRuntimeOnly("io.github.javaeden.orchid:OrchidKotlindoc:0.20.0")
orchidRuntimeOnly("io.github.javaeden.orchid:OrchidPluginDocs:0.20.0")
}

tasks.withType(org.jetbrains.dokka.gradle.DokkaTask::class) {
outputFormat = "html"
configuration {
externalDocumentationLink {
url = uri("https://hub.spigotmc.org/javadocs/bukkit/").toURL()
url = uri("http://milkbowl.github.io/VaultAPI/").toURL()
}
}
}

orchid {
theme = "Editorial"
}
85 changes: 85 additions & 0 deletions buildSrc/src/main/kotlin/mcspring-publish.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import com.jfrog.bintray.gradle.BintrayExtension

plugins {
kotlin("jvm")
`maven-publish`
id("com.jfrog.bintray")
}

val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.getByName("main").allSource)
dependsOn(tasks.classes)
}

val artifactName = project.name
val artifactGroup = project.group.toString()
val artifactVersion = project.version.toString()

val pomUrl = "https://github.com/kylepls/mcspring"
val pomScmUrl = "https://github.com/kylepls/mcspring"
val pomIssueUrl = "https://github.com/kylepls/mcspring/issues"
val pomDesc = "https://github.com/kylepls/mcspring"

val githubRepo = "kylepls/mcspring"
val githubReadme = "README.md"

val pomLicenseName = "MIT"
val pomLicenseUrl = "https://opensource.org/licenses/mit-license.php"
val pomLicenseDist = "repo"

val pomDeveloperId = "kylepls"
val pomDeveloperName = "Kyle"

publishing {
publications {
create<MavenPublication>("mcspring") {
groupId = artifactGroup
artifactId = artifactName
version = artifactVersion
from(components["java"])
artifact(sourcesJar) {
classifier = "sources"
}

pom.withXml {
asNode().apply {
appendNode("description", pomDesc)
appendNode("name", rootProject.name)
appendNode("url", pomUrl)
appendNode("licenses").appendNode("license").apply {
appendNode("name", pomLicenseName)
appendNode("url", pomLicenseUrl)
appendNode("distribution", pomLicenseDist)
}
appendNode("developers").appendNode("developer").apply {
appendNode("id", pomDeveloperId)
appendNode("name", pomDeveloperName)
}
appendNode("scm").apply {
appendNode("url", pomScmUrl)
}
}
}
}
}
}

bintray {
user = project.findProperty("bintray.user")?.toString() ?: System.getProperty("bintray.user")
key = project.findProperty("bintray.key")?.toString() ?: System.getProperty("bintray.key")
setPublications("mcspring")
override = true
publish = true

pkg(delegateClosureOf<BintrayExtension.PackageConfig> {
repo = "maven"
name = "mcspring"
userOrg = "mcspring"
setLabels("kotlin", "spigot", "spring")
vcsUrl = "https://github.com/kylepls/mcspring"
})
}

tasks.findByName("build")!!.dependsOn(tasks.findByName("publishToMavenLocal"))

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-6.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading