1#!/usr/bin/env bash
2# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15# ==============================================================================
16
17#
18# Sync's the shared TfLite / TFLM code from the upstream Tensorflow repo.
19#
20# While the standalone TFLM repo is under development, we are also sync'ing all
21# of the TFLM code via this script.
22#
23
24set -e
25
26SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
27ROOT_DIR=${SCRIPT_DIR}/..
28cd "${ROOT_DIR}"
29
30rm -rf /tmp/tensorflow
31
32git clone https://github.com/tensorflow/tensorflow.git --depth=1 /tmp/tensorflow
33
34SHARED_TFL_CODE=$(<ci/tflite_files.txt)
35
36for filepath in ${SHARED_TFL_CODE}
37do
38  mkdir -p $(dirname ${filepath})
39  /bin/cp /tmp/tensorflow/${filepath} ${filepath}
40done
41
42# Since the TFLM code was deleted from the tensorflow repository, the
43# microfrontend is no longer sync'd from upstream and instead maintaned as a
44# fork.
45git checkout tensorflow/lite/experimental/microfrontend/lib/
46