blob: 9d196a0f83589221157ade9b2aab62553f4b0c9c [file] [log] [blame]
Justin Yun8effde42017-06-23 19:24:43 +09001// 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 (
Jiyong Parkd5b18a52017-08-03 21:22:50 +090018 "strings"
Jiyong Parkd5b18a52017-08-03 21:22:50 +090019
Justin Yun8effde42017-06-23 19:24:43 +090020 "android/soong/android"
21)
22
Jooyung Han39edb6c2019-11-06 16:53:07 +090023const (
Kiyoung Kim9f26fcf2024-05-27 17:25:52 +090024 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 Han39edb6c2019-11-06 16:53:07 +090029)
30
Kiyoung Kima2d6dee2023-08-11 10:14:43 +090031func VndkLibrariesTxtModules(vndkVersion string, ctx android.BaseModuleContext) []string {
Jooyung Han39edb6c2019-11-06 16:53:07 +090032 // Snapshot vndks have their own *.libraries.VER.txt files.
33 // Note that snapshots don't have "vndkcorevariant.libraries.VER.txt"
Kiyoung Kima2d6dee2023-08-11 10:14:43 +090034 result := []string{
Jooyung Han39edb6c2019-11-06 16:53:07 +090035 insertVndkVersion(vndkCoreLibrariesTxt, vndkVersion),
36 insertVndkVersion(vndkSpLibrariesTxt, vndkVersion),
37 insertVndkVersion(vndkPrivateLibrariesTxt, vndkVersion),
Justin Yun8a2600c2020-12-07 12:44:03 +090038 insertVndkVersion(vndkProductLibrariesTxt, vndkVersion),
Kiyoung Kima2d6dee2023-08-11 10:14:43 +090039 insertVndkVersion(llndkLibrariesTxt, vndkVersion),
Jooyung Han39edb6c2019-11-06 16:53:07 +090040 }
Kiyoung Kima2d6dee2023-08-11 10:14:43 +090041
42 return result
Jooyung Han39edb6c2019-11-06 16:53:07 +090043}
44
Justin Yun8effde42017-06-23 19:24:43 +090045type 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 Yun63e9ec72020-10-29 16:49:43 +090050 // `vendor_available` and `product_available` must be explicitly
51 // set to either true or false together with `vndk: {enabled: true}`.
Justin Yun8effde42017-06-23 19:24:43 +090052 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 Chienf3511742017-10-31 18:04:35 +080065
Justin Yunfd9e8042020-12-23 18:23:14 +090066 // 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 Chienf3511742017-10-31 18:04:35 +080073 // Extending another module
74 Extends *string
Justin Yun8effde42017-06-23 19:24:43 +090075 }
76}
77
Jooyung Han2216fb12019-11-06 16:46:15 +090078func 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}