Skip to content

Commit 8f781ef

Browse files
committed
Updates to gradle configuration
- Update gradle wrapper to 9.3.1 - Update velocity to use Blossom 2.2.0 - Bubblegum fix for common exec-blocks
1 parent 7fb7ef9 commit 8f781ef

File tree

9 files changed

+66
-16
lines changed

9 files changed

+66
-16
lines changed

Plan/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ subprojects {
5151

5252
compileJava {
5353
options.release = 11
54+
sourceCompatibility = "${JavaVersion.VERSION_11}"
5455
}
5556

5657
ext {

Plan/common/build.gradle

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ plugins {
99
id "io.swagger.core.v3.swagger-gradle-plugin" version "2.2.43"
1010
}
1111

12+
compileTestFixturesJava {
13+
sourceCompatibility = "${JavaVersion.VERSION_17}"
14+
}
15+
1216
configurations {
1317
// Runtime downloading scopes
1418
mysqlDriver
@@ -198,6 +202,12 @@ tasks.named("checkstyleTest").configure {
198202
it.dependsOn(copyYarnBuildResults)
199203
}
200204

205+
// Add support for exec block https://stackoverflow.com/a/79720796/20825073
206+
interface InjectedExecOps {
207+
@Inject
208+
ExecOperations getExecOps()
209+
}
210+
201211
tasks.register("determineAssetModifications") {
202212
// Skip Yarn build on Jitpack since Jitpack doesn't offer gclib version compatible with Node 20
203213
// Jitpack build is used mainly for java dependencies.
@@ -209,14 +219,15 @@ tasks.register("determineAssetModifications") {
209219
inputs.files(fileTree(dir: "src/main/resources/assets/plan/themes"))
210220
outputs.file("build/resources/main/assets/plan/AssetVersion.yml")
211221

222+
def execOps = project.objects.newInstance(InjectedExecOps).execOps
212223
doLast {
213224
mkdir "build/resources/main/assets/plan"
214225
def versionFile = file("build/resources/main/assets/plan/AssetVersion.yml")
215226
versionFile.text = "" // Clear previous build
216227
ConfigurableFileTree tree = fileTree(dir: "src/main/resources/assets/plan/web")
217228
tree.forEach { File f ->
218229
def gitModified = new ByteArrayOutputStream()
219-
exec {
230+
execOps.exec {
220231
commandLine "git", "log", "-1", "--pretty=%ct", f.toString()
221232
standardOutput = gitModified
222233
}
@@ -232,7 +243,7 @@ tasks.register("determineAssetModifications") {
232243
tree = fileTree(dir: "src/main/resources/assets/plan/locale")
233244
tree.forEach { File f ->
234245
def gitModified = new ByteArrayOutputStream()
235-
exec {
246+
execOps.exec {
236247
commandLine "git", "log", "-1", "--pretty=%ct", f.toString()
237248
standardOutput = gitModified
238249
}
@@ -248,7 +259,7 @@ tasks.register("determineAssetModifications") {
248259
tree = fileTree(dir: "src/main/resources/assets/plan/themes")
249260
tree.forEach { File f ->
250261
def gitModified = new ByteArrayOutputStream()
251-
exec {
262+
execOps.exec {
252263
commandLine "git", "log", "-1", "--pretty=%ct", f.toString()
253264
standardOutput = gitModified
254265
}
311 Bytes
Binary file not shown.

Plan/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

Plan/gradlew

Lines changed: 7 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Plan/gradlew.bat

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Plan/velocity/build.gradle

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
plugins {
2-
id "net.kyori.blossom" version "1.3.1"
2+
id "net.kyori.blossom" version "2.2.0"
33
}
44

55
apply plugin: "com.gradleup.shadow"
66

7-
blossom {
8-
replaceTokenIn("src/main/java/com/djrapitops/plan/PlanVelocity.java")
9-
replaceToken("@version@", "$fullVersion")
7+
compileJava {
8+
dependsOn generateTemplates
9+
}
10+
11+
sourceSets {
12+
main {
13+
// java {
14+
// srcDir("src/main/java-templates")
15+
// }
16+
blossom {
17+
javaSources {
18+
property("version", "$fullVersion")
19+
}
20+
}
21+
}
1022
}
1123

1224
repositories {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* This file is part of Player Analytics (Plan).
3+
*
4+
* Plan is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License v3 as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* Plan is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
package net.playeranalytics.plan;
18+
19+
public class BuildParameters {
20+
public static final String VERSION = "{{ version }}";
21+
}

Plan/velocity/src/main/java/com/djrapitops/plan/PlanVelocity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import com.velocitypowered.api.plugin.Plugin;
3535
import com.velocitypowered.api.plugin.annotation.DataDirectory;
3636
import com.velocitypowered.api.proxy.ProxyServer;
37+
import net.playeranalytics.plan.BuildParameters;
3738
import net.playeranalytics.plugin.PlatformAbstractionLayer;
3839
import net.playeranalytics.plugin.VelocityPlatformLayer;
3940
import net.playeranalytics.plugin.scheduling.RunnableFactory;
@@ -54,7 +55,7 @@
5455
@Plugin(
5556
id = "plan",
5657
name = "Plan",
57-
version = "@version@",
58+
version = BuildParameters.VERSION,
5859
description = "Player Analytics Plugin by AuroraLS3",
5960
dependencies = {
6061
@Dependency(id = "viaversion", optional = true),

0 commit comments

Comments
 (0)