Skip to content

Commit

Permalink
[fuchsia] Migrate cr_package_fuchsia() to use SDK-provided rules.
Browse files Browse the repository at this point in the history
This is a reland of
https://chromium-review.googlesource.com/c/chromium/src/+/2134299
which had broken handling of dependencies on the CMX manifest fragments
of each package's "primary" component. Processing of the fragment to
generate the full CMX file is now broken out into a distinct build
target, on which the primary component target depends.

Some unused Python and CMX files, missed in the original migration CL,
are also removed.

Migrate the cr_package_fuchsia() rule to use the SDK-provided
fuchsia_component() and fuchsia_package() rules internally.

TBR=dpranke

Bug: 1050703, 1068782, fuchsia:49479
Change-Id: I217d9276f85602c4120e3ad0db6d64c47c691f40
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2141094
Reviewed-by: Wez <wez@chromium.org>
Reviewed-by: Michael Spang <spang@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Commit-Queue: Michael Spang <spang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757471}
  • Loading branch information
Wez authored and Commit Bot committed Apr 8, 2020
1 parent 7d18d8e commit dd593a5
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 829 deletions.
49 changes: 49 additions & 0 deletions build/config/fuchsia/build_cmx_from_fragment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Creates a complete CMX (v1) component manifest, from a program name and
manifest fragment file."""

import argparse
import json
import sys


def BuildCmxFromFragment(output_file, fragment_file, program_binary):
"""Reads a CMX fragment specifying e.g. features & sandbox, and a program
binary's filename, and writes out the full CMX.
output_file: Build-relative filename at which to write the full CMX.
fragment_file: Build-relative filename of the CMX fragment to read from.
program_binary: Package-relative filename of the program binary.
"""

with open(output_file, 'w') as component_manifest_file:
component_manifest = json.load(open(fragment_file, 'r'))
component_manifest.update({
'program': {
'binary': program_binary
},
})
json.dump(component_manifest, component_manifest_file)


def main():
parser = argparse.ArgumentParser()
parser.add_argument(
'--cmx-fragment',
required=True,
help='Path to the CMX fragment to read from')
parser.add_argument(
'--cmx', required=True, help='Path to write the complete CMX file to')
parser.add_argument(
'--program',
required=True,
help='Package-relative path to the program binary')
args = parser.parse_args()

return BuildCmxFromFragment(args.cmx, args.cmx_fragment, args.program)


if __name__ == '__main__':
sys.exit(main())
Loading

0 comments on commit dd593a5

Please sign in to comment.