blob: 7869763d96cca47496fb4521e59302c3b267d8d7 [file] [log] [blame]
#!/bin/bash
#
# Copyright (C) 2012 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Generate all files we have templates for:
# docs.html
# ../src/camera_metadata_tag_info.c
# ../src/camera_metadata_tags.h
#
thisdir=$(dirname $(readlink -f $0))
function relpath() {
python -c "import os.path; print os.path.relpath('$1', '$PWD')"
}
function gen_file() {
local in=$thisdir/$1
local out=$thisdir/$2
python $thisdir/metadata_parser_xml.py $thisdir/metadata_properties.xml $in $out
local succ=$?
if [[ $succ -eq 0 ]]
then
echo "OK: Generated $(relpath "$out")"
else
echo "FAIL: Errors while generating $(relpath "$out")" >& 2
fi
return $succ
}
$thisdir/metadata-check-dependencies || exit 1
$thisdir/metadata-parser-sanity-check || exit 1
gen_file html.mako docs.html || exit 1
gen_file camera_metadata_tag_info.mako ../src/camera_metadata_tag_info.c || exit 1
gen_file camera_metadata_tags.mako ../include/system/camera_metadata_tags.h || exit 1
echo "Successfully generated all metadata source files"
exit 0