gradle: gradle-plugin вынесен в buildSrc
This commit is contained in:
36
build.gradle
36
build.gradle
@@ -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 {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
10
buildSrc/src/main/groovy/FilteringDependenciesPlugin.groovy
Normal file
10
buildSrc/src/main/groovy/FilteringDependenciesPlugin.groovy
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user