nashorn/bin/fixwhitespace.sh
author duke
Wed, 05 Jul 2017 20:41:20 +0200
changeset 31556 aad9d45ea14e
parent 26982 ff5dd57a40f2
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26982
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
     1
#!/bin/bash
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
     2
#
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
     3
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
     4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
     5
# 
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
     6
# This code is free software; you can redistribute it and/or modify it
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
     7
# under the terms of the GNU General Public License version 2 only, as
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
     8
# published by the Free Software Foundation.
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
     9
# 
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    10
# This code is distributed in the hope that it will be useful, but WITHOUT
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    12
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    13
# version 2 for more details (a copy is included in the LICENSE file that
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    14
# accompanied this code).
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    15
# 
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    16
# You should have received a copy of the GNU General Public License version
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    17
# 2 along with this work; if not, write to the Free Software Foundation,
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    18
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    19
# 
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    20
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    21
# or visit www.oracle.com if you need additional information or have any
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    22
# questions.
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    23
#
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    24
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    25
fix() {
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    26
    #convert tabs to spaces
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    27
    find . -name $1 -exec sed -i "" 's/	/    /g' {} \;
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    28
    #remove trailing whitespace
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    29
    find . -name $1 -exec sed -i "" 's/[ 	]*$//' \{} \;
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    30
}
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    31
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    32
if [ ! -z $1 ]; then 
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    33
    fix $1;
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    34
else
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    35
    fix "*.java"
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    36
    fix "*.js"
ff5dd57a40f2 8059811: Turn off optimistic typing by default and add both ant test-pessimistic and ant test-optimistic sub-test suites.
lagergren
parents:
diff changeset
    37
fi