Use custom version of Shadow for Record support

This is necessary until jdependency updates, and then shadow pulls that update.
This commit is contained in:
jmp committed 2021-05-12 17:30:15 -07:00
1 parent 7479fdf1fc
commit 93a9194711
8 files changed
+48 -37

No files matched your search

+3 -9
View File
@@ -1,15 +1,9 @@
import net.kyori.indra.IndraCheckstylePlugin
import net.kyori.indra.IndraPlugin
import net.kyori.indra.IndraPublishingPlugin
import net.kyori.indra.repository.sonatypeSnapshots
plugins {
id("net.kyori.indra")
id("net.kyori.indra.git")
id("net.kyori.indra.checkstyle")
id("net.kyori.indra.publishing") apply false
//id("com.github.johnrengelman.shadow") apply false
id("org.checkerframework") apply false
}
group = "net.draycia"
@@ -18,9 +12,9 @@ val projectVersion: String by project // get from gradle.properties
version = projectVersion
subprojects {
apply<IndraPlugin>()
apply<IndraCheckstylePlugin>()
apply<IndraPublishingPlugin>()
plugins.apply("net.kyori.indra")
plugins.apply("net.kyori.indra.checkstyle")
plugins.apply("net.kyori.indra.publishing")
if (projectVersion.endsWith("-SNAPSHOT")) {
// Add git commit hash to version for platforms, but not for API
+3 -1
View File
@@ -4,9 +4,11 @@ plugins {
repositories {
gradlePluginPortal()
maven("https://repo.jpenilla.xyz/snapshots/") // todo: for shadow to be compatible with Records
}
dependencies {
// sadly can't use the version catalog here (?), need to keep in sync manually
implementation("gradle.plugin.com.github.jengelman.gradle.plugins", "shadow", "7.0.0")
//implementation("gradle.plugin.com.github.jengelman.gradle.plugins", "shadow", "7.0.0") // temporary until shadow bumps jdependency for Record support
implementation("com.github.johnrengelman", "shadow", "7.1.0-hexaoxide-SNAPSHOT") // temporary until shadow bumps jdependency for Record support
}
@@ -14,7 +14,17 @@ public interface BukkitCommander extends Commander, ForwardingAudience.Single {
return new BukkitCommanderImpl(sender);
}
record BukkitCommanderImpl(@NonNull CommandSender commandSender) implements BukkitCommander {
final class BukkitCommanderImpl implements BukkitCommander {
private final CommandSender commandSender;
private BukkitCommanderImpl(final @NonNull CommandSender commandSender) {
this.commandSender = commandSender;
}
public @NonNull CommandSender commandSender() {
return this.commandSender;
}
@Override
public @NonNull Audience audience() {
@@ -10,26 +10,24 @@ import org.checkerframework.checker.nullness.qual.NonNull;
import static java.util.Objects.requireNonNull;
public record BukkitPlayerCommander(CarbonChat carbon,
@NonNull Player player) implements PlayerCommander, BukkitCommander {
public record BukkitPlayerCommander(
@NonNull CarbonChat carbon,
@NonNull Player player
) implements PlayerCommander, BukkitCommander {
@Override
public @NonNull
CommandSender commandSender() {
public @NonNull CommandSender commandSender() {
return this.player;
}
@Override
public @NonNull
Audience audience() {
public @NonNull Audience audience() {
return this.player;
}
@Override
public @NonNull
CarbonPlayer carbonPlayer() {
return requireNonNull(this.carbon.userManager().carbonPlayer(this.player.getUniqueId()),
"No CarbonPlayer for logged in Player!");
public @NonNull CarbonPlayer carbonPlayer() {
return requireNonNull(this.carbon.userManager().carbonPlayer(this.player.getUniqueId()), "No CarbonPlayer for logged in Player!");
}
}
+1 -2
View File
@@ -8,10 +8,9 @@ plugins:
net.kyori.indra.checkstyle: *indra
net.kyori.indra.publishing: *indra
net.kyori.indra.git: *indra
com.github.johnrengelman.shadow: 7.0.0
com.github.johnrengelman.shadow: 7.1.0-hexaoxide-SNAPSHOT # todo: temporary until shadow bumps jdependency for Record support
net.minecrell.plugin-yml.bukkit: 0.4.0
org.spongepowered.gradle.plugin: 1.0.3
org.checkerframework: 0.5.20
versions:
adventure: 4.7.0
+1
View File
@@ -5,6 +5,7 @@ pluginManagement {
repositories {
gradlePluginPortal()
maven("https://repo.stellardrift.ca/repository/snapshots/") // todo: polyglot-version-catalogs is not released on the gradle plugin portal yet
maven("https://repo.jpenilla.xyz/snapshots/") // todo: for shadow to be compatible with Records
}
}
@@ -14,12 +14,21 @@ public interface SpongeCommander extends Commander, ForwardingAudience.Single {
return new SpongeCommanderImpl(commandCause);
}
record SpongeCommanderImpl(
@NonNull CommandCause commandCause) implements SpongeCommander {
final class SpongeCommanderImpl implements SpongeCommander {
private final CommandCause commandCause;
private SpongeCommanderImpl(final @NonNull CommandCause commandCause) {
this.commandCause = commandCause;
}
@Override
public @NonNull
Audience audience() {
public @NonNull CommandCause commandCause() {
return this.commandCause;
}
@Override
public @NonNull Audience audience() {
return this.commandCause.audience();
}
@@ -10,21 +10,19 @@ import org.spongepowered.api.entity.living.player.server.ServerPlayer;
import static java.util.Objects.requireNonNull;
public record SpongePlayerCommander(CarbonChat carbon,
@NonNull ServerPlayer player,
@NonNull CommandCause commandCause)
implements PlayerCommander, SpongeCommander {
public record SpongePlayerCommander(
@NonNull CarbonChat carbon,
@NonNull ServerPlayer player,
@NonNull CommandCause commandCause
) implements PlayerCommander, SpongeCommander {
@Override
public @NonNull
CarbonPlayer carbonPlayer() {
return requireNonNull(this.carbon.userManager().carbonPlayer(this.player.uniqueId()),
"No CarbonPlayer for logged in Player!");
public @NonNull CarbonPlayer carbonPlayer() {
return requireNonNull(this.carbon.userManager().carbonPlayer(this.player.uniqueId()), "No CarbonPlayer for logged in Player!");
}
@Override
public @NonNull
Audience audience() {
public @NonNull Audience audience() {
return this.commandCause.audience();
}