blob: 0a5644ae306d87832a6870e0cd55b3887cf091c4 [file] [log] [blame]
Jiyong Park09d77522019-11-18 11:16:27 +09001// Copyright (C) 2019 The Android Open Source Project
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 apex
16
17import (
18 "fmt"
19 "io"
20 "path/filepath"
21 "strings"
22
23 "android/soong/android"
24 "android/soong/cc"
Jaewoong Jung87a33e72020-03-26 14:01:48 -070025 "android/soong/java"
Jiyong Parkc7a46882023-02-02 11:33:39 +090026 "android/soong/rust"
Jiyong Park09d77522019-11-18 11:16:27 +090027)
28
29func (a *apexBundle) AndroidMk() android.AndroidMkData {
30 if a.properties.HideFromMake {
31 return android.AndroidMkData{
32 Disabled: true,
33 }
34 }
Jooyung Han2ed99d02020-06-24 23:26:26 +090035 return a.androidMkForType()
Jiyong Park09d77522019-11-18 11:16:27 +090036}
37
Jiyong Parkc0ec6f92020-11-19 23:00:52 +090038// nameInMake converts apexFileClass into the corresponding class name in Make.
39func (class apexFileClass) nameInMake() string {
40 switch class {
41 case etc:
42 return "ETC"
43 case nativeSharedLib:
44 return "SHARED_LIBRARIES"
Jooyung Han8d4a1f02023-08-23 13:54:08 +090045 case nativeExecutable, shBinary:
Jiyong Parkc0ec6f92020-11-19 23:00:52 +090046 return "EXECUTABLES"
47 case javaSharedLib:
48 return "JAVA_LIBRARIES"
49 case nativeTest:
50 return "NATIVE_TESTS"
51 case app, appSet:
52 // b/142537672 Why isn't this APP? We want to have full control over
53 // the paths and file names of the apk file under the flattend APEX.
54 // If this is set to APP, then the paths and file names are modified
55 // by the Make build system. For example, it is installed to
56 // /system/apex/<apexname>/app/<Appname>/<apexname>.<Appname>/ instead of
57 // /system/apex/<apexname>/app/<Appname> because the build system automatically
58 // appends module name (which is <apexname>.<Appname> to the path.
59 return "ETC"
60 default:
61 panic(fmt.Errorf("unknown class %d", class))
62 }
63}
64
Bob Badourb4999222021-01-07 03:34:31 +000065// Return the full module name for a dependency module, which appends the apex module name unless re-using a system lib.
Jingwen Chen2d37b642023-03-14 16:11:38 +000066func (a *apexBundle) fullModuleName(apexBundleName string, linkToSystemLib bool, fi *apexFile) string {
Bob Badourb4999222021-01-07 03:34:31 +000067 if linkToSystemLib {
68 return fi.androidMkModuleName
69 }
Jooyung Han06a8a1c2023-08-23 11:11:43 +090070 return fi.androidMkModuleName + "." + apexBundleName
Bob Badourb4999222021-01-07 03:34:31 +000071}
72
Jingwen Chen2d37b642023-03-14 16:11:38 +000073// androidMkForFiles generates Make definitions for the contents of an
74// apexBundle (apexBundle#filesInfo). The filesInfo structure can either be
75// populated by Soong for unconverted APEXes, or Bazel in mixed mode. Use
76// apexFile#isBazelPrebuilt to differentiate.
Jooyung Han63dff462023-02-09 00:11:27 +000077func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, moduleDir string,
Jihoon Kangb6b93c22025-03-21 11:03:10 -070078 apexAndroidMkData android.AndroidMkData) (archSpecificModuleNames []string, moduleNames []string) {
Jooyung Han07931c72020-09-11 17:19:20 +090079
Jooyung Han63dff462023-02-09 00:11:27 +000080 // apexBundleName comes from the 'name' property or soong module.
81 // apexName comes from 'name' property of apex_manifest.
Jiyong Parkdb334862020-02-05 17:19:28 +090082 // An apex is installed to /system/apex/<apexBundleName> and is activated at /apex/<apexName>
83 // In many cases, the two names are the same, but could be different in general.
Jooyung Han63dff462023-02-09 00:11:27 +000084 // However, symbol files for apex files are installed under /apex/<apexBundleName> to avoid
85 // conflicts between two apexes with the same apexName.
Jiyong Parkdb334862020-02-05 17:19:28 +090086
Jiyong Park09d77522019-11-18 11:16:27 +090087 for _, fi := range a.filesInfo {
Jiyong Parkc0ec6f92020-11-19 23:00:52 +090088 linkToSystemLib := a.linkToSystemLib && fi.transitiveDep && fi.availableToPlatform()
Jingwen Chen2d37b642023-03-14 16:11:38 +000089 moduleName := a.fullModuleName(apexBundleName, linkToSystemLib, &fi)
Jihoon Kangb6b93c22025-03-21 11:03:10 -070090 if !android.InList(moduleName, moduleNames) {
91 moduleNames = append(moduleNames, moduleName)
92 }
Jiyong Park7cd10e32020-01-14 09:22:18 +090093
Jiyong Park57621b22021-01-20 20:33:11 +090094 // This name will be added to LOCAL_REQUIRED_MODULES of the APEX. We need to be
95 // arch-specific otherwise we will end up installing both ABIs even when only
96 // either of the ABI is requested.
97 aName := moduleName
98 switch fi.multilib {
99 case "lib32":
100 aName = aName + ":32"
101 case "lib64":
102 aName = aName + ":64"
103 }
Jihoon Kangb6b93c22025-03-21 11:03:10 -0700104 if !android.InList(aName, archSpecificModuleNames) {
105 archSpecificModuleNames = append(archSpecificModuleNames, aName)
Jiyong Park7cd10e32020-01-14 09:22:18 +0900106 }
107
108 if linkToSystemLib {
109 // No need to copy the file since it's linked to the system file
110 continue
Jiyong Park09d77522019-11-18 11:16:27 +0900111 }
112
Sasha Smundak5c4729d2022-12-01 10:49:23 -0800113 fmt.Fprintln(w, "\ninclude $(CLEAR_VARS) # apex.apexBundle.files")
Jiyong Park1833cef2019-12-13 13:28:36 +0900114 if fi.moduleDir != "" {
115 fmt.Fprintln(w, "LOCAL_PATH :=", fi.moduleDir)
116 } else {
117 fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
118 }
Jiyong Park7cd10e32020-01-14 09:22:18 +0900119 fmt.Fprintln(w, "LOCAL_MODULE :=", moduleName)
Jingwen Chen2d37b642023-03-14 16:11:38 +0000120
Anton Hansson1ee62c02020-06-30 11:51:53 +0100121 if fi.module != nil && fi.module.Owner() != "" {
122 fmt.Fprintln(w, "LOCAL_MODULE_OWNER :=", fi.module.Owner())
123 }
Jooyung Han63dff462023-02-09 00:11:27 +0000124 // /apex/<apexBundleName>/{lib|framework|...}
125 pathForSymbol := filepath.Join("$(PRODUCT_OUT)", "apex", apexBundleName, fi.installDir)
Jooyung Haneec1b3f2023-06-20 16:25:59 +0900126 modulePath := pathForSymbol
127 fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", modulePath)
LaMont Jonesb5099382024-01-10 23:42:36 +0000128 // AconfigUpdateAndroidMkData may have added elements to Extra. Process them here.
129 for _, extra := range apexAndroidMkData.Extra {
130 extra(w, fi.builtFile)
131 }
Jiyong Park19972c72020-01-28 20:05:29 +0900132
Jooyung Haneec1b3f2023-06-20 16:25:59 +0900133 // For non-flattend APEXes, the merged notice file is attached to the APEX itself.
134 // We don't need to have notice file for the individual modules in it. Otherwise,
135 // we will have duplicated notice entries.
136 fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
Colin Cross6340ea52021-11-04 12:01:18 -0700137 fmt.Fprintln(w, "LOCAL_SOONG_INSTALLED_MODULE :=", filepath.Join(modulePath, fi.stem()))
138 fmt.Fprintln(w, "LOCAL_SOONG_INSTALL_PAIRS :=", fi.builtFile.String()+":"+filepath.Join(modulePath, fi.stem()))
Jiyong Park09d77522019-11-18 11:16:27 +0900139 fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", fi.builtFile.String())
Colin Crossa6182ab2024-08-21 10:47:44 -0700140 if fi.checkbuildTarget != nil {
141 fmt.Fprintln(w, "LOCAL_CHECKED_MODULE :=", fi.checkbuildTarget.String())
142 } else {
143 fmt.Fprintln(w, "LOCAL_CHECKED_MODULE :=", fi.builtFile.String())
144 }
Jiyong Parkc0ec6f92020-11-19 23:00:52 +0900145 fmt.Fprintln(w, "LOCAL_MODULE_CLASS :=", fi.class.nameInMake())
Jiyong Park09d77522019-11-18 11:16:27 +0900146 if fi.module != nil {
Jingwen Chen2d37b642023-03-14 16:11:38 +0000147 // This apexFile's module comes from Soong
Jooyung Han8d4a1f02023-08-23 13:54:08 +0900148 if fi.module.Target().Arch.ArchType != android.Common {
149 archStr := fi.module.Target().Arch.ArchType.String()
150 fmt.Fprintln(w, "LOCAL_MODULE_TARGET_ARCH :=", archStr)
Jiyong Park09d77522019-11-18 11:16:27 +0900151 }
152 }
Jiyong Park618922e2020-01-08 13:35:43 +0900153 if fi.jacocoReportClassesFile != nil {
154 fmt.Fprintln(w, "LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=", fi.jacocoReportClassesFile.String())
155 }
Sasha Smundak18d98bc2020-05-27 16:36:07 -0700156 switch fi.class {
157 case javaSharedLib:
Jiyong Park09d77522019-11-18 11:16:27 +0900158 // soong_java_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .jar Therefore
159 // we need to remove the suffix from LOCAL_MODULE_STEM, otherwise
160 // we will have foo.jar.jar
Jiyong Parkc0ec6f92020-11-19 23:00:52 +0900161 fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", strings.TrimSuffix(fi.stem(), ".jar"))
Paul Duffin44b481b2020-06-17 16:59:43 +0100162 if javaModule, ok := fi.module.(java.ApexDependency); ok {
Jiyong Park9e83f0b2020-06-11 00:35:03 +0900163 fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", javaModule.ImplementationAndResourcesJars()[0].String())
164 fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", javaModule.HeaderJars()[0].String())
165 } else {
166 fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", fi.builtFile.String())
167 fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", fi.builtFile.String())
168 }
Jiyong Park09d77522019-11-18 11:16:27 +0900169 fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", fi.builtFile.String())
170 fmt.Fprintln(w, "LOCAL_DEX_PREOPT := false")
171 fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk")
Sasha Smundak18d98bc2020-05-27 16:36:07 -0700172 case app:
Colin Cross503c1d02020-01-28 14:00:53 -0800173 fmt.Fprintln(w, "LOCAL_CERTIFICATE :=", fi.certificate.AndroidMkString())
Jiyong Park618922e2020-01-08 13:35:43 +0900174 // soong_app_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .apk Therefore
175 // we need to remove the suffix from LOCAL_MODULE_STEM, otherwise
176 // we will have foo.apk.apk
Jiyong Parkc0ec6f92020-11-19 23:00:52 +0900177 fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", strings.TrimSuffix(fi.stem(), ".apk"))
Colin Cross403cc152020-07-06 14:15:24 -0700178 if app, ok := fi.module.(*java.AndroidApp); ok {
Sasha Smundakdcb61292022-12-08 10:41:33 -0800179 android.AndroidMkEmitAssignList(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE", app.JniCoverageOutputs().Strings())
Colin Cross403cc152020-07-06 14:15:24 -0700180 if jniLibSymbols := app.JNISymbolsInstalls(modulePath); len(jniLibSymbols) > 0 {
181 fmt.Fprintln(w, "LOCAL_SOONG_JNI_LIBS_SYMBOLS :=", jniLibSymbols.String())
182 }
Jaewoong Jung87a33e72020-03-26 14:01:48 -0700183 }
Jiyong Park618922e2020-01-08 13:35:43 +0900184 fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_app_prebuilt.mk")
Sasha Smundak18d98bc2020-05-27 16:36:07 -0700185 case appSet:
186 as, ok := fi.module.(*java.AndroidAppSet)
187 if !ok {
188 panic(fmt.Sprintf("Expected %s to be AndroidAppSet", fi.module))
189 }
Colin Crossffbcd1d2021-11-12 12:19:42 -0800190 fmt.Fprintln(w, "LOCAL_APK_SET_INSTALL_FILE :=", as.PackedAdditionalOutputs().String())
Colin Cross4fb652d2020-07-09 19:05:35 -0700191 fmt.Fprintln(w, "LOCAL_APKCERTS_FILE :=", as.APKCertsFile().String())
Sasha Smundak18d98bc2020-05-27 16:36:07 -0700192 fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_android_app_set.mk")
193 case nativeSharedLib, nativeExecutable, nativeTest:
Jiyong Parkc0ec6f92020-11-19 23:00:52 +0900194 fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.stem())
Colin Cross8ff10582023-12-07 13:10:56 -0800195 if ccMod, ok := fi.module.(*cc.Module); ok {
196 if ccMod.UnstrippedOutputFile() != nil {
197 fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", ccMod.UnstrippedOutputFile().String())
198 }
199 ccMod.AndroidMkWriteAdditionalDependenciesForSourceAbiDiff(w)
200 if ccMod.CoverageOutputFile().Valid() {
201 fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", ccMod.CoverageOutputFile().String())
202 }
203 } else if rustMod, ok := fi.module.(*rust.Module); ok {
204 if rustMod.UnstrippedOutputFile() != nil {
205 fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", rustMod.UnstrippedOutputFile().String())
Jiyong Parkc7a46882023-02-02 11:33:39 +0900206 }
Jiyong Park09d77522019-11-18 11:16:27 +0900207 }
Ivan Lozanod06cc742021-11-12 13:27:58 -0500208 fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_cc_rust_prebuilt.mk")
Sasha Smundak18d98bc2020-05-27 16:36:07 -0700209 default:
Jiyong Parkc0ec6f92020-11-19 23:00:52 +0900210 fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.stem())
Jiyong Park09d77522019-11-18 11:16:27 +0900211 fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
212 }
Jiyong Park31af2672020-02-11 09:36:25 +0900213
214 // m <module_name> will build <module_name>.<apex_name> as well.
Jooyung Han06a8a1c2023-08-23 11:11:43 +0900215 if fi.androidMkModuleName != moduleName {
Yo Chiange8128052020-07-23 20:09:18 +0800216 fmt.Fprintf(w, ".PHONY: %s\n", fi.androidMkModuleName)
217 fmt.Fprintf(w, "%s: %s\n", fi.androidMkModuleName, moduleName)
Jiyong Park31af2672020-02-11 09:36:25 +0900218 }
Jiyong Park09d77522019-11-18 11:16:27 +0900219 }
Jihoon Kangb6b93c22025-03-21 11:03:10 -0700220 return
Jiyong Park09d77522019-11-18 11:16:27 +0900221}
222
Jiakai Zhangd70dff72022-02-24 15:06:05 +0000223func (a *apexBundle) writeRequiredModules(w io.Writer, moduleNames []string) {
Jiyong Park7afd1072019-12-30 16:56:33 +0900224 var required []string
225 var targetRequired []string
226 var hostRequired []string
Cole Faust43ddd082024-06-17 12:32:40 -0700227 required = append(required, a.required...)
Jiyong Parkcacc4f32021-10-28 14:26:03 +0900228 targetRequired = append(targetRequired, a.TargetRequiredModuleNames()...)
229 hostRequired = append(hostRequired, a.HostRequiredModuleNames()...)
Jingwen Chen29743c82023-01-25 17:49:46 +0000230 android.AndroidMkEmitAssignList(w, "LOCAL_REQUIRED_MODULES", moduleNames, a.makeModulesToInstall, required)
Sasha Smundakdcb61292022-12-08 10:41:33 -0800231 android.AndroidMkEmitAssignList(w, "LOCAL_TARGET_REQUIRED_MODULES", targetRequired)
232 android.AndroidMkEmitAssignList(w, "LOCAL_HOST_REQUIRED_MODULES", hostRequired)
Jiyong Park7afd1072019-12-30 16:56:33 +0900233}
234
Jiyong Park09d77522019-11-18 11:16:27 +0900235func (a *apexBundle) androidMkForType() android.AndroidMkData {
236 return android.AndroidMkData{
LaMont Jonesb5099382024-01-10 23:42:36 +0000237 // While we do not provide a value for `Extra`, AconfigUpdateAndroidMkData may add some, which we must honor.
Jiyong Park09d77522019-11-18 11:16:27 +0900238 Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
Jihoon Kangb6b93c22025-03-21 11:03:10 -0700239 archSpecificModuleNames := []string{}
Diwas Sharmabb9202e2023-01-26 18:42:21 +0000240 moduleNames := []string{}
Diwas Sharmabb9202e2023-01-26 18:42:21 +0000241 if a.installable() {
Jihoon Kangb6b93c22025-03-21 11:03:10 -0700242 archSpecificModuleNames, moduleNames = a.androidMkForFiles(w, name, moduleDir, data)
Diwas Sharmabb9202e2023-01-26 18:42:21 +0000243 }
Jiyong Park09d77522019-11-18 11:16:27 +0900244
Jooyung Haneec1b3f2023-06-20 16:25:59 +0900245 fmt.Fprintln(w, "\ninclude $(CLEAR_VARS) # apex.apexBundle")
246 fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
Jooyung Han06a8a1c2023-08-23 11:11:43 +0900247 fmt.Fprintln(w, "LOCAL_MODULE :=", name)
Jooyung Haneec1b3f2023-06-20 16:25:59 +0900248 fmt.Fprintln(w, "LOCAL_MODULE_CLASS := ETC") // do we need a new class?
249 fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", a.outputFile.String())
250 fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", a.installDir.String())
Jooyung Han06a8a1c2023-08-23 11:11:43 +0900251 stemSuffix := imageApexSuffix
Jooyung Haneec1b3f2023-06-20 16:25:59 +0900252 if a.isCompressed {
253 stemSuffix = imageCapexSuffix
Jiyong Park09d77522019-11-18 11:16:27 +0900254 }
Jooyung Haneec1b3f2023-06-20 16:25:59 +0900255 fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", name+stemSuffix)
256 fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !a.installable())
257 if a.installable() {
258 fmt.Fprintln(w, "LOCAL_SOONG_INSTALLED_MODULE :=", a.installedFile.String())
259 fmt.Fprintln(w, "LOCAL_SOONG_INSTALL_PAIRS :=", a.outputFile.String()+":"+a.installedFile.String())
Cole Faustd22afe92023-08-18 16:05:44 -0700260 fmt.Fprintln(w, "LOCAL_SOONG_INSTALL_SYMLINKS := ", strings.Join(a.compatSymlinks.Strings(), " "))
Colin Cross388c6612025-01-28 14:00:12 -0800261 fmt.Fprintln(w, "LOCAL_SOONG_INSTALL_PAIRS +=", a.extraInstalledPairs.String())
Jooyung Haneec1b3f2023-06-20 16:25:59 +0900262 }
Jooyung Han286957d2023-10-30 16:17:56 +0900263 fmt.Fprintln(w, "LOCAL_APEX_KEY_PATH := ", a.apexKeysPath.String())
Jooyung Haneec1b3f2023-06-20 16:25:59 +0900264
265 // Because apex writes .mk with Custom(), we need to write manually some common properties
266 // which are available via data.Entries
267 commonProperties := []string{
268 "LOCAL_FULL_INIT_RC", "LOCAL_FULL_VINTF_FRAGMENTS",
269 "LOCAL_PROPRIETARY_MODULE", "LOCAL_VENDOR_MODULE", "LOCAL_ODM_MODULE", "LOCAL_PRODUCT_MODULE", "LOCAL_SYSTEM_EXT_MODULE",
270 "LOCAL_MODULE_OWNER",
271 }
272 for _, name := range commonProperties {
273 if value, ok := data.Entries.EntryMap[name]; ok {
274 android.AndroidMkEmitAssignList(w, name, value)
275 }
276 }
277
278 android.AndroidMkEmitAssignList(w, "LOCAL_OVERRIDES_MODULES", a.overridableProperties.Overrides)
Jihoon Kangb6b93c22025-03-21 11:03:10 -0700279 a.writeRequiredModules(w, archSpecificModuleNames)
LaMont Jonesb5099382024-01-10 23:42:36 +0000280 // AconfigUpdateAndroidMkData may have added elements to Extra. Process them here.
281 for _, extra := range data.Extra {
282 extra(w, a.outputFile)
283 }
Jooyung Haneec1b3f2023-06-20 16:25:59 +0900284
285 fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
Jooyung Han06a8a1c2023-08-23 11:11:43 +0900286 fmt.Fprintln(w, "ALL_MODULES.$(my_register_name).BUNDLE :=", a.bundleModuleFile.String())
Jooyung Haneec1b3f2023-06-20 16:25:59 +0900287 android.AndroidMkEmitAssignList(w, "ALL_MODULES.$(my_register_name).LINT_REPORTS", a.lintReports.Strings())
288
289 if a.installedFilesFile != nil {
290 goal := "checkbuild"
291 distFile := name + "-installed-files.txt"
292 fmt.Fprintln(w, ".PHONY:", goal)
293 fmt.Fprintf(w, "$(call dist-for-goals,%s,%s:%s)\n",
294 goal, a.installedFilesFile.String(), distFile)
295 fmt.Fprintf(w, "$(call declare-0p-target,%s)\n", a.installedFilesFile.String())
296 }
297 for _, dist := range data.Entries.GetDistForGoals(a) {
Yu Liue70976d2024-10-15 20:45:35 +0000298 fmt.Fprintln(w, dist)
Jooyung Haneec1b3f2023-06-20 16:25:59 +0900299 }
300
Jihoon Kangb6b93c22025-03-21 11:03:10 -0700301 fmt.Fprintf(w, "ALL_MODULES.$(my_register_name).SYMBOLIC_OUTPUT_PATH := $(foreach m,%s,$(ALL_MODULES.$(m).SYMBOLIC_OUTPUT_PATH))\n", strings.Join(moduleNames, " "))
302 fmt.Fprintf(w, "ALL_MODULES.$(my_register_name).ELF_SYMBOL_MAPPING_PATH := $(foreach m,%s,$(ALL_MODULES.$(m).ELF_SYMBOL_MAPPING_PATH))\n", strings.Join(moduleNames, " "))
303
Jooyung Haneec1b3f2023-06-20 16:25:59 +0900304 distCoverageFiles(w, "ndk_apis_usedby_apex", a.nativeApisUsedByModuleFile.String())
305 distCoverageFiles(w, "ndk_apis_backedby_apex", a.nativeApisBackedByModuleFile.String())
306 distCoverageFiles(w, "java_apis_used_by_apex", a.javaApisUsedByModuleFile.String())
Jiyong Park09d77522019-11-18 11:16:27 +0900307 }}
308}
sophiez02347372021-11-02 17:58:02 -0700309
310func distCoverageFiles(w io.Writer, dir string, distfile string) {
311 if distfile != "" {
312 goal := "apps_only"
313 fmt.Fprintf(w, "ifneq (,$(filter $(my_register_name),$(TARGET_BUILD_APPS)))\n"+
314 " $(call dist-for-goals,%s,%s:%s/$(notdir %s))\n"+
315 "endif\n", goal, distfile, dir, distfile)
316 }
317}