Loading android/arch.go +11 −4 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ func newArch(name, multilib string) ArchType { return archType } // ArchTypeList returns the a slice copy of the 4 supported ArchTypes for arm, // ArchTypeList returns a slice copy of the 4 supported ArchTypes for arm, // arm64, x86 and x86_64. func ArchTypeList() []ArchType { return append([]ArchType(nil), archTypeList...) Loading Loading @@ -408,7 +408,7 @@ func bp2buildArchPathDepsMutator(ctx BottomUpMutatorContext) { // addPathDepsForProps does not descend into sub structs, so we need to descend into the // arch-specific properties ourselves properties := []interface{}{} var properties []interface{} for _, archProperties := range m.archProperties { for _, archProps := range archProperties { archPropValues := reflect.ValueOf(archProps).Elem() Loading Loading @@ -995,8 +995,11 @@ func initArchModule(m Module) { // Store the original list of top level property structs base.generalProperties = m.GetProperties() if len(base.archProperties) != 0 { panic(fmt.Errorf("module %s already has archProperties", m.Name())) } for _, properties := range base.generalProperties { getStructType := func(properties interface{}) reflect.Type { propertiesValue := reflect.ValueOf(properties) t := propertiesValue.Type() if propertiesValue.Kind() != reflect.Ptr { Loading @@ -1006,10 +1009,14 @@ func initArchModule(m Module) { propertiesValue = propertiesValue.Elem() if propertiesValue.Kind() != reflect.Struct { panic(fmt.Errorf("properties must be a pointer to a struct, got %T", panic(fmt.Errorf("properties must be a pointer to a struct, got a pointer to %T", propertiesValue.Interface())) } return t } for _, properties := range base.generalProperties { t := getStructType(properties) // Get or create the arch-specific property struct types for this property struct type. archPropTypes := archPropTypeMap.Once(NewCustomOnceKey(t), func() interface{} { return createArchPropTypeDesc(t) Loading android/defaults.go +0 −1 Original line number Diff line number Diff line Loading @@ -212,7 +212,6 @@ func InitDefaultsModule(module DefaultsModule) { // The applicable licenses property for defaults is 'licenses'. setPrimaryLicensesProperty(module, "licenses", &commonProperties.Licenses) base.module = module } var _ Defaults = (*DefaultsModuleBase)(nil) Loading android/module.go +6 −6 Original line number Diff line number Diff line Loading @@ -2096,18 +2096,18 @@ func (e *earlyModuleContext) GlobFiles(globPattern string, excludes []string) Pa return GlobFiles(e, globPattern, excludes) } func (b *earlyModuleContext) IsSymlink(path Path) bool { fileInfo, err := b.config.fs.Lstat(path.String()) func (e *earlyModuleContext) IsSymlink(path Path) bool { fileInfo, err := e.config.fs.Lstat(path.String()) if err != nil { b.ModuleErrorf("os.Lstat(%q) failed: %s", path.String(), err) e.ModuleErrorf("os.Lstat(%q) failed: %s", path.String(), err) } return fileInfo.Mode()&os.ModeSymlink == os.ModeSymlink } func (b *earlyModuleContext) Readlink(path Path) string { dest, err := b.config.fs.Readlink(path.String()) func (e *earlyModuleContext) Readlink(path Path) string { dest, err := e.config.fs.Readlink(path.String()) if err != nil { b.ModuleErrorf("os.Readlink(%q) failed: %s", path.String(), err) e.ModuleErrorf("os.Readlink(%q) failed: %s", path.String(), err) } return dest } Loading android/package_test.go +2 −3 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ var packageTests = []struct { }{ // Package default_visibility handling is tested in visibility_test.go { name: "package must not accept visibility and name properties", name: "package must not accept visibility, name or licenses properties", fs: map[string][]byte{ "top/Android.bp": []byte(` package { Loading Loading @@ -48,7 +48,6 @@ var packageTests = []struct { default_visibility: ["//visibility:private"], default_applicable_licenses: ["license"], } package { }`), }, Loading Loading
android/arch.go +11 −4 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ func newArch(name, multilib string) ArchType { return archType } // ArchTypeList returns the a slice copy of the 4 supported ArchTypes for arm, // ArchTypeList returns a slice copy of the 4 supported ArchTypes for arm, // arm64, x86 and x86_64. func ArchTypeList() []ArchType { return append([]ArchType(nil), archTypeList...) Loading Loading @@ -408,7 +408,7 @@ func bp2buildArchPathDepsMutator(ctx BottomUpMutatorContext) { // addPathDepsForProps does not descend into sub structs, so we need to descend into the // arch-specific properties ourselves properties := []interface{}{} var properties []interface{} for _, archProperties := range m.archProperties { for _, archProps := range archProperties { archPropValues := reflect.ValueOf(archProps).Elem() Loading Loading @@ -995,8 +995,11 @@ func initArchModule(m Module) { // Store the original list of top level property structs base.generalProperties = m.GetProperties() if len(base.archProperties) != 0 { panic(fmt.Errorf("module %s already has archProperties", m.Name())) } for _, properties := range base.generalProperties { getStructType := func(properties interface{}) reflect.Type { propertiesValue := reflect.ValueOf(properties) t := propertiesValue.Type() if propertiesValue.Kind() != reflect.Ptr { Loading @@ -1006,10 +1009,14 @@ func initArchModule(m Module) { propertiesValue = propertiesValue.Elem() if propertiesValue.Kind() != reflect.Struct { panic(fmt.Errorf("properties must be a pointer to a struct, got %T", panic(fmt.Errorf("properties must be a pointer to a struct, got a pointer to %T", propertiesValue.Interface())) } return t } for _, properties := range base.generalProperties { t := getStructType(properties) // Get or create the arch-specific property struct types for this property struct type. archPropTypes := archPropTypeMap.Once(NewCustomOnceKey(t), func() interface{} { return createArchPropTypeDesc(t) Loading
android/defaults.go +0 −1 Original line number Diff line number Diff line Loading @@ -212,7 +212,6 @@ func InitDefaultsModule(module DefaultsModule) { // The applicable licenses property for defaults is 'licenses'. setPrimaryLicensesProperty(module, "licenses", &commonProperties.Licenses) base.module = module } var _ Defaults = (*DefaultsModuleBase)(nil) Loading
android/module.go +6 −6 Original line number Diff line number Diff line Loading @@ -2096,18 +2096,18 @@ func (e *earlyModuleContext) GlobFiles(globPattern string, excludes []string) Pa return GlobFiles(e, globPattern, excludes) } func (b *earlyModuleContext) IsSymlink(path Path) bool { fileInfo, err := b.config.fs.Lstat(path.String()) func (e *earlyModuleContext) IsSymlink(path Path) bool { fileInfo, err := e.config.fs.Lstat(path.String()) if err != nil { b.ModuleErrorf("os.Lstat(%q) failed: %s", path.String(), err) e.ModuleErrorf("os.Lstat(%q) failed: %s", path.String(), err) } return fileInfo.Mode()&os.ModeSymlink == os.ModeSymlink } func (b *earlyModuleContext) Readlink(path Path) string { dest, err := b.config.fs.Readlink(path.String()) func (e *earlyModuleContext) Readlink(path Path) string { dest, err := e.config.fs.Readlink(path.String()) if err != nil { b.ModuleErrorf("os.Readlink(%q) failed: %s", path.String(), err) e.ModuleErrorf("os.Readlink(%q) failed: %s", path.String(), err) } return dest } Loading
android/package_test.go +2 −3 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ var packageTests = []struct { }{ // Package default_visibility handling is tested in visibility_test.go { name: "package must not accept visibility and name properties", name: "package must not accept visibility, name or licenses properties", fs: map[string][]byte{ "top/Android.bp": []byte(` package { Loading Loading @@ -48,7 +48,6 @@ var packageTests = []struct { default_visibility: ["//visibility:private"], default_applicable_licenses: ["license"], } package { }`), }, Loading