GithubHelp home page GithubHelp logo

febers / bytex Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bytedance/bytex

0.0 0.0 0.0 0 B

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

License: Apache License 2.0

Kotlin 4.08% Java 95.75% Shell 0.17%

bytex's Introduction

English | 简体中文

ByteX(Infinite Possibilities)

logo

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.

buildscript {
  	ext.plugin_version="0.1.0"
    repositories {
        maven { url "https://dl.bintray.com/tellh/maven" }
        google()
        jcenter()
    }
  
    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 you do not apply the ByteX host, those ByteX plugins are no different from ordinary plugins and each will form a separate Transform. On the contrary, all ByteX plugins will automatically merge into a Transform with the help of the ByteX host.

The following are the plugins based on ByteX. You can learn more usage information about those plugins in their own README.md.

Plugins

Known Users

抖音

tiktok

今日头条

火山小视频

Lark


多闪

FaceU

轻颜

飞聊

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](wiki/ByteX Developer API-zh.md).

License

Apache 2.0

bytex's People

Contributors

tanlehua avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.