summaryrefslogtreecommitdiff
path: root/util/migrated_files.sh
blob: cec86b565bd3b1358c030aec38150f5136946e20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
#
# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

mapfile -d '' cmakes < <(find zephyr \( -path zephyr/test -prune \) -o \
  -name CMakeLists.txt -print0)

exit_code=0

for file in "$@"; do
  ec_file="${file##**/platform/ec/}"
  case "${ec_file}" in
    baseboard/*|board/*|chip/*|*fpsensor*|test/*|util/*|zephyr/*) ;;
    **.c)
      if ! grep -q -F "\${PLATFORM_EC}/${ec_file}" "${cmakes[@]}" ; then
        echo -n "WARNING: ${ec_file} is not used in Zephyr EC. Do not edit this"
        echo -n " unless you also find the zephyr copy and fix the same code"
        echo " there."
        exit_code=1
      fi
      ;;
  esac
done

exit "${exit_code}"