Fix checking of empty slice properties
Properties can be empty (not nil), and in that case some weird error
messages will happen to be emitted.
Bug: N/A
Test: try to build with api_pacakges: [] and srcs: []
Change-Id: I492077616e742072696265796520737465616b21
diff --git a/sysprop/sysprop_library.go b/sysprop/sysprop_library.go
index 6e8e306..48078d8 100644
--- a/sysprop/sysprop_library.go
+++ b/sysprop/sysprop_library.go
@@ -82,7 +82,11 @@
}
func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
- if m.syspropLibraryProperties.Api_packages == nil {
+ if len(m.commonProperties.Srcs) == 0 {
+ ctx.PropertyErrorf("srcs", "sysprop_library must specify srcs")
+ }
+
+ if len(m.syspropLibraryProperties.Api_packages) == 0 {
ctx.PropertyErrorf("api_packages", "sysprop_library must specify api_packages")
}