1# -*- bazel-starlark -*- 2# Copyright 2024 The Chromium Authors 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5"""Siso configuration for Fuchsia builds.""" 6 7load("@builtin//lib/gn.star", "gn") 8load("@builtin//struct.star", "module") 9load("./gn_logs.star", "gn_logs") 10 11def __enabled(ctx): 12 if "args.gn" in ctx.metadata: 13 gn_args = gn.args(ctx) 14 if gn_args.get("target_os") == '"fuchsia"': 15 return True 16 return False 17 18def __filegroups(ctx): 19 gn_logs_data = gn_logs.read(ctx) 20 fuchsia_arch_root = gn_logs_data.get("fuchsia_arch_root") 21 fuchsia_legacy_arch_root = gn_logs_data.get("fuchsia_legacy_arch_root") 22 if not fuchsia_arch_root or not fuchsia_legacy_arch_root: 23 print("could not find fuchsia_arch_root or fuchsia_legacy_arch_root from gn_logs.txt") 24 return {} 25 fg = { 26 # The legacy directory is still used. But, will be removed soon. 27 fuchsia_legacy_arch_root + "/lib:libs": { 28 "type": "glob", 29 "includes": ["*.o", "*.a", "*.so"], 30 }, 31 fuchsia_arch_root + "/sysroot:headers": { 32 "type": "glob", 33 "includes": ["*.h", "*.inc", "*.o"], 34 }, 35 fuchsia_arch_root + "/sysroot:link": { 36 "type": "glob", 37 "includes": ["*.o", "*.a", "*.so"], 38 }, 39 fuchsia_arch_root + "/lib:link": { 40 "type": "glob", 41 "includes": ["*.o", "*.a", "*.so"], 42 }, 43 } 44 return fg 45 46fuchsia = module( 47 "fuchsia", 48 enabled = __enabled, 49 filegroups = __filegroups, 50) 51