1+ buildscript {
2+ repositories {
3+ google()
4+ mavenCentral()
5+ }
6+
7+ dependencies {
8+ classpath " com.android.tools.build:gradle:8.12.1"
9+ }
10+ }
11+
12+ def reactNativeArchitectures () {
13+ def value = rootProject. getProperties(). get(" reactNativeArchitectures" )
14+ return value ? value. split(" ," ) : [" armeabi-v7a" , " x86" , " x86_64" , " arm64-v8a" ]
15+ }
16+
17+ def isNewArchitectureEnabled () {
18+ return rootProject. hasProperty(" newArchEnabled" ) && rootProject. getProperty(" newArchEnabled" ) == " true"
19+ }
20+
21+ apply plugin : " com.android.library"
22+ apply plugin : ' org.jetbrains.kotlin.android'
23+ apply from : ' ../nitrogen/generated/android/NitroText+autolinking.gradle'
24+
25+ if (isNewArchitectureEnabled()) {
26+ apply plugin : " com.facebook.react"
27+ }
28+
29+ def getExtOrDefault (name ) {
30+ return rootProject. ext. has(name) ? rootProject. ext. get(name) : project. properties[" NitroText_" + name]
31+ }
32+
33+ def getExtOrIntegerDefault (name ) {
34+ return rootProject. ext. has(name) ? rootProject. ext. get(name) : (project. properties[" NitroText_" + name]). toInteger()
35+ }
36+
37+ android {
38+ namespace " com.nitrotext"
39+
40+ ndkVersion getExtOrDefault(" ndkVersion" )
41+ compileSdkVersion getExtOrIntegerDefault(" compileSdkVersion" )
42+
43+ defaultConfig {
44+ minSdkVersion getExtOrIntegerDefault(" minSdkVersion" )
45+ targetSdkVersion getExtOrIntegerDefault(" targetSdkVersion" )
46+ buildConfigField " boolean" , " IS_NEW_ARCHITECTURE_ENABLED" , isNewArchitectureEnabled(). toString()
47+
48+ externalNativeBuild {
49+ cmake {
50+ cppFlags " -frtti -fexceptions -Wall -Wextra -fstack-protector-all"
51+ arguments " -DANDROID_STL=c++_shared" , " -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
52+ abiFilters (* reactNativeArchitectures())
53+
54+ buildTypes {
55+ debug {
56+ cppFlags " -O1 -g"
57+ }
58+ release {
59+ cppFlags " -O2"
60+ }
61+ }
62+ }
63+ }
64+ }
65+
66+ externalNativeBuild {
67+ cmake {
68+ path " CMakeLists.txt"
69+ }
70+ }
71+
72+ packagingOptions {
73+ excludes = [
74+ " META-INF" ,
75+ " META-INF/**" ,
76+ " **/libc++_shared.so" ,
77+ " **/libfbjni.so" ,
78+ " **/libjsi.so" ,
79+ " **/libfolly_json.so" ,
80+ " **/libfolly_runtime.so" ,
81+ " **/libglog.so" ,
82+ " **/libhermes.so" ,
83+ " **/libhermes-executor-debug.so" ,
84+ " **/libhermes_executor.so" ,
85+ " **/libreactnative.so" ,
86+ " **/libreactnativejni.so" ,
87+ " **/libturbomodulejsijni.so" ,
88+ " **/libreact_nativemodule_core.so" ,
89+ " **/libjscexecutor.so"
90+ ]
91+ }
92+
93+ buildFeatures {
94+ buildConfig true
95+ prefab true
96+ }
97+
98+ buildTypes {
99+ release {
100+ minifyEnabled false
101+ }
102+ }
103+
104+ lintOptions {
105+ disable " GradleCompatible"
106+ }
107+
108+ compileOptions {
109+ sourceCompatibility JavaVersion . VERSION_1_8
110+ targetCompatibility JavaVersion . VERSION_1_8
111+ }
112+
113+ sourceSets {
114+ main {
115+ if (isNewArchitectureEnabled()) {
116+ java. srcDirs + = [
117+ // React Codegen files
118+ " ${ project.buildDir} /generated/source/codegen/java"
119+ ]
120+ }
121+ }
122+ }
123+ }
124+
125+ repositories {
126+ mavenCentral()
127+ google()
128+ }
129+
130+
131+ dependencies {
132+ // For < 0.71, this will be from the local maven repo
133+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
134+ // noinspection GradleDynamicVersion
135+ implementation " com.facebook.react:react-native:+"
136+
137+ // Add a dependency on NitroModules
138+ implementation project(" :react-native-nitro-modules" )
139+
140+ }
141+
142+ if (isNewArchitectureEnabled()) {
143+ react {
144+ jsRootDir = file(" ../src/" )
145+ libraryName = " NitroText"
146+ codegenJavaPackageName = " com.nitrotext"
147+ }
148+ }
0 commit comments