Compare commits
5 Commits
feature/ph
...
dev/module
| Author | SHA1 | Date | |
|---|---|---|---|
|
b2ef9b25e3
|
|||
|
d602296032
|
|||
|
9461a70f92
|
|||
|
d621e9c4f4
|
|||
|
0eed089809
|
10
build.gradle
10
build.gradle
@@ -1,5 +1,3 @@
|
||||
import libs.LibsPlugin
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'java'
|
||||
apply plugin: LibsPlugin
|
||||
@@ -11,8 +9,12 @@ subprojects {
|
||||
}
|
||||
|
||||
project.group = projectGroup
|
||||
project.version = moduleVersion
|
||||
jar.archiveBaseName.set(moduleName)
|
||||
if (project.hasProperty('moduleVersion')) {
|
||||
project.version = project.property('moduleVersion')
|
||||
}
|
||||
if (project.hasProperty('moduleName')) {
|
||||
jar.archiveBaseName.set(project.property('moduleName') as String)
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
71
buildSrc/src/main/groovy/LibsPlugin.groovy
Normal file
71
buildSrc/src/main/groovy/LibsPlugin.groovy
Normal file
@@ -0,0 +1,71 @@
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
|
||||
|
||||
class LibsPlugin implements Plugin<Project> {
|
||||
|
||||
@Override
|
||||
void apply(Project project) {
|
||||
project.extensions.create('libs', LibsExtention)
|
||||
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(':', 2)
|
||||
if (excludeLib.length == 2) {
|
||||
exclude group: excludeLib[0], module: excludeLib[1]
|
||||
} else {
|
||||
exclude group: excludeLib[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
@@ -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,13 +0,0 @@
|
||||
package libs
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
|
||||
class LibsPlugin implements Plugin<Project> {
|
||||
|
||||
@Override
|
||||
void apply(Project project) {
|
||||
project.extensions.create('libs', LibsExtention)
|
||||
project.extensions.create('repos', ReposExtention)
|
||||
}
|
||||
}
|
||||
@@ -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