Refactor the bp file to avoid arch variant in cc_genrule.

The arch variant of genrule.out will be soon disallowed in soong.

Bug: 253645813
Test: Manually build.
Change-Id: I2d5daa67b4e10f4abddebc98775df18df485843f
This commit is contained in:
Yu Liu 2022-10-17 16:36:30 -07:00
parent 8333532f3b
commit 938ec9b7e8
1 changed files with 221 additions and 164 deletions

View File

@ -2507,13 +2507,8 @@ genrule {
cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)", cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
} }
cc_genrule { filegroup {
name: "libseccomp_policy_app_zygote_sources", name: "seccomp_syscalls_sources_zygote",
recovery_available: true,
cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
tools: [ "genseccomp" ],
srcs: [ srcs: [
"SYSCALLS.TXT", "SYSCALLS.TXT",
"SECCOMP_ALLOWLIST_COMMON.TXT", "SECCOMP_ALLOWLIST_COMMON.TXT",
@ -2522,62 +2517,10 @@ cc_genrule {
"SECCOMP_PRIORITY.TXT", "SECCOMP_PRIORITY.TXT",
":generate_app_zygote_blocklist", ":generate_app_zygote_blocklist",
], ],
arch: {
arm: {
srcs: [
":libseccomp_gen_syscall_nrs_arm",
":libseccomp_gen_syscall_nrs_arm64",
],
out: [
"arm_app_zygote_policy.cpp",
"arm64_app_zygote_policy.cpp",
],
},
arm64: {
srcs: [
":libseccomp_gen_syscall_nrs_arm",
":libseccomp_gen_syscall_nrs_arm64",
],
out: [
"arm_app_zygote_policy.cpp",
"arm64_app_zygote_policy.cpp",
],
},
riscv64: {
srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
out: ["riscv64_app_zygote_policy.cpp"],
},
x86: {
srcs: [
":libseccomp_gen_syscall_nrs_x86",
":libseccomp_gen_syscall_nrs_x86_64",
],
out: [
"x86_app_zygote_policy.cpp",
"x86_64_app_zygote_policy.cpp",
],
},
x86_64: {
srcs: [
":libseccomp_gen_syscall_nrs_x86",
":libseccomp_gen_syscall_nrs_x86_64",
],
out: [
"x86_app_zygote_policy.cpp",
"x86_64_app_zygote_policy.cpp",
],
},
},
} }
cc_genrule { filegroup {
name: "libseccomp_policy_app_sources", name: "seccomp_syscalls_sources_app",
recovery_available: true,
cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
tools: [ "genseccomp" ],
srcs: [ srcs: [
"SYSCALLS.TXT", "SYSCALLS.TXT",
"SECCOMP_ALLOWLIST_COMMON.TXT", "SECCOMP_ALLOWLIST_COMMON.TXT",
@ -2586,62 +2529,10 @@ cc_genrule {
"SECCOMP_BLOCKLIST_APP.TXT", "SECCOMP_BLOCKLIST_APP.TXT",
"SECCOMP_PRIORITY.TXT", "SECCOMP_PRIORITY.TXT",
], ],
arch: {
arm: {
srcs: [
":libseccomp_gen_syscall_nrs_arm",
":libseccomp_gen_syscall_nrs_arm64",
],
out: [
"arm_app_policy.cpp",
"arm64_app_policy.cpp",
],
},
arm64: {
srcs: [
":libseccomp_gen_syscall_nrs_arm",
":libseccomp_gen_syscall_nrs_arm64",
],
out: [
"arm_app_policy.cpp",
"arm64_app_policy.cpp",
],
},
riscv64: {
srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
out: ["riscv64_app_policy.cpp"],
},
x86: {
srcs: [
":libseccomp_gen_syscall_nrs_x86",
":libseccomp_gen_syscall_nrs_x86_64",
],
out: [
"x86_app_policy.cpp",
"x86_64_app_policy.cpp",
],
},
x86_64: {
srcs: [
":libseccomp_gen_syscall_nrs_x86",
":libseccomp_gen_syscall_nrs_x86_64",
],
out: [
"x86_app_policy.cpp",
"x86_64_app_policy.cpp",
],
},
},
} }
cc_genrule { filegroup {
name: "libseccomp_policy_system_sources", name: "seccomp_syscalls_sources_system",
recovery_available: true,
cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
tools: [ "genseccomp" ],
srcs: [ srcs: [
"SYSCALLS.TXT", "SYSCALLS.TXT",
"SECCOMP_ALLOWLIST_COMMON.TXT", "SECCOMP_ALLOWLIST_COMMON.TXT",
@ -2649,34 +2540,135 @@ cc_genrule {
"SECCOMP_BLOCKLIST_COMMON.TXT", "SECCOMP_BLOCKLIST_COMMON.TXT",
"SECCOMP_PRIORITY.TXT", "SECCOMP_PRIORITY.TXT",
], ],
}
cc_genrule {
name: "libseccomp_policy_app_zygote_sources_x86",
recovery_available: true,
cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
tools: [ "genseccomp" ],
srcs: [
":seccomp_syscalls_sources_zygote",
":libseccomp_gen_syscall_nrs_x86",
":libseccomp_gen_syscall_nrs_x86_64",
],
out: [
"x86_app_zygote_policy.cpp",
"x86_64_app_zygote_policy.cpp",
],
enabled: false,
arch: { arch: {
arm: { x86: { enabled: true },
x86_64: { enabled: true },
},
}
cc_genrule {
name: "libseccomp_policy_app_zygote_sources_arm",
recovery_available: true,
cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
tools: [ "genseccomp" ],
srcs: [ srcs: [
":seccomp_syscalls_sources_zygote",
":libseccomp_gen_syscall_nrs_arm", ":libseccomp_gen_syscall_nrs_arm",
":libseccomp_gen_syscall_nrs_arm64", ":libseccomp_gen_syscall_nrs_arm64",
], ],
out: [ out: [
"arm_system_policy.cpp", "arm_app_zygote_policy.cpp",
"arm64_system_policy.cpp", "arm64_app_zygote_policy.cpp",
], ],
enabled: false,
arch: {
arm: { enabled: true },
arm64: { enabled: true },
}, },
arm64: { }
cc_genrule {
name: "libseccomp_policy_app_zygote_sources_riscv64",
recovery_available: true,
cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
tools: [ "genseccomp" ],
srcs: [ srcs: [
":seccomp_syscalls_sources_zygote",
":libseccomp_gen_syscall_nrs_riscv64",
],
out: [
"riscv64_app_zygote_policy.cpp",
],
enabled: false,
arch: {
riscv64: { enabled: true },
},
}
cc_genrule {
name: "libseccomp_policy_app_sources_x86",
recovery_available: true,
cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
tools: [ "genseccomp" ],
srcs: [
":seccomp_syscalls_sources_app",
":libseccomp_gen_syscall_nrs_x86",
":libseccomp_gen_syscall_nrs_x86_64",
],
out: [
"x86_app_policy.cpp",
"x86_64_app_policy.cpp",
],
enabled: false,
arch: {
x86: { enabled: true },
x86_64: { enabled: true },
},
}
cc_genrule {
name: "libseccomp_policy_app_sources_arm",
recovery_available: true,
cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
tools: [ "genseccomp" ],
srcs: [
":seccomp_syscalls_sources_app",
":libseccomp_gen_syscall_nrs_arm", ":libseccomp_gen_syscall_nrs_arm",
":libseccomp_gen_syscall_nrs_arm64", ":libseccomp_gen_syscall_nrs_arm64",
], ],
out: [ out: [
"arm_system_policy.cpp", "arm_app_policy.cpp",
"arm64_system_policy.cpp", "arm64_app_policy.cpp",
], ],
enabled: false,
arch: {
arm: { enabled: true },
arm64: { enabled: true },
}, },
riscv64: { }
srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
out: ["riscv64_system_policy.cpp"], cc_genrule {
}, name: "libseccomp_policy_app_sources_riscv64",
x86: { recovery_available: true,
cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
tools: [ "genseccomp" ],
srcs: [ srcs: [
":seccomp_syscalls_sources_app",
":libseccomp_gen_syscall_nrs_riscv64",
],
out: [
"riscv64_app_policy.cpp",
],
enabled: false,
arch: {
riscv64: { enabled: true },
},
}
cc_genrule {
name: "libseccomp_policy_system_sources_x86",
recovery_available: true,
cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
tools: [ "genseccomp" ],
srcs: [
":seccomp_syscalls_sources_system",
":libseccomp_gen_syscall_nrs_x86", ":libseccomp_gen_syscall_nrs_x86",
":libseccomp_gen_syscall_nrs_x86_64", ":libseccomp_gen_syscall_nrs_x86_64",
], ],
@ -2684,17 +2676,49 @@ cc_genrule {
"x86_system_policy.cpp", "x86_system_policy.cpp",
"x86_64_system_policy.cpp", "x86_64_system_policy.cpp",
], ],
enabled: false,
arch: {
x86: { enabled: true },
x86_64: { enabled: true },
}, },
x86_64: { }
cc_genrule {
name: "libseccomp_policy_system_sources_arm",
recovery_available: true,
cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
tools: [ "genseccomp" ],
srcs: [ srcs: [
":libseccomp_gen_syscall_nrs_x86", ":seccomp_syscalls_sources_system",
":libseccomp_gen_syscall_nrs_x86_64", ":libseccomp_gen_syscall_nrs_arm",
":libseccomp_gen_syscall_nrs_arm64",
], ],
out: [ out: [
"x86_system_policy.cpp", "arm_system_policy.cpp",
"x86_64_system_policy.cpp", "arm64_system_policy.cpp",
], ],
enabled: false,
arch: {
arm: { enabled: true },
arm64: { enabled: true },
}, },
}
cc_genrule {
name: "libseccomp_policy_system_sources_riscv64",
recovery_available: true,
cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
tools: [ "genseccomp" ],
srcs: [
":seccomp_syscalls_sources_system",
":libseccomp_gen_syscall_nrs_riscv64",
],
out: [
"riscv64_system_policy.cpp",
],
enabled: false,
arch: {
riscv64: { enabled: true },
}, },
} }
@ -2702,11 +2726,44 @@ cc_library {
name: "libseccomp_policy", name: "libseccomp_policy",
recovery_available: true, recovery_available: true,
generated_headers: ["func_to_syscall_nrs"], generated_headers: ["func_to_syscall_nrs"],
arch: {
arm: {
generated_sources: [ generated_sources: [
"libseccomp_policy_app_sources", "libseccomp_policy_app_sources_arm",
"libseccomp_policy_app_zygote_sources", "libseccomp_policy_app_zygote_sources_arm",
"libseccomp_policy_system_sources", "libseccomp_policy_system_sources_arm",
], ],
},
arm64: {
generated_sources: [
"libseccomp_policy_app_sources_arm",
"libseccomp_policy_app_zygote_sources_arm",
"libseccomp_policy_system_sources_arm",
],
},
riscv64: {
generated_sources: [
"libseccomp_policy_app_sources_riscv64",
"libseccomp_policy_app_zygote_sources_riscv64",
"libseccomp_policy_system_sources_riscv64",
],
},
x86: {
generated_sources: [
"libseccomp_policy_app_sources_x86",
"libseccomp_policy_app_zygote_sources_x86",
"libseccomp_policy_system_sources_x86",
],
},
x86_64: {
generated_sources: [
"libseccomp_policy_app_sources_x86",
"libseccomp_policy_app_zygote_sources_x86",
"libseccomp_policy_system_sources_x86",
],
},
},
srcs: [ srcs: [
"seccomp/seccomp_policy.cpp", "seccomp/seccomp_policy.cpp",