GithubHelp home page GithubHelp logo

lerist / freeline Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alibaba/freeline

0.0 3.0 0.0 39.54 MB

License: BSD 3-Clause "New" or "Revised" License

Python 52.66% Groovy 10.80% Shell 3.24% Batchfile 1.91% Java 31.39%

freeline's Introduction

Freeline

Freeline

Release Version BSD License PRs Welcome

Freeline is a fast build and deployment tool for Android. Caching reusable class files and resource indices, it enables incrementally building Android apps, and optionally deploying the update to your device with hot swap.

Developed and used by Ant Fortune( about us ) Android Team, Freeline has been significantly saving time in daily work. Inspiring by Buck and Instant Run but faster than ever, Freeline can finish an incremental build in just a few seconds. No more recompile and reinstall again and again before seeing your modifications, Freeline brings life-changing development experience for Android.

Freeline Insights

Freeline splits the build task into several small tasks that run concurrently. It makes full use of the compiled cache files to implement a real incremental build and uses some components of Buck such as dx and DexMerger to speed up the build tasks. Freeline runs a socket server in a separate process on device side, which connects with build tool on developer's machine, so that deployment can still take effects even if the main process crashes.

Freeline uses multi-dex solution for incremental dex hot swapping. A deeply optimized version of aapt tool (FreelineAapt) is made to generate incremental resource pack, which can be as small as 1 kb. MonkeyPatcher from Instant Run is utilized to make hot resource replacement.

Freeline will automatically switch between full build and incremental build.

Freeline is also a great basis for over-the-air hotpatching. Deliverying Freeline's incremental output, which can be packed into a zip file and usually less than 100 kb, it is able to take effect to fix crashes or other problems and replace resoucres dynamically. Statistical data over large amount cases show that it is effective for 99% of users. Please note that the OTA patch delivery system is out of scope of this project.

FreelineAapt will open source codes later. See wiki to know more about Freeline, only Chinese available now.

中文详细说明

Features

  • Speed up standard android gradle projects with multiple modules;
  • Concurrent tasks that incrementally build project;
  • Hot deploy even if the main process crashes;
  • Build incremental dex and resource pack;
  • Caching resource.arsc support;
  • Running on Windows, Linux and Mac.

See the following table for changes support.

Java drawable, layout, etc. res/values
add
change
remove x

Freeline has been tested with API versions 17, 19, 22, 23 on the android emulators, a Nexus 6p running marshmallow and a smartisan running Kitkat. Incremental resource patch would be much faster if the android device is running Lolipop or above.

Download

Configure your project-level build.gradle to include freeline plugin:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.antfortune.freeline:gradle:0.5.2'
    }
}

Then, apply the freeline plugin in your android application module's build.gradle and add the freeline dependencies:

apply plugin: 'com.antfortune.freeline'

android {
    ...
    freeline {
        hack true
    }
}

dependencies {
  compile 'com.antfortune.freeline:runtime:0.5.0'
}

Finally, apply freeline in your application class.

public class App extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        FreelineCore.init(this);
    }
}

If you have a complex project structure, you may need to use freeline DSL to customize your build process. For more details about freeline DSL, see Freeline DSL References.

Installation

  • Windows: gradlew.bat initFreeline
  • Linux/Mac: ./gradlew initFreeline

gradle initFreeline -Pmirror or proxy might be useful, if you have trouble in downloading freeline dependency.

Note that, you should apply the freeline plugin dependency before you execute these commands.

Usage

On the root dir of your project :

  • python freeline.py

    freeline will automatically perform a full build on your project as follows:

    • manifest.xml modified
    • build.gradle modified
    • libs modified
    • connect to other mobile phones after any incremental build

    and an incremental build on other change case (java or res modified ),you don't need to pay attention to what you just modified!

  • force full build:python freeline.py -f

    when if freeline are not automatically change to full build ,you can force it through "-f"

Sample Usage

git clone [email protected]:alibaba/freeline.git
cd freeline/sample
./gradlew initFreeline
python freeline.py

TODO

  • Compatibility Improvement
  • Android Studio Plugin
  • Annotation Support
  • Multiple Devices Connection Support

Limitations

  • Sync incremental resource pack to the device first time may be a bit slow
  • Annotation is not supported currently, such as ButterKnife etc.
  • Removing res/values is not supported, which may cause aapt exception

Contributing

We are always very happy to have contributions, whether for trivial cleanups, big new features or other material rewards.

Troubleshooting

See wiki.

Thanks

License

BSD License

freeline's People

Contributors

charvenhe avatar lomanyong avatar yrom avatar alibaba-oss avatar

Watchers

James Cloos avatar Lerist avatar  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.