[Refactoring] Removed now unused protobuff code from the buld scripts and project (#167)
Some checks failed
Build / Build-Server-Jar (push) Has been cancelled

* [Refactoring] Remove all protobuff related code from the gradle script and project

* [Refactoring] Removed now unused exlipse and intellij plugins

* [Dependencies] Updated lombok version (1.18.24->1.18.34)
This commit is contained in:
Alexander Hartmann 2024-11-02 07:08:03 +01:00 committed by GitHub
parent 3932bdead9
commit 95b26b5ba4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 11 additions and 98 deletions

View File

@ -12,9 +12,6 @@ buildscript {
repositories { repositories {
maven { url "https://plugins.gradle.org/m2/" } maven { url "https://plugins.gradle.org/m2/" }
} }
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
}
} }
plugins { plugins {
@ -26,15 +23,6 @@ plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1' id 'com.github.johnrengelman.shadow' version '8.1.1'
// Apply the protobuf auto generator
id 'com.google.protobuf' version "0.8.18"
// Eclipse Support
id 'eclipse'
// IntelliJ Support
id 'idea'
// Maven // Maven
id 'maven-publish' id 'maven-publish'
id 'signing' id 'signing'
@ -85,7 +73,6 @@ dependencies {
implementation group: 'io.netty', name: 'netty-transport-native-kqueue', version: '4.1.79.Final' implementation group: 'io.netty', name: 'netty-transport-native-kqueue', version: '4.1.79.Final'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0' implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0'
implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.18.2'
implementation group: 'org.reflections', name: 'reflections', version: '0.10.2' implementation group: 'org.reflections', name: 'reflections', version: '0.10.2'
@ -114,12 +101,10 @@ dependencies {
implementation group: 'io.javalin', name: 'javalin', version: '4.6.4' implementation group: 'io.javalin', name: 'javalin', version: '4.6.4'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.3' implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.3'
protobuf files('proto/') compileOnly 'org.projectlombok:lombok:1.18.34'
annotationProcessor 'org.projectlombok:lombok:1.18.34'
compileOnly 'org.projectlombok:lombok:1.18.24' testCompileOnly 'org.projectlombok:lombok:1.18.34'
annotationProcessor 'org.projectlombok:lombok:1.18.24' testAnnotationProcessor 'org.projectlombok:lombok:1.18.34'
testCompileOnly 'org.projectlombok:lombok:1.18.24'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.24'
} }
configurations.all { configurations.all {
@ -132,7 +117,6 @@ application {
} }
shadowJar { shadowJar {
exclude("*.proto")
zip64 = true zip64 = true
duplicatesStrategy = DuplicatesStrategy.INCLUDE duplicatesStrategy = DuplicatesStrategy.INCLUDE
mergeServiceFiles() mergeServiceFiles()
@ -146,8 +130,6 @@ shadowJar {
} }
jar { jar {
exclude '*.proto'
manifest { manifest {
attributes 'Main-Class': 'emu.grasscutter.Grasscutter' attributes 'Main-Class': 'emu.grasscutter.Grasscutter'
} }
@ -232,48 +214,14 @@ publishing {
} }
} }
clean {
delete protobuf.generatedFilesBaseDir
}
protobuf {
protoc {
// The artifact spec for the Protobuf Compiler
artifact = 'com.google.protobuf:protoc:3.18.1'
}
// generatedFilesBaseDir = "$projectDir/src/main/java/emu/grasscutter/net/proto/"
generatedFilesBaseDir = "$projectDir/src/generated/"
}
sourceSets { sourceSets {
main { main {
proto {
// In addition to the default 'src/main/proto'
srcDir 'src/generated'
}
java { java {
srcDir 'src/java' srcDir 'src/java'
} }
} }
} }
idea {
module {
// proto files and generated Java files are automatically added as
// source dirs.
// If you have additional sources, add them here:
sourceDirs += file("/proto/");
}
}
eclipse {
classpath {
file.whenMerged { cp ->
cp.entries.add( new org.gradle.plugins.ide.eclipse.model.SourceFolder('src/generated/main/java', null) )
}
}
}
signing { signing {
if(!version.endsWith('-dev')) { if(!version.endsWith('-dev')) {
sign publishing.publications.mavenJava sign publishing.publications.mavenJava
@ -306,8 +254,4 @@ public final class BuildConfig {
} }
processResources {
dependsOn "generateProto"
}
task generateActivityConditions(type: GenerateActivityConditions) task generateActivityConditions(type: GenerateActivityConditions)

View File

@ -11,8 +11,6 @@ import emu.grasscutter.Grasscutter;
import emu.grasscutter.Loggers; import emu.grasscutter.Loggers;
import emu.grasscutter.game.props.ElementReactionType; import emu.grasscutter.game.props.ElementReactionType;
import com.google.protobuf.InvalidProtocolBufferException;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.binout.AbilityData; import emu.grasscutter.data.binout.AbilityData;
import emu.grasscutter.data.binout.AbilityMixinData; import emu.grasscutter.data.binout.AbilityMixinData;
@ -414,11 +412,11 @@ public final class AbilityManager extends BasePlayerManager {
} }
} }
private void handleMixinCostStamina(AbilityInvokeEntry invoke) throws InvalidProtocolBufferException { private void handleMixinCostStamina(AbilityInvokeEntry invoke) {
} }
private void handleGenerateElemBall(AbilityInvokeEntry invoke) throws InvalidProtocolBufferException { private void handleGenerateElemBall(AbilityInvokeEntry invoke) {
} }
@ -432,7 +430,7 @@ public final class AbilityManager extends BasePlayerManager {
return null; return null;
} }
private void handleGlobalFloatValue(AbilityInvokeEntry invoke) throws InvalidProtocolBufferException { private void handleGlobalFloatValue(AbilityInvokeEntry invoke) {
var entity = this.player.getScene().getEntityById(invoke.getEntityId()); var entity = this.player.getScene().getEntityById(invoke.getEntityId());
if(entity == null) return; if(entity == null) return;
@ -465,11 +463,11 @@ public final class AbilityManager extends BasePlayerManager {
} }
private void handleModifierDurabilityChange(AbilityInvokeEntry invoke) throws InvalidProtocolBufferException { private void handleModifierDurabilityChange(AbilityInvokeEntry invoke) {
} }
private void handleAddNewAbility(AbilityInvokeEntry invoke) throws InvalidProtocolBufferException { private void handleAddNewAbility(AbilityInvokeEntry invoke) {
var entity = this.player.getScene().getEntityById(invoke.getEntityId()); var entity = this.player.getScene().getEntityById(invoke.getEntityId());
if(entity == null) { if(entity == null) {
@ -496,7 +494,7 @@ public final class AbilityManager extends BasePlayerManager {
* Invoked when an entity triggered an elemental reaction. * Invoked when an entity triggered an elemental reaction.
* @param invoke Holds information of elemental reaction, attacker and target. * @param invoke Holds information of elemental reaction, attacker and target.
*/ */
private void handleTriggerElementReaction(AbilityInvokeEntry invoke) throws InvalidProtocolBufferException { private void handleTriggerElementReaction(AbilityInvokeEntry invoke) {
if (getPlayer().getScene() == null) return; if (getPlayer().getScene() == null) return;
AbilityMetaTriggerElementReaction data = AbilityMetaTriggerElementReaction.parseBy(invoke.getAbilityData(), player.getSession().getVersion()); AbilityMetaTriggerElementReaction data = AbilityMetaTriggerElementReaction.parseBy(invoke.getAbilityData(), player.getSession().getVersion());

View File

@ -1,12 +1,8 @@
package emu.grasscutter.game.ability.actions; package emu.grasscutter.game.ability.actions;
import com.google.protobuf.ByteString;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction; import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction;
import emu.grasscutter.game.ability.Ability; import emu.grasscutter.game.ability.Ability;
import emu.grasscutter.game.ability.AbilityModifierController;
import emu.grasscutter.game.entity.GameEntity; import emu.grasscutter.game.entity.GameEntity;
@AbilityAction(AbilityModifierAction.Type.ApplyModifier) @AbilityAction(AbilityModifierAction.Type.ApplyModifier)

View File

@ -1,7 +1,5 @@
package emu.grasscutter.game.ability.mixins; package emu.grasscutter.game.ability.mixins;
import com.google.protobuf.ByteString;
import emu.grasscutter.data.binout.AbilityMixinData; import emu.grasscutter.data.binout.AbilityMixinData;
import emu.grasscutter.game.ability.Ability; import emu.grasscutter.game.ability.Ability;

View File

@ -1,6 +1,5 @@
package emu.grasscutter.game.managers.energy; package emu.grasscutter.game.managers.energy;
import com.google.protobuf.InvalidProtocolBufferException;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.DataLoader; import emu.grasscutter.data.DataLoader;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.GameData;
@ -121,7 +120,7 @@ public class EnergyManager extends BasePlayerManager {
}; };
} }
public void handleGenerateElemBall(AbilityInvokeEntry invoke) throws InvalidProtocolBufferException { public void handleGenerateElemBall(AbilityInvokeEntry invoke) {
// ToDo: // ToDo:
// This is also called when a weapon like Favonius Warbow etc. creates energy through its passive. // This is also called when a weapon like Favonius Warbow etc. creates energy through its passive.
// We are not handling this correctly at the moment. // We are not handling this correctly at the moment.

View File

@ -3,7 +3,6 @@ package emu.grasscutter.net.packet;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import com.google.protobuf.GeneratedMessageV3;
import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.utils.Crypto; import emu.grasscutter.utils.Crypto;
import lombok.val; import lombok.val;
@ -76,15 +75,6 @@ public class BasePacket {
this.data = data; this.data = data;
} }
public void setData(GeneratedMessageV3 proto) {
this.data = proto.toByteArray();
}
@SuppressWarnings("rawtypes")
public void setData(GeneratedMessageV3.Builder proto) {
this.data = proto.build().toByteArray();
}
public BasePacket buildHeader(int clientSequence) { public BasePacket buildHeader(int clientSequence) {
if (this.getHeader() != null && clientSequence == 0) { if (this.getHeader() != null && clientSequence == 0) {
return this; return this;

View File

@ -1,6 +1,5 @@
package emu.grasscutter.net.packet; package emu.grasscutter.net.packet;
import com.google.protobuf.GeneratedMessageV3;
import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.game.GameSession;
import org.anime_game_servers.core.base.Version; import org.anime_game_servers.core.base.Version;
import org.anime_game_servers.multi_proto.core.interfaces.ProtoModel; import org.anime_game_servers.multi_proto.core.interfaces.ProtoModel;
@ -36,14 +35,4 @@ public abstract class BaseTypedPacket<Packet extends ProtoModel> extends BasePac
public void setData(byte[] data) { public void setData(byte[] data) {
throw new UnsupportedOperationException("Not supported, why are you doing this."); throw new UnsupportedOperationException("Not supported, why are you doing this.");
} }
@Deprecated
@Override
public void setData(GeneratedMessageV3 proto) {
setData((byte[])null);
}
@Override @Deprecated
public void setData(GeneratedMessageV3.Builder proto) {
setData((byte[])null);
}
} }

View File

@ -1,6 +1,5 @@
package emu.grasscutter.server.http.dispatch; package emu.grasscutter.server.http.dispatch;
import com.google.protobuf.ByteString;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.Grasscutter.ServerRunMode; import emu.grasscutter.Grasscutter.ServerRunMode;
import emu.grasscutter.server.event.dispatch.QueryAllRegionsEvent; import emu.grasscutter.server.event.dispatch.QueryAllRegionsEvent;