-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
105 lines (91 loc) · 3.43 KB
/
build.gradle
File metadata and controls
105 lines (91 loc) · 3.43 KB
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
plugins {
id 'java'
id 'eclipse'
id 'maven-publish'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.8'
id("xyz.jpenilla.run-velocity") version "2.3.1"
}
group = 'au.com.addstar.ccm'
// Centralised version: semver 1.0.<build>. Jenkins sets BUILD_NUMBER; first build = 1.0.1, local = 1.0.0.
def versionBase = findProperty('versionBase') ?: '1.0'
def buildNumber = System.getenv('BUILD_NUMBER')
version = (buildNumber != null && !buildNumber.isEmpty()) ? "${versionBase}.${buildNumber}" : "${versionBase}.0"
repositories {
mavenCentral()
maven {
name = "papermc-repo"
url = "https://repo.papermc.io/repository/maven-public/"
}
maven {
name = "addstar"
url = "https://maven.addstar.com.au/artifactory/all-release/"
}
}
// If VelocityControl JAR is in lib/ (e.g. when Maven parent POM is missing from repo), use it for compilation.
def vcJar = file("lib/chatcontrol-velocity-2.4.4.jar")
def useLocalVc = vcJar.exists()
dependencies {
compileOnly("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")
annotationProcessor("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")
if (useLocalVc) {
compileOnly(files(vcJar))
} else {
compileOnly(group: "org.mineacademy", name: "chatcontrol-velocity", version: "2.4.4")
}
compileOnly("net.kyori:adventure-text-minimessage:4.26.1")
}
tasks {
runVelocity {
// Configure the Velocity version for our task.
// This is the only required configuration besides applying the plugin.
// Your plugin's jar (or shadowJar if present) will be used automatically.
velocityVersion("3.4.0-SNAPSHOT")
}
}
def targetJavaVersion = 17
java {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
publishing {
publications {
maven(MavenPublication) {
from components.java
groupId = project.group
artifactId = project.name
version = project.version
}
}
repositories {
maven {
name = 'artifactory'
url = 'https://maven.addstar.com.au/artifactory/maven-release-local/'
credentials {
username = project.findProperty('artifactory_username') ?: System.getenv('ARTIFACTORY_USERNAME') ?: ''
password = project.findProperty('artifactory_password') ?: System.getenv('ARTIFACTORY_PASSWORD') ?: ''
}
}
}
}
// Copy generated POM to build/libs with Maven naming so CI can upload JAR + POM together
tasks.register('preparePublication', Copy) {
dependsOn jar, generatePomFileForMavenPublication
from layout.buildDirectory.file("publications/maven/pom-default.xml")
into layout.buildDirectory.dir('libs')
rename { "${project.name}-${project.version}.pom" }
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.release.set(targetJavaVersion)
}
def templateSource = file('src/main/templates')
def templateDest = layout.buildDirectory.dir('generated/sources/templates')
def generateTemplates = tasks.register('generateTemplates', Copy) { task ->
def props = ['version': project.version]
task.inputs.properties props
task.from templateSource
task.into templateDest
task.expand props
}
sourceSets.main.java.srcDir(generateTemplates.map { it.outputs })
project.idea.project.settings.taskTriggers.afterSync generateTemplates
project.eclipse.synchronizationTasks(generateTemplates)