Merge pull request #1541 from babbaj/keep-annotation

Annotation for proguard -keep
This commit is contained in:
Leijurv 2020-08-17 16:36:48 -07:00 committed by GitHub
commit 836ef3328c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 0 deletions

View File

@ -23,6 +23,13 @@
-keep class baritone.api.utils.MyChunkPos { *; } # even in standalone we need to keep this for gson reflect -keep class baritone.api.utils.MyChunkPos { *; } # even in standalone we need to keep this for gson reflect
# Keep any class or member annotated with @KeepName so we dont have to put everything in the script
-keep,allowobfuscation @interface baritone.KeepName
-keep @baritone.KeepName class *
-keepclassmembers class * {
@baritone.KeepName *;
}
# setting names are reflected from field names, so keep field names # setting names are reflected from field names, so keep field names
-keepclassmembers class baritone.api.Settings { -keepclassmembers class baritone.api.Settings {
public <fields>; public <fields>;

View File

@ -0,0 +1,21 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone;
// Annotation for classes and class members that should not be renamed by proguard
public @interface KeepName { }

View File

@ -17,6 +17,7 @@
package baritone.command.defaults; package baritone.command.defaults;
import baritone.KeepName;
import baritone.api.IBaritone; import baritone.api.IBaritone;
import baritone.api.command.Command; import baritone.api.command.Command;
import baritone.api.command.datatypes.EntityClassById; import baritone.api.command.datatypes.EntityClassById;
@ -130,6 +131,7 @@ public class FollowCommand extends Command {
); );
} }
@KeepName
private enum FollowGroup { private enum FollowGroup {
ENTITIES(EntityLiving.class::isInstance), ENTITIES(EntityLiving.class::isInstance),
PLAYERS(EntityPlayer.class::isInstance); /* , PLAYERS(EntityPlayer.class::isInstance); /* ,
@ -142,6 +144,7 @@ public class FollowCommand extends Command {
} }
} }
@KeepName
private enum FollowList { private enum FollowList {
ENTITY(EntityClassById.INSTANCE), ENTITY(EntityClassById.INSTANCE),
PLAYER(NearbyPlayer.INSTANCE); PLAYER(NearbyPlayer.INSTANCE);