|
| 1 | +buildscript { |
| 2 | + ext.getExtOrDefault = {name -> |
| 3 | + return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Skeleton_' + name] |
| 4 | + } |
| 5 | + |
| 6 | + repositories { |
| 7 | + google() |
| 8 | + mavenCentral() |
| 9 | + } |
| 10 | + |
| 11 | + dependencies { |
| 12 | + classpath "com.android.tools.build:gradle:8.7.2" |
| 13 | + // noinspection DifferentKotlinGradleVersion |
| 14 | + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}" |
| 15 | + } |
| 16 | +} |
| 17 | + |
| 18 | +def reactNativeArchitectures() { |
| 19 | + def value = rootProject.getProperties().get("reactNativeArchitectures") |
| 20 | + return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] |
| 21 | +} |
| 22 | + |
| 23 | +apply plugin: "com.android.library" |
| 24 | +apply plugin: "kotlin-android" |
| 25 | +apply from: '../nitrogen/generated/android/skeleton+autolinking.gradle' |
| 26 | + |
| 27 | +apply plugin: "com.facebook.react" |
| 28 | + |
| 29 | +def getExtOrIntegerDefault(name) { |
| 30 | + return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Skeleton_" + name]).toInteger() |
| 31 | +} |
| 32 | + |
| 33 | +android { |
| 34 | + namespace "com.margelo.nitro.skeleton" |
| 35 | + |
| 36 | + compileSdkVersion getExtOrIntegerDefault("compileSdkVersion") |
| 37 | + |
| 38 | + defaultConfig { |
| 39 | + minSdkVersion getExtOrIntegerDefault("minSdkVersion") |
| 40 | + targetSdkVersion getExtOrIntegerDefault("targetSdkVersion") |
| 41 | + |
| 42 | + externalNativeBuild { |
| 43 | + cmake { |
| 44 | + cppFlags "-frtti -fexceptions -Wall -fstack-protector-all" |
| 45 | + arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON" |
| 46 | + abiFilters (*reactNativeArchitectures()) |
| 47 | + |
| 48 | + buildTypes { |
| 49 | + debug { |
| 50 | + cppFlags "-O1 -g" |
| 51 | + } |
| 52 | + release { |
| 53 | + cppFlags "-O2" |
| 54 | + } |
| 55 | + } |
| 56 | + } |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + externalNativeBuild { |
| 61 | + cmake { |
| 62 | + path "CMakeLists.txt" |
| 63 | + } |
| 64 | + } |
| 65 | + |
| 66 | + packagingOptions { |
| 67 | + excludes = [ |
| 68 | + "META-INF", |
| 69 | + "META-INF/**", |
| 70 | + "**/libc++_shared.so", |
| 71 | + "**/libfbjni.so", |
| 72 | + "**/libjsi.so", |
| 73 | + "**/libfolly_json.so", |
| 74 | + "**/libfolly_runtime.so", |
| 75 | + "**/libglog.so", |
| 76 | + "**/libhermes.so", |
| 77 | + "**/libhermes-executor-debug.so", |
| 78 | + "**/libhermes_executor.so", |
| 79 | + "**/libreactnative.so", |
| 80 | + "**/libreactnativejni.so", |
| 81 | + "**/libturbomodulejsijni.so", |
| 82 | + "**/libreact_nativemodule_core.so", |
| 83 | + "**/libjscexecutor.so" |
| 84 | + ] |
| 85 | + } |
| 86 | + |
| 87 | + buildFeatures { |
| 88 | + buildConfig true |
| 89 | + prefab true |
| 90 | + } |
| 91 | + |
| 92 | + buildTypes { |
| 93 | + release { |
| 94 | + minifyEnabled false |
| 95 | + } |
| 96 | + } |
| 97 | + |
| 98 | + lintOptions { |
| 99 | + disable "GradleCompatible" |
| 100 | + } |
| 101 | + |
| 102 | + compileOptions { |
| 103 | + sourceCompatibility JavaVersion.VERSION_1_8 |
| 104 | + targetCompatibility JavaVersion.VERSION_1_8 |
| 105 | + } |
| 106 | + |
| 107 | + sourceSets { |
| 108 | + main { |
| 109 | + java.srcDirs += [ |
| 110 | + "generated/java", |
| 111 | + "generated/jni" |
| 112 | + ] |
| 113 | + } |
| 114 | + } |
| 115 | +} |
| 116 | + |
| 117 | +repositories { |
| 118 | + mavenCentral() |
| 119 | + google() |
| 120 | +} |
| 121 | + |
| 122 | +def kotlin_version = getExtOrDefault("kotlinVersion") |
| 123 | + |
| 124 | +dependencies { |
| 125 | + implementation "com.facebook.react:react-android" |
| 126 | + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" |
| 127 | + implementation project(":react-native-nitro-modules") |
| 128 | +} |
0 commit comments