-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
139 lines (116 loc) · 3.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
plugins {
id "com.github.johnrengelman.shadow" version "6.1.0" apply false
// TODO: id 'maven-publish' apply false
}
// Root build configuration, applies to modules.
import org.apache.tools.ant.filters.ReplaceTokens
// Apply the common metadata to all projects including the root project
allprojects {
apply plugin: 'maven-publish'
group = 'io.github.davidmc971.ModularMSMF'
// Version bump on release goes here.
version = '0.3.0'
ext {
url = 'https://github.com/davidmc971/ModularMSMF'
build_timestamp = new Date().format('yyyy-MM-dd\'T\'HH:mm:ss\'Z\'z', TimeZone.getTimeZone('UTC'))
}
}
description = 'ModularMSMF root project'
// Apply common configuration across subprojects
subprojects {
apply plugin: 'java'
// Execution failed for task ':ModularMSMF-Core:compileJava'.
// > Error while evaluating property 'sourceCompatibility' of task ':ModularMSMF-Core:compileJava'
// > The new Java toolchain feature cannot be used at the project level in combination with source and/or target compatibility
// java.sourceCompatibility = JavaVersion.VERSION_1_8
repositories {
// papermc maven repo
maven {
url = uri("https://repo.papermc.io/repository/maven-public/")
}
// public maven repo
maven {
url = uri('https://repo.maven.apache.org/maven2/')
}
// IridiumColorAPI maven repo
maven {
url = uri('https://nexus.iridiumdevelopment.net/repository/maven-releases/')
}
// VaultAPI maven repo
maven { url 'https://jitpack.io' }
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.5.2'
//implementation 'com.iridium:IridiumColorAPI:1.0.6'
compileOnly 'com.github.MilkBowl:VaultAPI:1.7'
implementation 'io.papermc.paper:paper-api:1.19-R0.1-SNAPSHOT'
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
// Swap placeholders in resources with values
processResources {
filesMatching('**/plugin.yml') {
filter(ReplaceTokens, beginToken: '${', endToken: '}',
tokens: [
"version": project.property('version'),
"url": project.property('url')
]
)
}
filesMatching('**/props.yml') {
filter(ReplaceTokens, beginToken: '${', endToken: '}',
tokens: [
"timestamp": project.property('build_timestamp')
]
)
}
}
compileJava {
options.compilerArgs.add('-Xlint:-deprecation')
}
// TODO: javadoc
// publishing {
// publications {
// maven(MavenPublication) {
// from(components.java)
// }
// }
// }
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
}
// Thanks to EssentialsX again
def outputTasks() {
[
":ModularMSMF-Core:shadowJar",
":ModularMSMF-CommandBlocker:jar",
":ModularMSMF-Basics:jar",
":ModularMSMF-NovaPerms:jar",
":ModularMSMF-Economy:jar"
].stream().map({ tasks.findByPath(it) })
}
task copyToJars(type: Copy) {
//dependsOn tasks.findByPath(":ModularMSMF:processResources")
outputTasks().forEach {
from(it)
}
rename '(.*)-all.jar', '$1.jar'
into file('jars')
}
task cleanJars() {
delete file('jars')
}
task clean() {
dependsOn cleanJars
}
task build() {
dependsOn copyToJars
}
task buildDev(dependsOn: build, type: Copy) {
from 'jars'
into 'testserver/plugins'
include "*.jar"
outputs.upToDateWhen { false }
}