-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
85 lines (73 loc) · 2.67 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
plugins {
alias libs.plugins.screaming.plugin.builder apply false
}
defaultTasks 'clean', 'screamCompile'//, 'allowJavadocUpload'
subprojects {
ext.includeModule = { String module ->
if (!project.name.endsWith('-common')) {
throw new UnsupportedOperationException("This method can be used only in common modules!")
}
dependencies {
api project(":${module}-common")
}
rootProject.subprojects.each { Project sub ->
if (!sub.name.endsWith('-common') && sub.name.matches("${project.name.replace('-common', '')}-[^-]+")) {
var moduleProject = rootProject.findProject(":${module}-${sub.name.split("-")[1]}")
if (moduleProject != null) {
sub.dependencies {
api moduleProject
if (moduleProject.name == 'core-bukkit') {
// Fix another source sets missing when compiling
compileOnly moduleProject.sourceSets.main.output
}
}
}
}
}
}
if (!project.file('src').exists() && !project.file('build.gradle').exists()) {
project.ext['onlyPomArtifact'] = true
apply plugin: 'org.screamingsandals.plugin-builder-lite'
} else {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'org.screamingsandals.plugin-builder'
}
if (project.name.matches('[a-z]+-[a-z]+') && !project.name.endsWith("-common")) {
boolean foundAnotherModule = false
// modules for NMS based platforms can have shared vanilla modules
if (project.name.split('-')[1] in ['bukkit', 'sponge']) {
def vanillaProject = rootProject.findProject(":${project.name.split('-')[0]}-vanilla")
if (vanillaProject != null) {
dependencies {
api vanillaProject
}
foundAnotherModule = true
}
}
if (!foundAnotherModule) {
def commonProject = rootProject.findProject(":${project.name.split('-')[0]}-common")
if (commonProject != null) {
dependencies {
api commonProject
}
}
}
}
java {
disableAutoTargetJvm()
sourceCompatibility = JavaVersion.VERSION_11
}
repositories {
minecraftLibraries()
jitpack()
sponge()
placeholderApi()
paper()
screaming()
// TODO: add this to ScreamingPluginBuilder
maven {
url = uri('https://repo.viaversion.com/')
}
}
}