aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorYu Liu <yudiliu@google.com>2021-11-23 14:53:41 -0800
committerYu Liu <yudiliu@google.com>2021-12-02 14:42:20 -0800
commitb302455879381388ab82c0cf7b4632c68dc882b7 (patch)
tree5e3bbe4d6613262a71da22373bf8f347e46f7135 /sh
parenta5524e3272e534cd05c4432e2af93148b4e3f007 (diff)
downloadsoong-b302455879381388ab82c0cf7b4632c68dc882b7.tar.gz
Support filename and sub_dir attributes in sh_binary
Test: test by building system/timezone/apex:com.android.tzdata Change-Id: I08114910fccbdacf6750e237d3e80ba37fde7651
Diffstat (limited to 'sh')
-rw-r--r--sh/sh_binary.go21
1 files changed, 18 insertions, 3 deletions
diff --git a/sh/sh_binary.go b/sh/sh_binary.go
index c32cde01e..a87b9cf4c 100644
--- a/sh/sh_binary.go
+++ b/sh/sh_binary.go
@@ -516,7 +516,9 @@ func ShTestHostFactory() android.Module {
}
type bazelShBinaryAttributes struct {
- Srcs bazel.LabelListAttribute
+ Srcs bazel.LabelListAttribute
+ Filename string
+ Sub_dir string
// Bazel also supports the attributes below, but (so far) these are not required for Bionic
// deps
// data
@@ -547,12 +549,25 @@ func ShBinaryBp2Build(ctx android.TopDownMutatorContext) {
srcs := bazel.MakeLabelListAttribute(
android.BazelLabelForModuleSrc(ctx, []string{*m.properties.Src}))
+ var filename string
+ if m.properties.Filename != nil {
+ filename = *m.properties.Filename
+ }
+
+ var subDir string
+ if m.properties.Sub_dir != nil {
+ subDir = *m.properties.Sub_dir
+ }
+
attrs := &bazelShBinaryAttributes{
- Srcs: srcs,
+ Srcs: srcs,
+ Filename: filename,
+ Sub_dir: subDir,
}
props := bazel.BazelTargetModuleProperties{
- Rule_class: "sh_binary",
+ Rule_class: "sh_binary",
+ Bzl_load_location: "//build/bazel/rules:sh_binary.bzl",
}
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: m.Name()}, attrs)