mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
Transformer proguard hook
This commit is contained in:
parent
23a1c9a7e1
commit
b6ea3e0aa5
1 changed files with 3 additions and 7 deletions
|
@ -22,10 +22,6 @@ public interface PostBuildHook {
|
|||
public interface PreBuildHook {
|
||||
void build(BuildContext context);
|
||||
}
|
||||
@FunctionalInterface
|
||||
public interface ProGuardTransformHook {
|
||||
byte[] transform(byte[] input, CharSequence classname);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Transformer {
|
||||
|
@ -34,7 +30,7 @@ public interface Transformer {
|
|||
|
||||
private boolean BUILDRUNTIME;
|
||||
private final Set<PostBuildHook> POST_HOOKS;
|
||||
private final Set<ProGuardTransformHook> POST_PROGUARD_HOOKS;
|
||||
private final Set<Transformer> POST_PROGUARD_HOOKS;
|
||||
private final Set<PreBuildHook> PRE_HOOKS;
|
||||
private final Set<Transformer> CLASS_TRANSFORMER;
|
||||
private final Set<String> CLASS_BLACKLIST;
|
||||
|
@ -72,7 +68,7 @@ public byte[] classTransform(byte[] clazz, CharSequence classname) {
|
|||
}
|
||||
public byte[] proGuardClassTransform(byte[] clazz, CharSequence classname) {
|
||||
byte[] result = clazz;
|
||||
for (ProGuardTransformHook transformer : POST_PROGUARD_HOOKS) result = transformer.transform(result, classname);
|
||||
for (Transformer transformer : POST_PROGUARD_HOOKS) result = transformer.transform(result, classname);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -115,7 +111,7 @@ public void registerIgnoredClass(String clazz) {
|
|||
public void registerPostHook(PostBuildHook hook) {
|
||||
POST_HOOKS.add(hook);
|
||||
}
|
||||
public void registerProGuardHook(ProGuardTransformHook hook) {
|
||||
public void registerProGuardHook(Transformer hook) {
|
||||
POST_PROGUARD_HOOKS.add(hook);
|
||||
}
|
||||
public boolean isNeedPostProguardHook()
|
||||
|
|
Loading…
Reference in a new issue