platform_build_soong/android/license_kind.go
Usta dca0219965 Remove customizableProperties from android.ModuleBase
- customizableProperties was being used to access all properties,
i.e. basically `GetProperties()`

- generalProperties was a subset of properties,
i.e. `initArchModule()` would only add new arch-specific properties
to `customizableProperties` (and `archProperties`) but not `generalProperties`

This PR sets generalProperties to contain all properties,
which then makes customizableProperties redundant.
And in arch.go, any iteration is done via `archProperties` instead.

Bug: 206961391
Test: m nothing and diff the ninja files
Change-Id: Ieb72b31c0a447fcbf34c92a04f002d7b9d777a86
2022-01-04 13:33:51 -05:00

65 lines
1.8 KiB
Go

// Copyright 2020 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package android
func init() {
RegisterLicenseKindBuildComponents(InitRegistrationContext)
}
// Register the license_kind module type.
func RegisterLicenseKindBuildComponents(ctx RegistrationContext) {
ctx.RegisterModuleType("license_kind", LicenseKindFactory)
}
type licenseKindProperties struct {
// Specifies the conditions for all licenses of the kind.
Conditions []string
// Specifies the url to the canonical license definition.
Url string
// Specifies where this license can be used
Visibility []string
}
type licenseKindModule struct {
ModuleBase
DefaultableModuleBase
properties licenseKindProperties
}
func (m *licenseKindModule) DepsMutator(ctx BottomUpMutatorContext) {
// Nothing to do.
}
func (m *licenseKindModule) GenerateAndroidBuildActions(ModuleContext) {
// Nothing to do.
}
func LicenseKindFactory() Module {
module := &licenseKindModule{}
base := module.base()
module.AddProperties(&base.nameProperties, &module.properties)
base.generalProperties = module.GetProperties()
// The visibility property needs to be checked and parsed by the visibility module.
setPrimaryVisibilityProperty(module, "visibility", &module.properties.Visibility)
initAndroidModuleBase(module)
InitDefaultableModule(module)
return module
}