This repository has been archived by the owner on Jan 6, 2024. It is now read-only.
forked from expo/expo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
171 lines (157 loc) · 5.64 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// Top-level build file where you can add configuration options common to all sub-projects/modules.
import com.android.build.api.variant.AndroidComponentsExtension
buildscript {
ext {
minSdkVersion = 21
targetSdkVersion = 33
compileSdkVersion = 33
dbFlowVersion = '4.2.4'
buildToolsVersion = '33.0.0'
kotlinVersion = '1.8.10'
gradlePluginVersion = '7.4.2'
gradleDownloadTaskVersion = '5.0.1'
repositoryUrl = "file:${System.env.HOME}/.m2/repository/"
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:${gradlePluginVersion}"
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.6'
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
def reactProperties = new Properties()
file("${project(':packages:react-native:ReactAndroid').projectDir}/gradle.properties").withInputStream { reactProperties.load(it) }
allprojects {
repositories {
// For non-detach
maven {
url "$rootDir/maven"
}
// For old expoviews to work
maven {
url "$rootDir/versioned-abis/expoview-abi49_0_0/maven"
}
maven {
url "$rootDir/versioned-abis/expoview-abi48_0_0/maven"
}
maven {
url "$rootDir/versioned-abis/expoview-abi47_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"))
.using(project(":packages:react-native:ReactAndroid"))
.because("Building React Native from source")
substitute(module("com.facebook.react:react-native:+"))
.using(project(":packages:react-native:ReactAndroid"))
.because("Building React Native from source")
substitute(module("com.facebook.react:react-android"))
.using(project(":packages:react-native:ReactAndroid"))
.because("Building React Native from source")
}
// WHEN_DISTRIBUTING_REMOVE_TO_HERE
resolutionStrategy.force(
"com.facebook.fresco:fbcore:${reactProperties.getProperty('FRESCO_VERSION')}",
"com.facebook.fresco:fresco:${reactProperties.getProperty('FRESCO_VERSION')}",
"com.facebook.fresco:imagepipeline-okhttp3:${reactProperties.getProperty('FRESCO_VERSION')}",
"com.facebook.fresco:ui-common:${reactProperties.getProperty('FRESCO_VERSION')}",
)
}
}
// to prevent duplicated lib error, pick first of libc++_shared.so and libfbjni.so for instrumented tests
allprojects { subProject ->
subProject.afterEvaluate {
def androidComponents = subProject.extensions.findByType(AndroidComponentsExtension.class)
androidComponents?.with {
onVariants(selector().all()) {
getAndroidTest()?.packaging?.jniLibs?.pickFirsts?.addAll([
"**/libc++_shared.so",
"**/libfbjni.so",
])
}
}
}
}
// 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