Justin Yun | 8effde4 | 2017-06-23 19:24:43 +0900 | [diff] [blame] | 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 | |
| 15 | package cc |
| 16 | |
| 17 | import ( |
Jiyong Park | d5b18a5 | 2017-08-03 21:22:50 +0900 | [diff] [blame] | 18 | "strings" |
Jiyong Park | d5b18a5 | 2017-08-03 21:22:50 +0900 | [diff] [blame] | 19 | |
Justin Yun | 8effde4 | 2017-06-23 19:24:43 +0900 | [diff] [blame] | 20 | "android/soong/android" |
| 21 | ) |
| 22 | |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 23 | const ( |
Kiyoung Kim | 9f26fcf | 2024-05-27 17:25:52 +0900 | [diff] [blame] | 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" |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 29 | ) |
| 30 | |
Kiyoung Kim | a2d6dee | 2023-08-11 10:14:43 +0900 | [diff] [blame] | 31 | func VndkLibrariesTxtModules(vndkVersion string, ctx android.BaseModuleContext) []string { |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 32 | // Snapshot vndks have their own *.libraries.VER.txt files. |
| 33 | // Note that snapshots don't have "vndkcorevariant.libraries.VER.txt" |
Kiyoung Kim | a2d6dee | 2023-08-11 10:14:43 +0900 | [diff] [blame] | 34 | result := []string{ |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 35 | insertVndkVersion(vndkCoreLibrariesTxt, vndkVersion), |
| 36 | insertVndkVersion(vndkSpLibrariesTxt, vndkVersion), |
| 37 | insertVndkVersion(vndkPrivateLibrariesTxt, vndkVersion), |
Justin Yun | 8a2600c | 2020-12-07 12:44:03 +0900 | [diff] [blame] | 38 | insertVndkVersion(vndkProductLibrariesTxt, vndkVersion), |
Kiyoung Kim | a2d6dee | 2023-08-11 10:14:43 +0900 | [diff] [blame] | 39 | insertVndkVersion(llndkLibrariesTxt, vndkVersion), |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 40 | } |
Kiyoung Kim | a2d6dee | 2023-08-11 10:14:43 +0900 | [diff] [blame] | 41 | |
| 42 | return result |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 43 | } |
| 44 | |
Justin Yun | 8effde4 | 2017-06-23 19:24:43 +0900 | [diff] [blame] | 45 | type 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 | // |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 50 | // `vendor_available` and `product_available` must be explicitly |
| 51 | // set to either true or false together with `vndk: {enabled: true}`. |
Justin Yun | 8effde4 | 2017-06-23 19:24:43 +0900 | [diff] [blame] | 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 |
Logan Chien | f351174 | 2017-10-31 18:04:35 +0800 | [diff] [blame] | 65 | |
Justin Yun | fd9e804 | 2020-12-23 18:23:14 +0900 | [diff] [blame] | 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 | |
Logan Chien | f351174 | 2017-10-31 18:04:35 +0800 | [diff] [blame] | 73 | // Extending another module |
| 74 | Extends *string |
Justin Yun | 8effde4 | 2017-06-23 19:24:43 +0900 | [diff] [blame] | 75 | } |
| 76 | } |
| 77 | |
Jooyung Han | 2216fb1 | 2019-11-06 16:46:15 +0900 | [diff] [blame] | 78 | func 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 | } |