1# -*- bazel-starlark -*- 2# Copyright 2023 The Chromium Authors. All rights reserved. 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 simple steps.""" 6 7load("@builtin//struct.star", "module") 8 9def __copy(ctx, cmd): 10 input = cmd.inputs[0] 11 out = cmd.outputs[0] 12 ctx.actions.copy(input, out, recursive = ctx.fs.is_dir(input)) 13 ctx.actions.exit(exit_status = 0) 14 15def __stamp(ctx, cmd): 16 out = cmd.outputs[0] 17 ctx.actions.write(out) 18 ctx.actions.exit(exit_status = 0) 19 20__handlers = { 21 "copy": __copy, 22 "stamp": __stamp, 23} 24 25def __step_config(ctx, step_config): 26 step_config["rules"].extend([ 27 { 28 "name": "simple/copy", 29 "action": "(.*_)?copy", 30 "handler": "copy", 31 }, 32 { 33 "name": "simple/stamp", 34 "action": "(.*_)?stamp", 35 "handler": "stamp", 36 "replace": True, 37 }, 38 ]) 39 return step_config 40 41simple = module( 42 "simple", 43 step_config = __step_config, 44 filegroups = {}, 45 handlers = __handlers, 46) 47