From 3d64d494d2357f78e4e4117617ce1f04005306ea Mon Sep 17 00:00:00 2001 From: Yo Chiang Date: Wed, 27 May 2020 17:56:39 +0800 Subject: [PATCH] Add symlinks support for prebuilt_etc modules Filenames specified in the "symlinks" property are passed to LOCAL_MODULE_SYMLINKS, and kati would install these symlinks. For example: ``` prebuilt_etc { name: "foo", symlinks: [ "bar", "baz", ], } ``` Installs these files on device: - system/etc/foo - system/etc/bar -> foo - system/etc/baz -> foo Bug: 157537895 Test: Add some symlinks to a prebuilt_etc module and check artifact Change-Id: If50844e8a212a966be931117cfdff5bf73aadf25 --- android/prebuilt_etc.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/android/prebuilt_etc.go b/android/prebuilt_etc.go index 3dea6d8f6..f0c0767b6 100644 --- a/android/prebuilt_etc.go +++ b/android/prebuilt_etc.go @@ -49,6 +49,9 @@ type prebuiltEtcProperties struct { // Whether this module is directly installable to one of the partitions. Default: true. Installable *bool + + // Install symlinks to the installed file. + Symlinks []string `android:"arch_variant"` } type PrebuiltEtcModule interface { @@ -201,10 +204,13 @@ func (p *PrebuiltEtc) AndroidMkEntries() []AndroidMkEntries { entries.SetString("LOCAL_MODULE_TAGS", "optional") entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePath.Base()) + if len(p.properties.Symlinks) > 0 { + entries.AddStrings("LOCAL_MODULE_SYMLINKS", p.properties.Symlinks...) + } entries.SetString("LOCAL_UNINSTALLABLE_MODULE", strconv.FormatBool(!p.Installable())) if p.additionalDependencies != nil { for _, path := range *p.additionalDependencies { - entries.SetString("LOCAL_ADDITIONAL_DEPENDENCIES", path.String()) + entries.AddStrings("LOCAL_ADDITIONAL_DEPENDENCIES", path.String()) } } },