Created
June 14, 2016 11:10
-
-
Save brettwold/e6e8b74afddd328f2c79eec4e74c924c to your computer and use it in GitHub Desktop.
Gradle create a jar file from an android library module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android.libraryVariants.all { variant -> | |
def name = variant.buildType.name | |
if (name.indexOf("debug") > -1) { | |
return; // Skip debug builds. | |
} | |
def task = project.tasks.create "jar${name.capitalize()}", Jar | |
task.baseName = "${project.name}-${rootProject.version}" | |
task.dependsOn variant.javaCompile | |
task.from variant.javaCompile.destinationDir | |
artifacts.add('archives', task); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment