Skip to content

Commit eb92394

Browse files
authored
Merge pull request #49 from EndlessCodeGroup/feature/to_kotlin
To Kotlin: Final
2 parents 7114413 + 8864e92 commit eb92394

39 files changed

+1090
-1133
lines changed

CHANGELOG.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,58 @@
11
## Unreleased
22

3+
### Reworked tasks hierarchy
4+
5+
All plugin's tasks reworked to use actual Gradle APIs:
6+
- [Task Configuration Avoidance][tca].
7+
Plugin's tasks will be created and configured only when it needed
8+
- [Up-to-date checks][uptodate].
9+
Tasks will not re-run if input data not changed
10+
- Optimized work in offline mode.
11+
312
### Property syntax to configure meta fields
4-
Instead of:
5-
```kotlin
13+
Use `.set` instead of `=`:
14+
```diff
615
bukkit {
716
meta {
8-
desctiption = "My plugin's description"
17+
- desctiption = "My plugin's description"
18+
+ description.set("My plugin's description")
919
}
1020
}
1121
```
12-
You should use:
22+
23+
### run -> server
24+
`bukkit.run` renamed to `bukkit.server`. The old name is deprecated
25+
26+
### Improved Bukkit version management
27+
28+
Field `bukkit.version` is deprecated now, you should use `bukkit.apiVersion` instead.
29+
Also, you can specify a version for dev server different from `apiVersion`:
1330
```kotlin
1431
bukkit {
15-
meta {
16-
description.set("My plugin's description")
32+
apiVersion = "1.16.4"
33+
server {
34+
version = "1.15.2" // Want to test plugin on older minecraft version
1735
}
1836
}
1937
```
38+
If `bukkit.server.version` is not specified, will be used `bukkit.apiVersion` for server.
39+
40+
### Re-written in Kotlin
41+
The plugin has been converted to Kotlin to make support easier.
42+
The plugin still can be configured with Groovy DSL but
43+
now it is friendly to Kotlin DSL.
2044

2145
### Added
2246
- Configuration avoidance and build cache for task `generateMetaData`
47+
48+
### Removed
49+
- Task `:rebuildServerCore`, use `:buildServerCore --rerun-tasks` instead
50+
- Extension `DependencyHandler.craftbukkit()`, use `DependencyHandler.spigot()` instead
51+
- Automatic `mavenLocal()` apply, you should apply it manually if you need it
52+
53+
### Housekeeping
54+
- Default bukkit version now is 1.16.4
55+
- Update Gradle to 6.7.1
56+
57+
[tca]: https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
58+
[uptodate]: https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:up_to_date_checks

README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ BukkitGradle [![Version](https://img.shields.io/github/release/EndlessCodeGroup/
22
============
33
Gradle utilities for easier writing Bukkit plugins.
44

5-
## Table of Contents
6-
1. [Apply plugin](#apply-plugin)
7-
2. [Usage](#usage)
8-
1. [First steps](#first-steps)
9-
2. [Configuring plugin](#configuring-plugin)
10-
1. [Quotes around values](#quotes-around-values)
11-
3. [Repositories and Dependencies](#repositories-and-dependencies)
12-
4. [Running Dev server](#running-dev-server)
13-
1. [Server run configurations](#server-run-configurations)
5+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
6+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
7+
8+
9+
- [Apply plugin](#apply-plugin)
10+
- [Usage](#usage)
11+
- [First steps](#first-steps)
12+
- [Configuring plugin](#configuring-plugin)
13+
- [Repositories and Dependencies](#repositories-and-dependencies)
14+
- [Running Dev server](#running-dev-server)
15+
16+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1417

1518
#### Features:
1619
- Automatically applies plugin: java
@@ -142,13 +145,13 @@ BukkitGradle provides short extension-functions to add common repositories and d
142145
There are list of its.
143146

144147
Usage example:
145-
```groovy
148+
```kotlin
146149
repositories {
147150
spigot() // Adds spigot repo
148151
}
149152
150153
dependencies {
151-
compileOnly paperApi() // Adds paper-api dependency
154+
compileOnly(paperApi()) // Adds paper-api dependency
152155
}
153156
```
154157

@@ -169,15 +172,14 @@ Some dependencies also applies repo needed for them.
169172

170173
Name | Signature | Applies repo
171174
-------------|-----------------------------------------------|---------------
172-
spigot | org.spigotmc:spigot:$apiVersion | -
175+
spigot | org.spigotmc:spigot:$apiVersion | mavenLocal
173176
spigotApi | org.spigotmc:spigot-api:$apiVersion | spigot
174177
bukkit | org.bukkit:bukkit:$apiVersion | spigot
175-
craftbukkit | org.bukkit:craftbukkit:$apiVersion | -
176178
paperApi | com.destroystokyo.paper:paper-api:$apiVersion | destroystokyo
177179

178180
**Note:** `$apiVersion` - is `${version}-R0.1-SNAPSHOT` (where `$version` is `bukkit.version`)
179181

180-
If you want more extension-functions - you can [write issue](https://github.com/EndlessCodeGroup/BukkitGradle/issues/new).
182+
If you need more extension-functions, [create issue](https://github.com/EndlessCodeGroup/BukkitGradle/issues/new).
181183

182184
### Running Dev server
183185
Before running server you should configure dev server location.
@@ -188,7 +190,7 @@ You can define it in `local.properties` file (that was automatically created in
188190
server.dir=/path/to/buildtools/
189191
```
190192

191-
If you use Spigot (see `bukkit.run.core`) you also should specify BuildTools location. For Paper no additional actions
193+
If you use Spigot (see `bukkit.server.core`) you also should specify BuildTools location. For Paper no additional actions
192194
needed.
193195
```properties
194196
# Absolute path to directory that contains BuildTools.jar
@@ -208,12 +210,12 @@ server configurations.
208210
##### On other IDEs
209211
Run `:startServer` task.
210212

211-
#### Server run configurations
212-
To accept EULA and change settings use `bukkit.run` section:
213+
#### Dev server configuration
214+
To accept EULA and change settings use `bukkit.server` section:
213215
```groovy
214216
bukkit {
215217
// INFO: Here used default values
216-
run {
218+
server {
217219
// Core type. It can be 'spigot' or 'paper'
218220
core = "spigot"
219221
// Accept EULA

build.gradle.kts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
id("groovy")
55
id("maven-publish")
66
id("com.gradle.plugin-publish") version "0.12.0"
7-
id("com.github.ben-manes.versions") version "0.28.0"
7+
id("com.github.ben-manes.versions") version "0.36.0"
88
}
99

1010
java {
@@ -20,19 +20,11 @@ tasks.test {
2020
useJUnitPlatform()
2121
}
2222

23-
// TODO: Remove after migration to Kotlin
24-
tasks.compileGroovy {
25-
dependsOn(tasks.compileKotlin)
26-
classpath += files(tasks.compileKotlin.get().destinationDir)
27-
}
28-
2923
repositories {
3024
jcenter()
3125
}
3226

3327
dependencies {
34-
implementation(gradleApi())
35-
implementation(localGroovy())
3628
implementation("de.undercouch:gradle-download-task:4.1.1")
3729
testImplementation("junit:junit:4.13")
3830
testImplementation(platform("org.spockframework:spock-bom:2.0-M2-groovy-2.5"))

src/main/groovy/ru/endlesscode/bukkitgradle/BukkitGradlePlugin.groovy

Lines changed: 0 additions & 86 deletions
This file was deleted.

src/main/groovy/ru/endlesscode/bukkitgradle/BukkitGroovy.groovy

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/main/groovy/ru/endlesscode/bukkitgradle/Dependencies.groovy

Lines changed: 0 additions & 79 deletions
This file was deleted.

0 commit comments

Comments
 (0)