Skip to content

🔨 A plugin can change method modifier with Hide annotation and build jar and aar automatically

License

Notifications You must be signed in to change notification settings

JingYeoh/Seeker

Repository files navigation

Seeker

🔨 A plugin can change method modifier with Hide annotation and build jar and aar automatically. 一个可以改变字节码中方法的modifier为指定的值的gradle插件,并自动打包出jar/aar

Platform JingYeoh

Feature

  • hook java 字节码
  • 变为 private 的方法,使用反射缓存代理类调用方法
  • 插件多种属性可支持配置
  • 改变方法的 modifier

TODO

  • hook java 源代码
  • @Hide 支持类
  • @Hide 支持成员变量

Versions

lib version
seeker Download
seeker-plugin Download
seeker-annotation Download
seeker-processor Download

Usage example

给你的方法添加 @Hide 注解

public class Mock{
    @Hide(Modifier.PROTECTED)
    public void mock(){
    }
}

运行 ./gradlew :xxx:uploadArchives 命令,查看输出的 jar/aar

Configuration

project root build.gradle 中添加 seeker-plugin 的依赖

buildscript {
    //...
    repositories {
        jcenter()
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath "com.yeoh.seeker:seeker-plugin:${version}"
    }
}

在 library 的 build.gradle 中添加依赖

apply plugin: 'seeker-plugin'
// ...
dependencies {
    implementation "com.yeoh.seeker:seeker:${version}"
    implementation "com.yeoh.seeker:seeker-annotation:${version}"
    annotationProcessor "com.yeoh.seeker:seeker-processor:${version}"
}

About

🔨 A plugin can change method modifier with Hide annotation and build jar and aar automatically

Resources

License

Stars

Watchers

Forks

Packages

No packages published