langtools/src/share/bin/launcher.sh-template
author lana
Mon, 25 Nov 2013 09:41:20 -0800
changeset 21893 e8997d9f3f6b
parent 9087 e9e44877cd18
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
#!/bin/sh
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
#
9087
e9e44877cd18 7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents: 8421
diff changeset
     4
# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
#
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5490
diff changeset
     9
# published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
# particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5490
diff changeset
    11
# by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
# This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
# version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
# accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
# You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
# 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
#
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5490
diff changeset
    23
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5490
diff changeset
    24
# or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5490
diff changeset
    25
# questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
mydir="`dirname $0`"
7843
1103fac3fb5a 7008378: javac bootstrap launcher fails on cygwin when called via an absolute path
jjh
parents: 6574
diff changeset
    29
case `uname -s` in
1103fac3fb5a 7008378: javac bootstrap launcher fails on cygwin when called via an absolute path
jjh
parents: 6574
diff changeset
    30
    CYGWIN*)
1103fac3fb5a 7008378: javac bootstrap launcher fails on cygwin when called via an absolute path
jjh
parents: 6574
diff changeset
    31
      mydir=`cygpath -m $mydir`
1103fac3fb5a 7008378: javac bootstrap launcher fails on cygwin when called via an absolute path
jjh
parents: 6574
diff changeset
    32
      ;;
1103fac3fb5a 7008378: javac bootstrap launcher fails on cygwin when called via an absolute path
jjh
parents: 6574
diff changeset
    33
esac
8421
b268534d3e7a 7018447: langtools launcher template fails if tools run from their own directory
jjg
parents: 7843
diff changeset
    34
mylib="$mydir/../lib"
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
# By default, put the jar file and its dependencies on the bootclasspath.
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
# This is always required on a Mac, because the system langtools classes
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
# are always on the main class path; in addition, it may be required on
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
# standard versions of JDK (i.e. using rt.jar and tools.jar) because some
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
# langtools interfaces are in rt.jar.
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
# Assume that the jar file being invoked lists all the necessary langtools
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
# jar files in its Class-Path manifest entry, so there is no need to search
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
# dependent jar files for additional dependencies.
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
if [ "$LANGTOOLS_USE_BOOTCLASSPATH" != "no" ]; then
4706
9dc1a9745cf3 6916986: handle spaces in langtools launcher path
jjg
parents: 3654
diff changeset
    46
   cp=`unzip -c "$mylib/#PROGRAM#.jar" META-INF/MANIFEST.MF |
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
       grep "Class-Path:" |
6574
7729fe9665a2 6979564: ":" for path separator in dist/bin/javac does not work on Windows
jjg
parents: 5520
diff changeset
    48
       sed -e 's|Class-Path: *||' -e 's|\([a-z]*\.jar\) *|'"$mylib"'/\1#PS#|g'`
7729fe9665a2 6979564: ":" for path separator in dist/bin/javac does not work on Windows
jjg
parents: 5520
diff changeset
    49
   bcp="$mylib/#PROGRAM#.jar#PS#$cp"
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
fi
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    52
# tools currently assumes that assertions are enabled in the launcher
3654
bb3c0eeec3cb 6870706: langtools launcher issues
jjg
parents: 3154
diff changeset
    53
ea=-ea:com.sun.tools...
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    55
# Any parameters starting with -J are passed to the JVM.
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    56
# All other parameters become parameters of #PROGRAM#.
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    57
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    58
# Separate out -J* options for the JVM
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    59
# Unset IFS and use newline as arg separator to preserve spaces in args
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    60
DUALCASE=1  # for MKS: make case statement case-sensitive (6709498)
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    61
saveIFS="$IFS"
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    62
nl='
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    63
'
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    64
for i in "$@" ; do
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    65
   IFS=
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    66
   case $i in
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    67
   -J* )       javaOpts=$javaOpts$nl`echo $i | sed -e 's/^-J//'` ;;
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    68
   *   )       toolOpts=$toolOpts$nl$i ;;
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    69
   esac
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    70
   IFS="$saveIFS"
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    71
done
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    72
unset DUALCASE
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    73
5490
a237b108549d 6948251: need to quote args in langtools launcher script
jjg
parents: 4706
diff changeset
    74
IFS=$nl
8421
b268534d3e7a 7018447: langtools launcher template fails if tools run from their own directory
jjg
parents: 7843
diff changeset
    75
"#TARGET_JAVA#" "${bcp:+-Xbootclasspath/p:"$bcp"}" ${ea} ${javaOpts} -jar "${mylib}/#PROGRAM#.jar" ${toolOpts}