bin/idea.sh
author thartmann
Fri, 24 Aug 2018 08:17:23 +0200
changeset 51514 1e332d63bd96
parent 51266 f8696e0ab9b7
child 51565 7e5f08c619e3
permissions -rw-r--r--
8209833: C2 compilation fails with "assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place" Summary: Deoptimize if exception is thrown in _clone intrinsic. Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
     1
#!/bin/sh
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
     2
#
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
     3
# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
     4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
     5
#
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
     6
# This code is free software; you can redistribute it and/or modify it
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
     7
# under the terms of the GNU General Public License version 2 only, as
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
     8
# published by the Free Software Foundation.
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
     9
#
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    10
# This code is distributed in the hope that it will be useful, but WITHOUT
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    12
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    13
# version 2 for more details (a copy is included in the LICENSE file that
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    14
# accompanied this code).
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    15
#
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    16
# You should have received a copy of the GNU General Public License version
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    17
# 2 along with this work; if not, write to the Free Software Foundation,
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    18
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    19
#
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    20
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    21
# or visit www.oracle.com if you need additional information or have any
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    22
# questions.
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    23
#
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    24
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    25
# Shell script for generating an IDEA project from a given list of modules
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    26
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    27
usage() {
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    28
      echo "usage: $0 [-h|--help] [-v|--verbose] [-o|--output <path>] [modules]+"
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    29
      exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    30
}
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    31
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    32
SCRIPT_DIR=`dirname $0`
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    33
#assume TOP is the dir from which the script has been called
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    34
TOP=`pwd`
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    35
cd $SCRIPT_DIR; SCRIPT_DIR=`pwd`
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    36
cd $TOP;
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    37
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    38
IDEA_OUTPUT=$TOP/.idea
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    39
VERBOSE="false"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    40
while [ $# -gt 0 ]
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    41
do
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    42
  case $1 in
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    43
    -h | --help )
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    44
      usage
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    45
      ;;
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    46
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    47
    -v | --vebose )
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    48
      VERBOSE="true"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    49
      ;;
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    50
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    51
    -o | --output )
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    52
      IDEA_OUTPUT=$2
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    53
      shift
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    54
      ;;
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    55
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    56
    -*)  # bad option
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    57
      usage
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    58
      ;;
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    59
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    60
     * )  # non option
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    61
      break
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    62
      ;;
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    63
  esac
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    64
  shift
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    65
done
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    66
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    67
mkdir $IDEA_OUTPUT || exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    68
cd $IDEA_OUTPUT; IDEA_OUTPUT=`pwd`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    69
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    70
MAKE_DIR="$SCRIPT_DIR/../make"
51266
f8696e0ab9b7 8208524: IntelliJ support broken since 2018.2
mcimadamore
parents: 48667
diff changeset
    71
SUPPORT_DIR="$SCRIPT_DIR/../build/.idea-support"
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    72
IDEA_MAKE="$MAKE_DIR/idea"
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    73
IDEA_TEMPLATE="$IDEA_MAKE/template"
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    74
51266
f8696e0ab9b7 8208524: IntelliJ support broken since 2018.2
mcimadamore
parents: 48667
diff changeset
    75
mkdir -p $SUPPORT_DIR
f8696e0ab9b7 8208524: IntelliJ support broken since 2018.2
mcimadamore
parents: 48667
diff changeset
    76
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    77
cp -r "$IDEA_TEMPLATE"/* "$IDEA_OUTPUT"
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    78
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    79
#init template variables
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    80
for file in `ls -p $IDEA_TEMPLATE | grep -v /`; do
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    81
	VAR_SUFFIX=`echo $file | cut -d'.' -f1 | tr [:lower:] [:upper:]`
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    82
    eval "$VAR_SUFFIX"_TEMPLATE="$IDEA_TEMPLATE"/$file
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    83
	eval IDEA_"$VAR_SUFFIX"="$IDEA_OUTPUT"/$file
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    84
done
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    85
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    86
#override template variables
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    87
if [ -d "$TEMPLATES_OVERRIDE" ] ; then
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    88
    for file in `ls -p "$TEMPLATES_OVERRIDE" | grep -v /`; do
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    89
        cp "$TEMPLATES_OVERRIDE"/$file "$IDEA_OUTPUT"/
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    90
    	VAR_SUFFIX=`echo $file | cut -d'.' -f1 | tr [:lower:] [:upper:]`
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    91
        eval "$VAR_SUFFIX"_TEMPLATE="$TEMPLATES_OVERRIDE"/$file
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    92
    done
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    93
fi
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    94
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    95
if [ "$VERBOSE" = "true" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    96
  echo "output dir: $IDEA_OUTPUT"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    97
  echo "idea template dir: $IDEA_TEMPLATE"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    98
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    99
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
   100
if [ ! -f "$JDK_TEMPLATE" ] ; then
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
   101
  echo "FATAL: cannot find $JDK_TEMPLATE" >&2; exit 1
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   102
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   103
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   104
if [ ! -f "$ANT_TEMPLATE" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   105
  echo "FATAL: cannot find $ANT_TEMPLATE" >&2; exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   106
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   107
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
   108
cd $TOP ; make -f "$IDEA_MAKE/idea.gmk" -I $MAKE_DIR/.. idea MAKEOVERRIDES= OUT=$IDEA_OUTPUT/env.cfg MODULES="$*" || exit 1
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   109
cd $SCRIPT_DIR
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   110
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   111
. $IDEA_OUTPUT/env.cfg
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   112
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   113
# Expect MODULE_ROOTS, MODULE_NAMES, BOOT_JDK & SPEC to be set
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   114
if [ "x$MODULE_ROOTS" = "x" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   115
  echo "FATAL: MODULE_ROOTS is empty" >&2; exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   116
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   117
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   118
if [ "x$MODULE_NAMES" = "x" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   119
  echo "FATAL: MODULE_NAMES is empty" >&2; exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   120
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   121
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   122
if [ "x$BOOT_JDK" = "x" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   123
  echo "FATAL: BOOT_JDK is empty" >&2; exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   124
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   125
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   126
if [ "x$SPEC" = "x" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   127
  echo "FATAL: SPEC is empty" >&2; exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   128
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   129
51266
f8696e0ab9b7 8208524: IntelliJ support broken since 2018.2
mcimadamore
parents: 48667
diff changeset
   130
# move build.xml out of .idea, see IDEA-189915
f8696e0ab9b7 8208524: IntelliJ support broken since 2018.2
mcimadamore
parents: 48667
diff changeset
   131
IDEA_BUILD_OLD=$IDEA_BUILD
f8696e0ab9b7 8208524: IntelliJ support broken since 2018.2
mcimadamore
parents: 48667
diff changeset
   132
IDEA_BUILD=$SUPPORT_DIR/build.xml
f8696e0ab9b7 8208524: IntelliJ support broken since 2018.2
mcimadamore
parents: 48667
diff changeset
   133
mv $IDEA_BUILD_OLD $IDEA_BUILD
f8696e0ab9b7 8208524: IntelliJ support broken since 2018.2
mcimadamore
parents: 48667
diff changeset
   134
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   135
SOURCE_FOLDER="      <sourceFolder url=\"file://\$MODULE_DIR\$/####\" isTestSource=\"false\" />"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   136
SOURCE_FOLDERS_DONE="false"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   137
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   138
addSourceFolder() {
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   139
  root=$@
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   140
  relativePath="`echo "$root" | sed -e s@"$TOP/\(.*$\)"@"\1"@`"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   141
  folder="`echo "$SOURCE_FOLDER" | sed -e s@"\(.*/\)####\(.*\)"@"\1$relativePath\2"@`"
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
   142
  printf "%s\n" "$folder" >> $IDEA_JDK
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   143
}
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   144
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   145
### Generate project iml
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
   146
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
   147
rm -f $IDEA_JDK
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   148
while IFS= read -r line
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   149
do
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   150
  if echo "$line" | egrep "^ .* <sourceFolder.*####" > /dev/null ; then
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   151
    if [ "$SOURCE_FOLDERS_DONE" = "false" ] ; then
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   152
      SOURCE_FOLDERS_DONE="true"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   153
      for root in $MODULE_ROOTS; do
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   154
         addSourceFolder $root
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   155
      done
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   156
    fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   157
  else
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
   158
    printf "%s\n" "$line" >> $IDEA_JDK
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   159
  fi
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
   160
done < "$JDK_TEMPLATE"
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   161
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   162
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   163
MODULE_NAME="        <property name=\"module.name\" value=\"####\" />"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   164
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   165
addModuleName() {
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   166
  mn="`echo "$MODULE_NAME" | sed -e s@"\(.*\)####\(.*\)"@"\1$MODULE_NAMES\2"@`"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   167
  printf "%s\n" "$mn" >> $IDEA_ANT
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   168
}
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   169
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   170
BUILD_DIR="        <property name=\"build.target.dir\" value=\"####\" />"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   171
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   172
addBuildDir() {
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   173
  DIR=`dirname $SPEC`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   174
  mn="`echo "$BUILD_DIR" | sed -e s@"\(.*\)####\(.*\)"@"\1$DIR\2"@`"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   175
  printf "%s\n" "$mn" >> $IDEA_ANT
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   176
}
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   177
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   178
### Generate ant.xml
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   179
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   180
rm -f $IDEA_ANT
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   181
while IFS= read -r line
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   182
do
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   183
  if echo "$line" | egrep "^ .* <property name=\"module.name\"" > /dev/null ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   184
    addModuleName
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   185
  elif echo "$line" | egrep "^ .* <property name=\"build.target.dir\"" > /dev/null ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   186
    addBuildDir
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   187
  else
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   188
    printf "%s\n" "$line" >> $IDEA_ANT
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   189
  fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   190
done < "$ANT_TEMPLATE"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   191
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   192
### Generate misc.xml
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   193
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   194
rm -f $IDEA_MISC
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   195
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   196
JTREG_HOME="    <path>####</path>"
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   197
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   198
IMAGES_DIR="    <jre alt=\"true\" value=\"####\" />"
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   199
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   200
addImagesDir() {
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   201
  DIR=`dirname $SPEC`/images/jdk
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   202
  mn="`echo "$IMAGES_DIR" | sed -e s@"\(.*\)####\(.*\)"@"\1$DIR\2"@`"
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   203
  printf "%s\n" "$mn" >> $IDEA_MISC
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   204
}
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   205
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   206
addJtregHome() {
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   207
  DIR=`dirname $SPEC`
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   208
  mn="`echo "$JTREG_HOME" | sed -e s@"\(.*\)####\(.*\)"@"\1$JT_HOME\2"@`"
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   209
  printf "%s\n" "$mn" >> $IDEA_MISC
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   210
}
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   211
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   212
rm -f $MISC_ANT
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   213
while IFS= read -r line
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   214
do
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   215
  if echo "$line" | egrep "^ .*<path>jtreg_home</path>" > /dev/null ; then
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   216
	addJtregHome
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   217
  elif echo "$line" | egrep "^ .*<jre alt=\"true\" value=\"images_jdk\"" > /dev/null ; then
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   218
    addImagesDir
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   219
  else
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   220
    printf "%s\n" "$line" >> $IDEA_MISC
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   221
  fi
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   222
done < "$MISC_TEMPLATE"
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   223
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   224
### Compile the custom Logger
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   225
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   226
CLASSES=$IDEA_OUTPUT/classes
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   227
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   228
if [ "x$ANT_HOME" = "x" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   229
   # try some common locations, before giving up
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   230
   if [ -f "/usr/share/ant/lib/ant.jar" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   231
     ANT_HOME="/usr/share/ant"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   232
   elif [ -f "/usr/local/Cellar/ant/1.9.4/libexec/lib/ant.jar" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   233
     ANT_HOME="/usr/local/Cellar/ant/1.9.4/libexec"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   234
   else
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   235
     echo "FATAL: cannot find ant. Try setting ANT_HOME." >&2; exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   236
   fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   237
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   238
CP=$ANT_HOME/lib/ant.jar
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   239
rm -rf $CLASSES; mkdir $CLASSES
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   240
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   241
if [ "x$CYGPATH" = "x" ] ; then ## CYGPATH may be set in env.cfg
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   242
  JAVAC_SOURCE_FILE=$IDEA_OUTPUT/src/idea/JdkIdeaAntLogger.java
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   243
  JAVAC_CLASSES=$CLASSES
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   244
  JAVAC_CP=$CP
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   245
else
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   246
  JAVAC_SOURCE_FILE=`cygpath -am $IDEA_OUTPUT/src/idea/JdkIdeaAntLogger.java`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   247
  JAVAC_CLASSES=`cygpath -am $CLASSES`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   248
  JAVAC_CP=`cygpath -am $CP`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   249
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   250
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   251
$BOOT_JDK/bin/javac -d $JAVAC_CLASSES -cp $JAVAC_CP $JAVAC_SOURCE_FILE