Skip to content

Latest commit

 

History

History
executable file
·
94 lines (68 loc) · 2.83 KB

README.cn.md

File metadata and controls

executable file
·
94 lines (68 loc) · 2.83 KB

此插件可以根据 buildType 或者 flavor 来过滤 so 文件

使用

  1. 在 build.gradle 中添加以下脚本

    buildscript {
       repositories {
          jcenter()
       }
    
       dependencies {
          classpath 'com.jween.gradle:android-soexcluder:1.1'
       }
    }
    
    
    apply plugin: 'com.android.application'
    apply plugin: 'android-soexcluder'

    注意: android-soexcluder插件必须和com.android.application插件配合使用

配置

  1. 根据flavor移除指定so文件

    soexcluder {
        // 为flavor1 移除v7a的foo.so与v8a的bar.so文件
        flavor1 {
            exclude "lib/armeabi-v7a/foo.so", "lib/armeabi-v8a/bar.so"
        }
        
        // 对debug buildType保留v7a和x86 abi的除foo.so之外的所有so文件
        debug {
            include "lib/armeabi-v7a/*.so" 
            include "lib/x86/*.so"
            exclude "lib/armeabi-v7a/foo.so"
            exclude "lib/x86/foo.so"
        }
    }
  2. 与 gradle 的 include/exclude 的Ant路径正则用法完全一致

    soexcluder {
        
        // 对debug buildType保留除foo.so之外的所有so文件
        debug {
            include "**/*" 
            exclude "**/foo.so"
        }
    }
  3. 你甚至可以对buildType以及flavor使用正则表达式!

    soexcluder {
        
        // 当flavor或者buildType的名字以o结尾的时候, 移除所有so文件
        ".*o" {
            exclude "**/*"
        }
    }

License

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

<[email protected]> 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
  • The purpose of this license is to prevent anti-labour-law companies from using the software or codes under the license, and force those companies to weigh their way of working

  • See a full list of projects under Anti-996 License

  • This draft is adapted from the MIT license. For more detailed explanation, please see Wiki. This license is designed to be compatible with all major open source licenses.

  • For law professionals or anyone who is willing to contribute to future version directly, please go to Anti-996-License-1.0. Thank you.