blob: 8e5bf56fb7b272c38477363738013f58aa90735f [file] [log] [blame]
Igor Murashkineaddcd42012-11-26 12:01:11 -08001#!/bin/bash
2
3#
4# Copyright (C) 2012 The Android Open Source Project
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18
19#
20# Generate all files we have templates for:
21# docs.html
22# ../src/camera_metadata_tag_info.c
23# ../src/camera_metadata_tags.h
24#
25
Eino-Ville Talvala08885562013-03-18 09:43:57 -070026thisdir=$(cd "$(dirname "$0")"; pwd)
Igor Murashkineaddcd42012-11-26 12:01:11 -080027
Igor Murashkin5804a482012-12-05 13:06:59 -080028function relpath() {
29 python -c "import os.path; print os.path.relpath('$1', '$PWD')"
30}
31
Igor Murashkineaddcd42012-11-26 12:01:11 -080032function gen_file() {
33 local in=$thisdir/$1
34 local out=$thisdir/$2
35
Igor Murashkin48098682012-12-05 14:51:57 -080036 python $thisdir/metadata_parser_xml.py $thisdir/metadata_properties.xml $in $out
Igor Murashkin5804a482012-12-05 13:06:59 -080037
38 local succ=$?
39
40 if [[ $succ -eq 0 ]]
41 then
42 echo "OK: Generated $(relpath "$out")"
43 else
44 echo "FAIL: Errors while generating $(relpath "$out")" >& 2
45 fi
46
47 return $succ
Igor Murashkineaddcd42012-11-26 12:01:11 -080048}
49
Igor Murashkin0334aa02012-12-04 14:59:53 -080050$thisdir/metadata-check-dependencies || exit 1
Igor Murashkineaddcd42012-11-26 12:01:11 -080051$thisdir/metadata-parser-sanity-check || exit 1
52gen_file html.mako docs.html || exit 1
53gen_file camera_metadata_tag_info.mako ../src/camera_metadata_tag_info.c || exit 1
54gen_file camera_metadata_tags.mako ../include/system/camera_metadata_tags.h || exit 1
55
56echo "Successfully generated all metadata source files"
57
58exit 0