subprojects {
  buildscript {
    repositories {
      mavenCentral()
    }
    dependencies {
      classpath 'com.android.tools.build:gradle:1.1.3'
    }
  }

  repositories {
    mavenCentral()
  }

  group = GROUP
  version = VERSION_NAME
}

ext {
  minSdkVersion = 9
  compileSdkVersion = 22
  buildToolsVersion = '22.0.0'
}

subprojects {
  afterEvaluate {
    android.libraryVariants.all { variant ->
      def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
      task.description = "Create jar artifact for ${variant.name}"
      task.dependsOn variant.javaCompile
      task.from variant.javaCompile.destinationDir
      task.destinationDir = project.file("${project.buildDir}/outputs/jar")
      task.archiveName = "${project.name}-${variant.baseName}.jar"
      artifacts.add('archives', task);
    }
  }
}
