blob: af2ec3d2a513e3dfc3f931479fe73ce8b46801c3 [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 Park09d77522019-11-18 11:16:27 +090026
27 "github.com/google/blueprint/proptools"
28)
29
30func (a *apexBundle) AndroidMk() android.AndroidMkData {
31 if a.properties.HideFromMake {
32 return android.AndroidMkData{
33 Disabled: true,
34 }
35 }
Jooyung Han2ed99d02020-06-24 23:26:26 +090036 return a.androidMkForType()
Jiyong Park09d77522019-11-18 11:16:27 +090037}
38
Jiyong Parkdb334862020-02-05 17:19:28 +090039func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, moduleDir string) []string {
40 // apexBundleName comes from the 'name' property; apexName comes from 'apex_name' property.
41 // An apex is installed to /system/apex/<apexBundleName> and is activated at /apex/<apexName>
42 // In many cases, the two names are the same, but could be different in general.
43
Jiyong Park09d77522019-11-18 11:16:27 +090044 moduleNames := []string{}
45 apexType := a.properties.ApexType
46 // To avoid creating duplicate build rules, run this function only when primaryApexType is true
47 // to install symbol files in $(PRODUCT_OUT}/apex.
48 // And if apexType is flattened, run this function to install files in $(PRODUCT_OUT}/system/apex.
49 if !a.primaryApexType && apexType != flattenedApex {
50 return moduleNames
51 }
52
Yifan Hong93a90db2020-07-28 17:24:44 -070053 // b/162366062. Prevent GKI APEXes to emit make rules to avoid conflicts.
54 if strings.HasPrefix(apexName, "com.android.gki.") && apexType != flattenedApex {
55 return moduleNames
56 }
57
Jiyong Parkdb334862020-02-05 17:19:28 +090058 // b/140136207. When there are overriding APEXes for a VNDK APEX, the symbols file for the overridden
59 // APEX and the overriding APEX will have the same installation paths at /apex/com.android.vndk.v<ver>
60 // as their apexName will be the same. To avoid the path conflicts, skip installing the symbol files
61 // for the overriding VNDK APEXes.
62 symbolFilesNotNeeded := a.vndkApex && len(a.overridableProperties.Overrides) > 0
63 if symbolFilesNotNeeded && apexType != flattenedApex {
64 return moduleNames
65 }
66
Jiyong Park7cd10e32020-01-14 09:22:18 +090067 var postInstallCommands []string
68 for _, fi := range a.filesInfo {
69 if a.linkToSystemLib && fi.transitiveDep && fi.AvailableToPlatform() {
70 // TODO(jiyong): pathOnDevice should come from fi.module, not being calculated here
71 linkTarget := filepath.Join("/system", fi.Path())
Jiyong Parkdb334862020-02-05 17:19:28 +090072 linkPath := filepath.Join(a.installDir.ToMakePath().String(), apexBundleName, fi.Path())
Jiyong Park7cd10e32020-01-14 09:22:18 +090073 mkdirCmd := "mkdir -p " + filepath.Dir(linkPath)
74 linkCmd := "ln -sfn " + linkTarget + " " + linkPath
75 postInstallCommands = append(postInstallCommands, mkdirCmd, linkCmd)
76 }
77 }
Jiyong Park7cd10e32020-01-14 09:22:18 +090078
Liz Kammer5bd365f2020-05-27 15:15:11 -070079 seenDataOutPaths := make(map[string]bool)
80
Jiyong Park09d77522019-11-18 11:16:27 +090081 for _, fi := range a.filesInfo {
Sasha Smundak18d98bc2020-05-27 16:36:07 -070082 if ccMod, ok := fi.module.(*cc.Module); ok && ccMod.Properties.HideFromMake {
Jiyong Park09d77522019-11-18 11:16:27 +090083 continue
84 }
85
Jiyong Park7cd10e32020-01-14 09:22:18 +090086 linkToSystemLib := a.linkToSystemLib && fi.transitiveDep && fi.AvailableToPlatform()
87
88 var moduleName string
89 if linkToSystemLib {
Yo Chiange8128052020-07-23 20:09:18 +080090 moduleName = fi.androidMkModuleName
Jiyong Park7cd10e32020-01-14 09:22:18 +090091 } else {
Yo Chiange8128052020-07-23 20:09:18 +080092 moduleName = fi.androidMkModuleName + "." + apexBundleName + a.suffix
Jiyong Park7cd10e32020-01-14 09:22:18 +090093 }
94
95 if !android.InList(moduleName, moduleNames) {
96 moduleNames = append(moduleNames, moduleName)
97 }
98
99 if linkToSystemLib {
100 // No need to copy the file since it's linked to the system file
101 continue
Jiyong Park09d77522019-11-18 11:16:27 +0900102 }
103
104 fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)")
Jiyong Park1833cef2019-12-13 13:28:36 +0900105 if fi.moduleDir != "" {
106 fmt.Fprintln(w, "LOCAL_PATH :=", fi.moduleDir)
107 } else {
108 fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
109 }
Jiyong Park7cd10e32020-01-14 09:22:18 +0900110 fmt.Fprintln(w, "LOCAL_MODULE :=", moduleName)
Anton Hansson1ee62c02020-06-30 11:51:53 +0100111 if fi.module != nil && fi.module.Owner() != "" {
112 fmt.Fprintln(w, "LOCAL_MODULE_OWNER :=", fi.module.Owner())
113 }
Jiyong Park09d77522019-11-18 11:16:27 +0900114 // /apex/<apex_name>/{lib|framework|...}
115 pathWhenActivated := filepath.Join("$(PRODUCT_OUT)", "apex", apexName, fi.installDir)
Colin Cross403cc152020-07-06 14:15:24 -0700116 var modulePath string
Jiyong Park09d77522019-11-18 11:16:27 +0900117 if apexType == flattenedApex {
118 // /system/apex/<name>/{lib|framework|...}
Colin Cross403cc152020-07-06 14:15:24 -0700119 modulePath = filepath.Join(a.installDir.ToMakePath().String(), apexBundleName, fi.installDir)
Liz Kammer5bd365f2020-05-27 15:15:11 -0700120 fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", modulePath)
Jiyong Parkdb334862020-02-05 17:19:28 +0900121 if a.primaryApexType && !symbolFilesNotNeeded {
Jiyong Park09d77522019-11-18 11:16:27 +0900122 fmt.Fprintln(w, "LOCAL_SOONG_SYMBOL_PATH :=", pathWhenActivated)
123 }
124 if len(fi.symlinks) > 0 {
125 fmt.Fprintln(w, "LOCAL_MODULE_SYMLINKS :=", strings.Join(fi.symlinks, " "))
126 }
Chris Parsons216e10a2020-07-09 17:12:52 -0400127 newDataPaths := []android.DataPath{}
Liz Kammer5bd365f2020-05-27 15:15:11 -0700128 for _, path := range fi.dataPaths {
Chris Parsons216e10a2020-07-09 17:12:52 -0400129 dataOutPath := modulePath + ":" + path.SrcPath.Rel()
Liz Kammer5bd365f2020-05-27 15:15:11 -0700130 if ok := seenDataOutPaths[dataOutPath]; !ok {
131 newDataPaths = append(newDataPaths, path)
132 seenDataOutPaths[dataOutPath] = true
133 }
134 }
135 if len(newDataPaths) > 0 {
136 fmt.Fprintln(w, "LOCAL_TEST_DATA :=", strings.Join(cc.AndroidMkDataPaths(newDataPaths), " "))
Liz Kammer1c14a212020-05-12 15:26:55 -0700137 }
Jiyong Park09d77522019-11-18 11:16:27 +0900138
Bob Badoura75b0572020-02-18 20:21:55 -0800139 if fi.module != nil && len(fi.module.NoticeFiles()) > 0 {
140 fmt.Fprintln(w, "LOCAL_NOTICE_FILE :=", strings.Join(fi.module.NoticeFiles().Strings(), " "))
Jiyong Park09d77522019-11-18 11:16:27 +0900141 }
142 } else {
Colin Cross403cc152020-07-06 14:15:24 -0700143 modulePath = pathWhenActivated
Jiyong Park09d77522019-11-18 11:16:27 +0900144 fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", pathWhenActivated)
Jiyong Park19972c72020-01-28 20:05:29 +0900145
146 // For non-flattend APEXes, the merged notice file is attached to the APEX itself.
147 // We don't need to have notice file for the individual modules in it. Otherwise,
148 // we will have duplicated notice entries.
149 fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
Jiyong Park09d77522019-11-18 11:16:27 +0900150 }
151 fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", fi.builtFile.String())
152 fmt.Fprintln(w, "LOCAL_MODULE_CLASS :=", fi.class.NameInMake())
153 if fi.module != nil {
154 archStr := fi.module.Target().Arch.ArchType.String()
155 host := false
156 switch fi.module.Target().Os.Class {
157 case android.Host:
158 if fi.module.Target().Arch.ArchType != android.Common {
159 fmt.Fprintln(w, "LOCAL_MODULE_HOST_ARCH :=", archStr)
160 }
161 host = true
162 case android.HostCross:
163 if fi.module.Target().Arch.ArchType != android.Common {
164 fmt.Fprintln(w, "LOCAL_MODULE_HOST_CROSS_ARCH :=", archStr)
165 }
166 host = true
167 case android.Device:
168 if fi.module.Target().Arch.ArchType != android.Common {
169 fmt.Fprintln(w, "LOCAL_MODULE_TARGET_ARCH :=", archStr)
170 }
171 }
172 if host {
173 makeOs := fi.module.Target().Os.String()
174 if fi.module.Target().Os == android.Linux || fi.module.Target().Os == android.LinuxBionic {
175 makeOs = "linux"
176 }
177 fmt.Fprintln(w, "LOCAL_MODULE_HOST_OS :=", makeOs)
178 fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
179 }
180 }
Jiyong Park618922e2020-01-08 13:35:43 +0900181 if fi.jacocoReportClassesFile != nil {
182 fmt.Fprintln(w, "LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=", fi.jacocoReportClassesFile.String())
183 }
Sasha Smundak18d98bc2020-05-27 16:36:07 -0700184 switch fi.class {
185 case javaSharedLib:
Jiyong Park09d77522019-11-18 11:16:27 +0900186 // soong_java_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .jar Therefore
187 // we need to remove the suffix from LOCAL_MODULE_STEM, otherwise
188 // we will have foo.jar.jar
Jiyong Parkf1493cc2020-05-29 21:29:20 +0900189 fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", strings.TrimSuffix(fi.Stem(), ".jar"))
Paul Duffin44b481b2020-06-17 16:59:43 +0100190 if javaModule, ok := fi.module.(java.ApexDependency); ok {
Jiyong Park9e83f0b2020-06-11 00:35:03 +0900191 fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", javaModule.ImplementationAndResourcesJars()[0].String())
192 fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", javaModule.HeaderJars()[0].String())
193 } else {
194 fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", fi.builtFile.String())
195 fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", fi.builtFile.String())
196 }
Jiyong Park09d77522019-11-18 11:16:27 +0900197 fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", fi.builtFile.String())
198 fmt.Fprintln(w, "LOCAL_DEX_PREOPT := false")
199 fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk")
Sasha Smundak18d98bc2020-05-27 16:36:07 -0700200 case app:
Colin Cross503c1d02020-01-28 14:00:53 -0800201 fmt.Fprintln(w, "LOCAL_CERTIFICATE :=", fi.certificate.AndroidMkString())
Jiyong Park618922e2020-01-08 13:35:43 +0900202 // soong_app_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .apk Therefore
203 // we need to remove the suffix from LOCAL_MODULE_STEM, otherwise
204 // we will have foo.apk.apk
Jiyong Parkf1493cc2020-05-29 21:29:20 +0900205 fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", strings.TrimSuffix(fi.Stem(), ".apk"))
Colin Cross403cc152020-07-06 14:15:24 -0700206 if app, ok := fi.module.(*java.AndroidApp); ok {
207 if jniCoverageOutputs := app.JniCoverageOutputs(); len(jniCoverageOutputs) > 0 {
208 fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", strings.Join(jniCoverageOutputs.Strings(), " "))
209 }
210 if jniLibSymbols := app.JNISymbolsInstalls(modulePath); len(jniLibSymbols) > 0 {
211 fmt.Fprintln(w, "LOCAL_SOONG_JNI_LIBS_SYMBOLS :=", jniLibSymbols.String())
212 }
Jaewoong Jung87a33e72020-03-26 14:01:48 -0700213 }
Jiyong Park618922e2020-01-08 13:35:43 +0900214 fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_app_prebuilt.mk")
Sasha Smundak18d98bc2020-05-27 16:36:07 -0700215 case appSet:
216 as, ok := fi.module.(*java.AndroidAppSet)
217 if !ok {
218 panic(fmt.Sprintf("Expected %s to be AndroidAppSet", fi.module))
219 }
Liz Kammercada8072020-07-28 15:47:38 -0700220 fmt.Fprintln(w, "LOCAL_APK_SET_INSTALL_FILE :=", as.InstallFile())
Colin Cross4fb652d2020-07-09 19:05:35 -0700221 fmt.Fprintln(w, "LOCAL_APKCERTS_FILE :=", as.APKCertsFile().String())
Sasha Smundak18d98bc2020-05-27 16:36:07 -0700222 fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_android_app_set.mk")
223 case nativeSharedLib, nativeExecutable, nativeTest:
Jiyong Parkf1493cc2020-05-29 21:29:20 +0900224 fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.Stem())
Sasha Smundak18d98bc2020-05-27 16:36:07 -0700225 if ccMod, ok := fi.module.(*cc.Module); ok {
226 if ccMod.UnstrippedOutputFile() != nil {
227 fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", ccMod.UnstrippedOutputFile().String())
Jiyong Park09d77522019-11-18 11:16:27 +0900228 }
Sasha Smundak18d98bc2020-05-27 16:36:07 -0700229 ccMod.AndroidMkWriteAdditionalDependenciesForSourceAbiDiff(w)
230 if ccMod.CoverageOutputFile().Valid() {
231 fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", ccMod.CoverageOutputFile().String())
Jiyong Park09d77522019-11-18 11:16:27 +0900232 }
233 }
234 fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_cc_prebuilt.mk")
Sasha Smundak18d98bc2020-05-27 16:36:07 -0700235 default:
Jiyong Parkf1493cc2020-05-29 21:29:20 +0900236 fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.Stem())
Jiyong Park7aa3f762020-01-28 16:51:34 +0900237 if fi.builtFile == a.manifestPbOut && apexType == flattenedApex {
Jooyung Han75de2612020-01-24 02:02:45 +0900238 if a.primaryApexType {
239 // Make apex_manifest.pb module for this APEX to override all other
240 // modules in the APEXes being overridden by this APEX
241 var patterns []string
242 for _, o := range a.overridableProperties.Overrides {
243 patterns = append(patterns, "%."+o+a.suffix)
244 }
Yo Chiang12d9f7a2020-06-16 17:32:19 +0800245 if len(patterns) > 0 {
246 fmt.Fprintln(w, "LOCAL_OVERRIDES_MODULES :=", strings.Join(patterns, " "))
247 }
Jiyong Park7aa3f762020-01-28 16:51:34 +0900248 if len(a.compatSymlinks) > 0 {
Jooyung Han75de2612020-01-24 02:02:45 +0900249 // For flattened apexes, compat symlinks are attached to apex_manifest.json which is guaranteed for every apex
250 postInstallCommands = append(postInstallCommands, a.compatSymlinks...)
251 }
252 }
253 if len(postInstallCommands) > 0 {
Jiyong Park7cd10e32020-01-14 09:22:18 +0900254 fmt.Fprintln(w, "LOCAL_POST_INSTALL_CMD :=", strings.Join(postInstallCommands, " && "))
Jiyong Park0abc1b42020-01-09 17:43:39 +0900255 }
Jiyong Park09d77522019-11-18 11:16:27 +0900256 }
257 fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
258 }
Jiyong Park31af2672020-02-11 09:36:25 +0900259
260 // m <module_name> will build <module_name>.<apex_name> as well.
Yo Chiange8128052020-07-23 20:09:18 +0800261 if fi.androidMkModuleName != moduleName && a.primaryApexType {
262 fmt.Fprintf(w, ".PHONY: %s\n", fi.androidMkModuleName)
263 fmt.Fprintf(w, "%s: %s\n", fi.androidMkModuleName, moduleName)
Jiyong Park31af2672020-02-11 09:36:25 +0900264 }
Jiyong Park09d77522019-11-18 11:16:27 +0900265 }
266 return moduleNames
267}
268
Jiyong Park7afd1072019-12-30 16:56:33 +0900269func (a *apexBundle) writeRequiredModules(w io.Writer) {
270 var required []string
271 var targetRequired []string
272 var hostRequired []string
273 for _, fi := range a.filesInfo {
274 required = append(required, fi.requiredModuleNames...)
275 targetRequired = append(targetRequired, fi.targetRequiredModuleNames...)
276 hostRequired = append(hostRequired, fi.hostRequiredModuleNames...)
277 }
278
279 if len(required) > 0 {
280 fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(required, " "))
281 }
282 if len(targetRequired) > 0 {
283 fmt.Fprintln(w, "LOCAL_TARGET_REQUIRED_MODULES +=", strings.Join(targetRequired, " "))
284 }
285 if len(hostRequired) > 0 {
286 fmt.Fprintln(w, "LOCAL_HOST_REQUIRED_MODULES +=", strings.Join(hostRequired, " "))
287 }
288}
289
Jiyong Park09d77522019-11-18 11:16:27 +0900290func (a *apexBundle) androidMkForType() android.AndroidMkData {
291 return android.AndroidMkData{
292 Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
293 moduleNames := []string{}
294 apexType := a.properties.ApexType
295 if a.installable() {
296 apexName := proptools.StringDefault(a.properties.Apex_name, name)
Jiyong Parkdb334862020-02-05 17:19:28 +0900297 moduleNames = a.androidMkForFiles(w, name, apexName, moduleDir)
Jiyong Park09d77522019-11-18 11:16:27 +0900298 }
299
300 if apexType == flattenedApex {
301 // Only image APEXes can be flattened.
302 fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)")
303 fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
304 fmt.Fprintln(w, "LOCAL_MODULE :=", name+a.suffix)
305 if len(moduleNames) > 0 {
306 fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", strings.Join(moduleNames, " "))
307 }
Jiyong Park7afd1072019-12-30 16:56:33 +0900308 a.writeRequiredModules(w)
Jiyong Park09d77522019-11-18 11:16:27 +0900309 fmt.Fprintln(w, "include $(BUILD_PHONY_PACKAGE)")
Jiyong Park09d77522019-11-18 11:16:27 +0900310
311 } else {
312 fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)")
313 fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
314 fmt.Fprintln(w, "LOCAL_MODULE :=", name+a.suffix)
315 fmt.Fprintln(w, "LOCAL_MODULE_CLASS := ETC") // do we need a new class?
316 fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", a.outputFile.String())
317 fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", a.installDir.ToMakePath().String())
318 fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", name+apexType.suffix())
319 fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !a.installable())
Jooyung Han2ed99d02020-06-24 23:26:26 +0900320
321 // Because apex writes .mk with Custom(), we need to write manually some common properties
322 // which are available via data.Entries
323 commonProperties := []string{
324 "LOCAL_INIT_RC", "LOCAL_VINTF_FRAGMENTS",
325 "LOCAL_PROPRIETARY_MODULE", "LOCAL_VENDOR_MODULE", "LOCAL_ODM_MODULE", "LOCAL_PRODUCT_MODULE", "LOCAL_SYSTEM_EXT_MODULE",
326 "LOCAL_MODULE_OWNER",
327 }
328 for _, name := range commonProperties {
329 if value, ok := data.Entries.EntryMap[name]; ok {
330 fmt.Fprintln(w, name+" := "+strings.Join(value, " "))
331 }
332 }
333
Yo Chiang12d9f7a2020-06-16 17:32:19 +0800334 if len(a.overridableProperties.Overrides) > 0 {
335 fmt.Fprintln(w, "LOCAL_OVERRIDES_MODULES :=", strings.Join(a.overridableProperties.Overrides, " "))
336 }
Jiyong Park09d77522019-11-18 11:16:27 +0900337 if len(moduleNames) > 0 {
338 fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(moduleNames, " "))
339 }
Jiyong Park956305c2020-01-09 12:32:06 +0900340 if len(a.requiredDeps) > 0 {
341 fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(a.requiredDeps, " "))
Jiyong Park09d77522019-11-18 11:16:27 +0900342 }
Jiyong Park7afd1072019-12-30 16:56:33 +0900343 a.writeRequiredModules(w)
Jiyong Park09d77522019-11-18 11:16:27 +0900344 var postInstallCommands []string
345 if a.prebuiltFileToDelete != "" {
346 postInstallCommands = append(postInstallCommands, "rm -rf "+
347 filepath.Join(a.installDir.ToMakePath().String(), a.prebuiltFileToDelete))
348 }
349 // For unflattened apexes, compat symlinks are attached to apex package itself as LOCAL_POST_INSTALL_CMD
350 postInstallCommands = append(postInstallCommands, a.compatSymlinks...)
351 if len(postInstallCommands) > 0 {
352 fmt.Fprintln(w, "LOCAL_POST_INSTALL_CMD :=", strings.Join(postInstallCommands, " && "))
353 }
Jiyong Park19972c72020-01-28 20:05:29 +0900354
355 if a.mergedNotices.Merged.Valid() {
356 fmt.Fprintln(w, "LOCAL_NOTICE_FILE :=", a.mergedNotices.Merged.Path().String())
357 }
358
Jiyong Park09d77522019-11-18 11:16:27 +0900359 fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
360
361 if apexType == imageApex {
Yo Chiangef2d4892020-05-08 15:38:40 +0800362 fmt.Fprintln(w, "ALL_MODULES.$(my_register_name).BUNDLE :=", a.bundleModuleFile.String())
Jiyong Park09d77522019-11-18 11:16:27 +0900363 }
Colin Cross08dca382020-07-21 20:31:17 -0700364 if len(a.lintReports) > 0 {
365 fmt.Fprintln(w, "ALL_MODULES.$(my_register_name).LINT_REPORTS :=",
366 strings.Join(a.lintReports.Strings(), " "))
367 }
Jiyong Park3a1602e2020-01-14 14:39:19 +0900368
369 if a.installedFilesFile != nil {
Colin Cross1c85e8e2020-02-26 16:55:51 -0800370 goal := "checkbuild"
Jiyong Park3a1602e2020-01-14 14:39:19 +0900371 distFile := name + "-installed-files.txt"
372 fmt.Fprintln(w, ".PHONY:", goal)
373 fmt.Fprintf(w, "$(call dist-for-goals,%s,%s:%s)\n",
374 goal, a.installedFilesFile.String(), distFile)
375 }
Jiyong Park09d77522019-11-18 11:16:27 +0900376 }
377 }}
378}