1// Copyright 2017 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 cc 16 17import ( 18 "strings" 19 20 "android/soong/android" 21) 22 23const ( 24 llndkLibrariesTxt = "llndk.libraries.txt" 25 vndkCoreLibrariesTxt = "vndkcore.libraries.txt" 26 vndkSpLibrariesTxt = "vndksp.libraries.txt" 27 vndkPrivateLibrariesTxt = "vndkprivate.libraries.txt" 28 vndkProductLibrariesTxt = "vndkproduct.libraries.txt" 29) 30 31func VndkLibrariesTxtModules(vndkVersion string, ctx android.BaseModuleContext) []string { 32 // Snapshot vndks have their own *.libraries.VER.txt files. 33 // Note that snapshots don't have "vndkcorevariant.libraries.VER.txt" 34 result := []string{ 35 insertVndkVersion(vndkCoreLibrariesTxt, vndkVersion), 36 insertVndkVersion(vndkSpLibrariesTxt, vndkVersion), 37 insertVndkVersion(vndkPrivateLibrariesTxt, vndkVersion), 38 insertVndkVersion(vndkProductLibrariesTxt, vndkVersion), 39 insertVndkVersion(llndkLibrariesTxt, vndkVersion), 40 } 41 42 return result 43} 44 45type VndkProperties struct { 46 Vndk struct { 47 // declared as a VNDK or VNDK-SP module. The vendor variant 48 // will be installed in /system instead of /vendor partition. 49 // 50 // `vendor_available` and `product_available` must be explicitly 51 // set to either true or false together with `vndk: {enabled: true}`. 52 Enabled *bool 53 54 // declared as a VNDK-SP module, which is a subset of VNDK. 55 // 56 // `vndk: { enabled: true }` must set together. 57 // 58 // All these modules are allowed to link to VNDK-SP or LL-NDK 59 // modules only. Other dependency will cause link-type errors. 60 // 61 // If `support_system_process` is not set or set to false, 62 // the module is VNDK-core and can link to other VNDK-core, 63 // VNDK-SP or LL-NDK modules only. 64 Support_system_process *bool 65 66 // declared as a VNDK-private module. 67 // This module still creates the vendor and product variants refering 68 // to the `vendor_available: true` and `product_available: true` 69 // properties. However, it is only available to the other VNDK modules 70 // but not to the non-VNDK vendor or product modules. 71 Private *bool 72 73 // Extending another module 74 Extends *string 75 } 76} 77 78func insertVndkVersion(filename string, vndkVersion string) string { 79 if index := strings.LastIndex(filename, "."); index != -1 { 80 return filename[:index] + "." + vndkVersion + filename[index:] 81 } 82 return filename 83} 84