buildscript {
	repositories {
		mavenCentral()
	}

	dependencies {
		classpath 'com.android.tools.build:gradle:1.3.0'
	}
}

apply plugin: 'com.android.library'

android {
	compileSdkVersion 19
	buildToolsVersion '20'

	lintOptions {
		abortOnError false
	}

	compileOptions {
		sourceCompatibility JavaVersion.VERSION_1_7
		targetCompatibility JavaVersion.VERSION_1_7
	}

	sourceSets {
		main.java.srcDirs = ['src/main/java']
		main.aidl.srcDirs = ['src/main/java']
		main.res.srcDirs = ['src/main/res']
		main.jniLibs.srcDirs = ['src/main/libs']
		main.jni.srcDirs = []
		main.manifest.srcFile 'src/main/AndroidManifest.xml'
	}

	defaultConfig {
		minSdkVersion 5
		maxSdkVersion 10
		targetSdkVersion 9
		versionCode 1
		versionName "1.0"
	}

	task ndkBuild(type: Exec) {
		def ndkDir = plugins.getPlugin('com.android.library').sdkHandler.getNdkFolder()
		commandLine "$ndkDir/ndk-build", '-C', file('src/main/jni').absolutePath
	}

	tasks.withType(JavaCompile) {
		compileTask -> compileTask.dependsOn ndkBuild
	}

	clean {
		delete 'src/main/obj'
		delete 'src/main/libs'
	}
}
