Commit d9ce147e authored by Wez's avatar Wez Committed by Commit Bot

Revert "[fuchsia] Migrate cr_package_fuchsia() to use SDK-provided rules."

This reverts commit 81e217be.

Reason for revert: Broke the official builders' archive step.

Original change's description:
> [fuchsia] Migrate cr_package_fuchsia() to use SDK-provided rules.
> 
> Migrate the cr_package_fuchsia() rule to use the SDK-provided
> fuchsia_component() and fuchsia_package() rules internally.
> 
> TBR=jbudorick
> 
> Bug: 1050703
> Change-Id: I1ba54308f2f2f6fc0f0b305dab2b9c927a38b21e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094989
> Commit-Queue: Wez <wez@chromium.org>
> Auto-Submit: Wez <wez@chromium.org>
> Reviewed-by: Kevin Marshall <kmarshall@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#756250}

TBR=ddorwin@chromium.org,wez@chromium.org,kmarshall@chromium.org,sergeyu@chromium.org,jbudorick@chromium.org,wilkinsonclay@google.com

Change-Id: I9077ce9e4cab5dd85e3d5fc4f4d09cc91033e811
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1050703, 1067614
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2135691Reviewed-by: default avatarWez <wez@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756263}
parent 1ef9a9ac
......@@ -81,18 +81,13 @@ template("fuchsia_package_runner") {
}
wrapper_script = generated_run_pkg_script_path
data_deps = [
invoker.package,
# Runner scripts require access to "ids.txt" for symbolization, and to
# the "package" from which to get the name & version to deploy, which
# are outputs of the archive manifest generation action.
invoker.package + "__archive-manifest",
]
if (defined(invoker.data_deps)) {
data_deps += invoker.data_deps
deps = [ invoker.package ]
if (defined(invoker.deps)) {
deps += invoker.deps
}
data_deps = [ invoker.package ]
# Declares the files that are needed for test execution on the
# swarming test client.
data = [
......@@ -138,10 +133,7 @@ template("fuchsia_package_runner") {
package_dep_target = package_dep[0]
package_dep_name = package_dep[1]
data_deps += [
package_dep_target,
package_dep_target + "__archive-manifest",
]
deps += [ package_dep_target ]
package_dep_path = rebase_path(
get_label_info(package_dep_target, "target_gen_dir") + "/" +
package_dep_name + "/" + package_dep_name + ".far",
......@@ -186,9 +178,9 @@ template("fuchsia_package_runner") {
executable = rebase_path("//build/fuchsia/deploy_to_amber_repo.py")
wrapper_script = generated_install_pkg_script_path
data_deps = [ invoker.package ]
if (defined(invoker.data_deps)) {
data_deps += invoker.data_deps
deps = [ invoker.package ]
if (defined(invoker.deps)) {
deps += invoker.deps
}
# Build a list of all packages to install, and pass the list to the runner
......@@ -199,7 +191,7 @@ template("fuchsia_package_runner") {
package_dep_target = package_dep[0]
package_dep_name = package_dep[1]
data_deps += [ package_dep_target ]
deps += [ package_dep_target ]
package_dep_path = rebase_path(
get_label_info(package_dep_target, "target_gen_dir") + "/" +
package_dep_name + "/" + package_dep_name + ".far",
......
......@@ -2,12 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//third_party/fuchsia-sdk/sdk/build/component.gni")
import("//third_party/fuchsia-sdk/sdk/build/package.gni")
import("//build/config/sysroot.gni")
# DEPRECATED: Use the Fuchsia SDK's fuchsia_component() and fuchsia_package()
# templates directly, in new code.
#
# Creates a Fuchsia .far package file containing a Fuchsia component.
#
# Parameters are:
......@@ -32,97 +28,210 @@ import("//third_party/fuchsia-sdk/sdk/build/package.gni")
#
# TODO(https://crbug.com/1050703): Migrate consumers to GN SDK equivalents.
template("cr_fuchsia_package") {
assert(defined(invoker.binary))
pkg = {
forward_variables_from(invoker, "*")
if (defined(invoker.package_name_override)) {
_package_name = invoker.package_name_override
} else {
_package_name = invoker.target_name
if (defined(package_name_override)) {
package_name = package_name_override
} else {
package_name = invoker.target_name
}
if (defined(archive_name_override)) {
archive_filename = archive_name_override
} else {
archive_filename = package_name
}
if (!defined(manifest)) {
assert(testonly == true)
# TODO(1019938): switch the default to tests.cmx which doesn't request
# the deprecated-ambient-replace-as-executable feature.
manifest = "//build/config/fuchsia/tests-with-exec.cmx"
}
}
assert(defined(pkg.binary))
_pm_tool_path = "//third_party/fuchsia-sdk/sdk/tools/pm"
_package_contents = [ invoker.binary ]
if (defined(invoker.deps)) {
_package_contents += invoker.deps
_pkg_out_dir = "${target_gen_dir}/${pkg.archive_filename}"
_runtime_deps_file = "$_pkg_out_dir/${pkg.archive_filename}.runtime_deps"
_archive_manifest = "$_pkg_out_dir/${pkg.archive_filename}.archive_manifest"
_build_ids_file = "$_pkg_out_dir/ids.txt"
_meta_far_file = "$_pkg_out_dir/meta.far"
_combined_far_file = "$_pkg_out_dir/${pkg.package_name}-0.far"
_final_far_file = "$_pkg_out_dir/${pkg.archive_filename}.far"
_package_info_path = "$_pkg_out_dir/package"
if (defined(pkg.component_name_override)) {
_generated_cmx = "$_pkg_out_dir/${pkg.component_name_override}.cmx"
} else {
_generated_cmx = "$_pkg_out_dir/${pkg.package_name}.cmx"
}
_component_target = target_name + "__cr-component"
_package_components = [ ":${_component_target}" ]
_write_manifest_target = "${pkg.package_name}__write_manifest"
_package_target = "${pkg.package_name}__pkg"
_bundle_target = "${pkg.package_name}__bundle"
# Generates a manifest file based on the GN runtime deps
# suitable for "pm" tool consumption.
action(_write_manifest_target) {
_depfile = "${target_gen_dir}/${target_name}_stamp.d"
# Declare the primary component for this package.
fuchsia_component(_component_target) {
forward_variables_from(invoker,
[
#"data",
"data",
"deps",
"testonly",
])
if (!defined(invoker.manifest)) {
assert(testonly == true)
script = "//build/config/fuchsia/prepare_package_inputs.py"
# TODO(1019938): switch the default to tests.cmx which doesn't request
# the deprecated-ambient-replace-as-executable feature.
manifest_fragment = "//build/config/fuchsia/tests-with-exec.cmx"
} else {
manifest_fragment = invoker.manifest
}
inputs = [
_runtime_deps_file,
pkg.manifest,
]
manifest_fragment_data = read_file(manifest_fragment, "json")
if (!defined(manifest_fragment_data.program)) {
manifest_fragment_data.program = {
binary = get_label_info(invoker.binary, "name")
outputs = [
_archive_manifest,
_build_ids_file,
_generated_cmx,
]
if (!defined(deps)) {
deps = []
}
deps += [ pkg.binary ]
data_deps = deps
# Use a depfile to trigger package rebuilds if any of the files (static
# assets, shared libraries, etc.) included by the package have changed.
depfile = _depfile
args = [
"--root-dir",
rebase_path("//", root_build_dir),
"--out-dir",
rebase_path(root_out_dir, root_build_dir),
"--app-name",
pkg.package_name,
"--app-filename",
get_label_info(pkg.binary, "name"),
"--manifest-input-path",
rebase_path(pkg.manifest, root_build_dir),
"--runtime-deps-file",
rebase_path(_runtime_deps_file, root_build_dir),
"--depfile-path",
rebase_path(_depfile, root_build_dir),
"--package-manifest-path",
rebase_path(_archive_manifest, root_build_dir),
"--component-manifest-path",
rebase_path(_generated_cmx, root_build_dir),
"--build-ids-file",
rebase_path(_build_ids_file, root_build_dir),
]
if (defined(pkg.excluded_files)) {
foreach(filename, pkg.excluded_files) {
args += [
"--exclude-file",
filename,
]
}
}
manifest = "$target_out_dir/" + target_name + "__component-manifest.cmx"
write_file(manifest, manifest_fragment_data, "json")
if (defined(invoker.component_name_override)) {
manifest_output_name = "${invoker.component_name_override}"
} else {
manifest_output_name = "${_package_name}"
if (defined(pkg.additional_manifests)) {
foreach(filename, pkg.additional_manifests) {
args += [
"--additional-manifest",
rebase_path(filename),
]
}
}
data_deps = _package_contents
write_runtime_deps = _runtime_deps_file
}
# Bundle manifests providing additional entrypoints into the package.
if (defined(invoker.additional_manifests)) {
foreach(filename, invoker.additional_manifests) {
_additional_component_target = target_name + "_" + filename
_package_components += [ ":${_additional_component_target}" ]
fuchsia_component(_additional_component_target) {
forward_variables_from(invoker, [ "testonly" ])
data_deps = _package_contents
manifest = filename
}
# Creates a signed Fuchsia metadata package.
action(_package_target) {
forward_variables_from(invoker, [ "testonly" ])
script = "//build/gn_run_binary.py"
deps = [ ":$_write_manifest_target" ]
inputs = [
# Depend on the SDK hash, to ensure rebuild if the SDK tools change.
"//third_party/fuchsia-sdk/sdk/.hash",
]
if (defined(pkg.additional_manifests)) {
inputs += pkg.additional_manifests
}
}
# Generate a Fuchsia ARchive (FAR) of the requested name.
if (defined(invoker.archive_name_override)) {
_archive_name = invoker.archive_name_override
} else {
_archive_name = _package_name
outputs = [ _meta_far_file ]
args = [
rebase_path(_pm_tool_path, root_build_dir),
"-o",
rebase_path(_pkg_out_dir, root_build_dir),
"-m",
rebase_path(_archive_manifest, root_build_dir),
"build",
]
}
if (_archive_name != _package_name) {
_archive_target = target_name + "__cr-archive"
# Creates a package containing the metadata archive and blob data.
action(_bundle_target) {
forward_variables_from(invoker, [ "testonly" ])
copy(target_name) {
deps = [ ":${_archive_target}" ]
_pkg_out_dir = "${target_gen_dir}/${_package_name}"
sources = [ "${_pkg_out_dir}/${_package_name}.far" ]
outputs = [ "${_pkg_out_dir}/${_archive_name}.far" ]
}
} else {
_archive_target = target_name
script = "//build/gn_run_binary.py"
deps = [
":$_package_target",
":$_write_manifest_target",
]
inputs = [
# Depend on the SDK hash, to ensure rebuild if the SDK tools change.
"//third_party/fuchsia-sdk/sdk/.hash",
_meta_far_file,
_archive_manifest,
]
outputs = [ _combined_far_file ]
args = [
rebase_path(_pm_tool_path, root_build_dir),
"-o",
rebase_path(_pkg_out_dir, root_build_dir),
"-m",
rebase_path(_archive_manifest, root_build_dir),
"archive",
]
}
fuchsia_package(_archive_target) {
# Copies the archive to a well-known path.
# TODO(kmarshall): Use a 'pm' output flag to write directly to the desired
# file path instead.
copy(target_name) {
forward_variables_from(invoker, [ "testonly" ])
package_name = _package_name
if (defined(invoker.excluded_files)) {
excluded_files = invoker.excluded_files
}
deps = _package_components
# Allows dependent targets to make use of "ids.txt".
public_deps = [ ":$_write_manifest_target" ]
deps = [ ":$_bundle_target" ]
data = [
_final_far_file,
# Files specified here so that they can be read by isolated testbots.
_package_info_path,
_build_ids_file,
]
sources = [ _combined_far_file ]
outputs = [ _final_far_file ]
}
}
......@@ -3,6 +3,7 @@
"features": [
"config-data"
],
"$comment": "Not all services are passed to WebEngine, see cast_runner.cc",
"services": [
"chromium.cast.ApplicationConfigManager",
"fuchsia.accessibility.semantics.SemanticsManager",
......
......@@ -217,7 +217,7 @@ template("test") {
package = ":$_pkg_target"
package_name_override = _output_name
data_deps = [ "//testing/buildbot/filters:fuchsia_filters" ]
deps = [ "//testing/buildbot/filters:fuchsia_filters" ]
}
cr_fuchsia_package(_pkg_target) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment