-
Notifications
You must be signed in to change notification settings - Fork 14
/
pack.gradle
33 lines (25 loc) · 994 Bytes
/
pack.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
/* Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
*
* This source code is licensed under the Apache 2.0 license found in
* the LICENSE file in the root directory of this source tree.
*/
import groovy.json.JsonSlurper
// Register task to generate string pack files.
if (hasProperty('stringPacksConfigFile')) {
def configFile = file(property('stringPacksConfigFile'))
def spConfig = new JsonSlurper().parse(configFile)
def packScript = "$rootDir/${spConfig.pack_scripts_directory}/pack_strings.py"
def assetsDir = "$rootDir/${spConfig.assets_directory}"
tasks.register('generateStringPacks', Exec) {
workingDir "$rootDir"
commandLine 'python3', packScript, '--config', configFile.path
}
tasks.whenTaskAdded { task ->
if (task.name =~ /^generate.*Assets$/) {
task.dependsOn generateStringPacks
}
}
clean.doFirst {
delete fileTree(assetsDir).include("strings_*.pack")
}
}