PageRenderTime 18ms CodeModel.GetById 12ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/google-toolbox-for-mac/BuildScripts/SDEFCompiler.sh

http://macfuse.googlecode.com/
Shell | 45 lines | 14 code | 6 blank | 25 comment | 2 complexity | 2456da6037f4b4406c0c59755c1958fb MD5 | raw file
 1#!/bin/sh
 2# SDEFCompiler.sh
 3
 4# Copyright 2009 Google Inc.
 5#
 6# Licensed under the Apache License, Version 2.0 (the "License"); you may not
 7# use this file except in compliance with the License.  You may obtain a copy
 8# 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, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
15# License for the specific language governing permissions and limitations under
16# the License.
17
18# Takes a file (usually with a suffix of .sdefsrc) and "compiles it" using
19# xmllint to verify its correctness. Gets rid of a lot of the guesswork when
20# trying to figure out what is wrong with your SDEF file.
21# The best way to use SDEFCompiler is to add a custom build rule to your target
22# in Xcode with the following settings:
23# Process: "Source files with names matching:" "*.sdefsrc"
24# using: "Custom script:"
25# "Path/to/SDEFCompiler/relative/to/${SRCROOT}'
26# with output files:
27# ${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/${INPUT_FILE_BASE}.sdef
28
29set -o errexit
30set -o nounset
31
32if [[ $# -ne 2 && $# -ne 0 ]] ; then
33  echo "usage: ${0} INPUT OUTPUT" >&2
34  exit 1
35fi
36
37if [[ $# -eq 2 ]] ; then
38  SCRIPT_INPUT_FILE="${1}"
39  SCRIPT_OUTPUT_FILE="${2}"
40else
41  SCRIPT_INPUT_FILE="${INPUT_FILE_PATH}"
42  SCRIPT_OUTPUT_FILE="${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/${INPUT_FILE_BASE}.sdef"
43fi
44
45exec xmllint --xinclude --valid --postvalid --format "${SCRIPT_INPUT_FILE}" > "${SCRIPT_OUTPUT_FILE}"