-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
fonts.gradle
43 lines (36 loc) · 1.41 KB
/
fonts.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
/**
* Register font asset source folder
*/
android.sourceSets.main.assets.srcDirs += file("$buildDir/intermediates/ReactNativeVectorIcons")
/**
* Task to copy icon font files
*/
afterEvaluate {
def config = project.hasProperty("vectoricons") ? project.vectoricons : [];
def iconFontsDir = config.iconFontsDir ?: "../../node_modules/react-native-vector-icons/Fonts";
def iconFontNames = config.iconFontNames ?: [ "*.ttf" ];
def fontCopyTask = tasks.create(
name: "copyReactNativeVectorIconFonts",
type: Copy) {
description = "copy vector icon fonts."
into "$buildDir/intermediates/ReactNativeVectorIcons/fonts"
iconFontNames.each { fontName ->
from(iconFontsDir) {
include(fontName)
}
}
}
android.applicationVariants.all { def variant ->
def targetName = variant.name.capitalize()
def lintVitalAnalyzeTask = tasks.findByName("lintVitalAnalyze${targetName}")
if (lintVitalAnalyzeTask) {
lintVitalAnalyzeTask.dependsOn(fontCopyTask)
}
def generateReportTask = tasks.findByName("generate${targetName}LintVitalReportModel")
if (generateReportTask) {
generateReportTask.dependsOn(fontCopyTask)
}
def generateAssetsTask = tasks.findByName("generate${targetName}Assets")
generateAssetsTask.dependsOn(fontCopyTask)
}
}