summaryrefslogtreecommitdiff
path: root/android/packaging.go
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2024-01-03 15:16:55 -0800
committer Cole Faust <colefaust@google.com> 2024-01-03 15:22:32 -0800
commit3b3a0114089ca97ac36ca37a4cea72f98a2018bb (patch)
treed95dc176070b0da6afb6fe87d3c18957ff461f4e /android/packaging.go
parent36ce95848b0e3da31d379086b7a55cd1ba1d31da (diff)
Check for errors in preparer.sh
In case any of the commands fail. Also skip writing out empty preparer.sh files. Bug: 314933937 Test: Presubmits Change-Id: Ia94d032bc4800379608d8a3cf594f25951a3ab32
Diffstat (limited to 'android/packaging.go')
-rw-r--r--android/packaging.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/android/packaging.go b/android/packaging.go
index 2506378d7..8873540c5 100644
--- a/android/packaging.go
+++ b/android/packaging.go
@@ -240,10 +240,14 @@ func (p *PackagingBase) GatherPackagingSpecs(ctx ModuleContext) map[string]Packa
// CopySpecsToDir is a helper that will add commands to the rule builder to copy the PackagingSpec
// entries into the specified directory.
func (p *PackagingBase) CopySpecsToDir(ctx ModuleContext, builder *RuleBuilder, specs map[string]PackagingSpec, dir WritablePath) (entries []string) {
+ if len(specs) == 0 {
+ return entries
+ }
seenDir := make(map[string]bool)
preparerPath := PathForModuleOut(ctx, "preparer.sh")
cmd := builder.Command().Tool(preparerPath)
var sb strings.Builder
+ sb.WriteString("set -e\n")
for _, k := range SortedKeys(specs) {
ps := specs[k]
destPath := filepath.Join(dir.String(), ps.relPathInPackage)