buildscript {
	repositories {
		mavenCentral()
		jcenter()
	}
	dependencies {
		classpath 'com.android.tools.build:gradle:2.2.0-beta3'
		classpath "org.jacoco:org.jacoco.core:0.7.7.201606060606"
	}
}
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'

repositories {
	mavenCentral()
	maven{
		url 'http://dl.bintray.com/lemonade/maven'
	}
}

android {
	compileSdkVersion 24
	buildToolsVersion "24.0.2"
	defaultConfig {
		minSdkVersion 10
		targetSdkVersion 24
		testApplicationId 'ua.anatolii.graphics.ninepatch.test'
		testInstrumentationRunner 'de.lemona.android.testng.TestNGRunner'
		versionName '1.0'
		versionCode 1
	}
	compileOptions {
		sourceCompatibility JavaVersion.VERSION_1_7
		targetCompatibility JavaVersion.VERSION_1_7
	}
	buildTypes {
		debug {
			testCoverageEnabled true
		}
	}
	productFlavors {
	}
}
dependencies {
	androidTestCompile 'org.hamcrest:java-hamcrest:2.0.0.0'
	androidTestCompile 'de.lemona.android:android-testng:1.1.27'
	compile 'com.android.support:support-annotations:24.2.0'
}

publishing {
	publications {
		release(MavenPublication) {
			groupId 'ua.anatolii.graphics'
			artifactId 'ninepatch'
			version "$android.defaultConfig.versionName"
			artifact("$buildDir/outputs/aar/Library-release.aar")
		}
		debug(MavenPublication) {
			groupId 'ua.anatolii.graphics'
			artifactId 'ninepatch'
			version "$android.defaultConfig.versionName-debug"
			artifact("$buildDir/outputs/aar/Library-debug.aar")
		}
	}

	repositories {
		maven {
			url "$rootProject.projectDir.parent/m2Repository"
			if(!file("$rootProject.projectDir.parent/m2Repository").exists()){
				mkdir("$rootProject.projectDir.parent/m2Repository")
			}
		}
	}
}

project.tasks.getByPath(":Library:publish").dependsOn project.tasks.getByPath(":Library:assemble")