mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +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 {
|
public interface PreBuildHook {
|
||||||
void build(BuildContext context);
|
void build(BuildContext context);
|
||||||
}
|
}
|
||||||
@FunctionalInterface
|
|
||||||
public interface ProGuardTransformHook {
|
|
||||||
byte[] transform(byte[] input, CharSequence classname);
|
|
||||||
}
|
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface Transformer {
|
public interface Transformer {
|
||||||
|
@ -34,7 +30,7 @@ public interface Transformer {
|
||||||
|
|
||||||
private boolean BUILDRUNTIME;
|
private boolean BUILDRUNTIME;
|
||||||
private final Set<PostBuildHook> POST_HOOKS;
|
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<PreBuildHook> PRE_HOOKS;
|
||||||
private final Set<Transformer> CLASS_TRANSFORMER;
|
private final Set<Transformer> CLASS_TRANSFORMER;
|
||||||
private final Set<String> CLASS_BLACKLIST;
|
private final Set<String> CLASS_BLACKLIST;
|
||||||
|
@ -72,7 +68,7 @@ public byte[] classTransform(byte[] clazz, CharSequence classname) {
|
||||||
}
|
}
|
||||||
public byte[] proGuardClassTransform(byte[] clazz, CharSequence classname) {
|
public byte[] proGuardClassTransform(byte[] clazz, CharSequence classname) {
|
||||||
byte[] result = clazz;
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +111,7 @@ public void registerIgnoredClass(String clazz) {
|
||||||
public void registerPostHook(PostBuildHook hook) {
|
public void registerPostHook(PostBuildHook hook) {
|
||||||
POST_HOOKS.add(hook);
|
POST_HOOKS.add(hook);
|
||||||
}
|
}
|
||||||
public void registerProGuardHook(ProGuardTransformHook hook) {
|
public void registerProGuardHook(Transformer hook) {
|
||||||
POST_PROGUARD_HOOKS.add(hook);
|
POST_PROGUARD_HOOKS.add(hook);
|
||||||
}
|
}
|
||||||
public boolean isNeedPostProguardHook()
|
public boolean isNeedPostProguardHook()
|
||||||
|
|
Loading…
Reference in a new issue