• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -e
2# Copyright 2023 The ChromiumOS Authors
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6# Generates the Suite and SuiteSet proto files.
7#
8# This depends on lucicfg binary which would normally be on a ChromeOS
9# engineer's PATH as part of depot_tools.
10
11set -e
12
13script_dir="$(dirname "$(realpath -e "${BASH_SOURCE[0]}")")"
14readonly script_dir
15repo_root="$(realpath -e "${script_dir}/../..")"
16readonly repo_root
17
18package_root="${script_dir}"
19
20usage="Regenerate Suite and SuiteSet protos.
21
22Usage: ${0} [OPTION]...
23
24Options:
25  -r, --package-root      Package root starlark generation script
26                          (default ${package_root})
27  -h, --help              Display help output."
28
29# Parse args
30while [[ $# -ne 0 ]]; do
31  case $1 in
32  -r|--package-root)
33    package_root="$2"
34    shift
35    ;;
36  -h|--help)
37    echo "${usage}"
38    exit 0
39    ;;
40  *)
41    echo "${usage}"
42    exit 1
43    ;;
44  esac
45  shift
46done
47
48# CWD to script location.
49cd "${script_dir}"
50
51# Make sure we have the latest lucicfg. If this fails, please be sure that you
52# have a depot_tools checkout on your PATH.
53update_depot_tools || echo "update_depot_tools not found"
54
55if ! "${repo_root}/descriptors/generate_proto_descriptors.sh" \
56     "${package_root}/proto"; then
57  echo "The generation of proto descriptors failed."
58  exit 1
59fi
60
61# Format the *.star files
62lucicfg fmt
63
64# Run the proto generation script
65lucicfg generate "${package_root}/main.star"
66