The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
Siva Velusamy | de3fa5d | 2013-10-09 07:42:07 -0700 | [diff] [blame] | 3 | # This script cleans up a set of files given as arguments for release in the SDK |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 4 | # Note that these files are modified in-place. |
| 5 | # |
| 6 | |
| 7 | DIR=$1 |
| 8 | |
| 9 | # |
| 10 | # Remove BEGIN_INCLUDE and END_INCLUDE lines used by the javadoc. |
| 11 | # |
| 12 | # This does it by replacing these lines with blank lines so line numbers aren't |
| 13 | # changed in the process, making it easier to match 3rd party complaints/questions |
| 14 | # with the source tree. |
| 15 | # |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 16 | find $DIR -name "*.java" -o -name "*.xml" | xargs -n 1 \ |
| 17 | sed \ |
| 18 | -e "s/.*BEGIN_INCLUDE(.*//" \ |
| 19 | -e "s/.*END_INCLUDE(.*//" \ |
| 20 | -i |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 21 | |
| 22 | # |
Siva Velusamy | de3fa5d | 2013-10-09 07:42:07 -0700 | [diff] [blame] | 23 | # Fix up the line endings of all text files. This also removes executable permissions. |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 24 | # |
| 25 | if [ $HOST_OS = windows ] ; then |
| 26 | ENDING_TYPE=dos |
| 27 | else |
| 28 | ENDING_TYPE=unix |
| 29 | fi |
diegoperez | b596210 | 2019-04-10 17:28:51 +0100 | [diff] [blame] | 30 | |
| 31 | # Using -n 500 for xargs to limit the max number of arguments per call to line_endings |
| 32 | # to 500. This avoids line_endings failing with "arguments too long". |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 33 | find $DIR -name "*.aidl" -o -name "*.css" -o -name "*.html" -o -name "*.java" \ |
Siva Velusamy | de3fa5d | 2013-10-09 07:42:07 -0700 | [diff] [blame] | 34 | -o -name "*.js" -o -name "*.prop" -o -name "*.template" \ |
| 35 | -o -name "*.txt" -o -name "*.windows" -o -name "*.xml" \ |
diegoperez | b596210 | 2019-04-10 17:28:51 +0100 | [diff] [blame] | 36 | | xargs -n 500 $HOST_OUT_EXECUTABLES/line_endings $ENDING_TYPE |
The Android Open Source Project | 52d4c30 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 37 | |
| 38 | |