mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 21:15:56 +08:00
Feat: add include/exclude filters for JuiceRemapper
- add thread-safe include/exclude sets to Remapper; shouldRemap matches
exact name, package prefix (trailing '/'), or nested class ('\$' after
the prefix), with exclude taking priority
- remapping stays OFF by default: an empty include set remaps nothing;
it is only enabled once addInclude is called (no config include)
- implement addInclude/addExclude/removeInclude/removeExclude/
clearIncludes/clearExcludes JNI bindings
- apply shouldRemap filter in JuiceRemapperService::onClassFileLoadHook
This commit is contained in:
1 parent
4bed99f417
commit
6fe467bccf
3 files changed
+113
-18
No files matched your search
@@ -72,45 +72,69 @@ JNIEXPORT jboolean JNICALL Java_cn_xiaozhou233_juiceremapper_JuiceRemapper_initN
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_cn_xiaozhou233_juiceremapper_JuiceRemapper_addInclude
|
||||
(JNIEnv *, jclass, jstring) {
|
||||
// TODO: implement
|
||||
spdlog::warn("JuiceRemapper::addInclude");
|
||||
(JNIEnv *env, jclass, jstring name) {
|
||||
if (!name) return JNI_FALSE;
|
||||
|
||||
const char* utf = env->GetStringUTFChars(name, nullptr);
|
||||
if (!utf) return JNI_FALSE;
|
||||
std::string s(utf);
|
||||
env->ReleaseStringUTFChars(name, utf);
|
||||
|
||||
JuiceAgent::Services::Remapper::getInstance().addInclude(std::move(s));
|
||||
spdlog::debug("[JuiceRemapper JNI] addInclude");
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_cn_xiaozhou233_juiceremapper_JuiceRemapper_addExclude
|
||||
(JNIEnv *, jclass, jstring) {
|
||||
// TODO: implement
|
||||
spdlog::warn("JuiceRemapper::addExclude");
|
||||
(JNIEnv *env, jclass, jstring name) {
|
||||
if (!name) return JNI_FALSE;
|
||||
|
||||
const char* utf = env->GetStringUTFChars(name, nullptr);
|
||||
if (!utf) return JNI_FALSE;
|
||||
std::string s(utf);
|
||||
env->ReleaseStringUTFChars(name, utf);
|
||||
|
||||
JuiceAgent::Services::Remapper::getInstance().addExclude(std::move(s));
|
||||
spdlog::debug("[JuiceRemapper JNI] addExclude");
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_cn_xiaozhou233_juiceremapper_JuiceRemapper_removeInclude
|
||||
(JNIEnv *, jclass, jstring) {
|
||||
// TODO: implement
|
||||
spdlog::warn("JuiceRemapper::removeInclude");
|
||||
(JNIEnv *env, jclass, jstring name) {
|
||||
if (!name) return JNI_FALSE;
|
||||
|
||||
const char* utf = env->GetStringUTFChars(name, nullptr);
|
||||
if (!utf) return JNI_FALSE;
|
||||
std::string s(utf);
|
||||
env->ReleaseStringUTFChars(name, utf);
|
||||
|
||||
JuiceAgent::Services::Remapper::getInstance().removeInclude(s);
|
||||
spdlog::debug("[JuiceRemapper JNI] removeInclude");
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_cn_xiaozhou233_juiceremapper_JuiceRemapper_removeExclude
|
||||
(JNIEnv *, jclass, jstring){
|
||||
// TODO: implement
|
||||
spdlog::warn("JuiceRemapper::removeExclude");
|
||||
(JNIEnv *env, jclass, jstring name){
|
||||
if (!name) return JNI_FALSE;
|
||||
|
||||
const char* utf = env->GetStringUTFChars(name, nullptr);
|
||||
if (!utf) return JNI_FALSE;
|
||||
std::string s(utf);
|
||||
env->ReleaseStringUTFChars(name, utf);
|
||||
|
||||
JuiceAgent::Services::Remapper::getInstance().removeExclude(s);
|
||||
spdlog::debug("[JuiceRemapper JNI] removeExclude");
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_cn_xiaozhou233_juiceremapper_JuiceRemapper_clearIncludes
|
||||
(JNIEnv *, jclass) {
|
||||
// TODO: implement
|
||||
spdlog::warn("JuiceRemapper::clearIncludes");
|
||||
JuiceAgent::Services::Remapper::getInstance().clearIncludes();
|
||||
spdlog::debug("[JuiceRemapper JNI] clearIncludes");
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_cn_xiaozhou233_juiceremapper_JuiceRemapper_clearExcludes
|
||||
(JNIEnv *, jclass) {
|
||||
// TODO: implement
|
||||
spdlog::warn("JuiceRemapper::clearExcludes");
|
||||
JuiceAgent::Services::Remapper::getInstance().clearExcludes();
|
||||
spdlog::debug("[JuiceRemapper JNI] clearExcludes");
|
||||
}
|
||||
Reference in new issue
Block a user