apply plugin: 'com.android.library'

group = 'com.paulingalls.realtimeaudio'
version = '0.1.0'

def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
apply from: expoModulesCorePlugin
applyKotlinExpoModulesCorePlugin()
useCoreDependencies()
useExpoPublishing()

// If you want to use the managed Android SDK versions from expo-modules-core, set this to true.
// The Android SDK versions will be bumped from time to time in SDK releases and may introduce breaking changes in your module code.
// Most of the time, you may like to manage the Android SDK versions yourself.
def useManagedAndroidSdkVersions = false
if (useManagedAndroidSdkVersions) {
  useDefaultAndroidSdkVersions()
} else {
  buildscript {
    // Simple helper that allows the root project to override versions declared by this library.
    ext.safeExtGet = { prop, fallback ->
      rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
    }
  }
  project.android {
    compileSdkVersion safeExtGet("compileSdkVersion", 34)
    defaultConfig {
      minSdkVersion safeExtGet("minSdkVersion", 26)
      targetSdkVersion safeExtGet("targetSdkVersion", 34)
    }
  }
}

android {
  namespace "com.paulingalls.realtimeaudio"
  defaultConfig {
    versionCode 1
    versionName "0.1.0"
  }
  lintOptions {
    abortOnError false
  }

  sourceSets {
    main {
      assets.srcDirs = ['src/main/assets']
    }
  }

  repositories {
    google()
    mavenCentral()
    maven {
      url "https://www.beatunes.com/repo/maven2"
    }
  }

  dependencies {
    // 1.23.0+ ships libonnxruntime4j_jni.so with 16 KB-aligned LOAD segments,
    // required for Google Play submissions targeting Android 15+ devices
    // (microsoft/onnxruntime PR #24947, post-1.22 release).
    implementation 'com.microsoft.onnxruntime:onnxruntime-android:1.24.1'
    implementation 'com.tagtraum:pcmsampledsp:0.9.5'
  }
}
