aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJingwen Chen <jingwen@google.com>2022-03-18 12:12:03 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-03-18 12:12:03 +0000
commit34f6f6c65eb09db5384e2b143e0dab6e217a2129 (patch)
tree2091a252757bb19e3c46413f1b5ffe60badb8e5d
parent360caa5f89cf9c7b4627701c7b45c7b9325181fd (diff)
parentb77e42bc950b29f6f75e874f96884a8238c50494 (diff)
downloadbazel-34f6f6c65eb09db5384e2b143e0dab6e217a2129.tar.gz
Build resize2fs and mkefs with Bazel. am: d7fd4af2c8 am: b77e42bc95
Original change: https://android-review.googlesource.com/c/platform/build/bazel/+/2030404 Change-Id: Id8e94412e4a54198b899379059f4f3f9adb971e0
-rw-r--r--bazel.WORKSPACE3
-rwxr-xr-xci/bp2build.sh14
-rw-r--r--rules/apex.bzl8
-rw-r--r--rules/apex/BUILD8
-rw-r--r--rules/apex/toolchain.bzl8
5 files changed, 24 insertions, 17 deletions
diff --git a/bazel.WORKSPACE b/bazel.WORKSPACE
index c8eb09e7..4a3c0220 100644
--- a/bazel.WORKSPACE
+++ b/bazel.WORKSPACE
@@ -23,10 +23,7 @@ make_injection_repository(
"deapexer",
"debugfs",
"merge_zips",
- "mke2fs",
- "resize2fs",
"sefcontext_compile",
- "signapk",
"soong_zip",
"zip2zip",
],
diff --git a/ci/bp2build.sh b/ci/bp2build.sh
index 71b44789..d7e5af05 100755
--- a/ci/bp2build.sh
+++ b/ci/bp2build.sh
@@ -54,13 +54,19 @@ BUILD_TARGETS_LIST=(
//system/...
//tools/apksig/...
//tools/platform-compat/...
+
+ # These tools only build for host currently
+ -//external/e2fsprogs/misc:all
+ -//external/e2fsprogs/resize:all
+ -//external/e2fsprogs/debugfs:all
+ -//external/e2fsprogs/e2fsck:all
)
BUILD_TARGETS="${BUILD_TARGETS_LIST[@]}"
# Iterate over various architectures supported in the platform build.
-tools/bazel --max_idle_secs=5 build ${FLAGS} --platforms //build/bazel/platforms:android_x86 -k ${BUILD_TARGETS}
-tools/bazel --max_idle_secs=5 build ${FLAGS} --platforms //build/bazel/platforms:android_x86_64 -k ${BUILD_TARGETS}
-tools/bazel --max_idle_secs=5 build ${FLAGS} --platforms //build/bazel/platforms:android_arm -k ${BUILD_TARGETS}
-tools/bazel --max_idle_secs=5 build ${FLAGS} --platforms //build/bazel/platforms:android_arm64 -k ${BUILD_TARGETS}
+tools/bazel --max_idle_secs=5 build ${FLAGS} --platforms //build/bazel/platforms:android_x86 -k -- ${BUILD_TARGETS}
+tools/bazel --max_idle_secs=5 build ${FLAGS} --platforms //build/bazel/platforms:android_x86_64 -k -- ${BUILD_TARGETS}
+tools/bazel --max_idle_secs=5 build ${FLAGS} --platforms //build/bazel/platforms:android_arm -k -- ${BUILD_TARGETS}
+tools/bazel --max_idle_secs=5 build ${FLAGS} --platforms //build/bazel/platforms:android_arm64 -k -- ${BUILD_TARGETS}
HOST_INCOMPATIBLE_TARGETS=(
# TODO(b/217756861): Apex toolchain is incompatible with host arches but apex modules do
diff --git a/rules/apex.bzl b/rules/apex.bzl
index 323b5c08..4dbd86c9 100644
--- a/rules/apex.bzl
+++ b/rules/apex.bzl
@@ -173,6 +173,8 @@ def _run_apexer(ctx, apex_toolchain, apex_content_inputs, bazel_apexer_wrapper_m
# the creation of an apex
avbtool_files = apex_toolchain.avbtool[DefaultInfo].files_to_run
e2fsdroid_files = apex_toolchain.e2fsdroid[DefaultInfo].files_to_run
+ mke2fs_files = apex_toolchain.mke2fs[DefaultInfo].files_to_run
+ resize2fs_files = apex_toolchain.resize2fs[DefaultInfo].files_to_run
apexer_tool_paths = [
# These are built by make_injection
apex_toolchain.apexer.dirname,
@@ -180,6 +182,8 @@ def _run_apexer(ctx, apex_toolchain, apex_content_inputs, bazel_apexer_wrapper_m
# These are real Bazel targets
avbtool_files.executable.dirname,
e2fsdroid_files.executable.dirname,
+ mke2fs_files.executable.dirname,
+ resize2fs_files.executable.dirname,
]
args.add_all(["--apexer_tool_path", ":".join(apexer_tool_paths)])
@@ -200,11 +204,11 @@ def _run_apexer(ctx, apex_toolchain, apex_content_inputs, bazel_apexer_wrapper_m
tools = [
avbtool_files,
e2fsdroid_files,
+ mke2fs_files,
+ resize2fs_files,
apex_toolchain.apexer,
- apex_toolchain.mke2fs,
apex_toolchain.sefcontext_compile,
- apex_toolchain.resize2fs,
apex_toolchain.aapt2,
]
diff --git a/rules/apex/BUILD b/rules/apex/BUILD
index e220afd3..b72cdbc6 100644
--- a/rules/apex/BUILD
+++ b/rules/apex/BUILD
@@ -26,8 +26,8 @@ apex_toolchain(
aapt2 = "@make_injection//:host/linux-x86/bin/aapt2",
avbtool = "//external/avb:avbtool",
apexer = "@make_injection//:host/linux-x86/bin/apexer",
- mke2fs = "@make_injection//:host/linux-x86/bin/mke2fs",
- resize2fs = "@make_injection//:host/linux-x86/bin/resize2fs",
+ mke2fs = "//external/e2fsprogs/misc:mke2fs",
+ resize2fs = "//external/e2fsprogs/resize:resize2fs",
e2fsdroid = "//external/e2fsprogs/contrib/android:e2fsdroid",
sefcontext_compile = "@make_injection//:host/linux-x86/bin/sefcontext_compile",
conv_apex_manifest = "@make_injection//:host/linux-x86/bin/conv_apex_manifest",
@@ -64,14 +64,14 @@ sh_test(
"test.pem",
"//external/avb:avbtool",
"//external/e2fsprogs/contrib/android:e2fsdroid",
+ "//external/e2fsprogs/misc:mke2fs",
+ "//external/e2fsprogs/resize:resize2fs",
"@make_injection//:host/linux-x86/bin/aapt2",
"@make_injection//:host/linux-x86/bin/apex_compression_tool",
"@make_injection//:host/linux-x86/bin/apexer",
"@make_injection//:host/linux-x86/bin/conv_apex_manifest",
"@make_injection//:host/linux-x86/bin/deapexer",
"@make_injection//:host/linux-x86/bin/debugfs",
- "@make_injection//:host/linux-x86/bin/mke2fs",
- "@make_injection//:host/linux-x86/bin/resize2fs",
"@make_injection//:host/linux-x86/bin/sefcontext_compile",
"@make_injection//:host/linux-x86/bin/soong_zip",
"//prebuilts/sdk/current:public/android.jar",
diff --git a/rules/apex/toolchain.bzl b/rules/apex/toolchain.bzl
index c56c66a8..04c7f4d8 100644
--- a/rules/apex/toolchain.bzl
+++ b/rules/apex/toolchain.bzl
@@ -37,8 +37,8 @@ def _apex_toolchain_impl(ctx):
aapt2 = ctx.file.aapt2,
avbtool = ctx.attr.avbtool,
apexer = ctx.file.apexer,
- mke2fs = ctx.file.mke2fs,
- resize2fs = ctx.file.resize2fs,
+ mke2fs = ctx.attr.mke2fs,
+ resize2fs = ctx.attr.resize2fs,
e2fsdroid = ctx.attr.e2fsdroid,
sefcontext_compile = ctx.file.sefcontext_compile,
conv_apex_manifest = ctx.file.conv_apex_manifest,
@@ -55,8 +55,8 @@ apex_toolchain = rule(
"aapt2": attr.label(allow_single_file = True, cfg = "host", executable = True),
"avbtool": attr.label(cfg = "host", executable = True),
"apexer": attr.label(allow_single_file = True, cfg = "host", executable = True),
- "mke2fs": attr.label(allow_single_file = True, cfg = "host", executable = True),
- "resize2fs": attr.label(allow_single_file = True, cfg = "host", executable = True),
+ "mke2fs": attr.label(cfg = "host", executable = True),
+ "resize2fs": attr.label(cfg = "host", executable = True),
"e2fsdroid": attr.label(cfg = "host", executable = True),
"sefcontext_compile": attr.label(allow_single_file = True, cfg = "host", executable = True),
"conv_apex_manifest": attr.label(allow_single_file = True, cfg = "host", executable = True),