apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'

def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
if (expoModulesCorePlugin.exists()) {
  apply from: expoModulesCorePlugin
  applyKotlinExpoModulesCorePlugin()
  useCoreDependencies()
  useExpoPublishing()
} else {
  def expoModulesCorePath = new File(
    ["node", "--print", "require.resolve('expo-modules-core/package.json')"]
      .execute(null, rootProject.rootDir)
      .text.trim()
  ).parentFile.absolutePath
  apply from: "$expoModulesCorePath/gradle/android-native-library.gradle"
}

android {
  namespace "expo.modules.usbserial"
  compileSdkVersion 35

  defaultConfig {
    minSdkVersion 24
    targetSdkVersion 35
  }
}

dependencies {
  implementation project(':expo-modules-core')
  // usb-serial-for-android by mik3y — the rock-solid pure-Java USB serial library.
  // Hosted on JitPack. Version 3.7.2 supports FTDI, CH34x, CP21xx, PL2303, CDC-ACM.
  implementation 'com.github.mik3y:usb-serial-for-android:3.7.2'
  testImplementation 'junit:junit:4.13.2'
}
