Skip to content

Commit

Permalink
[Fuchsia] Switch CIPD targets to use SDK provided template.
Browse files Browse the repository at this point in the history
Switch to use fuchsia_cipd_package template provided by
the Fuchsia SDK.

(cherry picked from commit 4493482)

Bug: 1199847
Change-Id: I678911339f748e01a9d6fc5776a13997f262bdc5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2871551
Reviewed-by: David Dorwin <ddorwin@chromium.org>
Commit-Queue: David Dorwin <ddorwin@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#879187}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2872999
Commit-Queue: Srinivas Sista <srinivassista@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Srinivas Sista <srinivassista@chromium.org>
Auto-Submit: Srinivas Sista <srinivassista@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/4498@{#2}
Cr-Branched-From: e7262ea-refs/heads/master@{#879147}
  • Loading branch information
Chong Gu authored and Chromium LUCI CQ committed May 5, 2021
1 parent 9324fb7 commit 8615037
Showing 1 changed file with 85 additions and 88 deletions.
173 changes: 85 additions & 88 deletions fuchsia/cipd/BUILD.gn
Expand Up @@ -9,6 +9,7 @@ assert(is_fuchsia)
import("//build/cipd/cipd.gni")
import("//build/util/process_version.gni")
import("//third_party/fuchsia-sdk/sdk/build/build_id_dir.gni")
import("//third_party/fuchsia-sdk/sdk/build/cipd.gni")

# gn binary location.
if (host_os == "mac") {
Expand All @@ -30,56 +31,48 @@ process_version("build_id") {
process_only = true
}

# Prepares a CIPD archive and generates a manifest file.
if (target_cpu == "x64") {
targetarch = "amd64"
} else {
targetarch = "arm64"
}

# Prepares a CIPD archive, produces a corresponding LICENSE file and generates
# a manifest file.
#
# Parameters:
# package_basename: Determines the package basename in CIPD.
# package_definition_basename: The non-extension portion of the filename used
# for the generated CIPD YAML file. Defaults to
# package_basename.
# package_relative_path: Specify the package location relative to the fuchsia/
# CIPD subdirectory. Defaults to a package name
# based on package_basename.
# description: Sets the "description" field in CIPD metadata.
# install_mode: String, should be either "symlink" or "copy".
# deps: A list of targets to build prior to copying files.
# sources: A list of files to copy into the staging root.
# source_directories: A list of directories to include in the package.
template("cipd_archive_internal") {
# description: Sets the "description" field in CIPD package definition.
#
# Optional parameters used directly by fuchsia_cipd_package template:
# "package_root",
# "package_definition_name",
# "package_definition_dir",
# "install_mode",
# "files",
# "directories",
# "sources",

template("cipd_archive") {
forward_variables_from(invoker,
[
"deps",
"package_basename",
"package_definition_basename",
"package_relative_path",
"source_directories",
"package_root",
"package_definition_name",
"package_definition_dir",
"description",
"install_mode",
"files",
"directories",
"sources",
"deps",
"testonly",
"visibility",
])
if (!defined(package_definition_basename)) {
package_definition_basename = package_basename
}

if (!defined(package_relative_path)) {
if (target_cpu == "x64") {
targetarch = "amd64"
} else {
targetarch = "arm64"
}
package_relative_path = "${package_basename}-$targetarch"
}

if (invoker.is_internal) {
package = "chrome_internal/fuchsia/" + package_relative_path

# '_google' is appended to the YAML file for internal binaries.
# TODO (crbug.com/1169400): Remove this once we have separate builders
# for internal and public WebEngine.
package_definition_yaml = package_definition_basename + "_google.yaml"
} else {
package = "chromium/fuchsia/" + package_relative_path
package_definition_yaml = package_definition_basename + ".yaml"
}

# Produces a consolidated license file.
action("${target_name}_license") {
Expand Down Expand Up @@ -109,52 +102,41 @@ template("cipd_archive_internal") {
}
sources += get_target_outputs(":${target_name}_license")

cipd_package_definition(target_name) {
forward_variables_from(invoker,
[
"description",
"install_mode",
"package",
"package_definition_yaml",
])
}
}
fuchsia_cipd_package(target_name) {
if (!defined(package_relative_path)) {
package_relative_path = "${package_basename}-$targetarch"
}

# This template allows built binaries to be saved to both the internal and
# public CIPD directory.
# TODO (crbug.com/1169400): Remove this template once we have separate builders
# for internal and public WebEngine.
template("cipd_archive") {
cipd_archive_internal("${target_name}") {
is_internal = false
forward_variables_from(invoker,
[
"package_basename",
"package_definition_basename",
"package_relative_path",
"description",
"source_directories",
"install_mode",
"deps",
"sources",
"testonly",
])
package = "chromium/fuchsia/${package_relative_path}"

if (!defined(package_definition_name)) {
package_definition_name = "${target_name}.yaml"
}

# Always use absolute path.
use_absolute_root_path = true
}

cipd_archive_internal("${target_name}_google") {
is_internal = true
forward_variables_from(invoker,
[
"package_basename",
"package_definition_basename",
"package_relative_path",
"description",
"source_directories",
"install_mode",
"deps",
"sources",
"testonly",
])
# TODO (crbug.com/1169400): Remove this target when Fuchsia side is ready to
# transition.
fuchsia_cipd_package("${target_name}_google") {
if (!defined(package_relative_path)) {
if (target_cpu == "x64") {
targetarch = "amd64"
} else {
targetarch = "arm64"
}
package_relative_path = "${package_basename}-$targetarch"
}

package = "chrome_internal/fuchsia/${package_relative_path}"

if (!defined(package_definition_name)) {
package_definition_name = "${target_name}.yaml"
}

# Always use absolute path.
use_absolute_root_path = true
}
}

Expand Down Expand Up @@ -229,7 +211,6 @@ action("strip_chromedriver_binary") {
}

cipd_archive("chromedriver") {
package_basename = "chromedriver"
package_relative_path = "chromedriver/\${os}-\${arch}"
description = "Prebuilt Chromedriver binary for Fuchsia host."
install_mode = "copy"
Expand Down Expand Up @@ -288,34 +269,50 @@ cipd_archive("tests") {
# .build_id structure for CIPD archival.
_build_ids_target = "debug_symbol_directory"
_debug_symbols_archive_name = "debug_symbols"
_debug_symbols_outdir =
"${target_gen_dir}/${_debug_symbols_archive_name}/${_build_ids_target}"

build_id_dir(_build_ids_target) {
build_id_dirs = [
"${root_gen_dir}/fuchsia/engine/web_engine",
"${root_gen_dir}/fuchsia/runners/cast_runner",
"${root_gen_dir}/fuchsia/runners/web_runner",
]
output_path =
"${target_gen_dir}/${_debug_symbols_archive_name}/${target_name}"

output_path = _debug_symbols_outdir
deps = [
"//fuchsia/engine:web_engine",
"//fuchsia/runners:cast_runner_pkg",
"//fuchsia/runners:web_runner_pkg",
]
}

cipd_archive(_debug_symbols_archive_name) {
package_basename = "debug-symbols"
package_definition_basename = _debug_symbols_archive_name
fuchsia_cipd_package(_debug_symbols_archive_name) {
package = "chromium/fuchsia/debug-symbols-${targetarch}"
package_root = _debug_symbols_outdir
package_definition_name = "${target_name}.yaml"
package_definition_dir = "${target_gen_dir}/${target_name}"
description = "Debugging symbols for prebuilt binaries from Chromium."
use_absolute_root_path = true

directories = [ "." ]
deps = [ ":${_build_ids_target}" ]
}

fuchsia_cipd_package("${_debug_symbols_archive_name}_google") {
package = "chrome_internal/fuchsia/debug-symbols-${targetarch}"
package_root = _debug_symbols_outdir
package_definition_name = "${target_name}.yaml"
package_definition_dir = "${target_gen_dir}/${_debug_symbols_archive_name}"
description = "Debugging symbols for prebuilt binaries from Chromium."
use_absolute_root_path = true

directories = [ "." ]
deps = [ ":${_build_ids_target}" ]
source_directories = [ "${_build_ids_target}" ]
}

cipd_archive("clear_key_cdm") {
package_basename = "libclearkeycdm"
package_definition_basename = "clear_key_cdm"
description = "Prebuilt libclearkeycdm.so binary for Fuchsia."

testonly = true
Expand Down

0 comments on commit 8615037

Please sign in to comment.