• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# Copyright 2021 The ChromiumOS Authors
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# Required for setup_cipd
8readonly script_dir="$(dirname "$(realpath -e "${BASH_SOURCE[0]}")")"
9
10# Exit if any command fails.
11set -e
12
13source "../setup_cipd.sh"
14
15
16# Get all unique directories with at least one fake config
17for config in $(find . -type f -name "*.star");
18do
19    echo "Formatting .star with lucicfg fmt..."
20    lucicfg fmt "${config}"
21    config_dir="$(dirname "${config}")"
22
23    lucicfg         \
24        generate    \
25        -config-dir \
26        "$(realpath -m --relative-to="$(pwd)" "${config_dir}/generated")" \
27        "${config}"
28
29done
30
31# Replaces tabs with spaces for easier diff'ing
32for config in $(find . -type f -name "*.jsonproto");
33do
34    sed -i 's/\t/  /g' "${config}"
35done
36