Mobbeel / fataar-gradle-plugin

Gradle plugin to help embed dependencies in generated AAR artifact
https://plugins.gradle.org/plugin/com.mobbeel.plugin
Apache License 2.0
340 stars 44 forks source link
android gradle

Mobbeel fat AAR Gradle plugin

In Mobbeel we work with a complex hierarchy of modules that in turn must embed other dependencies in the resulting AAR. To do this we use this Gradle plugin that allows to merge a project and its dependencies in the same AAR (fat-aar).

Issue reporting are welcome to continue to improve this plugin.

Plugin work with Android gradle plugin 3.0.0 o higher

Features

How to use?

  1. Configure your buildscript to include the plugin:

    buildscript {
    repositories {
      maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
      classpath "com.mobbeel.plugin:fat-aar:2.0.1"
    }
    }
  2. Apply the plugin on the top of your library module build.gradle:

    apply plugin: "com.mobbeel.plugin"
  3. Mark with 'api' configuration dependecies that need embed on the final AAR:

    dependencies {
      api "com.mobbeel:my-lib:1.0.0"  // <- Embed external dependency from any repository
      api project(':My-lib-module')   // <- Embed internal dependency on workspace
    
      ...
    }

Add to fat AAR all transitive dependencies

By default, the transitive dependencies that define a dependency are not added to the fat AAR. You can add them by adding these settings:

 aarPlugin {
     includeAllInnerDependencies true  // It's false for default
 }