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