https://github.com/bytedance/bytex

ByteX is a bytecode plugin platform based on Android Gradle Transform API and ASM. 字节码插件开发平台

https://github.com/bytedance/bytex

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.4%) to scientific vocabulary

Keywords

asm bytecode gradle gradle-plugin
Last synced: 5 months ago · JSON representation

Repository

ByteX is a bytecode plugin platform based on Android Gradle Transform API and ASM. 字节码插件开发平台

Basic Info
  • Host: GitHub
  • Owner: bytedance
  • License: apache-2.0
  • Language: Java
  • Default Branch: master
  • Homepage:
  • Size: 15.2 MB
Statistics
  • Stars: 3,196
  • Watchers: 76
  • Forks: 467
  • Open Issues: 58
  • Releases: 3
Topics
asm bytecode gradle gradle-plugin
Created about 6 years ago · Last pushed about 2 years ago
Metadata Files
Readme Changelog License

README.md

English | 简体中文

ByteX(Infinite Possibilities)

logo

GitHub license

Powered by ByteDance TikTok & Douyin Android team.

ByteX is a bytecode plugin platform based on Android Gradle Transform Api and ASM.

(Maybe you can think of it as a socket with unlimited plugs?)

In the apk building process, each plugin is completely independent. It not only can run independently from the ByteX host, but also can be automatically integrated into the host into a single Transform along with other plugins.

What's more, each plugin's code is decoupled from one another, as well as their host, which makes it extensible and highly efficient for the development of new plugins.

Background

If all features are developed as a separate plugin, each plugin will cost 10+s, and the compilation time will increase linearly.

But if the iterative development in only one plugin module will make it more and more cluttered, for the code is deeply coupled.

So an idea was raised. It could make sense to build a bytecode plugin platform, and the new feature can be extended based on it as a new plugin.

Feature

  • Code reuse. The common code sinks to common module and is reused by all plugins, so that each plugin only needs to focus on bytecode operation.

  • Plugin code is isolated and decoupled from each other. Based on ByteX, each feature is independent as a single plugin, and the code of each plugin is isolated from each other, which is conducive to develop a new plugin.

  • Platformization makes Transform more efficient.

    • Class files are processed in multiple threads concurrently, making full use of the CPU resources of your machine.
    • Plugins are automatically and seamlessly integrated into a single Transform to improve the efficiency of processing. During the Transform process, the IO of the class file is time-consuming. Integrating all the plugins into a single transform can avoid the costing time increasing linearly. It makes "1 + 1 = 2" become "1 + 1 <2" or approximately equal to 1.
  • Plugin portability is outstanding. Each plugin can be separated from the ByteX host, working as a transform independently.

Structure

structure

TransformEngine

Reading all the class files in the project and Android SDK, and writing back to the specified directory.

base-plugin

ByteX host.

common

Basic code library, including class diagram construction, logs, interfaces provided to various plugins.

other plugin modules

Depending on common module and focusing on bytecode operation.

Quick Start

Add those configuration code to your build.gradle, and apply your plugins on demand.

```groovy buildscript { ext.plugin_version="0.3.0" repositories { google() jcenter() maven { url "https://artifact.bytedance.com/repository/byteX/" } }

dependencies {
    classpath "com.bytedance.android.byteX:base-plugin:${plugin_version}"
    // Add bytex plugins' dependencies on demand
    classpath "com.bytedance.android.byteX:refer-check-plugin:${plugin_version}"
    // ...
}

}

apply plugin: 'com.android.application' // apply bytex host apply plugin: 'bytex' ByteX { enable true enableInDebug false logLevel "DEBUG" }

// apply bytex plugins on demand... apply plugin: 'bytex.refer_check' // ... ```

Note: If ByteX host is not applied, there is no difference between ByteX plugins and ordinary ones, and all of them will run separately. On the contrary, all ByteX plugins can be automatically merged into one single Transform with the help of the ByteX host.

Plugins

Apps Using ByteX

| 抖音 | tiktok | 今日头条 | |:-----------:|:-------:|:-------:| | 抖音 | Tik Tok | 今日头条 | | 火山小视频 | lark | 多闪 | | 火山小视频 | 飞书 | 多闪 | |FaceU | 轻颜 | 飞聊 | | FaceU激萌 | 轻颜| 飞聊|

What else can the ByteX do?

There are more than 25 plugins developed based on ByteX in ByteDance (We only open sourced some of them). You can quickly develop the following related plugins based on ByteX: - Performance optimization(SPI...) - Optimize apk size(xxx-inline...) - Fix Bug - Code analysis / security scan - AOP(replace SharedPreferences...) - and so on

Contribution

If you have some creative ideas and demands related to bytecode, come to join us to develop a new bytecode plugin based on ByteX!

Please read through our Developer API.

Thanks

Contact us

If you have any question or advice about ByteX, feel free to join our WeChat group.

WeChat Group

Besides, sending email to yangzhiqian@bytedance.com or tanlehua@bytedance.com is also available for you.

Change Log

Change Log

License

Apache 2.0

Owner

  • Name: Bytedance Inc.
  • Login: bytedance
  • Kind: organization
  • Location: Singapore

GitHub Events

Total
  • Issues event: 2
  • Watch event: 73
  • Issue comment event: 1
  • Fork event: 12
Last Year
  • Issues event: 2
  • Watch event: 73
  • Issue comment event: 1
  • Fork event: 12

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 70
  • Total Committers: 6
  • Avg Commits per committer: 11.667
  • Development Distribution Score (DDS): 0.457
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
yangzhiqian y****n@b****m 38
tanlehua t****a@b****m 17
EvilsoulM m****8@q****m 7
yangzhiqian 9****7@q****m 5
lehua 5****7@q****m 2
jiangzilai j****i@b****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 130
  • Total pull requests: 41
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 15 days
  • Total issue authors: 104
  • Total pull request authors: 13
  • Average comments per issue: 2.39
  • Average comments per pull request: 0.15
  • Merged pull requests: 32
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 3
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • QiAnXinCodeSafe (6)
  • haizhiyun (4)
  • ksforme (3)
  • jokermonn (3)
  • yanchunlan (3)
  • GvcZhang (2)
  • wqycsu (2)
  • abshyer (2)
  • hesheng1024-p (2)
  • GaoGates (2)
  • nishibaiyang (2)
  • Xinmeng322 (2)
  • beyondckw (2)
  • jiangzhengnan (2)
  • xmqapple (2)
Pull Request Authors
  • yangzhiqian (23)
  • TellH (5)
  • EvilsoulM (3)
  • Garenzhou (2)
  • Zzzia (1)
  • darcycui (1)
  • lizhangqu (1)
  • Xiaojuanmao (1)
  • wtfisthatzzz (1)
  • Alonexx (1)
  • Knight-ZXW (1)
  • listen2code (1)
  • BaeBae33 (1)
Top Labels
Issue Labels
bug (6) fixed (3) 0.2.4 (3) ASM6 (2) 0.2.3 (2) agp bug (2) 不支持AGP3.6 (2) gradle6 (1) invalid (1) 0.2.6 (1) NPE (1) java9 (1) todo (1)
Pull Request Labels

Dependencies

GradleToolKit/GradleEnvApi/build.gradle maven
  • com.android.tools.build:gradle $gradle_version compileOnly
GradleToolKit/build.gradle maven
  • com.bytedance.android.build:gradle-compat-api $gradle_compat_version compile
  • com.google.auto.service:auto-service 1.0-rc4 compile
  • org.jetbrains.kotlin:kotlin-stdlib $kotlin_version compile
  • com.android.tools.build:gradle $gradle_version compileOnly
  • com.bytedance.android.build:gradle-compat-impl $gradle_compat_version
HookProguard/ProguardConfigurationResolver/build.gradle maven
HookProguard/ProguardConfigurationResolver/task/build.gradle maven
  • com.android.tools.build:gradle 3.6.2 compileOnly
HookProguard/ProguardConfigurationResolver/transform/build.gradle maven
  • com.android.tools.build:gradle 3.5.3 compileOnly
HookProguard/build.gradle maven
PluginConfig/PluginConfigAnnotation/build.gradle maven
PluginConfig/PluginConfigProcessor/build.gradle maven
  • com.google.auto.service:auto-service 1.0-rc4 compile
SourceFileKiller/build.gradle maven
TransformEngine/build.gradle maven
  • com.google.guava:guava $guava_version compile
  • io.reactivex.rxjava2:rxjava 2.2.6 compile
  • com.android.tools.build:gradle $gradle_version compileOnly
  • com.squareup.okio:okio 1.14.0 testCompile
access-inline-plugin/build.gradle maven
base-plugin/build.gradle maven
build.gradle maven
butterknife-check-plugin/build.gradle maven
closeable-check-plugin/build.gradle maven
  • br.usp.each.saeg:asm-defuse 0.0.5 implementation
common/build.gradle maven
  • com.bytedance.android.build:gradle-compat-api $gradle_compat_version compile
  • com.google.code.gson:gson 2.8.2 compile
  • com.google.guava:guava $guava_version compile
  • org.ow2.asm:asm $asm_version compile
  • org.ow2.asm:asm-analysis $asm_version compile
  • org.ow2.asm:asm-commons $asm_version compile
  • org.ow2.asm:asm-tree $asm_version compile
  • org.ow2.asm:asm-util $asm_version compile
  • com.android.tools.build:gradle $gradle_version compileOnly
const-inline-plugin/build.gradle maven
coverage/coverage-lib/build.gradle maven
coverage/coverage-plugin/build.gradle maven
  • com.google.code.gson:gson 2.8.2 implementation
example/build.gradle maven
  • com.android.support.constraint:constraint-layout 1.1.3 implementation
  • com.android.support:appcompat-v7 28.0.0 implementation
  • com.bytedance.android.byteX:coverage-lib ${plugin_version} implementation
  • com.google.code.gson:gson 2.8.2 implementation
  • org.jetbrains.kotlin:kotlin-stdlib-jdk7 $kotlin_version implementation
field-assign-opt-plugin/build.gradle maven
getter-setter-inline-plugin/build.gradle maven
method-call-opt-plugin/build.gradle maven
refer-check-plugin/build.gradle maven
serialization-check-plugin/build.gradle maven
shrink-r-plugin/build.gradle maven