apply plugin: 'com.android.library'
apply plugin: 'com.facebook.react'

def safeExtGet(prop, fallback) {
	rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

android {

	def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
	// Check AGP version for backward compatibility w/react-native versions still on gradle plugin 6
	def major = agpVersion[0].toInteger()
	def minor = agpVersion[1].toInteger()
	if ((major == 7 && minor >= 3) || major >= 8) {
		namespace "com.reactnative.hybridnavigation"
		buildFeatures {
			buildConfig true
		}
	}

	compileSdkVersion safeExtGet('compileSdkVersion', 35)
	buildToolsVersion safeExtGet('buildToolsVersion', '35.0.0')

	defaultConfig {
		minSdkVersion safeExtGet('minSdkVersion', 24)
		targetSdkVersion safeExtGet('targetSdkVersion', 35)
	}

	sourceSets {
		main {
			java.srcDirs += [
				"generated/java",
				"generated/jni"
			]
		}
	}
}

repositories {
	google()
	mavenCentral()
}

dependencies {
	implementation "com.facebook.react:react-android:+"
	implementation "androidx.appcompat:appcompat:1.6.1"
}
