|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Copyright (c) 2020 Silicon Labs |
| 4 | + |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | + |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +USAGE="Export Matter Examples to a new Location : export_examples.sh <new location> <examples path> <matter_root>" |
| 18 | + |
| 19 | +if [ -z "$1" ]; then |
| 20 | + echo "Missing export location" |
| 21 | +fi |
| 22 | + |
| 23 | +if [ -z "$2" ]; then |
| 24 | + echo "Missing examples location" |
| 25 | +fi |
| 26 | + |
| 27 | +if [ -z "${MATTER_ROOT}" ]; then |
| 28 | + if [ -z "$3" ]; then |
| 29 | + echo "Cannot Export without the MATTER_ROOT" |
| 30 | + exit 1 |
| 31 | + else |
| 32 | + ROOT="$3" |
| 33 | + fi |
| 34 | +else |
| 35 | + ROOT="${MATTER_ROOT}" |
| 36 | +fi |
| 37 | + |
| 38 | +#1. copy folder examples and platfor/generated stuff |
| 39 | +CURRENT_DIR=$(pwd) |
| 40 | +mkdir -p $1 |
| 41 | + |
| 42 | +rsync -a $2 $1 --exclude=third_party --exclude=build_overrides |
| 43 | + |
| 44 | +#2. Symlink build scripts |
| 45 | +if [ -f "$1/../build_silabs_examples.sh" ]; then |
| 46 | + echo "Build scripts already linked" |
| 47 | +else |
| 48 | + ln -s "${ROOT}/scripts/examples/gn_efr32_example.sh" "$1/../build_silabs_examples.sh" |
| 49 | +fi |
| 50 | + |
| 51 | +#3. symlink the buildoverride folder |
| 52 | +cd $1 |
| 53 | +ln -s "${ROOT}/examples/build_overrides" "./efr32/build_overrides" |
| 54 | + |
| 55 | +#4 symlink the third_party to point to the actual location of the matter repo |
| 56 | +mkdir -p ./efr32/third_party |
| 57 | +cd ./efr32/third_party |
| 58 | + |
| 59 | +ln -s ${ROOT} ./connectedhomeip |
0 commit comments