Skip to content

Commit 68a63fb

Browse files
authored
Update to v0.7.1
2 parents 36c0ae1 + 16118c9 commit 68a63fb

File tree

13 files changed

+153
-59
lines changed

13 files changed

+153
-59
lines changed

README.md

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,51 +14,62 @@ Gradle utilities for easier writing Bukkit plugins.
1414
- Automatically applies plugins: java, idea, eclipse
1515
- Sets up compiler encoding to UTF-8
1616
- Adds repositories: mavenCentral, mavenLocal, spigot-repo, sk89q-repo
17-
- Automatically resolves needed version of bukkit api
17+
- Provides short extension-functions to include bukkit/craftbukkit/spigot/spigot-api
1818
- Generates plugin.yml from Gradle project information
1919
- Allows to run dev server from IDE
20+
- Automatically copies your plugin to plugins dir on server running
2021

2122
#### TODO:
23+
- Add extension function for PaperApi
24+
- Add possibility to use Paper/CraftBukkit as dev server core
25+
- Add automatically downloading of BuildTools
2226
- Add smart dependency system
2327

2428
## Apply plugin
2529
[BukkitGradle on plugins.gradle.org](https://plugins.gradle.org/plugin/ru.endlesscode.bukkitgradle)
26-
#### Gradle 2.1 and higher
30+
#### With new plugins mechanism
2731
```groovy
2832
plugins {
29-
id "ru.endlesscode.bukkitgradle" version "0.6.7"
33+
id "ru.endlesscode.bukkitgradle" version "0.7.1"
3034
}
3135
```
3236

33-
#### Any gradle versions
37+
#### With buildscript and apply
3438
```groovy
3539
buildscript {
3640
repositories {
3741
jcenter()
3842
}
3943
dependencies {
40-
classpath "gradle.plugin.ru.endlesscode:bukkit-gradle:0.6.7"
44+
classpath "gradle.plugin.ru.endlesscode:bukkit-gradle:0.7.1"
4145
}
4246
}
4347
4448
apply plugin: "ru.endlesscode.bukkitgradle"
4549
```
4650

4751
## Usage
48-
You can clone [this example project](https://github.com/EndlessCodeGroup/BukkitGradle-Example), and use it for quick start.
52+
You can clone [this example project](https://github.com/EndlessCodeGroup/BukkitGradle-Example) [**OUTDATED**], and use it for quick start.
4953

5054
### First steps
5155
Simple `build.gradle` file that use BukkitGradle:
5256
```groovy
5357
plugins {
54-
id "ru.endlesscode.bukkitgradle" version "0.6.7"
58+
id "ru.endlesscode.bukkitgradle" version "0.7.1"
5559
}
5660
5761
// Project information
5862
group "com.example"
5963
description "My first Bukkit plugin with Gradle"
6064
version "0.1"
65+
66+
// Let's add needed API to project
67+
dependencies {
68+
compileOnly bukkit()
69+
// You also can use craftbukkit(), spigot() and spigotApi()
70+
}
6171
```
72+
`compileOnly` - it's like provided scope in Maven. It means that this dependncy will not included to your final jar.
6273
It's enough! Will be hooked latest version of Bukkit and automatically generated `plugin.yml` with next content:
6374
```yaml
6475
name: MyPlugin
@@ -73,8 +84,8 @@ You can configure attributes that will be placed to `plugin.yml`:
7384
```groovy
7485
// Override default configurations
7586
bukkit {
76-
// Version of Bukkit (latest by default)
77-
version = "1.10.2"
87+
// Version of API (latest by default)
88+
version = "1.12.2"
7889
7990
// Attributes for plugin.yml
8091
meta {
@@ -102,9 +113,21 @@ Also you can add custom (unsupported by BukkitGradle) attributes like a `depend`
102113
Just create `plugin.yml` file and put custom attributes into.
103114

104115
### Running Dev server
116+
Before running server you should configure BuildTools and dev server location.
117+
118+
You can define it in `local.properties` file (that was automatically created in project root on refresh):
119+
```properties
120+
# Absolute path to directory that contains BuildTools.jar
121+
buildtools.dir=/path/to/buildtools/
122+
# Absolute path to dev server
123+
server.dir=/path/to/buildtools/
124+
```
125+
Or you can define it globally (for all projects that uses BukkitGradle) with environment variables `BUKKIT_DEV_SERVER_HOME`
126+
and `BUILDTOOLS_HOME`.
105127

106128
##### On IntelliJ IDEA
107-
Run `:buildIdeaRun` task. To your IDE will be added Run Configuration that will dynamically refreshes when you change server configurations.
129+
Run `:buildIdeaRun` task. To your IDE will be added Run Configuration that will dynamically refreshes when you change
130+
server configurations.
108131

109132
![Run Configuration](http://image.prntscr.com/image/1a12a03b8ac54fccb7d5b70a335fa996.png)
110133

@@ -121,8 +144,6 @@ bukkit {
121144
eula = false
122145
// Set online-mode flag
123146
onlineMode = false
124-
// Path to deploy server (relative)
125-
dir = "server"
126147
// Debug mode (listen 5005 port, if you use running from IDEA this option will be ignored)
127148
debug = true
128149
// Set server encoding (flag -Dfile.encoding)

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
id "idea"
44

55
id "java-gradle-plugin"
6-
id "com.gradle.plugin-publish" version "0.9.9"
6+
id "com.gradle.plugin-publish" version "0.9.10"
77
}
88

99
apply from: "jacoco.gradle"
@@ -17,10 +17,10 @@ repositories {
1717
jar.archivePath
1818

1919
dependencies {
20-
compile gradleApi()
21-
compile localGroovy()
22-
compile group: "de.undercouch", name: "gradle-download-task", version: "3.2.+"
23-
testCompile group: "junit", name: "junit", version: "4.12"
20+
implementation gradleApi()
21+
implementation localGroovy()
22+
implementation "de.undercouch:gradle-download-task:3.4.3"
23+
testImplementation "junit:junit:4.12"
2424
}
2525

2626
pluginBundle {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
group=ru.endlesscode
22
description=Bukkit Gradle integration plugins
3-
version=0.7.0
3+
version=0.7.1
44
org.gradle.jvmargs=-Xmx3G
55
org.gradle.parallel=true
66
org.gradle.daemon=true

gradle/wrapper/gradle-wrapper.jar

-402 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
34
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip

src/main/groovy/ru/endlesscode/bukkitgradle/extension/Bukkit.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class Bukkit {
1111
private final Project project
1212

1313
String version
14-
String buildtools = ''
1514

1615
final PluginMeta meta
1716
final RunConfiguration run

src/main/groovy/ru/endlesscode/bukkitgradle/extension/RunConfiguration.groovy

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class RunConfiguration {
1818
boolean onlineMode
1919
boolean debug
2020
String encoding
21-
String dir
2221
String javaArgs
2322
String bukkitArgs
2423

@@ -29,7 +28,6 @@ class RunConfiguration {
2928
this.onlineMode = false
3029
this.debug = true
3130
this.encoding = 'UTF-8'
32-
this.dir = 'server'
3331

3432
this.javaArgs = '-Xmx1G'
3533
this.bukkitArgs = ''
@@ -53,15 +51,6 @@ class RunConfiguration {
5351
return bukkitArgs ?: ''
5452
}
5553

56-
/**
57-
* Returns servers dir
58-
*
59-
* @return The directory
60-
*/
61-
Path getDir() {
62-
project.projectDir.toPath().resolve(this.dir)
63-
}
64-
6554
/**
6655
* Builds and writes to file run configuration in IDEA .xml format
6756
*

src/main/groovy/ru/endlesscode/bukkitgradle/meta/MetaFile.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class MetaFile {
7676
*/
7777
private void filterMetaLines() {
7878
staticLines.clear()
79-
if (!Files.exists(metaFile)) {
79+
if (Files.notExists(metaFile)) {
8080
return
8181
}
8282

src/main/groovy/ru/endlesscode/bukkitgradle/meta/PluginMeta.groovy

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ class PluginMeta {
1111
final MetaItem url
1212
final MetaItem authors
1313

14+
private final Project project
1415
private final List<MetaItem> metaItems = []
1516

1617
PluginMeta(Project project) {
18+
this.project = project
19+
1720
this.name = new MetaItem("name", true, project.name)
1821
this.description = new MetaItem("description", { project.description })
1922
this.main = new MetaItem("main", true, { "${project.group}.${getName().toLowerCase()}.${getName()}" })
@@ -26,6 +29,7 @@ class PluginMeta {
2629

2730
void setName(def name) {
2831
this.name.value = name
32+
project.archivesBaseName = getName()
2933
}
3034

3135
String getName() {
@@ -75,4 +79,24 @@ class PluginMeta {
7579
List<MetaItem> getItems() {
7680
return metaItems
7781
}
82+
83+
/**
84+
* Enclose value in single quotes.
85+
*
86+
* @param value The value
87+
* @return Value with single quotes around
88+
*/
89+
def q(value) {
90+
return "'$value'"
91+
}
92+
93+
/**
94+
* Enclose value in double quotes.
95+
*
96+
* @param value The value
97+
* @return Value with double quotes around
98+
*/
99+
def qq(value) {
100+
return "\"$value\""
101+
}
78102
}

0 commit comments

Comments
 (0)