• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# This script processes a set of files given as arguments as sample code to be  released
4# in the SDK.
5#
6# Note that these files are modified in-place.
7#
8
9DIR=$1
10
11#
12# Remove BEGIN_INCLUDE and END_INCLUDE lines used by the javadoc.
13#
14# This does it by replacing these lines with blank lines so line numbers aren't
15# changed in the process, making it easier to match 3rd party complaints/questions
16# with the source tree.
17#
18# sed on Mac OS takes -i SUFFIX and sed on Linux takes -iSUFFIX
19#
20if [ $HOST_OS = darwin ] ; then
21find $DIR -name "*.java" -o -name "*.xml" | xargs -n 1 \
22    sed \
23        -e "s/.*BEGIN_INCLUDE(.*//" \
24        -e "s/.*END_INCLUDE(.*//" \
25        -i ""
26else
27find $DIR -name "*.java" -o -name "*.xml" | xargs -n 1 \
28    sed \
29        -e "s/.*BEGIN_INCLUDE(.*//" \
30        -e "s/.*END_INCLUDE(.*//" \
31        -i
32fi
33
34#
35# Fix up the line endings of all text files
36#
37if [ $HOST_OS = windows ] ; then
38    ENDING_TYPE=dos
39else
40    ENDING_TYPE=unix
41fi
42find $DIR -name "*.aidl" -o -name "*.css" -o -name "*.html" -o -name "*.java" \
43                     -o -name "*.js" -o -name "*.prop" -o -name "*.py" \
44                     -o -name "*.template" -o -name "*.txt" -o -name "*.windows" \
45                     -o -name "*.xml" \
46        | xargs $HOST_OUT_EXECUTABLES/line_endings $ENDING_TYPE
47
48
49