| Bob Badour | 37af046 | 2021-01-07 03:34:31 +0000 | [diff] [blame] | 1 | // Copyright 2020 Google Inc. All rights reserved. | 
 | 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 android | 
 | 16 |  | 
 | 17 | func init() { | 
 | 18 | 	RegisterLicenseKindBuildComponents(InitRegistrationContext) | 
 | 19 | } | 
 | 20 |  | 
 | 21 | // Register the license_kind module type. | 
 | 22 | func RegisterLicenseKindBuildComponents(ctx RegistrationContext) { | 
 | 23 | 	ctx.RegisterModuleType("license_kind", LicenseKindFactory) | 
 | 24 | } | 
 | 25 |  | 
 | 26 | type licenseKindProperties struct { | 
 | 27 | 	// Specifies the conditions for all licenses of the kind. | 
 | 28 | 	Conditions []string | 
 | 29 | 	// Specifies the url to the canonical license definition. | 
 | 30 | 	Url string | 
 | 31 | 	// Specifies where this license can be used | 
 | 32 | 	Visibility []string | 
 | 33 | } | 
 | 34 |  | 
 | 35 | type licenseKindModule struct { | 
 | 36 | 	ModuleBase | 
 | 37 | 	DefaultableModuleBase | 
 | 38 |  | 
 | 39 | 	properties licenseKindProperties | 
 | 40 | } | 
 | 41 |  | 
 | 42 | func (m *licenseKindModule) DepsMutator(ctx BottomUpMutatorContext) { | 
 | 43 | 	// Nothing to do. | 
 | 44 | } | 
 | 45 |  | 
 | 46 | func (m *licenseKindModule) GenerateAndroidBuildActions(ModuleContext) { | 
 | 47 | 	// Nothing to do. | 
 | 48 | } | 
 | 49 |  | 
 | 50 | func LicenseKindFactory() Module { | 
 | 51 | 	module := &licenseKindModule{} | 
 | 52 |  | 
 | 53 | 	base := module.base() | 
 | 54 | 	module.AddProperties(&base.nameProperties, &module.properties) | 
 | 55 |  | 
| Bob Badour | 37af046 | 2021-01-07 03:34:31 +0000 | [diff] [blame] | 56 | 	// The visibility property needs to be checked and parsed by the visibility module. | 
 | 57 | 	setPrimaryVisibilityProperty(module, "visibility", &module.properties.Visibility) | 
 | 58 |  | 
 | 59 | 	initAndroidModuleBase(module) | 
 | 60 | 	InitDefaultableModule(module) | 
 | 61 |  | 
 | 62 | 	return module | 
 | 63 | } |