blob: dbe1f3b5b91d2eb6dcea70976dd34e3b18df8972 [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 (
Inseob Kimae553032019-05-14 18:52:49 +090018 "encoding/json"
Martin Stjernholm257eb0c2018-10-15 13:05:27 +010019 "errors"
Jooyung Han0302a842019-10-30 18:43:49 +090020 "fmt"
Inseob Kim1f086e22019-05-09 13:29:15 +090021 "path/filepath"
Inseob Kim242ef0c2019-10-22 20:15:20 +090022 "sort"
Jiyong Parkd5b18a52017-08-03 21:22:50 +090023 "strings"
24 "sync"
25
Justin Yun8effde42017-06-23 19:24:43 +090026 "android/soong/android"
Vic Yangefd249e2018-11-12 20:19:56 -080027 "android/soong/cc/config"
Justin Yun8effde42017-06-23 19:24:43 +090028)
29
Jooyung Han39edb6c2019-11-06 16:53:07 +090030const (
31 llndkLibrariesTxt = "llndk.libraries.txt"
32 vndkCoreLibrariesTxt = "vndkcore.libraries.txt"
33 vndkSpLibrariesTxt = "vndksp.libraries.txt"
34 vndkPrivateLibrariesTxt = "vndkprivate.libraries.txt"
35 vndkUsingCoreVariantLibrariesTxt = "vndkcorevariant.libraries.txt"
36)
37
38func VndkLibrariesTxtModules(vndkVersion string) []string {
39 if vndkVersion == "current" {
40 return []string{
41 llndkLibrariesTxt,
42 vndkCoreLibrariesTxt,
43 vndkSpLibrariesTxt,
44 vndkPrivateLibrariesTxt,
Jooyung Han39edb6c2019-11-06 16:53:07 +090045 }
46 }
47 // Snapshot vndks have their own *.libraries.VER.txt files.
48 // Note that snapshots don't have "vndkcorevariant.libraries.VER.txt"
49 return []string{
50 insertVndkVersion(llndkLibrariesTxt, vndkVersion),
51 insertVndkVersion(vndkCoreLibrariesTxt, vndkVersion),
52 insertVndkVersion(vndkSpLibrariesTxt, vndkVersion),
53 insertVndkVersion(vndkPrivateLibrariesTxt, vndkVersion),
54 }
55}
56
Justin Yun8effde42017-06-23 19:24:43 +090057type VndkProperties struct {
58 Vndk struct {
59 // declared as a VNDK or VNDK-SP module. The vendor variant
60 // will be installed in /system instead of /vendor partition.
61 //
Roland Levillaindfe75b32019-07-23 16:53:32 +010062 // `vendor_available` must be explicitly set to either true or
Jiyong Park82e2bf32017-08-16 14:05:54 +090063 // false together with `vndk: {enabled: true}`.
Justin Yun8effde42017-06-23 19:24:43 +090064 Enabled *bool
65
66 // declared as a VNDK-SP module, which is a subset of VNDK.
67 //
68 // `vndk: { enabled: true }` must set together.
69 //
70 // All these modules are allowed to link to VNDK-SP or LL-NDK
71 // modules only. Other dependency will cause link-type errors.
72 //
73 // If `support_system_process` is not set or set to false,
74 // the module is VNDK-core and can link to other VNDK-core,
75 // VNDK-SP or LL-NDK modules only.
76 Support_system_process *bool
Logan Chienf3511742017-10-31 18:04:35 +080077
78 // Extending another module
79 Extends *string
Justin Yun8effde42017-06-23 19:24:43 +090080 }
81}
82
83type vndkdep struct {
84 Properties VndkProperties
85}
86
87func (vndk *vndkdep) props() []interface{} {
88 return []interface{}{&vndk.Properties}
89}
90
91func (vndk *vndkdep) begin(ctx BaseModuleContext) {}
92
93func (vndk *vndkdep) deps(ctx BaseModuleContext, deps Deps) Deps {
94 return deps
95}
96
97func (vndk *vndkdep) isVndk() bool {
98 return Bool(vndk.Properties.Vndk.Enabled)
99}
100
101func (vndk *vndkdep) isVndkSp() bool {
102 return Bool(vndk.Properties.Vndk.Support_system_process)
103}
104
Logan Chienf3511742017-10-31 18:04:35 +0800105func (vndk *vndkdep) isVndkExt() bool {
106 return vndk.Properties.Vndk.Extends != nil
107}
108
109func (vndk *vndkdep) getVndkExtendsModuleName() string {
110 return String(vndk.Properties.Vndk.Extends)
111}
112
Justin Yun8effde42017-06-23 19:24:43 +0900113func (vndk *vndkdep) typeName() string {
114 if !vndk.isVndk() {
115 return "native:vendor"
116 }
Logan Chienf3511742017-10-31 18:04:35 +0800117 if !vndk.isVndkExt() {
118 if !vndk.isVndkSp() {
119 return "native:vendor:vndk"
120 }
121 return "native:vendor:vndksp"
Justin Yun8effde42017-06-23 19:24:43 +0900122 }
Logan Chienf3511742017-10-31 18:04:35 +0800123 if !vndk.isVndkSp() {
124 return "native:vendor:vndkext"
125 }
126 return "native:vendor:vndkspext"
Justin Yun8effde42017-06-23 19:24:43 +0900127}
128
Ivan Lozano183a3212019-10-18 14:18:45 -0700129func (vndk *vndkdep) vndkCheckLinkType(ctx android.ModuleContext, to *Module, tag DependencyTag) {
Justin Yun8effde42017-06-23 19:24:43 +0900130 if to.linker == nil {
131 return
132 }
Jiyong Park82e2bf32017-08-16 14:05:54 +0900133 if !vndk.isVndk() {
Justin Yun5f7f7e82019-11-18 19:52:14 +0900134 // Non-VNDK modules (those installed to /vendor, /product, or /system/product) can't depend
135 // on modules marked with vendor_available: false.
Jiyong Park82e2bf32017-08-16 14:05:54 +0900136 violation := false
Nan Zhang0007d812017-11-07 10:57:05 -0800137 if lib, ok := to.linker.(*llndkStubDecorator); ok && !Bool(lib.Properties.Vendor_available) {
Jiyong Park82e2bf32017-08-16 14:05:54 +0900138 violation = true
139 } else {
140 if _, ok := to.linker.(libraryInterface); ok && to.VendorProperties.Vendor_available != nil && !Bool(to.VendorProperties.Vendor_available) {
141 // Vendor_available == nil && !Bool(Vendor_available) should be okay since
Justin Yun5f7f7e82019-11-18 19:52:14 +0900142 // it means a vendor-only, or product-only library which is a valid dependency
143 // for non-VNDK modules.
Jiyong Park82e2bf32017-08-16 14:05:54 +0900144 violation = true
145 }
146 }
147 if violation {
148 ctx.ModuleErrorf("Vendor module that is not VNDK should not link to %q which is marked as `vendor_available: false`", to.Name())
149 }
150 }
Justin Yun8effde42017-06-23 19:24:43 +0900151 if lib, ok := to.linker.(*libraryDecorator); !ok || !lib.shared() {
152 // Check only shared libraries.
153 // Other (static and LL-NDK) libraries are allowed to link.
154 return
155 }
Ivan Lozano52767be2019-10-18 14:49:46 -0700156 if !to.UseVndk() {
Justin Yun8effde42017-06-23 19:24:43 +0900157 ctx.ModuleErrorf("(%s) should not link to %q which is not a vendor-available library",
158 vndk.typeName(), to.Name())
159 return
160 }
Logan Chienf3511742017-10-31 18:04:35 +0800161 if tag == vndkExtDepTag {
162 // Ensure `extends: "name"` property refers a vndk module that has vendor_available
163 // and has identical vndk properties.
164 if to.vndkdep == nil || !to.vndkdep.isVndk() {
165 ctx.ModuleErrorf("`extends` refers a non-vndk module %q", to.Name())
166 return
167 }
168 if vndk.isVndkSp() != to.vndkdep.isVndkSp() {
169 ctx.ModuleErrorf(
170 "`extends` refers a module %q with mismatched support_system_process",
171 to.Name())
172 return
173 }
174 if !Bool(to.VendorProperties.Vendor_available) {
175 ctx.ModuleErrorf(
176 "`extends` refers module %q which does not have `vendor_available: true`",
177 to.Name())
178 return
179 }
180 }
Justin Yun8effde42017-06-23 19:24:43 +0900181 if to.vndkdep == nil {
182 return
183 }
Logan Chienf3511742017-10-31 18:04:35 +0800184
Logan Chiend3c59a22018-03-29 14:08:15 +0800185 // Check the dependencies of VNDK shared libraries.
Martin Stjernholm257eb0c2018-10-15 13:05:27 +0100186 if err := vndkIsVndkDepAllowed(vndk, to.vndkdep); err != nil {
187 ctx.ModuleErrorf("(%s) should not link to %q (%s): %v",
188 vndk.typeName(), to.Name(), to.vndkdep.typeName(), err)
Logan Chienf3511742017-10-31 18:04:35 +0800189 return
190 }
Logan Chiend3c59a22018-03-29 14:08:15 +0800191}
Logan Chienf3511742017-10-31 18:04:35 +0800192
Martin Stjernholm257eb0c2018-10-15 13:05:27 +0100193func vndkIsVndkDepAllowed(from *vndkdep, to *vndkdep) error {
Logan Chiend3c59a22018-03-29 14:08:15 +0800194 // Check the dependencies of VNDK, VNDK-Ext, VNDK-SP, VNDK-SP-Ext and vendor modules.
195 if from.isVndkExt() {
196 if from.isVndkSp() {
Martin Stjernholm257eb0c2018-10-15 13:05:27 +0100197 if to.isVndk() && !to.isVndkSp() {
198 return errors.New("VNDK-SP extensions must not depend on VNDK or VNDK extensions")
199 }
200 return nil
Logan Chiend3c59a22018-03-29 14:08:15 +0800201 }
202 // VNDK-Ext may depend on VNDK, VNDK-Ext, VNDK-SP, VNDK-SP-Ext, or vendor libs.
Martin Stjernholm257eb0c2018-10-15 13:05:27 +0100203 return nil
Justin Yun8effde42017-06-23 19:24:43 +0900204 }
Logan Chiend3c59a22018-03-29 14:08:15 +0800205 if from.isVndk() {
206 if to.isVndkExt() {
Martin Stjernholm257eb0c2018-10-15 13:05:27 +0100207 return errors.New("VNDK-core and VNDK-SP must not depend on VNDK extensions")
Logan Chiend3c59a22018-03-29 14:08:15 +0800208 }
209 if from.isVndkSp() {
Martin Stjernholm257eb0c2018-10-15 13:05:27 +0100210 if !to.isVndkSp() {
211 return errors.New("VNDK-SP must only depend on VNDK-SP")
212 }
213 return nil
Logan Chiend3c59a22018-03-29 14:08:15 +0800214 }
Martin Stjernholm257eb0c2018-10-15 13:05:27 +0100215 if !to.isVndk() {
216 return errors.New("VNDK-core must only depend on VNDK-core or VNDK-SP")
217 }
218 return nil
Logan Chiend3c59a22018-03-29 14:08:15 +0800219 }
220 // Vendor modules may depend on VNDK, VNDK-Ext, VNDK-SP, VNDK-SP-Ext, or vendor libs.
Martin Stjernholm257eb0c2018-10-15 13:05:27 +0100221 return nil
Justin Yun8effde42017-06-23 19:24:43 +0900222}
Jiyong Parkd5b18a52017-08-03 21:22:50 +0900223
224var (
Jooyung Hana463f722019-11-01 08:45:59 +0900225 vndkCoreLibrariesKey = android.NewOnceKey("vndkCoreLibrarires")
226 vndkSpLibrariesKey = android.NewOnceKey("vndkSpLibrarires")
227 llndkLibrariesKey = android.NewOnceKey("llndkLibrarires")
228 vndkPrivateLibrariesKey = android.NewOnceKey("vndkPrivateLibrarires")
Kiyoung Kime1aa8ea2019-12-30 11:12:55 +0900229 vndkUsingCoreVariantLibrariesKey = android.NewOnceKey("vndkUsingCoreVariantLibraries")
Jooyung Hana463f722019-11-01 08:45:59 +0900230 vndkMustUseVendorVariantListKey = android.NewOnceKey("vndkMustUseVendorVariantListKey")
231 vndkLibrariesLock sync.Mutex
Inseob Kimae553032019-05-14 18:52:49 +0900232)
Inseob Kim1f086e22019-05-09 13:29:15 +0900233
Jooyung Han0302a842019-10-30 18:43:49 +0900234func vndkCoreLibraries(config android.Config) map[string]string {
Inseob Kim9516ee92019-05-09 10:56:13 +0900235 return config.Once(vndkCoreLibrariesKey, func() interface{} {
Jooyung Han0302a842019-10-30 18:43:49 +0900236 return make(map[string]string)
237 }).(map[string]string)
Inseob Kim9516ee92019-05-09 10:56:13 +0900238}
239
Jooyung Han0302a842019-10-30 18:43:49 +0900240func vndkSpLibraries(config android.Config) map[string]string {
Inseob Kim9516ee92019-05-09 10:56:13 +0900241 return config.Once(vndkSpLibrariesKey, func() interface{} {
Jooyung Han0302a842019-10-30 18:43:49 +0900242 return make(map[string]string)
243 }).(map[string]string)
Inseob Kim9516ee92019-05-09 10:56:13 +0900244}
245
Jooyung Han0302a842019-10-30 18:43:49 +0900246func isLlndkLibrary(baseModuleName string, config android.Config) bool {
247 _, ok := llndkLibraries(config)[baseModuleName]
248 return ok
249}
250
251func llndkLibraries(config android.Config) map[string]string {
Inseob Kim9516ee92019-05-09 10:56:13 +0900252 return config.Once(llndkLibrariesKey, func() interface{} {
Jooyung Han0302a842019-10-30 18:43:49 +0900253 return make(map[string]string)
254 }).(map[string]string)
Inseob Kim9516ee92019-05-09 10:56:13 +0900255}
256
Jooyung Han0302a842019-10-30 18:43:49 +0900257func isVndkPrivateLibrary(baseModuleName string, config android.Config) bool {
258 _, ok := vndkPrivateLibraries(config)[baseModuleName]
259 return ok
260}
261
262func vndkPrivateLibraries(config android.Config) map[string]string {
Inseob Kim9516ee92019-05-09 10:56:13 +0900263 return config.Once(vndkPrivateLibrariesKey, func() interface{} {
Jooyung Han0302a842019-10-30 18:43:49 +0900264 return make(map[string]string)
265 }).(map[string]string)
Inseob Kim9516ee92019-05-09 10:56:13 +0900266}
267
Jooyung Han0302a842019-10-30 18:43:49 +0900268func vndkUsingCoreVariantLibraries(config android.Config) map[string]string {
Inseob Kim9516ee92019-05-09 10:56:13 +0900269 return config.Once(vndkUsingCoreVariantLibrariesKey, func() interface{} {
Jooyung Han0302a842019-10-30 18:43:49 +0900270 return make(map[string]string)
271 }).(map[string]string)
Inseob Kim9516ee92019-05-09 10:56:13 +0900272}
273
Jooyung Han097087b2019-10-22 19:32:18 +0900274func vndkMustUseVendorVariantList(cfg android.Config) []string {
275 return cfg.Once(vndkMustUseVendorVariantListKey, func() interface{} {
Jooyung Han097087b2019-10-22 19:32:18 +0900276 return config.VndkMustUseVendorVariantList
277 }).([]string)
278}
279
280// test may call this to override global configuration(config.VndkMustUseVendorVariantList)
281// when it is called, it must be before the first call to vndkMustUseVendorVariantList()
282func setVndkMustUseVendorVariantListForTest(config android.Config, mustUseVendorVariantList []string) {
Jooyung Hana463f722019-11-01 08:45:59 +0900283 config.Once(vndkMustUseVendorVariantListKey, func() interface{} {
Jooyung Han097087b2019-10-22 19:32:18 +0900284 return mustUseVendorVariantList
285 })
286}
287
Inseob Kim1f086e22019-05-09 13:29:15 +0900288func processLlndkLibrary(mctx android.BottomUpMutatorContext, m *Module) {
289 lib := m.linker.(*llndkStubDecorator)
Jooyung Han0302a842019-10-30 18:43:49 +0900290 name := m.BaseModuleName()
291 filename := m.BaseModuleName() + ".so"
Inseob Kim9516ee92019-05-09 10:56:13 +0900292
Inseob Kim1f086e22019-05-09 13:29:15 +0900293 vndkLibrariesLock.Lock()
294 defer vndkLibrariesLock.Unlock()
Inseob Kim9516ee92019-05-09 10:56:13 +0900295
Jooyung Han0302a842019-10-30 18:43:49 +0900296 llndkLibraries(mctx.Config())[name] = filename
Inseob Kim1f086e22019-05-09 13:29:15 +0900297 if !Bool(lib.Properties.Vendor_available) {
Jooyung Han0302a842019-10-30 18:43:49 +0900298 vndkPrivateLibraries(mctx.Config())[name] = filename
Jiyong Parkd5b18a52017-08-03 21:22:50 +0900299 }
Jooyung Han61b66e92020-03-21 14:21:46 +0000300 if mctx.OtherModuleExists(name) {
301 mctx.AddFarVariationDependencies(m.Target().Variations(), llndkImplDep, name)
302 }
Jiyong Parkd5b18a52017-08-03 21:22:50 +0900303}
Inseob Kim1f086e22019-05-09 13:29:15 +0900304
305func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) {
Jooyung Han0302a842019-10-30 18:43:49 +0900306 name := m.BaseModuleName()
307 filename, err := getVndkFileName(m)
308 if err != nil {
309 panic(err)
310 }
Inseob Kim1f086e22019-05-09 13:29:15 +0900311
Jiyong Parkea97f512020-03-31 15:31:17 +0900312 if m.HasStubsVariants() {
313 mctx.PropertyErrorf("vndk.enabled", "This library provides stubs. Shouldn't be VNDK. Consider making it as LLNDK")
314 }
315
Inseob Kim1f086e22019-05-09 13:29:15 +0900316 vndkLibrariesLock.Lock()
317 defer vndkLibrariesLock.Unlock()
318
Jooyung Han097087b2019-10-22 19:32:18 +0900319 if inList(name, vndkMustUseVendorVariantList(mctx.Config())) {
320 m.Properties.MustUseVendorVariant = true
321 }
Jooyung Han0302a842019-10-30 18:43:49 +0900322 if mctx.DeviceConfig().VndkUseCoreVariant() && !m.Properties.MustUseVendorVariant {
323 vndkUsingCoreVariantLibraries(mctx.Config())[name] = filename
Inseob Kim1f086e22019-05-09 13:29:15 +0900324 }
Jooyung Han0302a842019-10-30 18:43:49 +0900325
Inseob Kim1f086e22019-05-09 13:29:15 +0900326 if m.vndkdep.isVndkSp() {
Jooyung Han0302a842019-10-30 18:43:49 +0900327 vndkSpLibraries(mctx.Config())[name] = filename
Inseob Kim1f086e22019-05-09 13:29:15 +0900328 } else {
Jooyung Han0302a842019-10-30 18:43:49 +0900329 vndkCoreLibraries(mctx.Config())[name] = filename
Inseob Kim1f086e22019-05-09 13:29:15 +0900330 }
331 if !Bool(m.VendorProperties.Vendor_available) {
Jooyung Han0302a842019-10-30 18:43:49 +0900332 vndkPrivateLibraries(mctx.Config())[name] = filename
Inseob Kim1f086e22019-05-09 13:29:15 +0900333 }
334}
335
Jooyung Han31c470b2019-10-18 16:26:59 +0900336func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool {
337 if !m.Enabled() {
338 return false
339 }
340
Jooyung Han87a7f302019-10-29 05:18:21 +0900341 if !mctx.Device() {
342 return false
343 }
344
Jooyung Han31c470b2019-10-18 16:26:59 +0900345 if m.Target().NativeBridge == android.NativeBridgeEnabled {
346 return false
347 }
348
349 // prebuilt vndk modules should match with device
350 // TODO(b/142675459): Use enabled: to select target device in vndk_prebuilt_shared
351 // When b/142675459 is landed, remove following check
352 if p, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok && !p.matchesWithDevice(mctx.DeviceConfig()) {
353 return false
354 }
355
356 if lib, ok := m.linker.(libraryInterface); ok {
Jooyung Han73d20d02020-03-27 16:06:55 +0900357 // VNDK APEX for VNDK-Lite devices will have VNDK-SP libraries from core variants
358 if mctx.DeviceConfig().VndkVersion() == "" {
359 // b/73296261: filter out libz.so because it is considered as LLNDK for VNDK-lite devices
360 if mctx.ModuleName() == "libz" {
361 return false
362 }
363 return m.ImageVariation().Variation == android.CoreVariation && lib.shared() && m.isVndkSp()
364 }
365
Justin Yun5f7f7e82019-11-18 19:52:14 +0900366 useCoreVariant := m.VndkVersion() == mctx.DeviceConfig().PlatformVndkVersion() &&
Jooyung Han87a7f302019-10-29 05:18:21 +0900367 mctx.DeviceConfig().VndkUseCoreVariant() && !m.MustUseVendorVariant()
Jooyung Hana57af4a2020-01-23 05:36:59 +0000368 return lib.shared() && m.inVendor() && m.IsVndk() && !m.isVndkExt() && !useCoreVariant
Jooyung Han31c470b2019-10-18 16:26:59 +0900369 }
370 return false
371}
372
Inseob Kim1f086e22019-05-09 13:29:15 +0900373// gather list of vndk-core, vndk-sp, and ll-ndk libs
374func VndkMutator(mctx android.BottomUpMutatorContext) {
375 m, ok := mctx.Module().(*Module)
376 if !ok {
377 return
378 }
Inseob Kim1f086e22019-05-09 13:29:15 +0900379 if !m.Enabled() {
380 return
381 }
Justin Yun7390ea32019-09-08 11:34:06 +0900382 if m.Target().NativeBridge == android.NativeBridgeEnabled {
383 // Skip native_bridge modules
384 return
385 }
Inseob Kim1f086e22019-05-09 13:29:15 +0900386
387 if _, ok := m.linker.(*llndkStubDecorator); ok {
388 processLlndkLibrary(mctx, m)
389 return
390 }
391
392 lib, is_lib := m.linker.(*libraryDecorator)
393 prebuilt_lib, is_prebuilt_lib := m.linker.(*prebuiltLibraryLinker)
394
Inseob Kim64c43952019-08-26 16:52:35 +0900395 if (is_lib && lib.buildShared()) || (is_prebuilt_lib && prebuilt_lib.buildShared()) {
396 if m.vndkdep != nil && m.vndkdep.isVndk() && !m.vndkdep.isVndkExt() {
Inseob Kim1f086e22019-05-09 13:29:15 +0900397 processVndkLibrary(mctx, m)
398 return
399 }
400 }
401}
402
403func init() {
Jooyung Han39edb6c2019-11-06 16:53:07 +0900404 android.RegisterModuleType("vndk_libraries_txt", VndkLibrariesTxtFactory)
Inseob Kim1f086e22019-05-09 13:29:15 +0900405 android.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
Inseob Kim1f086e22019-05-09 13:29:15 +0900406}
407
Jooyung Han2216fb12019-11-06 16:46:15 +0900408type vndkLibrariesTxt struct {
409 android.ModuleBase
410 outputFile android.OutputPath
411}
412
Jooyung Han39edb6c2019-11-06 16:53:07 +0900413var _ android.PrebuiltEtcModule = &vndkLibrariesTxt{}
414var _ android.OutputFileProducer = &vndkLibrariesTxt{}
415
Jooyung Han2216fb12019-11-06 16:46:15 +0900416// vndk_libraries_txt is a special kind of module type in that it name is one of
417// - llndk.libraries.txt
418// - vndkcore.libraries.txt
419// - vndksp.libraries.txt
420// - vndkprivate.libraries.txt
421// - vndkcorevariant.libraries.txt
422// A module behaves like a prebuilt_etc but its content is generated by soong.
423// By being a soong module, these files can be referenced by other soong modules.
424// For example, apex_vndk can depend on these files as prebuilt.
Jooyung Han39edb6c2019-11-06 16:53:07 +0900425func VndkLibrariesTxtFactory() android.Module {
Jooyung Han2216fb12019-11-06 16:46:15 +0900426 m := &vndkLibrariesTxt{}
427 android.InitAndroidModule(m)
428 return m
429}
430
431func insertVndkVersion(filename string, vndkVersion string) string {
432 if index := strings.LastIndex(filename, "."); index != -1 {
433 return filename[:index] + "." + vndkVersion + filename[index:]
434 }
435 return filename
436}
437
438func (txt *vndkLibrariesTxt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
439 var list []string
440 switch txt.Name() {
Jooyung Han39edb6c2019-11-06 16:53:07 +0900441 case llndkLibrariesTxt:
Jooyung Han2216fb12019-11-06 16:46:15 +0900442 for _, filename := range android.SortedStringMapValues(llndkLibraries(ctx.Config())) {
443 if strings.HasPrefix(filename, "libclang_rt.hwasan-") {
444 continue
445 }
446 list = append(list, filename)
447 }
Jooyung Han39edb6c2019-11-06 16:53:07 +0900448 case vndkCoreLibrariesTxt:
Jooyung Han2216fb12019-11-06 16:46:15 +0900449 list = android.SortedStringMapValues(vndkCoreLibraries(ctx.Config()))
Jooyung Han39edb6c2019-11-06 16:53:07 +0900450 case vndkSpLibrariesTxt:
Jooyung Han2216fb12019-11-06 16:46:15 +0900451 list = android.SortedStringMapValues(vndkSpLibraries(ctx.Config()))
Jooyung Han39edb6c2019-11-06 16:53:07 +0900452 case vndkPrivateLibrariesTxt:
Jooyung Han2216fb12019-11-06 16:46:15 +0900453 list = android.SortedStringMapValues(vndkPrivateLibraries(ctx.Config()))
Jooyung Han39edb6c2019-11-06 16:53:07 +0900454 case vndkUsingCoreVariantLibrariesTxt:
Jooyung Han2216fb12019-11-06 16:46:15 +0900455 list = android.SortedStringMapValues(vndkUsingCoreVariantLibraries(ctx.Config()))
456 default:
457 ctx.ModuleErrorf("name(%s) is unknown.", txt.Name())
458 return
459 }
460
Kiyoung Kime1aa8ea2019-12-30 11:12:55 +0900461 var filename string
462 if txt.Name() != vndkUsingCoreVariantLibrariesTxt {
463 filename = insertVndkVersion(txt.Name(), ctx.DeviceConfig().PlatformVndkVersion())
464 } else {
465 filename = txt.Name()
466 }
467
Jooyung Han2216fb12019-11-06 16:46:15 +0900468 txt.outputFile = android.PathForModuleOut(ctx, filename).OutputPath
469 ctx.Build(pctx, android.BuildParams{
470 Rule: android.WriteFile,
471 Output: txt.outputFile,
472 Description: "Writing " + txt.outputFile.String(),
473 Args: map[string]string{
474 "content": strings.Join(list, "\\n"),
475 },
476 })
477
478 installPath := android.PathForModuleInstall(ctx, "etc")
479 ctx.InstallFile(installPath, filename, txt.outputFile)
480}
481
Jiyong Park0b0e1b92019-12-03 13:24:29 +0900482func (txt *vndkLibrariesTxt) AndroidMkEntries() []android.AndroidMkEntries {
483 return []android.AndroidMkEntries{android.AndroidMkEntries{
Jooyung Han2216fb12019-11-06 16:46:15 +0900484 Class: "ETC",
485 OutputFile: android.OptionalPathForPath(txt.outputFile),
486 ExtraEntries: []android.AndroidMkExtraEntriesFunc{
487 func(entries *android.AndroidMkEntries) {
488 entries.SetString("LOCAL_MODULE_STEM", txt.outputFile.Base())
489 },
490 },
Jiyong Park0b0e1b92019-12-03 13:24:29 +0900491 }}
Jooyung Han2216fb12019-11-06 16:46:15 +0900492}
493
Jooyung Han39edb6c2019-11-06 16:53:07 +0900494func (txt *vndkLibrariesTxt) OutputFile() android.OutputPath {
495 return txt.outputFile
496}
497
498func (txt *vndkLibrariesTxt) OutputFiles(tag string) (android.Paths, error) {
499 return android.Paths{txt.outputFile}, nil
500}
501
502func (txt *vndkLibrariesTxt) SubDir() string {
503 return ""
504}
505
Inseob Kim1f086e22019-05-09 13:29:15 +0900506func VndkSnapshotSingleton() android.Singleton {
507 return &vndkSnapshotSingleton{}
508}
509
Jooyung Han0302a842019-10-30 18:43:49 +0900510type vndkSnapshotSingleton struct {
Jooyung Han39edb6c2019-11-06 16:53:07 +0900511 vndkLibrariesFile android.OutputPath
512 vndkSnapshotZipFile android.OptionalPath
Jooyung Han0302a842019-10-30 18:43:49 +0900513}
Inseob Kim1f086e22019-05-09 13:29:15 +0900514
Inseob Kimeda2e9c2020-03-03 22:06:32 +0900515func isVndkSnapshotLibrary(config android.DeviceConfig, m *Module) (i snapshotLibraryInterface, vndkType string, isVndkSnapshotLib bool) {
516 if m.Target().NativeBridge == android.NativeBridgeEnabled {
517 return nil, "", false
518 }
519 if !m.inVendor() || !m.installable() || m.isSnapshotPrebuilt() {
520 return nil, "", false
521 }
522 l, ok := m.linker.(snapshotLibraryInterface)
523 if !ok || !l.shared() {
524 return nil, "", false
525 }
526 if m.VndkVersion() == config.PlatformVndkVersion() && m.IsVndk() && !m.isVndkExt() {
527 if m.isVndkSp() {
528 return l, "vndk-sp", true
529 } else {
530 return l, "vndk-core", true
531 }
532 }
533
534 return nil, "", false
535}
536
Inseob Kim1f086e22019-05-09 13:29:15 +0900537func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContext) {
Jooyung Han0302a842019-10-30 18:43:49 +0900538 // build these files even if PlatformVndkVersion or BoardVndkVersion is not set
539 c.buildVndkLibrariesTxtFiles(ctx)
540
Inseob Kim1f086e22019-05-09 13:29:15 +0900541 // BOARD_VNDK_VERSION must be set to 'current' in order to generate a VNDK snapshot.
542 if ctx.DeviceConfig().VndkVersion() != "current" {
543 return
544 }
545
546 if ctx.DeviceConfig().PlatformVndkVersion() == "" {
547 return
548 }
549
550 if ctx.DeviceConfig().BoardVndkRuntimeDisable() {
551 return
552 }
553
Inseob Kim242ef0c2019-10-22 20:15:20 +0900554 var snapshotOutputs android.Paths
555
556 /*
557 VNDK snapshot zipped artifacts directory structure:
558 {SNAPSHOT_ARCH}/
559 arch-{TARGET_ARCH}-{TARGET_ARCH_VARIANT}/
560 shared/
561 vndk-core/
562 (VNDK-core libraries, e.g. libbinder.so)
563 vndk-sp/
564 (VNDK-SP libraries, e.g. libc++.so)
565 arch-{TARGET_2ND_ARCH}-{TARGET_2ND_ARCH_VARIANT}/
566 shared/
567 vndk-core/
568 (VNDK-core libraries, e.g. libbinder.so)
569 vndk-sp/
570 (VNDK-SP libraries, e.g. libc++.so)
571 binder32/
572 (This directory is newly introduced in v28 (Android P) to hold
573 prebuilts built for 32-bit binder interface.)
574 arch-{TARGET_ARCH}-{TARGE_ARCH_VARIANT}/
575 ...
576 configs/
577 (various *.txt configuration files)
578 include/
579 (header files of same directory structure with source tree)
580 NOTICE_FILES/
581 (notice files of libraries, e.g. libcutils.so.txt)
582 */
Inseob Kim1f086e22019-05-09 13:29:15 +0900583
584 snapshotDir := "vndk-snapshot"
Inseob Kim242ef0c2019-10-22 20:15:20 +0900585 snapshotArchDir := filepath.Join(snapshotDir, ctx.DeviceConfig().DeviceArch())
Inseob Kim1f086e22019-05-09 13:29:15 +0900586
Inseob Kim242ef0c2019-10-22 20:15:20 +0900587 configsDir := filepath.Join(snapshotArchDir, "configs")
588 noticeDir := filepath.Join(snapshotArchDir, "NOTICE_FILES")
589 includeDir := filepath.Join(snapshotArchDir, "include")
590
Inseob Kim242ef0c2019-10-22 20:15:20 +0900591 // set of notice files copied.
Inseob Kim1f086e22019-05-09 13:29:15 +0900592 noticeBuilt := make(map[string]bool)
593
Inseob Kim242ef0c2019-10-22 20:15:20 +0900594 // paths of VNDK modules for GPL license checking
595 modulePaths := make(map[string]string)
596
597 // actual module names of .so files
598 // e.g. moduleNames["libprotobuf-cpp-full-3.9.1.so"] = "libprotobuf-cpp-full"
599 moduleNames := make(map[string]string)
600
Inseob Kim8471cda2019-11-15 09:59:12 +0900601 var headers android.Paths
Inseob Kim242ef0c2019-10-22 20:15:20 +0900602
Inseob Kim8471cda2019-11-15 09:59:12 +0900603 installVndkSnapshotLib := func(m *Module, l snapshotLibraryInterface, vndkType string) (android.Paths, bool) {
Inseob Kim242ef0c2019-10-22 20:15:20 +0900604 var ret android.Paths
605
Inseob Kim8471cda2019-11-15 09:59:12 +0900606 targetArch := "arch-" + m.Target().Arch.ArchType.String()
607 if m.Target().Arch.ArchVariant != "" {
608 targetArch += "-" + m.Target().Arch.ArchVariant
Inseob Kim242ef0c2019-10-22 20:15:20 +0900609 }
Inseob Kimae553032019-05-14 18:52:49 +0900610
Inseob Kim8471cda2019-11-15 09:59:12 +0900611 libPath := m.outputFile.Path()
612 snapshotLibOut := filepath.Join(snapshotArchDir, targetArch, "shared", vndkType, libPath.Base())
613 ret = append(ret, copyFile(ctx, libPath, snapshotLibOut))
614
Inseob Kimae553032019-05-14 18:52:49 +0900615 if ctx.Config().VndkSnapshotBuildArtifacts() {
616 prop := struct {
617 ExportedDirs []string `json:",omitempty"`
618 ExportedSystemDirs []string `json:",omitempty"`
619 ExportedFlags []string `json:",omitempty"`
620 RelativeInstallPath string `json:",omitempty"`
621 }{}
622 prop.ExportedFlags = l.exportedFlags()
Jiyong Park74955042019-10-22 20:19:51 +0900623 prop.ExportedDirs = l.exportedDirs().Strings()
624 prop.ExportedSystemDirs = l.exportedSystemDirs().Strings()
Inseob Kimae553032019-05-14 18:52:49 +0900625 prop.RelativeInstallPath = m.RelativeInstallPath()
626
Inseob Kim242ef0c2019-10-22 20:15:20 +0900627 propOut := snapshotLibOut + ".json"
Inseob Kimae553032019-05-14 18:52:49 +0900628
629 j, err := json.Marshal(prop)
630 if err != nil {
631 ctx.Errorf("json marshal to %q failed: %#v", propOut, err)
Inseob Kim242ef0c2019-10-22 20:15:20 +0900632 return nil, false
Inseob Kimae553032019-05-14 18:52:49 +0900633 }
Inseob Kim8471cda2019-11-15 09:59:12 +0900634 ret = append(ret, writeStringToFile(ctx, string(j), propOut))
Inseob Kimae553032019-05-14 18:52:49 +0900635 }
Inseob Kim242ef0c2019-10-22 20:15:20 +0900636 return ret, true
Inseob Kimae553032019-05-14 18:52:49 +0900637 }
638
Inseob Kim1f086e22019-05-09 13:29:15 +0900639 ctx.VisitAllModules(func(module android.Module) {
640 m, ok := module.(*Module)
Inseob Kimae553032019-05-14 18:52:49 +0900641 if !ok || !m.Enabled() {
Inseob Kim1f086e22019-05-09 13:29:15 +0900642 return
643 }
644
Inseob Kimeda2e9c2020-03-03 22:06:32 +0900645 l, vndkType, ok := isVndkSnapshotLibrary(ctx.DeviceConfig(), m)
Inseob Kimae553032019-05-14 18:52:49 +0900646 if !ok {
dimitry51ea18a2019-05-20 10:39:52 +0200647 return
648 }
649
Inseob Kim8471cda2019-11-15 09:59:12 +0900650 // install .so files for appropriate modules.
651 // Also install .json files if VNDK_SNAPSHOT_BUILD_ARTIFACTS
Inseob Kim242ef0c2019-10-22 20:15:20 +0900652 libs, ok := installVndkSnapshotLib(m, l, vndkType)
Inseob Kimae553032019-05-14 18:52:49 +0900653 if !ok {
Inseob Kim1f086e22019-05-09 13:29:15 +0900654 return
655 }
Inseob Kim242ef0c2019-10-22 20:15:20 +0900656 snapshotOutputs = append(snapshotOutputs, libs...)
Inseob Kim1f086e22019-05-09 13:29:15 +0900657
Inseob Kim8471cda2019-11-15 09:59:12 +0900658 // These are for generating module_names.txt and module_paths.txt
659 stem := m.outputFile.Path().Base()
660 moduleNames[stem] = ctx.ModuleName(m)
661 modulePaths[stem] = ctx.ModuleDir(m)
662
Bob Badoura75b0572020-02-18 20:21:55 -0800663 if len(m.NoticeFiles()) > 0 {
Inseob Kim8471cda2019-11-15 09:59:12 +0900664 noticeName := stem + ".txt"
665 // skip already copied notice file
666 if _, ok := noticeBuilt[noticeName]; !ok {
667 noticeBuilt[noticeName] = true
Bob Badoura75b0572020-02-18 20:21:55 -0800668 snapshotOutputs = append(snapshotOutputs, combineNotices(
669 ctx, m.NoticeFiles(), filepath.Join(noticeDir, noticeName)))
Inseob Kim8471cda2019-11-15 09:59:12 +0900670 }
671 }
672
673 if ctx.Config().VndkSnapshotBuildArtifacts() {
Inseob Kimeda2e9c2020-03-03 22:06:32 +0900674 headers = append(headers, l.snapshotHeaders()...)
Inseob Kimae553032019-05-14 18:52:49 +0900675 }
676 })
Inseob Kim1f086e22019-05-09 13:29:15 +0900677
Inseob Kim8471cda2019-11-15 09:59:12 +0900678 // install all headers after removing duplicates
679 for _, header := range android.FirstUniquePaths(headers) {
680 snapshotOutputs = append(snapshotOutputs, copyFile(
681 ctx, header, filepath.Join(includeDir, header.String())))
Inseob Kimae553032019-05-14 18:52:49 +0900682 }
683
Jooyung Han39edb6c2019-11-06 16:53:07 +0900684 // install *.libraries.txt except vndkcorevariant.libraries.txt
685 ctx.VisitAllModules(func(module android.Module) {
686 m, ok := module.(*vndkLibrariesTxt)
687 if !ok || !m.Enabled() || m.Name() == vndkUsingCoreVariantLibrariesTxt {
688 return
689 }
Inseob Kim8471cda2019-11-15 09:59:12 +0900690 snapshotOutputs = append(snapshotOutputs, copyFile(
691 ctx, m.OutputFile(), filepath.Join(configsDir, m.Name())))
Jooyung Han39edb6c2019-11-06 16:53:07 +0900692 })
Inseob Kim1f086e22019-05-09 13:29:15 +0900693
Inseob Kim242ef0c2019-10-22 20:15:20 +0900694 /*
695 Dump a map to a list file as:
Inseob Kim1f086e22019-05-09 13:29:15 +0900696
Inseob Kim242ef0c2019-10-22 20:15:20 +0900697 {key1} {value1}
698 {key2} {value2}
699 ...
700 */
701 installMapListFile := func(m map[string]string, path string) android.OutputPath {
702 var txtBuilder strings.Builder
703 for idx, k := range android.SortedStringKeys(m) {
704 if idx > 0 {
705 txtBuilder.WriteString("\\n")
706 }
707 txtBuilder.WriteString(k)
708 txtBuilder.WriteString(" ")
709 txtBuilder.WriteString(m[k])
Inseob Kim1f086e22019-05-09 13:29:15 +0900710 }
Inseob Kim8471cda2019-11-15 09:59:12 +0900711 return writeStringToFile(ctx, txtBuilder.String(), path)
Inseob Kim1f086e22019-05-09 13:29:15 +0900712 }
713
Inseob Kim242ef0c2019-10-22 20:15:20 +0900714 /*
715 module_paths.txt contains paths on which VNDK modules are defined.
716 e.g.,
717 libbase.so system/core/base
718 libc.so bionic/libc
719 ...
720 */
721 snapshotOutputs = append(snapshotOutputs, installMapListFile(modulePaths, filepath.Join(configsDir, "module_paths.txt")))
722
723 /*
724 module_names.txt contains names as which VNDK modules are defined,
725 because output filename and module name can be different with stem and suffix properties.
726
727 e.g.,
728 libcutils.so libcutils
729 libprotobuf-cpp-full-3.9.2.so libprotobuf-cpp-full
730 ...
731 */
732 snapshotOutputs = append(snapshotOutputs, installMapListFile(moduleNames, filepath.Join(configsDir, "module_names.txt")))
733
734 // All artifacts are ready. Sort them to normalize ninja and then zip.
735 sort.Slice(snapshotOutputs, func(i, j int) bool {
736 return snapshotOutputs[i].String() < snapshotOutputs[j].String()
737 })
738
739 zipPath := android.PathForOutput(ctx, snapshotDir, "android-vndk-"+ctx.DeviceConfig().DeviceArch()+".zip")
740 zipRule := android.NewRuleBuilder()
741
Inseob Kim8471cda2019-11-15 09:59:12 +0900742 // filenames in rspfile from FlagWithRspFileInputList might be single-quoted. Remove it with xargs
Inseob Kim242ef0c2019-10-22 20:15:20 +0900743 snapshotOutputList := android.PathForOutput(ctx, snapshotDir, "android-vndk-"+ctx.DeviceConfig().DeviceArch()+"_list")
744 zipRule.Command().
Inseob Kim8471cda2019-11-15 09:59:12 +0900745 Text("tr").
746 FlagWithArg("-d ", "\\'").
747 FlagWithRspFileInputList("< ", snapshotOutputs).
748 FlagWithOutput("> ", snapshotOutputList)
Inseob Kim242ef0c2019-10-22 20:15:20 +0900749
750 zipRule.Temporary(snapshotOutputList)
751
752 zipRule.Command().
753 BuiltTool(ctx, "soong_zip").
754 FlagWithOutput("-o ", zipPath).
755 FlagWithArg("-C ", android.PathForOutput(ctx, snapshotDir).String()).
756 FlagWithInput("-l ", snapshotOutputList)
757
758 zipRule.Build(pctx, ctx, zipPath.String(), "vndk snapshot "+zipPath.String())
Inseob Kim8471cda2019-11-15 09:59:12 +0900759 zipRule.DeleteTemporaryFiles()
Inseob Kim242ef0c2019-10-22 20:15:20 +0900760 c.vndkSnapshotZipFile = android.OptionalPathForPath(zipPath)
Inseob Kim1f086e22019-05-09 13:29:15 +0900761}
Jooyung Han097087b2019-10-22 19:32:18 +0900762
Jooyung Han0302a842019-10-30 18:43:49 +0900763func getVndkFileName(m *Module) (string, error) {
764 if library, ok := m.linker.(*libraryDecorator); ok {
765 return library.getLibNameHelper(m.BaseModuleName(), true) + ".so", nil
766 }
767 if prebuilt, ok := m.linker.(*prebuiltLibraryLinker); ok {
768 return prebuilt.libraryDecorator.getLibNameHelper(m.BaseModuleName(), true) + ".so", nil
769 }
770 return "", fmt.Errorf("VNDK library should have libraryDecorator or prebuiltLibraryLinker as linker: %T", m.linker)
Jooyung Han097087b2019-10-22 19:32:18 +0900771}
772
773func (c *vndkSnapshotSingleton) buildVndkLibrariesTxtFiles(ctx android.SingletonContext) {
Jooyung Han39edb6c2019-11-06 16:53:07 +0900774 llndk := android.SortedStringMapValues(llndkLibraries(ctx.Config()))
Jooyung Han0302a842019-10-30 18:43:49 +0900775 vndkcore := android.SortedStringMapValues(vndkCoreLibraries(ctx.Config()))
776 vndksp := android.SortedStringMapValues(vndkSpLibraries(ctx.Config()))
777 vndkprivate := android.SortedStringMapValues(vndkPrivateLibraries(ctx.Config()))
Jooyung Han0302a842019-10-30 18:43:49 +0900778
Jooyung Han2216fb12019-11-06 16:46:15 +0900779 // Build list of vndk libs as merged & tagged & filter-out(libclang_rt):
Jooyung Han0302a842019-10-30 18:43:49 +0900780 // Since each target have different set of libclang_rt.* files,
781 // keep the common set of files in vndk.libraries.txt
782 var merged []string
Jooyung Han097087b2019-10-22 19:32:18 +0900783 filterOutLibClangRt := func(libList []string) (filtered []string) {
784 for _, lib := range libList {
785 if !strings.HasPrefix(lib, "libclang_rt.") {
786 filtered = append(filtered, lib)
787 }
788 }
789 return
790 }
791 merged = append(merged, addPrefix(filterOutLibClangRt(llndk), "LLNDK: ")...)
792 merged = append(merged, addPrefix(vndksp, "VNDK-SP: ")...)
793 merged = append(merged, addPrefix(filterOutLibClangRt(vndkcore), "VNDK-core: ")...)
794 merged = append(merged, addPrefix(vndkprivate, "VNDK-private: ")...)
Jooyung Han39edb6c2019-11-06 16:53:07 +0900795 c.vndkLibrariesFile = android.PathForOutput(ctx, "vndk", "vndk.libraries.txt")
796 ctx.Build(pctx, android.BuildParams{
797 Rule: android.WriteFile,
798 Output: c.vndkLibrariesFile,
799 Description: "Writing " + c.vndkLibrariesFile.String(),
800 Args: map[string]string{
801 "content": strings.Join(merged, "\\n"),
802 },
803 })
Jooyung Han0302a842019-10-30 18:43:49 +0900804}
Jooyung Han097087b2019-10-22 19:32:18 +0900805
Jooyung Han0302a842019-10-30 18:43:49 +0900806func (c *vndkSnapshotSingleton) MakeVars(ctx android.MakeVarsContext) {
807 // Make uses LLNDK_MOVED_TO_APEX_LIBRARIES to avoid installing libraries on /system if
808 // they been moved to an apex.
809 movedToApexLlndkLibraries := []string{}
Jooyung Han39edb6c2019-11-06 16:53:07 +0900810 for lib := range llndkLibraries(ctx.Config()) {
Jooyung Han0302a842019-10-30 18:43:49 +0900811 // Skip bionic libs, they are handled in different manner
812 if android.DirectlyInAnyApex(&notOnHostContext{}, lib) && !isBionic(lib) {
813 movedToApexLlndkLibraries = append(movedToApexLlndkLibraries, lib)
814 }
815 }
816 ctx.Strict("LLNDK_MOVED_TO_APEX_LIBRARIES", strings.Join(movedToApexLlndkLibraries, " "))
Jooyung Han39edb6c2019-11-06 16:53:07 +0900817
818 // Make uses LLNDK_LIBRARIES to determine which libraries to install.
819 // HWASAN is only part of the LL-NDK in builds in which libc depends on HWASAN.
820 // Therefore, by removing the library here, we cause it to only be installed if libc
821 // depends on it.
822 installedLlndkLibraries := []string{}
823 for lib := range llndkLibraries(ctx.Config()) {
824 if strings.HasPrefix(lib, "libclang_rt.hwasan-") {
825 continue
826 }
827 installedLlndkLibraries = append(installedLlndkLibraries, lib)
828 }
829 sort.Strings(installedLlndkLibraries)
830 ctx.Strict("LLNDK_LIBRARIES", strings.Join(installedLlndkLibraries, " "))
831
Jooyung Han0302a842019-10-30 18:43:49 +0900832 ctx.Strict("VNDK_CORE_LIBRARIES", strings.Join(android.SortedStringKeys(vndkCoreLibraries(ctx.Config())), " "))
833 ctx.Strict("VNDK_SAMEPROCESS_LIBRARIES", strings.Join(android.SortedStringKeys(vndkSpLibraries(ctx.Config())), " "))
834 ctx.Strict("VNDK_PRIVATE_LIBRARIES", strings.Join(android.SortedStringKeys(vndkPrivateLibraries(ctx.Config())), " "))
835 ctx.Strict("VNDK_USING_CORE_VARIANT_LIBRARIES", strings.Join(android.SortedStringKeys(vndkUsingCoreVariantLibraries(ctx.Config())), " "))
836
Jooyung Han0302a842019-10-30 18:43:49 +0900837 ctx.Strict("VNDK_LIBRARIES_FILE", c.vndkLibrariesFile.String())
Inseob Kim242ef0c2019-10-22 20:15:20 +0900838 ctx.Strict("SOONG_VNDK_SNAPSHOT_ZIP", c.vndkSnapshotZipFile.String())
Jooyung Han097087b2019-10-22 19:32:18 +0900839}