1#!/usr/bin/env bash
2
3# Copyright 2017, The Android Open Source Project
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
17function setup_paths {
18    if [ -z "${ANDROID_BUILD_TOP}" ]; then
19        echo "Could not resolve ANDROID_BUILD_TOP. Make sure you run source build/envsetup.sh and lunch <target> first."
20        exit
21    fi
22
23    ANDROID_CLASSES="${ANDROID_BUILD_TOP}/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes"
24    if [ ! -d "${ANDROID_CLASSES}" ]; then
25        echo "Could not find folder ${ANDROID_CLASSES}. Make sure you compile ManagedProvisioning first"
26        exit
27    fi
28
29    MP="${ANDROID_BUILD_TOP}/packages/apps/ManagedProvisioning"
30    TOOLS_JAVA="${MP}/tools/java"
31    CP="${TOOLS_JAVA}:${MP}/src:${ANDROID_CLASSES}"
32    OUT_PATH="${MP}/swiper-themes.xml"
33}
34
35setup_paths
36
37pushd "${TOOLS_JAVA}" > /dev/null
38
39echo "compiling.."
40javac -cp "${CP}" com/android/managedprovisioning/tools/anim/SwiperThemeGenerator.java
41
42echo "generating themes.."
43java  -cp "${CP}" com.android.managedprovisioning.tools.anim.SwiperThemeGenerator "${OUT_PATH}"
44
45echo "output stored under: ${OUT_PATH}"
46echo "done"
47
48popd > /dev/null