Comments (7)
只要设置一下 Procedure 的 parent 然后 将对应的 Procedure 传到 InstanceInvocation 即可完成转换, 具体可以参考我的fork
// ...
//目标新建stub函数,方便完成目标->aopstub->目标stub链路
final Procedure originalStubProcedure = AopUtils.createStubProcedure(
Name(originalProcedure.name.text + '_' + stubKey, originalProcedure.name.library),
aopItemInfo,
originalProcedure,
body,
shouldReturn,
)..parent = originalProcedure.parent;
// ...
final mockedInvocation = InstanceInvocation(
InstanceAccessKind.Instance,
AsExpression(
AopUtils.getPointCutClassInstanceGet(pointcutClass, 'target'),
InterfaceType(originalClass, Nullability.nonNullable),
),
originalStubProcedure.name,
AopUtils.concatArguments4PointcutStubCall(originalProcedure),
interfaceTarget: originalStubProcedure,
functionType: originalStubProcedure.getterType as FunctionType
);
//...
from aspectd.
只要设置一下 Procedure 的 parent 然后 将对应的 Procedure 传到 InstanceInvocation 即可完成转换, 具体可以参考我的fork
// ... //目标新建stub函数,方便完成目标->aopstub->目标stub链路 final Procedure originalStubProcedure = AopUtils.createStubProcedure( Name(originalProcedure.name.text + '_' + stubKey, originalProcedure.name.library), aopItemInfo, originalProcedure, body, shouldReturn, )..parent = originalProcedure.parent; // ... final mockedInvocation = InstanceInvocation( InstanceAccessKind.Instance, AsExpression( AopUtils.getPointCutClassInstanceGet(pointcutClass, 'target'), InterfaceType(originalClass, Nullability.nonNullable), ), originalStubProcedure.name, AopUtils.concatArguments4PointcutStubCall(originalProcedure), interfaceTarget: originalStubProcedure, functionType: originalStubProcedure.getterType as FunctionType ); //...
目前已经迁移了 call execute (构造器 hook 没搞,暂时用不到, 实例方法和静态方法简单测了 可以用)
from aspectd.
from aspectd.
2.5.4版本在哪里下的?我看flutter最新版本只支持到了2.5.3呀
from aspectd.
项目地址https://github.com/lancexin/aspect_frontend_server 现在暂时只支持execute模式
该方法和aspectd的区别
- aspectd不支持flutter 2.5.4,本项目是基于flutter 2.5.4测试
- aspectd的编译需要对dart sdk中的vm进行修改,本项目不需要
- aspectd使用前需要对flutter tools的代码进行修改,本项目只需要替换flutter sdk对应的frontend_server.dart.snapshot即可
- aspectd的实现原理过于复杂,本项目去掉了Call,Inject等用法保留了Execute用法的同时对注入逻辑进行了简化
- aspectd还需要aspect_impl等,本项目可以直接在主程序代码中添加注入代码,也可以用plugin的方式添加
- 本项目不需要引入任何第三方包,用pragma注解完成对应插桩
- 可以有限制支持hot reload,完全支持hot restart,免去了冷重启的烦恼
- 为了性能优化inject方法限制必须是static的
为什么用pragma注解,而不是自定义注解?
本项目是在aot优化后再对字节码进行修改,aot优化后只有白名单中的注解才能被识别到,pragma是在白名单中的注解.
2.5.4版本在哪里下的呀,我看最新版本只支持到了2.5.3呀
from aspectd.
项目地址https://github.com/lancexin/aspect_frontend_server 现在暂时只支持execute模式
该方法和aspectd的区别
- aspectd不支持flutter 2.5.4,本项目是基于flutter 2.5.4测试
- aspectd的编译需要对dart sdk中的vm进行修改,本项目不需要
- aspectd使用前需要对flutter tools的代码进行修改,本项目只需要替换flutter sdk对应的frontend_server.dart.snapshot即可
- aspectd的实现原理过于复杂,本项目去掉了Call,Inject等用法保留了Execute用法的同时对注入逻辑进行了简化
- aspectd还需要aspect_impl等,本项目可以直接在主程序代码中添加注入代码,也可以用plugin的方式添加
- 本项目不需要引入任何第三方包,用pragma注解完成对应插桩
- 可以有限制支持hot reload,完全支持hot restart,免去了冷重启的烦恼
- 为了性能优化inject方法限制必须是static的
为什么用pragma注解,而不是自定义注解?
本项目是在aot优化后再对字节码进行修改,aot优化后只有白名单中的注解才能被识别到,pragma是在白名单中的注解.
2.5.4版本在哪里下的呀,我看最新版本只支持到了2.5.3呀
flutter是 2.5.3
from aspectd.
朋友,二维码 过期了
from aspectd.
Related Issues (20)
- flutter run --debug --verbose运行不成功
- 不同dert文件中不同类里面,相同名称的方法注入有错乱 HOT 2
- 嵌套Execute注入的时候在release打包时候会报错
- Aspectd如何给所有方法进行函数插桩
- 最新版本的库作为第三方库是否需要global activate? HOT 1
- Target kernel_snapshot failed: FileSystemException: Cannot open file, path = '/Users/liuxin/aspectd/aspectd_impl/.packages' HOT 1
- Where can I find the lastest version of aspectd ?? HOT 4
- 1.22.2 版本demo运行报错 HOT 1
- flutter version 2.2.3, dart version 2.13.4, 请问aspectd应该使用哪个版本。
- 自建工程没有成功,跑的master2.2.3的最新demo可以成功 HOT 1
- 啥时候适配 2.5.0 HOT 5
- 为啥2.2.3版本里面frontend_server/frontend_server.dart编译器会报红找不到该引用
- AspectD 非官方交流群 HOT 2
- 什么时候考虑升级支持2.5吗 HOT 8
- 有没有计划开源PowerScrollView HOT 2
- Beike_AspectD is now compatible with Flutter 2.5.3.
- Crash when compiling package:aspectd_impl/aspectd_impl.dart
- Inject hook GestureDetector无效
- xcode build fail
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aspectd.