gradle:LibsPlugin: объединение отдельных классов в один файл
This commit is contained in:
@@ -1,39 +0,0 @@
|
|||||||
package libs
|
|
||||||
|
|
||||||
class LibsExtention {
|
|
||||||
private def junit_version = '5.5.2'
|
|
||||||
|
|
||||||
final def commons_text = 'org.apache.commons:commons-text:1.9'
|
|
||||||
final def lombok = 'org.projectlombok:lombok:1.18.12'
|
|
||||||
|
|
||||||
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: [
|
|
||||||
"org.junit.jupiter:junit-jupiter-api:$junit_version",
|
|
||||||
"org.junit.jupiter:junit-jupiter-engine:$junit_version"
|
|
||||||
],
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
package libs
|
package libs
|
||||||
|
|
||||||
|
import org.gradle.api.Action
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
|
||||||
|
|
||||||
class LibsPlugin implements Plugin<Project> {
|
class LibsPlugin implements Plugin<Project> {
|
||||||
|
|
||||||
@@ -11,3 +13,57 @@ class LibsPlugin implements Plugin<Project> {
|
|||||||
project.extensions.create('repos', ReposExtention)
|
project.extensions.create('repos', ReposExtention)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ReposExtention {
|
||||||
|
|
||||||
|
final def mavenSpigotMC = createSimpleMavenRepo('SpigotMC repository', 'https://hub.spigotmc.org/nexus/content/groups/public')
|
||||||
|
final def mavenDmxMcProject = createSimpleMavenRepo('DmitriyMX MC Project repository', 'https://dmx-mc-project.gitlab.io/maven-repository/')
|
||||||
|
|
||||||
|
private static Action<MavenArtifactRepository> createSimpleMavenRepo(String name, String url) {
|
||||||
|
return new Action<MavenArtifactRepository>() {
|
||||||
|
@Override
|
||||||
|
void execute(MavenArtifactRepository mavenArtifactRepository) {
|
||||||
|
mavenArtifactRepository.setName(name)
|
||||||
|
mavenArtifactRepository.setUrl(url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LibsExtention {
|
||||||
|
private def junit_version = '5.5.2'
|
||||||
|
|
||||||
|
final def commons_text = 'org.apache.commons:commons-text:1.9'
|
||||||
|
final def lombok = 'org.projectlombok:lombok:1.18.12'
|
||||||
|
|
||||||
|
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: [
|
||||||
|
"org.junit.jupiter:junit-jupiter-api:$junit_version",
|
||||||
|
"org.junit.jupiter:junit-jupiter-engine:$junit_version"
|
||||||
|
],
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
package libs
|
|
||||||
|
|
||||||
import org.gradle.api.Action
|
|
||||||
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
|
|
||||||
|
|
||||||
class ReposExtention {
|
|
||||||
|
|
||||||
final def mavenSpigotMC = createSimpleMavenRepo('SpigotMC repository', 'https://hub.spigotmc.org/nexus/content/groups/public')
|
|
||||||
final def mavenDmxMcProject = createSimpleMavenRepo('DmitriyMX MC Project repository', 'https://dmx-mc-project.gitlab.io/maven-repository/')
|
|
||||||
|
|
||||||
private static Action<MavenArtifactRepository> createSimpleMavenRepo(String name, String url) {
|
|
||||||
return new Action<MavenArtifactRepository>() {
|
|
||||||
@Override
|
|
||||||
void execute(MavenArtifactRepository mavenArtifactRepository) {
|
|
||||||
mavenArtifactRepository.setName(name)
|
|
||||||
mavenArtifactRepository.setUrl(url)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user