sh_binary.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. // Copyright 2019 Google Inc. All rights reserved.
  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. package sh
  15. import (
  16. "fmt"
  17. "path/filepath"
  18. "sort"
  19. "strings"
  20. "github.com/google/blueprint"
  21. "github.com/google/blueprint/proptools"
  22. "android/soong/android"
  23. "android/soong/bazel"
  24. "android/soong/cc"
  25. "android/soong/snapshot"
  26. "android/soong/tradefed"
  27. )
  28. // sh_binary is for shell scripts (and batch files) that are installed as
  29. // executable files into .../bin/
  30. //
  31. // Do not use them for prebuilt C/C++/etc files. Use cc_prebuilt_binary
  32. // instead.
  33. var pctx = android.NewPackageContext("android/soong/sh")
  34. func init() {
  35. pctx.Import("android/soong/android")
  36. registerShBuildComponents(android.InitRegistrationContext)
  37. }
  38. func registerShBuildComponents(ctx android.RegistrationContext) {
  39. ctx.RegisterModuleType("sh_binary", ShBinaryFactory)
  40. ctx.RegisterModuleType("sh_binary_host", ShBinaryHostFactory)
  41. ctx.RegisterModuleType("sh_test", ShTestFactory)
  42. ctx.RegisterModuleType("sh_test_host", ShTestHostFactory)
  43. }
  44. // Test fixture preparer that will register most sh build components.
  45. //
  46. // Singletons and mutators should only be added here if they are needed for a majority of sh
  47. // module types, otherwise they should be added under a separate preparer to allow them to be
  48. // selected only when needed to reduce test execution time.
  49. //
  50. // Module types do not have much of an overhead unless they are used so this should include as many
  51. // module types as possible. The exceptions are those module types that require mutators and/or
  52. // singletons in order to function in which case they should be kept together in a separate
  53. // preparer.
  54. var PrepareForTestWithShBuildComponents = android.GroupFixturePreparers(
  55. android.FixtureRegisterWithContext(registerShBuildComponents),
  56. )
  57. type shBinaryProperties struct {
  58. // Source file of this prebuilt.
  59. Src *string `android:"path,arch_variant"`
  60. // optional subdirectory under which this file is installed into
  61. Sub_dir *string `android:"arch_variant"`
  62. // optional name for the installed file. If unspecified, name of the module is used as the file name
  63. Filename *string `android:"arch_variant"`
  64. // when set to true, and filename property is not set, the name for the installed file
  65. // is the same as the file name of the source file.
  66. Filename_from_src *bool `android:"arch_variant"`
  67. // Whether this module is directly installable to one of the partitions. Default: true.
  68. Installable *bool
  69. // install symlinks to the binary
  70. Symlinks []string `android:"arch_variant"`
  71. // Make this module available when building for ramdisk.
  72. // On device without a dedicated recovery partition, the module is only
  73. // available after switching root into
  74. // /first_stage_ramdisk. To expose the module before switching root, install
  75. // the recovery variant instead.
  76. Ramdisk_available *bool
  77. // Make this module available when building for vendor ramdisk.
  78. // On device without a dedicated recovery partition, the module is only
  79. // available after switching root into
  80. // /first_stage_ramdisk. To expose the module before switching root, install
  81. // the recovery variant instead.
  82. Vendor_ramdisk_available *bool
  83. // Make this module available when building for recovery.
  84. Recovery_available *bool
  85. }
  86. type TestProperties struct {
  87. // list of compatibility suites (for example "cts", "vts") that the module should be
  88. // installed into.
  89. Test_suites []string `android:"arch_variant"`
  90. // the name of the test configuration (for example "AndroidTest.xml") that should be
  91. // installed with the module.
  92. Test_config *string `android:"path,arch_variant"`
  93. // list of files or filegroup modules that provide data that should be installed alongside
  94. // the test.
  95. Data []string `android:"path,arch_variant"`
  96. // Add RootTargetPreparer to auto generated test config. This guarantees the test to run
  97. // with root permission.
  98. Require_root *bool
  99. // the name of the test configuration template (for example "AndroidTestTemplate.xml") that
  100. // should be installed with the module.
  101. Test_config_template *string `android:"path,arch_variant"`
  102. // Flag to indicate whether or not to create test config automatically. If AndroidTest.xml
  103. // doesn't exist next to the Android.bp, this attribute doesn't need to be set to true
  104. // explicitly.
  105. Auto_gen_config *bool
  106. // list of binary modules that should be installed alongside the test
  107. Data_bins []string `android:"path,arch_variant"`
  108. // list of library modules that should be installed alongside the test
  109. Data_libs []string `android:"path,arch_variant"`
  110. // list of device binary modules that should be installed alongside the test.
  111. // Only available for host sh_test modules.
  112. Data_device_bins []string `android:"path,arch_variant"`
  113. // list of device library modules that should be installed alongside the test.
  114. // Only available for host sh_test modules.
  115. Data_device_libs []string `android:"path,arch_variant"`
  116. // Install the test into a folder named for the module in all test suites.
  117. Per_testcase_directory *bool
  118. // Test options.
  119. Test_options android.CommonTestOptions
  120. }
  121. type ShBinary struct {
  122. android.ModuleBase
  123. android.BazelModuleBase
  124. properties shBinaryProperties
  125. sourceFilePath android.Path
  126. outputFilePath android.OutputPath
  127. installedFile android.InstallPath
  128. }
  129. var _ android.HostToolProvider = (*ShBinary)(nil)
  130. type ShTest struct {
  131. ShBinary
  132. testProperties TestProperties
  133. installDir android.InstallPath
  134. data android.Paths
  135. testConfig android.Path
  136. dataModules map[string]android.Path
  137. }
  138. func (s *ShBinary) HostToolPath() android.OptionalPath {
  139. return android.OptionalPathForPath(s.installedFile)
  140. }
  141. func (s *ShBinary) DepsMutator(ctx android.BottomUpMutatorContext) {
  142. }
  143. func (s *ShBinary) OutputFile() android.OutputPath {
  144. return s.outputFilePath
  145. }
  146. func (s *ShBinary) SubDir() string {
  147. return proptools.String(s.properties.Sub_dir)
  148. }
  149. func (s *ShBinary) RelativeInstallPath() string {
  150. return s.SubDir()
  151. }
  152. func (s *ShBinary) Installable() bool {
  153. return s.properties.Installable == nil || proptools.Bool(s.properties.Installable)
  154. }
  155. func (s *ShBinary) Symlinks() []string {
  156. return s.properties.Symlinks
  157. }
  158. var _ android.ImageInterface = (*ShBinary)(nil)
  159. func (s *ShBinary) ImageMutatorBegin(ctx android.BaseModuleContext) {}
  160. func (s *ShBinary) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
  161. return !s.ModuleBase.InstallInRecovery() && !s.ModuleBase.InstallInRamdisk()
  162. }
  163. func (s *ShBinary) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
  164. return proptools.Bool(s.properties.Ramdisk_available) || s.ModuleBase.InstallInRamdisk()
  165. }
  166. func (s *ShBinary) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
  167. return proptools.Bool(s.properties.Vendor_ramdisk_available) || s.ModuleBase.InstallInVendorRamdisk()
  168. }
  169. func (s *ShBinary) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
  170. return false
  171. }
  172. func (s *ShBinary) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
  173. return proptools.Bool(s.properties.Recovery_available) || s.ModuleBase.InstallInRecovery()
  174. }
  175. func (s *ShBinary) ExtraImageVariations(ctx android.BaseModuleContext) []string {
  176. return nil
  177. }
  178. func (s *ShBinary) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
  179. }
  180. func (s *ShBinary) generateAndroidBuildActions(ctx android.ModuleContext) {
  181. if s.properties.Src == nil {
  182. ctx.PropertyErrorf("src", "missing prebuilt source file")
  183. }
  184. s.sourceFilePath = android.PathForModuleSrc(ctx, proptools.String(s.properties.Src))
  185. filename := proptools.String(s.properties.Filename)
  186. filenameFromSrc := proptools.Bool(s.properties.Filename_from_src)
  187. if filename == "" {
  188. if filenameFromSrc {
  189. filename = s.sourceFilePath.Base()
  190. } else {
  191. filename = ctx.ModuleName()
  192. }
  193. } else if filenameFromSrc {
  194. ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true")
  195. return
  196. }
  197. s.outputFilePath = android.PathForModuleOut(ctx, filename).OutputPath
  198. // This ensures that outputFilePath has the correct name for others to
  199. // use, as the source file may have a different name.
  200. ctx.Build(pctx, android.BuildParams{
  201. Rule: android.CpExecutable,
  202. Output: s.outputFilePath,
  203. Input: s.sourceFilePath,
  204. })
  205. }
  206. func (s *ShBinary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
  207. s.generateAndroidBuildActions(ctx)
  208. installDir := android.PathForModuleInstall(ctx, "bin", proptools.String(s.properties.Sub_dir))
  209. if !s.Installable() {
  210. s.SkipInstall()
  211. }
  212. s.installedFile = ctx.InstallExecutable(installDir, s.outputFilePath.Base(), s.outputFilePath)
  213. for _, symlink := range s.Symlinks() {
  214. ctx.InstallSymlink(installDir, symlink, s.installedFile)
  215. }
  216. }
  217. func (s *ShBinary) AndroidMkEntries() []android.AndroidMkEntries {
  218. return []android.AndroidMkEntries{android.AndroidMkEntries{
  219. Class: "EXECUTABLES",
  220. OutputFile: android.OptionalPathForPath(s.outputFilePath),
  221. Include: "$(BUILD_SYSTEM)/soong_cc_rust_prebuilt.mk",
  222. ExtraEntries: []android.AndroidMkExtraEntriesFunc{
  223. func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
  224. s.customAndroidMkEntries(entries)
  225. entries.SetString("LOCAL_MODULE_RELATIVE_PATH", proptools.String(s.properties.Sub_dir))
  226. entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !s.Installable())
  227. },
  228. },
  229. }}
  230. }
  231. func (s *ShBinary) customAndroidMkEntries(entries *android.AndroidMkEntries) {
  232. entries.SetString("LOCAL_MODULE_SUFFIX", "")
  233. entries.SetString("LOCAL_MODULE_STEM", s.outputFilePath.Rel())
  234. if len(s.properties.Symlinks) > 0 {
  235. entries.SetString("LOCAL_MODULE_SYMLINKS", strings.Join(s.properties.Symlinks, " "))
  236. }
  237. }
  238. type dependencyTag struct {
  239. blueprint.BaseDependencyTag
  240. name string
  241. }
  242. var (
  243. shTestDataBinsTag = dependencyTag{name: "dataBins"}
  244. shTestDataLibsTag = dependencyTag{name: "dataLibs"}
  245. shTestDataDeviceBinsTag = dependencyTag{name: "dataDeviceBins"}
  246. shTestDataDeviceLibsTag = dependencyTag{name: "dataDeviceLibs"}
  247. )
  248. var sharedLibVariations = []blueprint.Variation{{Mutator: "link", Variation: "shared"}}
  249. func (s *ShTest) DepsMutator(ctx android.BottomUpMutatorContext) {
  250. s.ShBinary.DepsMutator(ctx)
  251. ctx.AddFarVariationDependencies(ctx.Target().Variations(), shTestDataBinsTag, s.testProperties.Data_bins...)
  252. ctx.AddFarVariationDependencies(append(ctx.Target().Variations(), sharedLibVariations...),
  253. shTestDataLibsTag, s.testProperties.Data_libs...)
  254. if ctx.Target().Os.Class == android.Host && len(ctx.Config().Targets[android.Android]) > 0 {
  255. deviceVariations := ctx.Config().AndroidFirstDeviceTarget.Variations()
  256. ctx.AddFarVariationDependencies(deviceVariations, shTestDataDeviceBinsTag, s.testProperties.Data_device_bins...)
  257. ctx.AddFarVariationDependencies(append(deviceVariations, sharedLibVariations...),
  258. shTestDataDeviceLibsTag, s.testProperties.Data_device_libs...)
  259. } else if ctx.Target().Os.Class != android.Host {
  260. if len(s.testProperties.Data_device_bins) > 0 {
  261. ctx.PropertyErrorf("data_device_bins", "only available for host modules")
  262. }
  263. if len(s.testProperties.Data_device_libs) > 0 {
  264. ctx.PropertyErrorf("data_device_libs", "only available for host modules")
  265. }
  266. }
  267. }
  268. func (s *ShTest) addToDataModules(ctx android.ModuleContext, relPath string, path android.Path) {
  269. if _, exists := s.dataModules[relPath]; exists {
  270. ctx.ModuleErrorf("data modules have a conflicting installation path, %v - %s, %s",
  271. relPath, s.dataModules[relPath].String(), path.String())
  272. return
  273. }
  274. s.dataModules[relPath] = path
  275. }
  276. func (s *ShTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
  277. s.ShBinary.generateAndroidBuildActions(ctx)
  278. testDir := "nativetest"
  279. if ctx.Target().Arch.ArchType.Multilib == "lib64" {
  280. testDir = "nativetest64"
  281. }
  282. if ctx.Target().NativeBridge == android.NativeBridgeEnabled {
  283. testDir = filepath.Join(testDir, ctx.Target().NativeBridgeRelativePath)
  284. } else if !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) {
  285. testDir = filepath.Join(testDir, ctx.Arch().ArchType.String())
  286. }
  287. if s.SubDir() != "" {
  288. // Don't add the module name to the installation path if sub_dir is specified for backward
  289. // compatibility.
  290. s.installDir = android.PathForModuleInstall(ctx, testDir, s.SubDir())
  291. } else {
  292. s.installDir = android.PathForModuleInstall(ctx, testDir, s.Name())
  293. }
  294. s.installedFile = ctx.InstallExecutable(s.installDir, s.outputFilePath.Base(), s.outputFilePath)
  295. s.data = android.PathsForModuleSrc(ctx, s.testProperties.Data)
  296. var configs []tradefed.Config
  297. if Bool(s.testProperties.Require_root) {
  298. configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.RootTargetPreparer", nil})
  299. } else {
  300. options := []tradefed.Option{{Name: "force-root", Value: "false"}}
  301. configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.RootTargetPreparer", options})
  302. }
  303. if len(s.testProperties.Data_device_bins) > 0 {
  304. moduleName := s.Name()
  305. remoteDir := "/data/local/tests/unrestricted/" + moduleName + "/"
  306. options := []tradefed.Option{{Name: "cleanup", Value: "true"}}
  307. for _, bin := range s.testProperties.Data_device_bins {
  308. options = append(options, tradefed.Option{Name: "push-file", Key: bin, Value: remoteDir + bin})
  309. }
  310. configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.PushFilePreparer", options})
  311. }
  312. s.testConfig = tradefed.AutoGenShellTestConfig(ctx, s.testProperties.Test_config,
  313. s.testProperties.Test_config_template, s.testProperties.Test_suites, configs, s.testProperties.Auto_gen_config, s.outputFilePath.Base())
  314. s.dataModules = make(map[string]android.Path)
  315. ctx.VisitDirectDeps(func(dep android.Module) {
  316. depTag := ctx.OtherModuleDependencyTag(dep)
  317. switch depTag {
  318. case shTestDataBinsTag, shTestDataDeviceBinsTag:
  319. path := android.OutputFileForModule(ctx, dep, "")
  320. s.addToDataModules(ctx, path.Base(), path)
  321. case shTestDataLibsTag, shTestDataDeviceLibsTag:
  322. if cc, isCc := dep.(*cc.Module); isCc {
  323. // Copy to an intermediate output directory to append "lib[64]" to the path,
  324. // so that it's compatible with the default rpath values.
  325. var relPath string
  326. if cc.Arch().ArchType.Multilib == "lib64" {
  327. relPath = filepath.Join("lib64", cc.OutputFile().Path().Base())
  328. } else {
  329. relPath = filepath.Join("lib", cc.OutputFile().Path().Base())
  330. }
  331. if _, exist := s.dataModules[relPath]; exist {
  332. return
  333. }
  334. relocatedLib := android.PathForModuleOut(ctx, "relocated", relPath)
  335. ctx.Build(pctx, android.BuildParams{
  336. Rule: android.Cp,
  337. Input: cc.OutputFile().Path(),
  338. Output: relocatedLib,
  339. })
  340. s.addToDataModules(ctx, relPath, relocatedLib)
  341. return
  342. }
  343. property := "data_libs"
  344. if depTag == shTestDataDeviceBinsTag {
  345. property = "data_device_libs"
  346. }
  347. ctx.PropertyErrorf(property, "%q of type %q is not supported", dep.Name(), ctx.OtherModuleType(dep))
  348. }
  349. })
  350. }
  351. func (s *ShTest) InstallInData() bool {
  352. return true
  353. }
  354. func (s *ShTest) AndroidMkEntries() []android.AndroidMkEntries {
  355. return []android.AndroidMkEntries{android.AndroidMkEntries{
  356. Class: "NATIVE_TESTS",
  357. OutputFile: android.OptionalPathForPath(s.outputFilePath),
  358. Include: "$(BUILD_SYSTEM)/soong_cc_rust_prebuilt.mk",
  359. ExtraEntries: []android.AndroidMkExtraEntriesFunc{
  360. func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
  361. s.customAndroidMkEntries(entries)
  362. entries.SetPath("LOCAL_MODULE_PATH", s.installDir)
  363. entries.AddCompatibilityTestSuites(s.testProperties.Test_suites...)
  364. if s.testConfig != nil {
  365. entries.SetPath("LOCAL_FULL_TEST_CONFIG", s.testConfig)
  366. }
  367. for _, d := range s.data {
  368. rel := d.Rel()
  369. path := d.String()
  370. if !strings.HasSuffix(path, rel) {
  371. panic(fmt.Errorf("path %q does not end with %q", path, rel))
  372. }
  373. path = strings.TrimSuffix(path, rel)
  374. entries.AddStrings("LOCAL_TEST_DATA", path+":"+rel)
  375. }
  376. relPaths := make([]string, 0)
  377. for relPath, _ := range s.dataModules {
  378. relPaths = append(relPaths, relPath)
  379. }
  380. sort.Strings(relPaths)
  381. for _, relPath := range relPaths {
  382. dir := strings.TrimSuffix(s.dataModules[relPath].String(), relPath)
  383. entries.AddStrings("LOCAL_TEST_DATA", dir+":"+relPath)
  384. }
  385. if s.testProperties.Data_bins != nil {
  386. entries.AddStrings("LOCAL_TEST_DATA_BINS", s.testProperties.Data_bins...)
  387. }
  388. entries.SetBoolIfTrue("LOCAL_COMPATIBILITY_PER_TESTCASE_DIRECTORY", Bool(s.testProperties.Per_testcase_directory))
  389. s.testProperties.Test_options.SetAndroidMkEntries(entries)
  390. },
  391. },
  392. }}
  393. }
  394. func InitShBinaryModule(s *ShBinary) {
  395. s.AddProperties(&s.properties)
  396. android.InitBazelModule(s)
  397. }
  398. // sh_binary is for a shell script or batch file to be installed as an
  399. // executable binary to <partition>/bin.
  400. func ShBinaryFactory() android.Module {
  401. module := &ShBinary{}
  402. InitShBinaryModule(module)
  403. android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibFirst)
  404. return module
  405. }
  406. // sh_binary_host is for a shell script to be installed as an executable binary
  407. // to $(HOST_OUT)/bin.
  408. func ShBinaryHostFactory() android.Module {
  409. module := &ShBinary{}
  410. InitShBinaryModule(module)
  411. android.InitAndroidArchModule(module, android.HostSupported, android.MultilibFirst)
  412. return module
  413. }
  414. // sh_test defines a shell script based test module.
  415. func ShTestFactory() android.Module {
  416. module := &ShTest{}
  417. InitShBinaryModule(&module.ShBinary)
  418. module.AddProperties(&module.testProperties)
  419. android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibFirst)
  420. return module
  421. }
  422. // sh_test_host defines a shell script based test module that runs on a host.
  423. func ShTestHostFactory() android.Module {
  424. module := &ShTest{}
  425. InitShBinaryModule(&module.ShBinary)
  426. module.AddProperties(&module.testProperties)
  427. // Default sh_test_host to unit_tests = true
  428. if module.testProperties.Test_options.Unit_test == nil {
  429. module.testProperties.Test_options.Unit_test = proptools.BoolPtr(true)
  430. }
  431. android.InitAndroidArchModule(module, android.HostSupported, android.MultilibFirst)
  432. return module
  433. }
  434. type bazelShBinaryAttributes struct {
  435. Srcs bazel.LabelListAttribute
  436. Filename *string
  437. Sub_dir *string
  438. // Bazel also supports the attributes below, but (so far) these are not required for Bionic
  439. // deps
  440. // data
  441. // args
  442. // compatible_with
  443. // deprecation
  444. // distribs
  445. // env
  446. // exec_compatible_with
  447. // exec_properties
  448. // features
  449. // licenses
  450. // output_licenses
  451. // restricted_to
  452. // tags
  453. // target_compatible_with
  454. // testonly
  455. // toolchains
  456. // visibility
  457. }
  458. func (m *ShBinary) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
  459. srcs := bazel.MakeLabelListAttribute(
  460. android.BazelLabelForModuleSrc(ctx, []string{*m.properties.Src}))
  461. var filename *string
  462. if m.properties.Filename != nil {
  463. filename = m.properties.Filename
  464. }
  465. var subDir *string
  466. if m.properties.Sub_dir != nil {
  467. subDir = m.properties.Sub_dir
  468. }
  469. attrs := &bazelShBinaryAttributes{
  470. Srcs: srcs,
  471. Filename: filename,
  472. Sub_dir: subDir,
  473. }
  474. props := bazel.BazelTargetModuleProperties{
  475. Rule_class: "sh_binary",
  476. Bzl_load_location: "//build/bazel/rules:sh_binary.bzl",
  477. }
  478. ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: m.Name()}, attrs)
  479. }
  480. var Bool = proptools.Bool
  481. var _ snapshot.RelativeInstallPath = (*ShBinary)(nil)