From 132dd2f4ca4451f662a56f9f647895ff517cf941 Mon Sep 17 00:00:00 2001 From: DmitriyMX Date: Thu, 7 Jan 2021 02:25:29 +0300 Subject: [PATCH] =?UTF-8?q?gradle:=20=D1=83=D0=B1=D1=80=D0=B0=D0=BD=20?= =?UTF-8?q?=D0=BB=D0=B8=D1=88=D0=BD=D0=B8=D0=B9=20=D0=BF=D0=BB=D0=B0=D0=B3?= =?UTF-8?q?=D0=B8=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 6 ++-- .../FilteringDependenciesExtention.groovy | 29 ------------------- .../fildep/FilteringDependenciesPlugin.groovy | 12 -------- .../src/main/groovy/libs/LibsExtention.groovy | 27 +++++++++++++---- 4 files changed, 23 insertions(+), 51 deletions(-) delete mode 100644 buildSrc/src/main/groovy/fildep/FilteringDependenciesExtention.groovy delete mode 100644 buildSrc/src/main/groovy/fildep/FilteringDependenciesPlugin.groovy diff --git a/build.gradle b/build.gradle index 6c156a7..742197c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,9 @@ -import fildep.FilteringDependenciesPlugin import libs.LibsPlugin plugins { id 'java' } -apply plugin: FilteringDependenciesPlugin apply plugin: LibsPlugin def publishScript = file(rootProject.getProjectDir().getPath() + '/publish.gradle') @@ -27,13 +25,13 @@ dependencies { compileOnly libs.lombok annotationProcessor libs.lombok - compileOnly fildep.filter(libs.bukkit) + compileOnly libs.bukkit implementation libs.commons_text implementation libs.refobj testImplementation libs.test.junit5 testImplementation libs.test.mock - testImplementation fildep.filter(libs.bukkit) + testImplementation libs.bukkit testImplementation libs.test.h2db } diff --git a/buildSrc/src/main/groovy/fildep/FilteringDependenciesExtention.groovy b/buildSrc/src/main/groovy/fildep/FilteringDependenciesExtention.groovy deleted file mode 100644 index 3fcbdf5..0000000 --- a/buildSrc/src/main/groovy/fildep/FilteringDependenciesExtention.groovy +++ /dev/null @@ -1,29 +0,0 @@ -package fildep - -class FilteringDependenciesExtention { - - /** - * example for 'library': - *
-     * [lib: 'org.bukkit:bukkit:1.12.2-R0.1-SNAPSHOT',
-     * exclude: [
-     *   'com.google.code.gson:gson',
-     *   'com.googlecode.json-simple:json-simple'
-     * ]]
-     * 
- * - * @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 - } -} diff --git a/buildSrc/src/main/groovy/fildep/FilteringDependenciesPlugin.groovy b/buildSrc/src/main/groovy/fildep/FilteringDependenciesPlugin.groovy deleted file mode 100644 index 72a165f..0000000 --- a/buildSrc/src/main/groovy/fildep/FilteringDependenciesPlugin.groovy +++ /dev/null @@ -1,12 +0,0 @@ -package fildep - -import org.gradle.api.Plugin -import org.gradle.api.Project - -class FilteringDependenciesPlugin implements Plugin { - - @Override - void apply(Project target) { - target.extensions.create('fildep', FilteringDependenciesExtention) - } -} diff --git a/buildSrc/src/main/groovy/libs/LibsExtention.groovy b/buildSrc/src/main/groovy/libs/LibsExtention.groovy index fe507c3..9c104da 100644 --- a/buildSrc/src/main/groovy/libs/LibsExtention.groovy +++ b/buildSrc/src/main/groovy/libs/LibsExtention.groovy @@ -7,12 +7,14 @@ class LibsExtention { final def lombok = 'org.projectlombok:lombok:1.18.12' final def refobj = 'ru.dmitriymx:reflection-object:1.0-BETA' - final def bukkit = [lib: 'org.bukkit:bukkit:1.12.2-R0.1-SNAPSHOT', exclude: [ - 'com.google.code.gson:gson', - 'com.googlecode.json-simple:json-simple', - 'commons-lang:commons-lang', - 'org.yaml:snakeyaml' - ]] + final def bukkit = filter([ + lib : 'org.bukkit:bukkit:1.12.2-R0.1-SNAPSHOT', + exclude: [ + 'com.google.code.gson:gson', + 'com.googlecode.json-simple:json-simple', + 'commons-lang:commons-lang', + 'org.yaml:snakeyaml' + ]]) final def test = [ junit5: [ @@ -22,4 +24,17 @@ class LibsExtention { mock : ['org.mockito:mockito-core:1.10.19'], h2db : 'com.h2database:h2:1.4.200' ] + + private static 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 + } }