square / assertj-android

A set of AssertJ helpers geared toward testing Android.
https://square.github.io/assertj-android/
Apache License 2.0
1.58k stars 156 forks source link

Sub projects will generate jar files on build. #149

Closed pendext closed 9 years ago

pendext commented 9 years ago

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.

JakeWharton commented 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);
  }
}
kingargyle commented 9 years ago

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.

kriegfrj commented 9 years ago

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.