forked from omnirom/android_bootable_recovery
-
Notifications
You must be signed in to change notification settings - Fork 415
/
libaosprecovery_defaults.go
56 lines (45 loc) · 1.06 KB
/
libaosprecovery_defaults.go
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
package twrp
import (
"android/soong/android"
"android/soong/cc"
)
func globalFlags(ctx android.BaseContext) []string {
var cflags []string
if getMakeVars(ctx, "AB_OTA_UPDATER") == "true" {
cflags = append(cflags, "-DAB_OTA_UPDATER=1")
}
return cflags
}
func globalSrcs(ctx android.BaseContext) []string {
var srcs []string
if getMakeVars(ctx, "TWRP_CUSTOM_KEYBOARD") != "" {
srcs = append(srcs, getMakeVars(ctx, "TWRP_CUSTOM_KEYBOARD"))
}
return srcs
}
func libAospRecoveryDefaults(ctx android.LoadHookContext) {
type props struct {
Target struct {
Android struct {
Cflags []string
Enabled *bool
}
}
Cflags []string
Srcs []string
Include_dirs []string
}
p := &props{}
p.Cflags = globalFlags(ctx)
s := globalSrcs(ctx)
p.Srcs = s
ctx.AppendProperties(p)
}
func init() {
android.RegisterModuleType("libaosprecovery_defaults", libAospRecoveryDefaultsFactory)
}
func libAospRecoveryDefaultsFactory() android.Module {
module := cc.DefaultsFactory()
android.AddLoadHook(module, libAospRecoveryDefaults)
return module
}