75 lines
1.7 KiB
Groovy
75 lines
1.7 KiB
Groovy
class FilteringDependenciesExtention {
|
|
|
|
/**
|
|
* example for 'library':
|
|
* <pre>
|
|
* [lib: 'org.bukkit:bukkit:1.12.2-R0.1-SNAPSHOT',
|
|
* exclude: [
|
|
* 'com.google.code.gson:gson',
|
|
* 'com.googlecode.json-simple:json-simple'
|
|
* ]]
|
|
* </pre>
|
|
*
|
|
* @param library see example
|
|
*/
|
|
def filter(library) {
|
|
Object[] result = new Object[2]
|
|
result[0] = library.lib
|
|
result[1] = {
|
|
library.exclude.each { String excludeLibStr ->
|
|
String[] excludeLib = excludeLibStr.split(':')
|
|
exclude group: excludeLib[0], module: excludeLib[1]
|
|
}
|
|
}
|
|
|
|
return result
|
|
}
|
|
}
|
|
|
|
class FilteringDependenciesPlugin implements Plugin<Project> {
|
|
|
|
@Override
|
|
void apply(Project target) {
|
|
target.extensions.create('fildep', FilteringDependenciesExtention)
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
id 'java'
|
|
}
|
|
|
|
apply plugin: FilteringDependenciesPlugin
|
|
apply from: 'libs.gradle'
|
|
|
|
def publishScript = file(rootProject.getProjectDir().getPath() + '/publish.gradle')
|
|
if (publishScript.exists()) {
|
|
apply from: publishScript.path
|
|
}
|
|
|
|
project.group = projectGroup
|
|
project.version = projectVersion
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
mavenCentral()
|
|
maven { url 'https://hub.spigotmc.org/nexus/content/groups/public' }
|
|
maven { url 'https://dmx-mc-project.gitlab.io/maven-repository/' }
|
|
}
|
|
|
|
dependencies {
|
|
compileOnly libs.lombok
|
|
annotationProcessor libs.lombok
|
|
|
|
compileOnly fildep.filter(libs.bukkit)
|
|
implementation libs.commons_text
|
|
implementation libs.refobj
|
|
|
|
testImplementation libs.test.junit5
|
|
testImplementation libs.test.mock
|
|
testImplementation fildep.filter(libs.bukkit)
|
|
testImplementation libs.test.h2db
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
} |