[assembly] Remove the not needed image rebase
Change-Id: Ibc2bde7cc41f897a5d10f7054ce5b5fa6a626063
Reviewed-on: https://fuchsia-review.googlesource.com/c/sdk-integration/+/788442
Commit-Queue: Jiaming Li <lijiaming@google.com>
Reviewed-by: Chase Latta <chaselatta@google.com>
diff --git a/bazel_rules_fuchsia/MODULE.bazel b/bazel_rules_fuchsia/MODULE.bazel
index 0d60d7b..89bbd7f 100644
--- a/bazel_rules_fuchsia/MODULE.bazel
+++ b/bazel_rules_fuchsia/MODULE.bazel
@@ -16,21 +16,17 @@
# Setup the cipd_tool repo for downloading content
cipd_tool_ext = use_extension("//cipd:defs.bzl", "cipd_tool_ext")
-
cipd_tool_ext.client(bin = "foo_tool")
-
use_repo(cipd_tool_ext, "cipd_tool")
# Declare the fuchsia sdk
fuchsia_sdk_ext = use_extension("//fuchsia:deps.bzl", "fuchsia_sdk_ext")
-
use_repo(fuchsia_sdk_ext, "fuchsia_sdk")
register_toolchains("@fuchsia_sdk//:fuchsia_toolchain_sdk")
# Declare clang
fuchsia_clang_ext = use_extension("//fuchsia:deps.bzl", "fuchsia_clang_ext")
-
use_repo(fuchsia_clang_ext, "fuchsia_clang")
register_toolchains("@fuchsia_clang//:cc-x86_64")
diff --git a/bazel_rules_fuchsia/fuchsia/private/assembly/fuchsia_product_bundle.bzl b/bazel_rules_fuchsia/fuchsia/private/assembly/fuchsia_product_bundle.bzl
index eb38e2d..06a8263 100644
--- a/bazel_rules_fuchsia/fuchsia/private/assembly/fuchsia_product_bundle.bzl
+++ b/bazel_rules_fuchsia/fuchsia/private/assembly/fuchsia_product_bundle.bzl
@@ -393,7 +393,7 @@
def _fuchsia_product_bundle_impl(ctx):
partitions_configuration = ctx.attr.partitions_config[FuchsiaAssemblyConfigInfo].config
- system_a_manifest = ctx.attr.product_image[FuchsiaProductImageInfo].images_json
+ system_a_out = ctx.attr.product_image[FuchsiaProductImageInfo].images_out
ffx_tool = ctx.toolchains["@rules_fuchsia//fuchsia:toolchain"].ffx
pb_out_dir = ctx.actions.declare_directory(ctx.label.name + "_out")
@@ -413,7 +413,7 @@
"FFX": ffx_tool.path,
"OUTDIR": pb_out_dir.path,
"PARTITIONS_PATH": partitions_configuration.path,
- "SYSTEM_A_MANIFEST": system_a_manifest.path,
+ "SYSTEM_A_MANIFEST": system_a_out.path + "/images.json",
"ARTIFACTS_BASE_PATH": ctx.attr.artifacts_base_path,
}
@@ -422,9 +422,9 @@
# If recovery is supplied, add it to the product bundle.
if ctx.attr.recovery != None:
- system_r_manifest = ctx.attr.recovery[FuchsiaProductImageInfo].images_json
+ system_r_out = ctx.attr.recovery[FuchsiaProductImageInfo].images_out
ffx_invocation.append("--system-r $ORIG_DIR/$SYSTEM_R_MANIFEST")
- env["SYSTEM_R_MANIFEST"] = system_r_manifest.path
+ env["SYSTEM_R_MANIFEST"] = system_r_out.path + "/images.json"
inputs.extend(ctx.files.recovery)
# If update info is supplied, add it to the product bundle.
diff --git a/bazel_rules_fuchsia/fuchsia/private/assembly/fuchsia_product_image.bzl b/bazel_rules_fuchsia/fuchsia/private/assembly/fuchsia_product_image.bzl
index a7765e4..56884f8 100644
--- a/bazel_rules_fuchsia/fuchsia/private/assembly/fuchsia_product_image.bzl
+++ b/bazel_rules_fuchsia/fuchsia/private/assembly/fuchsia_product_image.bzl
@@ -54,8 +54,6 @@
images_config_file = images_config_info.config
product_config_file = ctx.attr.product_config[FuchsiaProductConfigInfo].product_config
- images_json = ctx.actions.declare_file(ctx.label.name + "_images_rebased.json")
-
ffx_inputs = [
ctx.file._sdk_manifest,
ffx_tool,
@@ -91,26 +89,14 @@
progress_message = "Product Assembly and create-system for %s" % ctx.label.name,
)
- ctx.actions.run(
- outputs = [images_json],
- inputs = [out_dir],
- executable = ctx.executable._rebase_image_json,
- arguments = [
- "--image-json-path",
- out_dir.path + "/images.json",
- "--output",
- images_json.path,
- ],
- )
-
return [
- DefaultInfo(files = depset(direct = [out_dir, images_json] + ctx.files.product_config)),
+ DefaultInfo(files = depset(direct = [out_dir] + ctx.files.product_config)),
OutputGroupInfo(
debug_files = depset([ffx_isolate_dir]),
- all_files = depset([out_dir, ffx_isolate_dir, images_json] + ctx.files.product_config),
+ all_files = depset([out_dir, ffx_isolate_dir] + ctx.files.product_config),
),
FuchsiaProductImageInfo(
- images_json = images_json,
+ images_out = out_dir,
),
]
@@ -148,10 +134,5 @@
allow_single_file = True,
default = "@fuchsia_sdk//:meta/manifest.json",
),
- "_rebase_image_json": attr.label(
- default = "//fuchsia/tools:rebase_image_json",
- executable = True,
- cfg = "exec",
- ),
},
)
diff --git a/bazel_rules_fuchsia/fuchsia/private/assembly/providers.bzl b/bazel_rules_fuchsia/fuchsia/private/assembly/providers.bzl
index deeabcd..103da16 100644
--- a/bazel_rules_fuchsia/fuchsia/private/assembly/providers.bzl
+++ b/bazel_rules_fuchsia/fuchsia/private/assembly/providers.bzl
@@ -172,7 +172,7 @@
FuchsiaProductImageInfo = provider(
doc = "Info needed to pave a Fuchsia image",
fields = {
- "images_json": "images.json file",
+ "images_out": "images out directory",
},
)
diff --git a/bazel_rules_fuchsia/fuchsia/tools/BUILD.bazel b/bazel_rules_fuchsia/fuchsia/tools/BUILD.bazel
index 42de923..ba73a34 100644
--- a/bazel_rules_fuchsia/fuchsia/tools/BUILD.bazel
+++ b/bazel_rules_fuchsia/fuchsia/tools/BUILD.bazel
@@ -48,11 +48,6 @@
python_version = "PY3",
)
-py_binary(
- name = "rebase_image_json",
- srcs = ["rebase_image_json.py"],
-)
-
py_library(
name = "fuchsia_task_lib",
srcs = ["fuchsia_task_lib.py"],
diff --git a/bazel_rules_fuchsia/fuchsia/tools/rebase_image_json.py b/bazel_rules_fuchsia/fuchsia/tools/rebase_image_json.py
deleted file mode 100755
index 530f1e9..0000000
--- a/bazel_rules_fuchsia/fuchsia/tools/rebase_image_json.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright 2022 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-"""Rebases relative paths in images.json from the assembly working directory
-
-into absolute paths.
-"""
-
-import argparse
-import json
-import os
-
-
-def parse_args():
- """Parses command-line arguments."""
- parser = argparse.ArgumentParser()
- parser.add_argument(
- "--image-json-path",
- help="Path to image json",
- required=True,
- )
- parser.add_argument(
- "--output",
- help="Path to output images.json file",
- required=True,
- )
- return parser.parse_args()
-
-
-def main():
- args = parse_args()
- image_json_path = args.image_json_path
- with open(image_json_path, "r") as f:
- images = json.load(f)
-
- images_manifest = []
- for image in images:
- newimage = image.copy()
- newimage["path"] = os.path.abspath(newimage["path"])
- images_manifest.append(newimage)
- with open(args.output, "w") as f:
- json.dump(images_manifest, f, indent=2)
-
-
-if __name__ == "__main__":
- main()
diff --git a/tests/MODULE.bazel b/tests/MODULE.bazel
index fc2c116..a67bcb7 100644
--- a/tests/MODULE.bazel
+++ b/tests/MODULE.bazel
@@ -4,17 +4,16 @@
module(
name = "sdk-integration",
+ version = "1.0",
# TODO(fxbug.dev/107744) Migrate to register_toolchains
toolchains_to_register = [
"@fuchsia_sdk//:fuchsia_toolchain_sdk",
"@fuchsia_clang//:cc-x86_64",
"@fuchsia_clang//:cc-aarch64",
],
- version = "1.0",
)
bazel_dep(name = "rules_fuchsia", version = "")
-
local_path_override(
module_name = "rules_fuchsia",
path = "bazel_rules_fuchsia",
@@ -23,9 +22,7 @@
bazel_dep(name = "bazel_skylib", version = "1.2.0")
fuchsia_sdk_ext = use_extension("@rules_fuchsia//fuchsia:deps.bzl", "fuchsia_sdk_ext")
-
use_repo(fuchsia_sdk_ext, "fuchsia_sdk")
fuchsia_clang_ext = use_extension("@rules_fuchsia//fuchsia:deps.bzl", "fuchsia_clang_ext")
-
use_repo(fuchsia_clang_ext, "fuchsia_clang")
diff --git a/tests/WORKSPACE.bazel b/tests/WORKSPACE.bazel
index 0e02e19..7b51c15 100644
--- a/tests/WORKSPACE.bazel
+++ b/tests/WORKSPACE.bazel
@@ -58,21 +58,21 @@
fuchsia_sdk_repository(
name = "fuchsia_sdk_x64_only",
local_paths = [
- "sdk_generation/goldens/simple_idk_x64",
+ "sdk_generation/goldens/simple_idk_x64",
],
)
fuchsia_sdk_repository(
name = "fuchsia_sdk_arm64_only",
local_paths = [
- "sdk_generation/goldens/simple_idk_arm64",
+ "sdk_generation/goldens/simple_idk_arm64",
],
)
fuchsia_sdk_repository(
name = "fuchsia_sdk_both",
local_paths = [
- "sdk_generation/goldens/simple_idk_both",
+ "sdk_generation/goldens/simple_idk_both",
],
)