Aucune description

build.gradle 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. apply plugin: "com.android.application"
  2. apply plugin: "org.jetbrains.kotlin.android"
  3. apply plugin: "com.facebook.react"
  4. def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
  5. /**
  6. * This is the configuration block to customize your React Native Android app.
  7. * By default you don't need to apply any configuration, just uncomment the lines you need.
  8. */
  9. react {
  10. entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim())
  11. reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
  12. hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc"
  13. codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
  14. enableBundleCompression = (findProperty('android.enableBundleCompression') ?: false).toBoolean()
  15. // Use Expo CLI to bundle the app, this ensures the Metro config
  16. // works correctly with Expo projects.
  17. cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim())
  18. bundleCommand = "export:embed"
  19. /* Folders */
  20. // The root of your project, i.e. where "package.json" lives. Default is '../..'
  21. // root = file("../../")
  22. // The folder where the react-native NPM package is. Default is ../../node_modules/react-native
  23. // reactNativeDir = file("../../node_modules/react-native")
  24. // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
  25. // codegenDir = file("../../node_modules/@react-native/codegen")
  26. /* Variants */
  27. // The list of variants to that are debuggable. For those we're going to
  28. // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
  29. // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
  30. // debuggableVariants = ["liteDebug", "prodDebug"]
  31. /* Bundling */
  32. // A list containing the node command and its flags. Default is just 'node'.
  33. // nodeExecutableAndArgs = ["node"]
  34. //
  35. // The path to the CLI configuration file. Default is empty.
  36. // bundleConfig = file(../rn-cli.config.js)
  37. //
  38. // The name of the generated asset file containing your JS bundle
  39. // bundleAssetName = "MyApplication.android.bundle"
  40. //
  41. // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
  42. // entryFile = file("../js/MyApplication.android.js")
  43. //
  44. // A list of extra flags to pass to the 'bundle' commands.
  45. // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
  46. // extraPackagerArgs = []
  47. /* Hermes Commands */
  48. // The hermes compiler command to run. By default it is 'hermesc'
  49. // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
  50. //
  51. // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
  52. // hermesFlags = ["-O", "-output-source-map"]
  53. /* Autolinking */
  54. autolinkLibrariesWithApp()
  55. }
  56. /**
  57. * Set this to true in release builds to optimize the app using [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization).
  58. */
  59. def enableMinifyInReleaseBuilds = (findProperty('android.enableMinifyInReleaseBuilds') ?: false).toBoolean()
  60. /**
  61. * The preferred build flavor of JavaScriptCore (JSC)
  62. *
  63. * For example, to use the international variant, you can use:
  64. * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
  65. *
  66. * The international variant includes ICU i18n library and necessary data
  67. * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
  68. * give correct results when using with locales other than en-US. Note that
  69. * this variant is about 6MiB larger per architecture than default.
  70. */
  71. def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
  72. android {
  73. ndkVersion rootProject.ext.ndkVersion
  74. buildToolsVersion rootProject.ext.buildToolsVersion
  75. compileSdk rootProject.ext.compileSdkVersion
  76. namespace 'net.simplico.sflite26'
  77. defaultConfig {
  78. applicationId 'net.simplico.sflite26'
  79. minSdkVersion rootProject.ext.minSdkVersion
  80. targetSdkVersion rootProject.ext.targetSdkVersion
  81. versionCode 8
  82. versionName "1.4.0"
  83. buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\""
  84. }
  85. signingConfigs {
  86. debug {
  87. storeFile file('debug.keystore')
  88. storePassword 'android'
  89. keyAlias 'androiddebugkey'
  90. keyPassword 'android'
  91. }
  92. }
  93. buildTypes {
  94. debug {
  95. signingConfig signingConfigs.debug
  96. }
  97. release {
  98. // Caution! In production, you need to generate your own keystore file.
  99. // see https://reactnative.dev/docs/signed-apk-android.
  100. signingConfig signingConfigs.debug
  101. def enableShrinkResources = findProperty('android.enableShrinkResourcesInReleaseBuilds') ?: 'false'
  102. shrinkResources enableShrinkResources.toBoolean()
  103. minifyEnabled enableMinifyInReleaseBuilds
  104. proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
  105. def enablePngCrunchInRelease = findProperty('android.enablePngCrunchInReleaseBuilds') ?: 'true'
  106. crunchPngs enablePngCrunchInRelease.toBoolean()
  107. }
  108. }
  109. packagingOptions {
  110. jniLibs {
  111. def enableLegacyPackaging = findProperty('expo.useLegacyPackaging') ?: 'false'
  112. useLegacyPackaging enableLegacyPackaging.toBoolean()
  113. }
  114. }
  115. androidResources {
  116. ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~'
  117. }
  118. }
  119. // Apply static values from `gradle.properties` to the `android.packagingOptions`
  120. // Accepts values in comma delimited lists, example:
  121. // android.packagingOptions.pickFirsts=/LICENSE,**/picasa.ini
  122. ["pickFirsts", "excludes", "merges", "doNotStrip"].each { prop ->
  123. // Split option: 'foo,bar' -> ['foo', 'bar']
  124. def options = (findProperty("android.packagingOptions.$prop") ?: "").split(",");
  125. // Trim all elements in place.
  126. for (i in 0..<options.size()) options[i] = options[i].trim();
  127. // `[] - ""` is essentially `[""].filter(Boolean)` removing all empty strings.
  128. options -= ""
  129. if (options.length > 0) {
  130. println "android.packagingOptions.$prop += $options ($options.length)"
  131. // Ex: android.packagingOptions.pickFirsts += '**/SCCS/**'
  132. options.each {
  133. android.packagingOptions[prop] += it
  134. }
  135. }
  136. }
  137. dependencies {
  138. // The version of react-native is set by the React Native Gradle Plugin
  139. implementation("com.facebook.react:react-android")
  140. implementation 'com.microsoft.onnxruntime:onnxruntime-android:latest.release'
  141. def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
  142. def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
  143. def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
  144. if (isGifEnabled) {
  145. // For animated gif support
  146. implementation("com.facebook.fresco:animated-gif:${expoLibs.versions.fresco.get()}")
  147. }
  148. if (isWebpEnabled) {
  149. // For webp support
  150. implementation("com.facebook.fresco:webpsupport:${expoLibs.versions.fresco.get()}")
  151. if (isWebpAnimatedEnabled) {
  152. // Animated webp support
  153. implementation("com.facebook.fresco:animated-webp:${expoLibs.versions.fresco.get()}")
  154. }
  155. }
  156. if (hermesEnabled.toBoolean()) {
  157. implementation("com.facebook.react:hermes-android")
  158. } else {
  159. implementation jscFlavor
  160. }
  161. }