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 15package android 16 17func init() { 18 RegisterLicenseKindBuildComponents(InitRegistrationContext) 19} 20 21// Register the license_kind module type. 22func RegisterLicenseKindBuildComponents(ctx RegistrationContext) { 23 ctx.RegisterModuleType("license_kind", LicenseKindFactory) 24} 25 26type 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 35type licenseKindModule struct { 36 ModuleBase 37 DefaultableModuleBase 38 39 properties licenseKindProperties 40} 41 42func (m *licenseKindModule) DepsMutator(ctx BottomUpMutatorContext) { 43 // Nothing to do. 44} 45 46func (m *licenseKindModule) GenerateAndroidBuildActions(ModuleContext) { 47 // Nothing to do. 48} 49 50func LicenseKindFactory() Module { 51 module := &licenseKindModule{} 52 53 base := module.base() 54 module.AddProperties(&base.nameProperties, &module.properties) 55 56 base.generalProperties = module.GetProperties() 57 base.customizableProperties = module.GetProperties() 58 59 // The visibility property needs to be checked and parsed by the visibility module. 60 setPrimaryVisibilityProperty(module, "visibility", &module.properties.Visibility) 61 62 initAndroidModuleBase(module) 63 InitDefaultableModule(module) 64 65 return module 66} 67