0

gradle: gradle-plugin вынесен в buildSrc

This commit is contained in:
2021-01-07 01:23:00 +03:00
parent 05f0245323
commit f09f0e7a89
3 changed files with 37 additions and 36 deletions

View File

@@ -1,39 +1,3 @@
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'
}

View File

@@ -0,0 +1,27 @@
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
}
}

View File

@@ -0,0 +1,10 @@
import org.gradle.api.Plugin
import org.gradle.api.Project
class FilteringDependenciesPlugin implements Plugin<Project> {
@Override
void apply(Project target) {
target.extensions.create('fildep', FilteringDependenciesExtention)
}
}