- 源码 316 文件收编为 rusto-rs/ 文件夹,随本仓库管理 - 移除内部 .git(补丁已存档 docs/rusto-rs-metal-patch-20260912.patch,上游可随时 re-clone) - target/ 与 docs/.yarn 缓存不入库;本地改动:ROCR_* 环境变量调优 + Metal 链接修复 + 预处理测试脚本
95 lines
2.6 KiB
Groovy
95 lines
2.6 KiB
Groovy
plugins {
|
|
id 'com.android.library'
|
|
id 'org.jetbrains.kotlin.android'
|
|
}
|
|
|
|
def safeExtGet(prop, fallback) {
|
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
}
|
|
|
|
android {
|
|
namespace 'com.byrizki.rusto.reactnative'
|
|
compileSdkVersion safeExtGet('ReactNativeRusto_compileSdkVersion', 34)
|
|
|
|
defaultConfig {
|
|
minSdkVersion safeExtGet('ReactNativeRusto_minSdkVersion', 21)
|
|
targetSdkVersion safeExtGet('ReactNativeRusto_targetSdkVersion', 34)
|
|
versionCode 1
|
|
versionName "0.2.5"
|
|
|
|
ndk {
|
|
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
}
|
|
}
|
|
|
|
lintOptions {
|
|
disable 'GradleCompatible'
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_17
|
|
targetCompatibility JavaVersion.VERSION_17
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = '17'
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
def assetDirs = ['src/main/assets']
|
|
def localAndroidAssets = file('../../../android/src/main/assets')
|
|
if (localAndroidAssets.exists()) {
|
|
assetDirs.add(localAndroidAssets.absolutePath)
|
|
}
|
|
assets.srcDirs = assetDirs
|
|
|
|
def jniDirs = ['src/main/jniLibs']
|
|
def localAndroidJni = file('../../../android/src/main/jniLibs')
|
|
if (localAndroidJni.exists()) {
|
|
jniDirs.add(localAndroidJni.absolutePath)
|
|
}
|
|
jniLibs.srcDirs = jniDirs
|
|
}
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
google()
|
|
mavenCentral()
|
|
maven { url 'https://jitpack.io' }
|
|
flatDir {
|
|
dirs 'libs'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
// Version comes from consumer React Native Gradle Plugin. `react-android`
|
|
// is current artifact name and works across RN 0.75+ consumers.
|
|
implementation 'com.facebook.react:react-android'
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:${safeExtGet('kotlinVersion', '1.9.20')}"
|
|
implementation "androidx.core:core-ktx:${safeExtGet('coreKtxVersion', '1.12.0')}"
|
|
|
|
def libsDir = file('libs')
|
|
def hasLocalAar = libsDir.exists() && libsDir.listFiles()?.any { it.name.endsWith('.aar') || it.name.endsWith('.jar') }
|
|
|
|
if (rootProject.findProject(':rusto-android') != null) {
|
|
// Monorepo development mode where :rusto-android is included in root project settings.gradle
|
|
implementation project(':rusto-android')
|
|
} else if (hasLocalAar) {
|
|
// Standalone / bundled mode using prebuilt AAR in libs/
|
|
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'])
|
|
} else {
|
|
// Fallback to JitPack coordinate
|
|
def rustoAndroidVersion = safeExtGet('RustoAndroid_version', 'v0.2.5')
|
|
implementation "com.github.byrizki.rusto-rs:rusto-android:$rustoAndroidVersion"
|
|
}
|
|
}
|