And pieces of open-source framework Booster / DoraemonKit / DroidAssist, Transform Api

> Drops open source framework

1. Quality optimization framework Booster-  https://github.com/didi/booster

  Drops on Github an open-source Android App of quality optimization tool Booster, through discovery and dynamic loading mechanism provides the ability to be scalable. Tantamount to a quality optimization framework for mobile applications.
Characteristically general terms, Booster performance testing and optimization can be done, thin package size, code injection and the like. .
  Booster consists of Transformer and Task components.
Transformer for scanning or modified bytecode (depending Transformer function), while the Task constructed for processing resources.
In order to meet the optimization needs of different business scenarios, Booster provides Transformer SPI and VariantProcessor SPI interface to allow developers to customize.
  Built-in Transformers Through Hole
Booster-the Transform-the bugfix-Toast: Toast repair system errors caused 7.0.
booster-transform-lint: check for potential performance problems.
booster-transform-shrink: used to clear the constants class file.
booster-transform-usage: scanning for the use of a particular API.
  Built-in Tasks
Booster-artifact-Task: Task artifact of providing display.
Booster-task-dependency: providing a display identifier and all dependencies file path Task.
Booster-task-permission: to provide all the dependencies of an Android permission to use.

2. a full-featured client (iOS, Android) research assistant DoraemonKit- https://github.com/didi/DoraemonKit
3. DroidAssist is a lightweight Android bytecode editor plug-in, based on byte Javassist code operation, in accordance with processing class xml configuration file to achieve the effect of the class file dynamically modified - https://github.com/didi/DroidAssist

> Transform API

ASM and the Transform .

A straightforward transformDemo, including how to support incremental updates, how to use the ASM Core and ASM Tree Api, with a certain degree of encapsulation - https://github.com/YuTianTina/TransformDemo
AppPlugin source code parsing - https: // yutiantina .github.io / 2018/07/06 / AppPlugin% E6% BA% 90% E7% A0% 81% E8% A7% A3% E6% 9E% 90 /
in-depth understanding Transform- https://juejin.im/post / 5cbffc7af265da03a97aed41
  fact Transform API in android packing process a very large role in the project, such as obfuscation we know, like file transfer process dex files are by Transform API to accomplish. 
  since the start of version 1.5.0-beta1 , android gradle plug contains a Transform API, which allows third-party plug-ins to convert dex file in the compiled class files do before processing operations.
the use Transform API, we can do not have to concern related task generation and execution process, it allows us to focus only on how to process the input file type

Custom Transform inherited com.android.build.api.transform.Transform
android.registerTransform (theTransform) or android.registerTransform (theTransform, dependencies). Can be registered.

  Understand the android com.android.application and com.android.library two plug-ins are inherited from BasePlugin.
  Related transform process in the file application, lack of space, can go to its own associated source, where the transform process are Custom Task from Desugar-> MergeJavaRes-> of transform-> MergeClasses-> Shrinker (including ResourcesShrinker and DexSplitter and the Proguard) -> MultiDex-> BundleMultiDex-> Dex-> ResourcesShrinker-> DexSplitter, thus the call chain, we can see that in dealing with the class file, it is not required to consider the processing of confusion.

 Action component communication
Transform API has many applications in the direction of the components of the project, we now project from the routing framework developed by the automation modules that do static registration, taking into account the routing protocol by not maintaining documents uncertainty (maintenance page routing address does not correspond in time lead to the development of not been able to update the corresponding codes), we made a constant management of routing, routing first gather information by scanning the code for the entire project, establish the route of the original base information file that matches certain criteria, by variant # registerJavaGeneratingTask registered by the corresponding original document information generated on the basis of common components in the sinking of the corresponding constant task Java file, so the upper depend on the basic components of the project are available through a direct call routing constants used in each component code isolated case, the corresponding constant tables may be generated by the step of passing the original information file component AAR, still go above class duplication exists, custom Transform combined treatment

 The role of business monitoring
in application engineering, we usually have about network monitoring, application performance testing (including page load times, even including the time spent each method call, there is likely to exceed the threshold necessary to warn) the requirements that we do not may be embedded in the business code, can all be handled based Transform API. and for point to buried, we can also functional automation buried by Transform, as much of the field of information passing through the ASM Core forming a recording and ASM Tree here are some of our projects have been implemented, some of it is we need to optimize or to achieve.

Guess you like

Origin blog.csdn.net/ShareUs/article/details/89707133