plugins {
	id 'com.android.library'
	id 'kotlin-android'
	id 'kotlin-android-extensions'
	id 'com.novoda.bintray-release'
}

publish {
	bintrayUser = rootProject.ext.publish_user_org
	bintrayKey = rootProject.ext.publish_bintray_key
	uploadName = rootProject.ext.uvccamera_package_name
	userOrg = rootProject.ext.publish_user_org
	groupId = rootProject.ext.publish_group_id
	artifactId = rootProject.ext.uvccamera_artifact_id
	publishVersion = rootProject.ext.uvccamera_version_name
	desc = rootProject.ext.uvccamera_artifact_id
	website = rootProject.ext.website + rootProject.ext.uvccamera_artifact_id
	dryRun = false
}

//import org.apache.tools.ant.taskdefs.condition.Os

android {
	compileSdkVersion rootProject.ext.compile_sdk_version
	defaultConfig {
		minSdkVersion rootProject.ext.min_sdk_version
		versionCode rootProject.ext.uvccamera_version_code
		versionName rootProject.ext.uvccamera_version_name
	}
	compileOptions {
		sourceCompatibility rootProject.ext.java_version
		targetCompatibility rootProject.ext.java_version
	}
}

//tasks.withType(JavaCompile) {
//	compileTask -> compileTask.dependsOn ndkBuild
//}
//
//String getNdkBuildPath() {
//	Properties properties = new Properties()
//	properties.load(project.rootProject.file('local.properties').newDataInputStream())
//	def ndkBuildingDir = properties.getProperty("ndk.dir")
//	if (Os.isFamily(Os.FAMILY_WINDOWS)) {
//		return ndkBuildingDir + '/ndk-build.cmd'
//	} else {
//		return ndkBuildingDir + '/ndk-build'
//	}
//}
//
//task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') {
//	println('executing ndkBuild')
//	def ndkBuildPath = getNdkBuildPath()
//	commandLine ndkBuildPath, '-j8', '-C', file('src/main').absolutePath
//}
//
//task ndkClean(type: Exec, description: 'clean JNI libraries') {
//	println('executing ndkBuild clean')
//	def ndkBuildPath = getNdkBuildPath()
//	commandLine ndkBuildPath, 'clean', '-C', file('src/main').absolutePath
//}
//
//clean.dependsOn 'ndkClean'

dependencies {
	//https://www.kotlincn.net/docs/reference/using-gradle.html
	compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
	compileOnly "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
	//https://maven.google.com
	compileOnly "com.google.android.material:material:$androidx_material_version"
	//https://github.com/saki4510t/UVCCamera
	api 'com.serenegiant:common:2.12.4'
}
