forked from linchCN/react-native-swisseph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassets.gradle
58 lines (47 loc) · 1.85 KB
/
assets.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
/**
* Task to copy assets
*/
def config = project.hasProperty("extassets") ? project.extassets : [];
def extAssetsDir = config.extAssetsDir ?: "../../node_modules/react-native-swisseph/assets";
def assetsNames = config.assetsNames ?: [ "*.se1" ];
gradle.projectsEvaluated {
android.applicationVariants.all { def variant ->
def targetName = variant.name.capitalize()
def targetPath = variant.dirName
// Create task for copying fonts
def currentFontTask = tasks.create(
name: "copy${targetName}Asset",
type: Copy) {
into("${buildDir}/intermediates")
iconFontNames.each { fileName ->
from(extAssetsDir) {
include(fileName)
into("assets/${targetPath}/swisseph/")
}
// Workaround for Android Gradle Plugin 3.2+ new asset directory
from(extAssetsDir) {
include(fileName)
into("merged_assets/${variant.name}/merge${targetName}Assets/out/swisseph/")
}
// Workaround for Android Gradle Plugin 3.4+ new asset directory
from(extAssetsDir) {
include(fileName)
into("merged_assets/${variant.name}/out/swisseph/")
}
}
}
currentFontTask.dependsOn("merge${targetName}Resources")
currentFontTask.dependsOn("merge${targetName}Assets")
[
"processArmeabi-v7a${targetName}Resources",
"processX86${targetName}Resources",
"processUniversal${targetName}Resources",
"process${targetName}Resources"
].each { name ->
Task dependentTask = tasks.findByPath(name);
if (dependentTask != null) {
dependentTask.dependsOn(currentFontTask)
}
}
}
}