forked from expo/expo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
versioning_linking.gradle
34 lines (27 loc) · 1.16 KB
/
versioning_linking.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
import java.nio.file.Paths
def normalizeProjectName(String projectRoot) {
return projectRoot.replace('/', '_')
}
/**
* Link vendored modules into settings.gradle
*/
ext.useVendoredModulesForSettingsGradle = { String sdkVersion ->
def vendoredRoot = Paths.get(rootDir.toString(), 'vendored', sdkVersion).toString()
fileTree(dir: vendoredRoot, include: '**/build.gradle').each { gradleFile ->
def projectRoot = rootDir.toPath().relativize(gradleFile.toPath()).getParent().getParent().toString()
def projectName = normalizeProjectName(projectRoot)
include(":${projectName}")
project(":${projectName}").projectDir = gradleFile.getParentFile()
}
}
/**
* Link vendored modules into settings.gradle
*/
ext.useVendoredModulesForExpoView = { String sdkVersion ->
def vendoredRoot = Paths.get(rootDir.toString(), 'vendored', sdkVersion).toString()
fileTree(dir: vendoredRoot, include: '**/build.gradle').each { gradleFile ->
def projectRoot = rootDir.toPath().relativize(gradleFile.toPath()).getParent().getParent().toString()
def projectName = normalizeProjectName(projectRoot)
dependencies.add('implementation', project(":${projectName}"))
}
}