Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 1 | // Copyright (C) 2019 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package sdk |
| 16 | |
| 17 | import ( |
| 18 | "fmt" |
Martin Stjernholm | 191c25f | 2020-09-10 00:40:37 +0100 | [diff] [blame^] | 19 | "reflect" |
| 20 | "strings" |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 21 | |
| 22 | "android/soong/android" |
| 23 | ) |
| 24 | |
| 25 | type bpPropertySet struct { |
| 26 | properties map[string]interface{} |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 27 | tags map[string]android.BpPropertyTag |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 28 | order []string |
| 29 | } |
| 30 | |
| 31 | var _ android.BpPropertySet = (*bpPropertySet)(nil) |
| 32 | |
| 33 | func (s *bpPropertySet) init() { |
| 34 | s.properties = make(map[string]interface{}) |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 35 | s.tags = make(map[string]android.BpPropertyTag) |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 36 | } |
| 37 | |
Martin Stjernholm | 191c25f | 2020-09-10 00:40:37 +0100 | [diff] [blame^] | 38 | // Converts the given value, which is assumed to be a struct, to a |
| 39 | // bpPropertySet. |
| 40 | func convertToPropertySet(value reflect.Value) *bpPropertySet { |
| 41 | res := newPropertySet() |
| 42 | structType := value.Type() |
| 43 | |
| 44 | for i := 0; i < structType.NumField(); i++ { |
| 45 | field := structType.Field(i) |
| 46 | fieldVal := value.Field(i) |
| 47 | |
| 48 | switch fieldVal.Type().Kind() { |
| 49 | case reflect.Ptr: |
| 50 | if fieldVal.IsNil() { |
| 51 | continue // nil pointer means the property isn't set. |
| 52 | } |
| 53 | fieldVal = fieldVal.Elem() |
| 54 | case reflect.Slice: |
| 55 | if fieldVal.IsNil() { |
| 56 | continue // Ignore a nil slice (but not one with length zero). |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | if fieldVal.Type().Kind() == reflect.Struct { |
| 61 | fieldVal = fieldVal.Addr() // Avoid struct copy below. |
| 62 | } |
| 63 | res.AddProperty(strings.ToLower(field.Name), fieldVal.Interface()) |
| 64 | } |
| 65 | |
| 66 | return res |
| 67 | } |
| 68 | |
| 69 | // Converts the given value to something that can be set in a property. |
| 70 | func coercePropertyValue(value interface{}) interface{} { |
| 71 | val := reflect.ValueOf(value) |
| 72 | switch val.Kind() { |
| 73 | case reflect.Struct: |
| 74 | // convertToPropertySet requires an addressable struct, and this is probably |
| 75 | // a mistake. |
| 76 | panic(fmt.Sprintf("Value is a struct, not a pointer to one: %v", value)) |
| 77 | case reflect.Ptr: |
| 78 | if _, ok := value.(*bpPropertySet); !ok { |
| 79 | derefValue := reflect.Indirect(val) |
| 80 | if derefValue.Kind() != reflect.Struct { |
| 81 | panic(fmt.Sprintf("A pointer must be to a struct, got: %v", value)) |
| 82 | } |
| 83 | return convertToPropertySet(derefValue) |
| 84 | } |
| 85 | } |
| 86 | return value |
| 87 | } |
| 88 | |
| 89 | // Merges the fields of the given property set into s. |
| 90 | func (s *bpPropertySet) mergePropertySet(propSet *bpPropertySet) { |
| 91 | for _, name := range propSet.order { |
| 92 | if tag, ok := propSet.tags[name]; ok { |
| 93 | s.AddPropertyWithTag(name, propSet.properties[name], tag) |
| 94 | } else { |
| 95 | s.AddProperty(name, propSet.properties[name]) |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 100 | func (s *bpPropertySet) AddProperty(name string, value interface{}) { |
Martin Stjernholm | 191c25f | 2020-09-10 00:40:37 +0100 | [diff] [blame^] | 101 | value = coercePropertyValue(value) |
| 102 | |
| 103 | if propSetValue, ok := value.(*bpPropertySet); ok { |
| 104 | if curValue, ok := s.properties[name]; ok { |
| 105 | if curSet, ok := curValue.(*bpPropertySet); ok { |
| 106 | curSet.mergePropertySet(propSetValue) |
| 107 | return |
| 108 | } |
| 109 | // If the current value isn't a property set we got conflicting types. |
| 110 | // Continue down to the check below to complain about it. |
| 111 | } |
| 112 | } |
| 113 | |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 114 | if s.properties[name] != nil { |
Paul Duffin | 109c2ad | 2020-03-02 16:29:11 +0000 | [diff] [blame] | 115 | panic(fmt.Sprintf("Property %q already exists in property set", name)) |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | s.properties[name] = value |
| 119 | s.order = append(s.order, name) |
| 120 | } |
| 121 | |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 122 | func (s *bpPropertySet) AddPropertyWithTag(name string, value interface{}, tag android.BpPropertyTag) { |
| 123 | s.AddProperty(name, value) |
| 124 | s.tags[name] = tag |
| 125 | } |
| 126 | |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 127 | func (s *bpPropertySet) AddPropertySet(name string) android.BpPropertySet { |
Martin Stjernholm | 191c25f | 2020-09-10 00:40:37 +0100 | [diff] [blame^] | 128 | s.AddProperty(name, newPropertySet()) |
| 129 | return s.properties[name].(android.BpPropertySet) |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 130 | } |
| 131 | |
| 132 | func (s *bpPropertySet) getValue(name string) interface{} { |
| 133 | return s.properties[name] |
| 134 | } |
| 135 | |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 136 | func (s *bpPropertySet) getTag(name string) interface{} { |
| 137 | return s.tags[name] |
| 138 | } |
| 139 | |
Paul Duffin | 047fdca | 2020-02-21 16:06:25 +0000 | [diff] [blame] | 140 | func (s *bpPropertySet) transformContents(transformer bpPropertyTransformer) { |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 141 | var newOrder []string |
| 142 | for _, name := range s.order { |
| 143 | value := s.properties[name] |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 144 | tag := s.tags[name] |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 145 | var newValue interface{} |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 146 | var newTag android.BpPropertyTag |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 147 | if propertySet, ok := value.(*bpPropertySet); ok { |
Paul Duffin | 047fdca | 2020-02-21 16:06:25 +0000 | [diff] [blame] | 148 | var newPropertySet *bpPropertySet |
| 149 | newPropertySet, newTag = transformPropertySet(transformer, name, propertySet, tag) |
| 150 | if newPropertySet == nil { |
| 151 | newValue = nil |
| 152 | } else { |
| 153 | newValue = newPropertySet |
| 154 | } |
Paul Duffin | cc72e98 | 2020-01-14 15:53:11 +0000 | [diff] [blame] | 155 | } else { |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 156 | newValue, newTag = transformer.transformProperty(name, value, tag) |
Paul Duffin | cc72e98 | 2020-01-14 15:53:11 +0000 | [diff] [blame] | 157 | } |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 158 | |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 159 | if newValue == nil { |
| 160 | // Delete the property from the map and exclude it from the new order. |
| 161 | delete(s.properties, name) |
| 162 | } else { |
| 163 | // Update the property in the map and add the name to the new order list. |
| 164 | s.properties[name] = newValue |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 165 | s.tags[name] = newTag |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 166 | newOrder = append(newOrder, name) |
| 167 | } |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 168 | } |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 169 | s.order = newOrder |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 170 | } |
| 171 | |
Paul Duffin | 047fdca | 2020-02-21 16:06:25 +0000 | [diff] [blame] | 172 | func transformPropertySet(transformer bpPropertyTransformer, name string, propertySet *bpPropertySet, tag android.BpPropertyTag) (*bpPropertySet, android.BpPropertyTag) { |
Paul Duffin | 180a006 | 2020-02-21 16:06:25 +0000 | [diff] [blame] | 173 | newPropertySet, newTag := transformer.transformPropertySetBeforeContents(name, propertySet, tag) |
Paul Duffin | 047fdca | 2020-02-21 16:06:25 +0000 | [diff] [blame] | 174 | if newPropertySet != nil { |
| 175 | newPropertySet.transformContents(transformer) |
Paul Duffin | 180a006 | 2020-02-21 16:06:25 +0000 | [diff] [blame] | 176 | |
| 177 | newPropertySet, newTag = transformer.transformPropertySetAfterContents(name, newPropertySet, newTag) |
Paul Duffin | 047fdca | 2020-02-21 16:06:25 +0000 | [diff] [blame] | 178 | } |
| 179 | return newPropertySet, newTag |
| 180 | } |
| 181 | |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 182 | func (s *bpPropertySet) setProperty(name string, value interface{}) { |
| 183 | if s.properties[name] == nil { |
| 184 | s.AddProperty(name, value) |
| 185 | } else { |
| 186 | s.properties[name] = value |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 187 | s.tags[name] = nil |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 188 | } |
| 189 | } |
| 190 | |
| 191 | func (s *bpPropertySet) insertAfter(position string, name string, value interface{}) { |
| 192 | if s.properties[name] != nil { |
| 193 | panic("Property %q already exists in property set") |
| 194 | } |
| 195 | |
| 196 | // Add the name to the end of the order, to ensure it has necessary capacity |
| 197 | // and to handle the case when the position does not exist. |
| 198 | s.order = append(s.order, name) |
| 199 | |
| 200 | // Search through the order for the item that matches supplied position. If |
| 201 | // found then insert the name of the new property after it. |
| 202 | for i, v := range s.order { |
| 203 | if v == position { |
| 204 | // Copy the items after the one where the new property should be inserted. |
| 205 | copy(s.order[i+2:], s.order[i+1:]) |
| 206 | // Insert the item in the list. |
| 207 | s.order[i+1] = name |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | s.properties[name] = value |
| 212 | } |
| 213 | |
| 214 | type bpModule struct { |
Paul Duffin | cc72e98 | 2020-01-14 15:53:11 +0000 | [diff] [blame] | 215 | *bpPropertySet |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 216 | moduleType string |
| 217 | } |
| 218 | |
| 219 | var _ android.BpModule = (*bpModule)(nil) |
| 220 | |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 221 | type bpPropertyTransformer interface { |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 222 | // Transform the property set, returning the new property set/tag to insert back into the |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 223 | // parent property set (or module if this is the top level property set). |
| 224 | // |
| 225 | // This will be called before transforming the properties in the supplied set. |
| 226 | // |
| 227 | // The name will be "" for the top level property set. |
| 228 | // |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 229 | // Returning (nil, ...) will cause the property set to be removed. |
Paul Duffin | 180a006 | 2020-02-21 16:06:25 +0000 | [diff] [blame] | 230 | transformPropertySetBeforeContents(name string, propertySet *bpPropertySet, tag android.BpPropertyTag) (*bpPropertySet, android.BpPropertyTag) |
| 231 | |
| 232 | // Transform the property set, returning the new property set/tag to insert back into the |
| 233 | // parent property set (or module if this is the top level property set). |
| 234 | // |
| 235 | // This will be called after transforming the properties in the supplied set. |
| 236 | // |
| 237 | // The name will be "" for the top level property set. |
| 238 | // |
| 239 | // Returning (nil, ...) will cause the property set to be removed. |
| 240 | transformPropertySetAfterContents(name string, propertySet *bpPropertySet, tag android.BpPropertyTag) (*bpPropertySet, android.BpPropertyTag) |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 241 | |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 242 | // Transform a property, return the new value/tag to insert back into the property set. |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 243 | // |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 244 | // Returning (nil, ...) will cause the property to be removed. |
| 245 | transformProperty(name string, value interface{}, tag android.BpPropertyTag) (interface{}, android.BpPropertyTag) |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | // Interface for transforming bpModule objects. |
| 249 | type bpTransformer interface { |
| 250 | // Transform the module, returning the result. |
| 251 | // |
| 252 | // The method can either create a new module and return that, or modify the supplied module |
| 253 | // in place and return that. |
| 254 | // |
| 255 | // After this returns the transformer is applied to the contents of the returned module. |
| 256 | transformModule(module *bpModule) *bpModule |
| 257 | |
| 258 | bpPropertyTransformer |
| 259 | } |
| 260 | |
| 261 | type identityTransformation struct{} |
| 262 | |
| 263 | var _ bpTransformer = (*identityTransformation)(nil) |
| 264 | |
| 265 | func (t identityTransformation) transformModule(module *bpModule) *bpModule { |
| 266 | return module |
| 267 | } |
| 268 | |
Paul Duffin | 180a006 | 2020-02-21 16:06:25 +0000 | [diff] [blame] | 269 | func (t identityTransformation) transformPropertySetBeforeContents(name string, propertySet *bpPropertySet, tag android.BpPropertyTag) (*bpPropertySet, android.BpPropertyTag) { |
| 270 | return propertySet, tag |
| 271 | } |
| 272 | |
| 273 | func (t identityTransformation) transformPropertySetAfterContents(name string, propertySet *bpPropertySet, tag android.BpPropertyTag) (*bpPropertySet, android.BpPropertyTag) { |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 274 | return propertySet, tag |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 275 | } |
| 276 | |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 277 | func (t identityTransformation) transformProperty(name string, value interface{}, tag android.BpPropertyTag) (interface{}, android.BpPropertyTag) { |
| 278 | return value, tag |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 279 | } |
| 280 | |
Paul Duffin | cc72e98 | 2020-01-14 15:53:11 +0000 | [diff] [blame] | 281 | func (m *bpModule) deepCopy() *bpModule { |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 282 | return m.transform(deepCopyTransformer) |
| 283 | } |
| 284 | |
| 285 | func (m *bpModule) transform(transformer bpTransformer) *bpModule { |
| 286 | transformedModule := transformer.transformModule(m) |
| 287 | // Copy the contents of the returned property set into the module and then transform that. |
Paul Duffin | 047fdca | 2020-02-21 16:06:25 +0000 | [diff] [blame] | 288 | transformedModule.bpPropertySet, _ = transformPropertySet(transformer, "", transformedModule.bpPropertySet, nil) |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 289 | return transformedModule |
| 290 | } |
| 291 | |
Paul Duffin | 180a006 | 2020-02-21 16:06:25 +0000 | [diff] [blame] | 292 | type deepCopyTransformation struct { |
| 293 | identityTransformation |
| 294 | } |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 295 | |
| 296 | func (t deepCopyTransformation) transformModule(module *bpModule) *bpModule { |
| 297 | // Take a shallow copy of the module. Any mutable property values will be copied by the |
| 298 | // transformer. |
| 299 | moduleCopy := *module |
| 300 | return &moduleCopy |
| 301 | } |
| 302 | |
Paul Duffin | 180a006 | 2020-02-21 16:06:25 +0000 | [diff] [blame] | 303 | func (t deepCopyTransformation) transformPropertySetBeforeContents(name string, propertySet *bpPropertySet, tag android.BpPropertyTag) (*bpPropertySet, android.BpPropertyTag) { |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 304 | // Create a shallow copy of the properties map. Any mutable property values will be copied by the |
| 305 | // transformer. |
| 306 | propertiesCopy := make(map[string]interface{}) |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 307 | for propertyName, value := range propertySet.properties { |
| 308 | propertiesCopy[propertyName] = value |
| 309 | } |
| 310 | |
| 311 | // Ditto for tags map. |
| 312 | tagsCopy := make(map[string]android.BpPropertyTag) |
| 313 | for propertyName, propertyTag := range propertySet.tags { |
| 314 | tagsCopy[propertyName] = propertyTag |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 315 | } |
| 316 | |
| 317 | // Create a new property set. |
| 318 | return &bpPropertySet{ |
| 319 | properties: propertiesCopy, |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 320 | tags: tagsCopy, |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 321 | order: append([]string(nil), propertySet.order...), |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 322 | }, tag |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 323 | } |
| 324 | |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 325 | func (t deepCopyTransformation) transformProperty(name string, value interface{}, tag android.BpPropertyTag) (interface{}, android.BpPropertyTag) { |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 326 | // Copy string slice, otherwise return value. |
| 327 | if values, ok := value.([]string); ok { |
| 328 | valuesCopy := make([]string, len(values)) |
| 329 | copy(valuesCopy, values) |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 330 | return valuesCopy, tag |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 331 | } |
Paul Duffin | 5b511a2 | 2020-01-15 14:23:52 +0000 | [diff] [blame] | 332 | return value, tag |
Paul Duffin | b4d9c1f | 2020-01-15 11:52:11 +0000 | [diff] [blame] | 333 | } |
| 334 | |
| 335 | var deepCopyTransformer bpTransformer = deepCopyTransformation{} |
| 336 | |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 337 | // A .bp file |
| 338 | type bpFile struct { |
| 339 | modules map[string]*bpModule |
| 340 | order []*bpModule |
| 341 | } |
| 342 | |
| 343 | // Add a module. |
| 344 | // |
| 345 | // The module must have had its "name" property set to a string value that |
| 346 | // is unique within this file. |
| 347 | func (f *bpFile) AddModule(module android.BpModule) { |
| 348 | m := module.(*bpModule) |
| 349 | if name, ok := m.getValue("name").(string); ok { |
| 350 | if f.modules[name] != nil { |
| 351 | panic(fmt.Sprintf("Module %q already exists in bp file", name)) |
| 352 | } |
| 353 | |
| 354 | f.modules[name] = m |
| 355 | f.order = append(f.order, m) |
| 356 | } else { |
| 357 | panic("Module does not have a name property, or it is not a string") |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | func (f *bpFile) newModule(moduleType string) *bpModule { |
Paul Duffin | 047fdca | 2020-02-21 16:06:25 +0000 | [diff] [blame] | 362 | return newModule(moduleType) |
| 363 | } |
| 364 | |
| 365 | func newModule(moduleType string) *bpModule { |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 366 | module := &bpModule{ |
Paul Duffin | cc72e98 | 2020-01-14 15:53:11 +0000 | [diff] [blame] | 367 | moduleType: moduleType, |
Paul Duffin | 047fdca | 2020-02-21 16:06:25 +0000 | [diff] [blame] | 368 | bpPropertySet: newPropertySet(), |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 369 | } |
Paul Duffin | b645ec8 | 2019-11-27 17:43:54 +0000 | [diff] [blame] | 370 | return module |
| 371 | } |
Paul Duffin | 047fdca | 2020-02-21 16:06:25 +0000 | [diff] [blame] | 372 | |
| 373 | func newPropertySet() *bpPropertySet { |
| 374 | set := &bpPropertySet{} |
| 375 | set.init() |
| 376 | return set |
| 377 | } |