Skip to content

Commit

Permalink
fix(test): directly reference plugin.yml in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Silthus committed May 3, 2020
1 parent 966c189 commit 97f7fc4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
16 changes: 12 additions & 4 deletions build.gradle
Expand Up @@ -37,7 +37,12 @@ spigot {
sourceCompatibility = 1.8
targetCompatibility = 1.8

compileJava.options.encoding = 'UTF-8'
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs += ["-parameters"]
options.fork = true
options.forkOptions.executable = 'javac'
}

archivesBaseName = project.property("pluginName")

Expand All @@ -60,18 +65,21 @@ repositories {
maven { url = 'https://oss.sonatype.org/content/repositories/central' }

//Add your repositories here
maven { url = "https://repo.aikar.co/content/groups/aikar/" }
}

ext {
//Define one of the supported mc versions
mcVersion = project.property("mcVersion")
packageName = project.property("packageName")
}

dependencies {
//Adds the spigot api to your plugin
compileOnly "org.spigotmc:spigot-api:${mcVersion}-R0.1-SNAPSHOT"

//Add your dependencies here
compile "co.aikar:acf-bukkit:0.5.0-SNAPSHOT"

//Test dependencies
testCompile "org.mockito:mockito-core:3.+"
Expand All @@ -85,6 +93,8 @@ test {

shadowJar {
classifier = ''
relocate 'co.aikar.commands', "${packageName}.acf"
relocate 'co.aikar.locales', "${packageName}.locales"
}

processResources {
Expand All @@ -103,9 +113,7 @@ task copyPluginYaml(type: Copy, dependsOn: spigotPluginYaml) {
into(sourceSets.main.resources.srcDirs[0])
}

tasks.test.dependsOn(copyPluginYaml)

task deploy(type: Copy, dependsOn: ['cleanPlugin', 'copyPluginYaml', 'jar']) {
task deploy(type: Copy, dependsOn: ['cleanPlugin', 'jar']) {
group 'deploy'
description 'Exports you plugin to the plugin directory in your test server'

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Expand Up @@ -3,5 +3,6 @@ author = Silthus
group = com.silthus
apiVersion = 1.15
mcVersion = 1.15.2
packageName = com.silthus.template

pluginFolder =
6 changes: 0 additions & 6 deletions src/main/resources/plugin.yml

This file was deleted.

4 changes: 3 additions & 1 deletion src/test/java/com/silthus/template/TemplatePluginTests.java
Expand Up @@ -9,6 +9,8 @@
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;

import java.io.File;

@RunWith(MockitoJUnitRunner.class)
public class TemplatePluginTests {

Expand All @@ -19,7 +21,7 @@ public class TemplatePluginTests {
public void setUp()
{
server = MockBukkit.mock();
plugin = MockBukkit.load(TemplatePlugin.class);
plugin = MockBukkit.loadWith(TemplatePlugin.class, new File("build/tmp/spigotPluginYaml/plugin.yml"));

}

Expand Down

0 comments on commit 97f7fc4

Please sign in to comment.