Closed pendext closed 9 years ago
Why not just:
android.libraryVariants.all { variant ->
def name = variant.buildType.name
// Only attach a jar for non-debug build types.
if (!name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
def task = project.tasks.create "jar${name.capitalize()}", Jar
task.dependsOn variant.javaCompile
task.from variant.javaCompile.destinationDir
artifacts.add('archives', task);
}
}
Looks good to me and still generates the jar. Would be nice to get this merged so we don't need to maintain a separate build and it'll help make things work better with maven and robolectric.
Is this PR or its related issue going anywhere, or has this been deliberately left alone for some technical reason? As well as Robolectric, Jar packaging of assertj-android would be useful for another project I'm working on.
See https://gist.github.com/kellyfj/9666950 and #110
I added the task to each subproject. There is probably a way to define the code in one place, however I am new to Gradle and I needed a quick way to generate the jars for the library.