1// Top-level build file where you can add configuration options common to all sub-projects/modules. 2 3buildscript { 4 ext { 5 minSdkVersion = 21 6 targetSdkVersion = 31 7 compileSdkVersion = 31 8 9 dbFlowVersion = '4.2.4' 10 buildToolsVersion = '31.0.0' 11 kotlinVersion = '1.6.10' 12 gradlePluginVersion = '7.0.4' 13 gradleDownloadTaskVersion = '4.1.2' 14 repositoryUrl = "file:${System.env.HOME}/.m2/repository/" 15 } 16 repositories { 17 google() 18 mavenCentral() 19 } 20 dependencies { 21 classpath "com.android.tools.build:gradle:${gradlePluginVersion}" 22 classpath 'com.google.gms:google-services:4.3.5' 23 classpath "de.undercouch:gradle-download-task:$gradleDownloadTaskVersion" 24 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" 25 classpath "com.facebook.react:react-native-gradle-plugin" 26 } 27} 28 29// WHEN_DISTRIBUTING_REMOVE_FROM_HERE 30// We don't need linter on turtle. 31plugins { 32 id "com.diffplug.spotless" version "5.14.1" 33} 34// WHEN_DISTRIBUTING_REMOVE_TO_HERE 35 36allprojects { 37 repositories { 38 // For non-detach 39 maven { 40 url "$rootDir/maven" 41 } 42 // For old expoviews to work 43 maven { 44 url "$rootDir/versioned-abis/expoview-abi44_0_0/maven" 45 } 46 maven { 47 url "$rootDir/versioned-abis/expoview-abi43_0_0/maven" 48 } 49 maven { 50 url "$rootDir/versioned-abis/maven" 51 } 52 google() 53 mavenCentral { 54 // We don't want to fetch react-native from Maven Central as there are 55 // older versions over there. 56 content { 57 excludeGroup "com.facebook.react" 58 } 59 } 60 maven { 61 // Local Maven repo containing AARs with JSC built for Android 62 url "$rootDir/../node_modules/jsc-android/dist" 63 } 64 maven { 65 // Local expo-camera Maven repo containing our slightly modified 66 // Google's cameraview from expo/cameraview. 67 url "$rootDir/../packages/expo-camera/android/maven" 68 } 69 flatDir { 70 dirs 'libs' 71 // dirs project(':expoview').file('libs') 72 } 73 // Using www.jitpack.io instead of plain jitpack.io due to 74 // https://github.com/jitpack/jitpack.io/issues/4002 75 maven { url "https://www.jitpack.io" } 76 77 // Want this last so that we never end up with a stale cache 78 mavenLocal() 79 } 80 81 configurations.all { 82 // WHEN_DISTRIBUTING_REMOVE_FROM_HERE 83 resolutionStrategy.dependencySubstitution { 84 substitute module("com.facebook.react:react-native:+") with project(":ReactAndroid") 85 86 // Gradle needs another hint (apart from plain dependency substitution) 87 // to know that it should first evaluate the replacing project before resolving 88 // classpaths etc. Without this block an error is thrown when running tests 89 // in a project that depends on react-native (eg. expo-updates): 90 // > No matching configuration of project :ReactAndroid was found. 91 // > The consumer was configured to find a runtime of a component, 92 // > as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' 93 // > with value 'debug' but: 94 // > - None of the consumable configurations have attributes. 95 all { 96 if (requested.displayName == "com.facebook.react:react-native:+") { 97 evaluationDependsOn(":ReactAndroid") 98 } 99 } 100 } 101 // WHEN_DISTRIBUTING_REMOVE_TO_HERE 102 } 103} 104 105// This var needs to be defined outside any "remove_from_here" comment blocks 106// because the "*/" in there could affect the resulted code by closing the comment to early. 107def ktlintTarget = '**/*.kt' 108 109// WHEN_DISTRIBUTING_REMOVE_FROM_HERE 110// We don't need linter on turtle. 111subprojects { 112 plugins.apply("com.diffplug.spotless") 113 spotless { 114 format 'gradle', { 115 target '*.gradle' 116 trimTrailingWhitespace() 117 indentWithSpaces() 118 endWithNewline() 119 } 120 kotlin { 121 target(ktlintTarget) 122 // TODO: (barthap) Replace this with raw string when dropped shell app macros 123 // The star "*" signs interferes with slash "/" and treated wildcard path as comment ¯\_(ツ)_/¯ 124 targetExclude(["**", "versioned/host/exp/exponent/modules/api", "**", "*.kt"].join("/")) 125 ktlint("0.41.0").userData([ 126 "disabled_rules" : "no-wildcard-imports,import-ordering", 127 "charset" : "utf-8", 128 "end_of_line" : "lf", 129 "indent_size" : "2", 130 "indent_style" : "space", 131 "insert_final_newline" : "true", 132 "tab_width" : "2", 133 "trim_trailing_whitespace" : "true" 134 ]) 135 trimTrailingWhitespace() 136 indentWithSpaces() 137 endWithNewline() 138 } 139 } 140} 141// WHEN_DISTRIBUTING_REMOVE_TO_HERE 142