Avoid duplicate genrule locations
The bp2build build is failing with:
ERROR: /buildbot/src/android/master/out/soong/workspace/bionic/libc/BUILD.bazel:3187:8: Label '//bionic/libc:execinfo/include/execinfo.h' is duplicated in the 'srcs' attribute of rule 'libc_musl_sysroot_bionic_headers'
ERROR: /buildbot/src/android/master/out/soong/workspace/bionic/libc/BUILD.bazel:3187:8: Label '//bionic/libc:kernel/android/uapi/linux/compiler.h' is duplicated in the 'srcs' attribute of rule 'libc_musl_sysroot_bionic_headers'
ERROR: /buildbot/src/android/master/out/soong/workspace/bionic/libc/BUILD.bazel:3187:8: Label '//bionic/libc:b64/include/bionic/b64.h' is duplicated in the 'srcs' attribute of rule 'libc_musl_sysroot_bionic_headers'
ERROR: /buildbot/src/android/master/out/soong/workspace/bionic/libc/BUILD.bazel:3187:8: Label '//bionic/libc:kernel/uapi/linux/capability.h' is duplicated in the 'srcs' attribute of rule 'libc_musl_sysroot_bionic_headers'
ERROR: /buildbot/src/android/master/out/soong/workspace/bionic/libc/BUILD.bazel:3187:8: Label '//bionic/libc:kernel/android/scsi/scsi/scsi.h' is duplicated in the 'srcs' attribute of rule 'libc_musl_sysroot_bionic_headers'
Rewrite the genrule to avoid referring to the same header twice by
using the NOTICE file as a known location in the bionic/libc directory.
Bug: 190084016
Bug: 218405924
Test: libc_musl_sysroot.zip has same contents
Change-Id: Id1a0484a3ed623bcc03b015d02eef19bbb31c06a
diff --git a/libc/Android.bp b/libc/Android.bp
index 84f5fbd..f45b044 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -2636,16 +2636,12 @@
srcs: [
"kernel/uapi/**/*.h",
"kernel/android/**/*.h",
-
- "kernel/uapi/linux/capability.h",
- "kernel/android/scsi/scsi/scsi.h",
- "kernel/android/uapi/linux/compiler.h",
-
"execinfo/include/**/*.h",
- "execinfo/include/execinfo.h",
-
"b64/include/**/*.h",
- "b64/include/bionic/b64.h",
+
+ // This file is used to identify the location of the bionic/libc directory
+ // to simplify accessing the rest of the files.
+ "NOTICE",
":libc_musl_sysroot_bionic_arch_headers",
],
@@ -2655,19 +2651,20 @@
"merge_zips",
"zip2zip",
],
- cmd: "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
+ cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " +
+ "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
// headers
" -P include " +
- " -C $$(dirname $(location kernel/uapi/linux/capability.h))/.. " +
- " -D $$(dirname $(location kernel/uapi/linux/capability.h))/.. " +
- " -C $$(dirname $(location kernel/android/scsi/scsi/scsi.h))/.. " +
- " -D $$(dirname $(location kernel/android/scsi/scsi/scsi.h))/.. " +
- " -C $$(dirname $(location kernel/android/uapi/linux/compiler.h))/.. " +
- " -D $$(dirname $(location kernel/android/uapi/linux/compiler.h))/.. " +
- " -C $$(dirname $(location execinfo/include/execinfo.h)) " +
- " -D $$(dirname $(location execinfo/include/execinfo.h)) " +
- " -C $$(dirname $(location b64/include/bionic/b64.h))/.. " +
- " -D $$(dirname $(location b64/include/bionic/b64.h))/.. " +
+ " -C $${BIONIC_LIBC_DIR}/kernel/uapi " +
+ " -D $${BIONIC_LIBC_DIR}/kernel/uapi " +
+ " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
+ " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
+ " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
+ " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
+ " -C $${BIONIC_LIBC_DIR}/execinfo/include " +
+ " -D $${BIONIC_LIBC_DIR}/execinfo/include " +
+ " -C $${BIONIC_LIBC_DIR}/b64/include " +
+ " -D $${BIONIC_LIBC_DIR}/b64/include " +
" && " +
"$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot.zip",
}