// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext { minSdkVersion = 21 targetSdkVersion = 31 compileSdkVersion = 33 dbFlowVersion = '4.2.4' buildToolsVersion = '31.0.0' kotlinVersion = '1.6.10' gradlePluginVersion = '7.2.1' gradleDownloadTaskVersion = '5.0.1' repositoryUrl = "file:${System.env.HOME}/.m2/repository/" if (System.properties['os.arch'] == "aarch64") { // For M1 Users we need to use the NDK 24 which added support for aarch64 ndkVersion = "24.0.8215888" } else { // Otherwise we default to the side-by-side NDK version from AGP. ndkVersion = "21.4.7075529" } } repositories { google() mavenCentral() } dependencies { classpath "com.android.tools.build:gradle:${gradlePluginVersion}" classpath 'com.google.gms:google-services:4.3.5' classpath "de.undercouch:gradle-download-task:$gradleDownloadTaskVersion" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" // WHEN_DISTRIBUTING_REMOVE_FROM_HERE classpath "com.facebook.react:react-native-gradle-plugin" // WHEN_DISTRIBUTING_REMOVE_TO_HERE } } // WHEN_DISTRIBUTING_REMOVE_FROM_HERE // We don't need linter on turtle. plugins { id "com.diffplug.spotless" version "5.14.1" } // WHEN_DISTRIBUTING_REMOVE_TO_HERE allprojects { repositories { // For non-detach maven { url "$rootDir/maven" } // For old expoviews to work maven { url "$rootDir/versioned-abis/expoview-abi47_0_0/maven" } maven { url "$rootDir/versioned-abis/expoview-abi46_0_0/maven" } maven { url "$rootDir/versioned-abis/expoview-abi45_0_0/maven" } maven { url "$rootDir/versioned-abis/maven" } google() mavenCentral { // We don't want to fetch react-native from Maven Central as there are // older versions over there. content { excludeGroup "com.facebook.react" } } maven { // Local Maven repo containing AARs with JSC built for Android url "$rootDir/../node_modules/jsc-android/dist" } maven { // Local expo-camera Maven repo containing our slightly modified // Google's cameraview from expo/cameraview. url "$rootDir/../packages/expo-camera/android/maven" } flatDir { dirs 'libs' // dirs project(':expoview').file('libs') } maven { url "https://jitpack.io" } // Want this last so that we never end up with a stale cache mavenLocal() } configurations.all { // WHEN_DISTRIBUTING_REMOVE_FROM_HERE resolutionStrategy.dependencySubstitution { substitute module("com.facebook.react:react-native:+") with project(":ReactAndroid") // Gradle needs another hint (apart from plain dependency substitution) // to know that it should first evaluate the replacing project before resolving // classpaths etc. Without this block an error is thrown when running tests // in a project that depends on react-native (eg. expo-updates): // > No matching configuration of project :ReactAndroid was found. // > The consumer was configured to find a runtime of a component, // > as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' // > with value 'debug' but: // > - None of the consumable configurations have attributes. all { if (requested.displayName == "com.facebook.react:react-native:+") { evaluationDependsOn(":ReactAndroid") } } } // WHEN_DISTRIBUTING_REMOVE_TO_HERE } } // This var needs to be defined outside any "remove_from_here" comment blocks // because the "*/" in there could affect the resulted code by closing the comment to early. def ktlintTarget = '**/*.kt' // WHEN_DISTRIBUTING_REMOVE_FROM_HERE // We don't need linter on turtle. subprojects { project -> if (project.name == "ReactAndroid") { return; } if (project.name.startsWith("vendored_")) { return; } plugins.apply("com.diffplug.spotless") spotless { format 'gradle', { target '*.gradle' trimTrailingWhitespace() indentWithSpaces() endWithNewline() } kotlin { target(ktlintTarget) // TODO: (barthap) Replace this with raw string when dropped shell app macros // The star "*" signs interferes with slash "/" and treated wildcard path as comment ¯\_(ツ)_/¯ targetExclude(["**", "versioned/host/exp/exponent/modules/api", "**", "*.kt"].join("/")) ktlint("0.41.0").userData([ "disabled_rules" : "no-wildcard-imports,import-ordering", "charset" : "utf-8", "end_of_line" : "lf", "indent_size" : "2", "indent_style" : "space", "insert_final_newline" : "true", "tab_width" : "2", "trim_trailing_whitespace" : "true" ]) trimTrailingWhitespace() indentWithSpaces() endWithNewline() } } } // WHEN_DISTRIBUTING_REMOVE_TO_HERE