Skip to content

Commit 36c0ae1

Browse files
authored
Update to v0.7.0
2 parents 34817e0 + 00bcf57 commit 36c0ae1

17 files changed

+259
-143
lines changed

build.gradle

+2-2
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.7"
6+
id "com.gradle.plugin-publish" version "0.9.9"
77
}
88

99
apply from: "jacoco.gradle"
@@ -36,4 +36,4 @@ pluginBundle {
3636
description = "Gradle plugin providing integration for plugins made for the Bukkit platform"
3737
}
3838
}
39-
}
39+
}

gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
group=ru.endlesscode
22
description=Bukkit Gradle integration plugins
3-
version=0.6.9
3+
version=0.7.0
44
org.gradle.jvmargs=-Xmx3G
55
org.gradle.parallel=true
66
org.gradle.daemon=true
7-
org.gradle.caching=true
7+
org.gradle.caching=true

gradle/wrapper/gradle-wrapper.jar

23 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip

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

+11-36
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ package ru.endlesscode.bukkitgradle
33
import org.gradle.api.JavaVersion
44
import org.gradle.api.Plugin
55
import org.gradle.api.Project
6-
import org.gradle.api.artifacts.DependencyResolutionListener
7-
import org.gradle.api.artifacts.ResolvableDependencies
86
import org.gradle.api.plugins.JavaPluginConvention
97
import org.gradle.api.tasks.compile.JavaCompile
8+
import ru.endlesscode.bukkitgradle.util.Dependencies
109

1110
class BukkitGradlePlugin implements Plugin<Project> {
12-
final static String GROUP = "Bukkit"
11+
final static String GROUP = 'Bukkit'
1312

1413
Project project
1514

@@ -39,9 +38,9 @@ class BukkitGradlePlugin implements Plugin<Project> {
3938
void addPlugins() {
4039
project.with {
4140
plugins.with {
42-
apply("java")
43-
apply("eclipse")
44-
apply("idea")
41+
apply('java')
42+
apply('eclipse')
43+
apply('idea')
4544
apply(PluginMetaPlugin)
4645
apply(DevServerPlugin)
4746
}
@@ -57,7 +56,7 @@ class BukkitGradlePlugin implements Plugin<Project> {
5756
*/
5857
void configureEncoding() {
5958
project.tasks.withType(JavaCompile) {
60-
options.encoding = "UTF-8"
59+
options.encoding = 'UTF-8'
6160
}
6261
}
6362

@@ -71,13 +70,13 @@ class BukkitGradlePlugin implements Plugin<Project> {
7170
mavenCentral()
7271

7372
maven {
74-
name = "sk89q"
75-
url = "http://maven.sk89q.com/repo/"
73+
name = 'sk89q'
74+
url = 'http://maven.sk89q.com/repo/'
7675
}
7776

7877
maven {
79-
name = "spigot"
80-
url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
78+
name = 'spigot'
79+
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
8180
}
8281
}
8382
}
@@ -87,30 +86,6 @@ class BukkitGradlePlugin implements Plugin<Project> {
8786
* Adds needed dependencies
8887
*/
8988
void addDependencies() {
90-
project.gradle.addListener(new DependencyResolutionListener() {
91-
@Override
92-
void beforeResolve(ResolvableDependencies resolvableDependencies) {
93-
addBukkitApi(project)
94-
project.gradle.removeListener(this)
95-
}
96-
97-
@Override
98-
void afterResolve(ResolvableDependencies resolvableDependencies) {}
99-
})
100-
}
101-
102-
/**
103-
* Adds Bukkit API to project dependencies
104-
* @param project The project
105-
*/
106-
static void addBukkitApi(Project project) {
107-
project.with {
108-
def compileOnlyDeps = configurations.compileOnly.dependencies
109-
def testCompileDeps = configurations.testCompile.dependencies
110-
def bukkitDep = dependencies.create("org.bukkit:bukkit:$bukkit.version")
111-
112-
compileOnlyDeps.add(bukkitDep)
113-
testCompileDeps.add(bukkitDep)
114-
}
89+
Dependencies.configureProject(project)
11590
}
11691
}

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

+12-10
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,33 @@ class DevServerPlugin implements Plugin<Project> {
1717
void apply(Project project) {
1818
this.project = project
1919
ServerCore serverCore = new ServerCore(project)
20-
project.task("runServer", type: RunServer, dependsOn: "prepareServer") {
21-
core serverCore
22-
}.configure {
20+
project.task('runServer', type: RunServer, dependsOn: 'prepareServer') {
2321
group = BukkitGradlePlugin.GROUP
2422
description = 'Run dev server'
23+
core serverCore
2524
}
2625

27-
PrepareServer prepareServer = project.task("prepareServer", type: PrepareServer, dependsOn: ["build", "copyServerCore"]) {
28-
core serverCore
29-
}.configure {
26+
PrepareServer prepareServer = project.task(
27+
'prepareServer',
28+
type: PrepareServer,
29+
dependsOn: ['build', 'buildServerCore', 'copyServerCore']
30+
) {
3031
group = BukkitGradlePlugin.GROUP
3132
description = 'Prepare server ro run. Configure server and copy compiled plugin to plugins dir'
33+
core serverCore
3234
} as PrepareServer
3335

3436
Path runConfigurationsDir = project.projectDir.toPath().resolve(".idea/runConfigurations")
35-
project.task("buildIdeaRun", dependsOn: "prepareServer").doLast {
37+
project.task('buildIdeaRun', dependsOn: 'prepareServer') {
38+
group = BukkitGradlePlugin.GROUP
39+
description = 'Configure IDEA server run configuration'
40+
}.doLast {
3641
if (Files.notExists(runConfigurationsDir.parent)) {
3742
throw new LifecycleExecutionException("This task only for IntelliJ IDEA.")
3843
}
3944

4045
Files.createDirectories(runConfigurationsDir)
4146
prepareServer.run.buildIdeaConfiguration(runConfigurationsDir)
42-
}.configure {
43-
group = BukkitGradlePlugin.GROUP
44-
description = 'Configure IDEA server run configuration'
4547
}
4648

4749
project.afterEvaluate {

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ import ru.endlesscode.bukkitgradle.meta.PluginMeta
55

66
class Bukkit {
77
public static final String NAME = "bukkit"
8-
public static final String DYNAMIC_LATEST = "+"
8+
public static final String LATEST = "+"
99
public static final String REVISION_SUFFIX = "-R0.1-SNAPSHOT"
1010

1111
private final Project project
1212

1313
String version
14+
String buildtools = ''
15+
1416
final PluginMeta meta
1517
final RunConfiguration run
1618

@@ -28,7 +30,7 @@ class Bukkit {
2830
* @return Chosen Bukkit version
2931
*/
3032
String getVersion() {
31-
return version ? "$version$REVISION_SUFFIX" : DYNAMIC_LATEST
33+
return version ? "$version$REVISION_SUFFIX" : LATEST
3234
}
3335

3436
void meta(@DelegatesTo(PluginMeta) Closure<?> closure) {

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

+25-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import java.nio.file.Files
99
import java.nio.file.Path
1010

1111
class RunConfiguration {
12-
private static final String DEBUG_ARGS = "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
12+
private static
13+
final String DEBUG_ARGS = "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
1314

1415
private Project project
1516

@@ -27,11 +28,11 @@ class RunConfiguration {
2728
this.eula = false
2829
this.onlineMode = false
2930
this.debug = true
30-
this.encoding = "UTF-8"
31-
this.dir = "server"
31+
this.encoding = 'UTF-8'
32+
this.dir = 'server'
3233

33-
this.javaArgs = "-Xmx1G"
34-
this.bukkitArgs = ""
34+
this.javaArgs = '-Xmx1G'
35+
this.bukkitArgs = ''
3536
}
3637

3738
/**
@@ -40,7 +41,7 @@ class RunConfiguration {
4041
* @return Java arguments
4142
*/
4243
String getJavaArgs() {
43-
return "${this.debug ? "$DEBUG_ARGS " : ""}-Dfile.encoding=$encoding ${this.javaArgs}"
44+
return "${this.debug ? "$DEBUG_ARGS " : ''}-Dfile.encoding=$encoding ${this.javaArgs}"
4445
}
4546

4647
/**
@@ -49,7 +50,7 @@ class RunConfiguration {
4950
* @return Bukkit arguments
5051
*/
5152
String getBukkitArgs() {
52-
return bukkitArgs ?: ""
53+
return bukkitArgs ?: ''
5354
}
5455

5556
/**
@@ -71,7 +72,7 @@ class RunConfiguration {
7172
return
7273
}
7374

74-
def taskName = "Run Server"
75+
def taskName = 'Run Server'
7576
def serverDir = (project.tasks.prepareServer as PrepareServer).serverDir.toRealPath()
7677
def args = this.bukkitArgs
7778

@@ -80,17 +81,29 @@ class RunConfiguration {
8081
def props = this.getJavaArgs()
8182
this.debug = realDebug
8283

83-
def runConfiguration = configurationDir.resolve("${taskName.replace(" ", "_")}.xml")
84+
def runConfiguration = configurationDir.resolve("${taskName.replace(' ', '_')}.xml")
8485
def xml = new MarkupBuilder(runConfiguration.newWriter())
85-
xml.component(name: "ProjectRunConfigurationManager") {
86-
configuration(default: 'false', name: taskName, type: "JarApplication", factoryName: "JAR Application", singleton: "true") {
86+
xml.component(name: 'ProjectRunConfigurationManager') {
87+
configuration(
88+
default: 'false',
89+
name: taskName,
90+
type: 'JarApplication',
91+
factoryName: 'JAR Application',
92+
singleton: 'true'
93+
) {
8794
option(name: 'JAR_PATH', value: "${serverDir.resolve(ServerCore.CORE_NAME)}")
8895
option(name: 'VM_PARAMETERS', value: props)
8996
option(name: 'PROGRAM_PARAMETERS', value: args)
9097
option(name: 'WORKING_DIRECTORY', value: serverDir)
9198
envs()
9299
method {
93-
option(name: "Gradle.BeforeRunTask", enabled: "true", tasks: "prepareServer", externalProjectPath: '$PROJECT_DIR$', vmOptions: "", scriptParameters: "")
100+
option(
101+
name: 'Gradle.BeforeRunTask',
102+
enabled: 'true',
103+
tasks: 'prepareServer',
104+
externalProjectPath: '$PROJECT_DIR$',
105+
vmOptions: '',
106+
scriptParameters: '')
94107
}
95108
}
96109
}

0 commit comments

Comments
 (0)