forked from oblador/react-native-vector-icons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fonts.gradle
38 lines (32 loc) · 1.22 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
/**
* 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 generateAssetsTask = tasks.findByName("generate${targetName}Assets")
generateAssetsTask.dependsOn(fontCopyTask)
}
}