/android-soexcluder

This plugin will help you exclude so files by flavor or buildType

Primary LanguageGroovyOtherNOASSERTION

Gradle Android So Excluder Plugin

This plugin will help you exclude so files by flavor or buildType

Usage

  1. Add the following scripts to your build.gradle

    buildscript {
       repositories {
          jcenter()
          maven { // package is not in jcenter for now
              url  "http://dl.bintray.com/jween/maven" 
          }
       }
    
       dependencies {
          classpath 'com.jween.gradle:android-soexcluder:1.0'
       }
    }
    
    
    apply plugin: 'com.android.application'
    apply plugin: 'android-soexcluder'

    Note: You MUST apply android-soexcluder AFTER android application plugin

  2. Wish we have step 2!

    But that's it, it a quite simple small tool to deal with so files.

Configuration

  1. Exclude specific so files by flavors

    soexcluder {
        // exclude armeabi-v7a/foo.so and armeabi-v8a/bar.so for flavor1
        flavor1 {
            exclude "lib/armeabi-v7a/foo.so", "lib/armeabi-v8a/bar.so"
        }
        
        // Reserve only v7a so files except foo.so for debug buildType
        debug {
            include "lib/armeabi-v7a/*.so" 
            exclude "lib/armeabi-v7a/foo.so"
        }
    }
  2. Exact the same path pattern as gradle include/exclude api

    soexcluder {
        
        // Reserve all so files for debug buildType except foo.so
        debug {
            include "**/*" 
            exclude "**/foo.so"
        }
    }
  3. You can even use regex in flavor/buildType entry!

    soexcluder {
        
        // Remove all so files if the flavor or buildType name ends with 'o' 
        ".*o" {
            exclude "**/*"
        }
    }

License

"THE BEER-WARE LICENSE" (Revision 42):

<Jween.Lau@gmail.com> wrote this file. As long as you retain this notice
you can do whatever you want with this stuff. If we meet some day, and you think
this stuff is worth it, you can buy me a beer in return. -Jween Lau