bin/idea.sh
author dcubed
Wed, 18 Sep 2019 20:49:13 -0400
changeset 58223 778fc2dcbdaa
parent 52804 28094715ae71
permissions -rw-r--r--
8231210: [BACKOUT] JDK-8207266 ThreadMXBean::getThreadAllocatedBytes() can be quicker for self thread Reviewed-by: phh, dholmes
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
#
52804
28094715ae71 8214718: Update missing copyright year in build system
ihse
parents: 52517
diff changeset
     3
# Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
37861
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 )
51612
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
    52
      IDEA_OUTPUT=$2/.idea
37861
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
51612
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
    67
mkdir -p $IDEA_OUTPUT || exit 1
37861
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
51612
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
    70
if [ "x$TOPLEVEL_DIR" = "x" ] ; then
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
    71
    cd $SCRIPT_DIR/..
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
    72
    TOPLEVEL_DIR=`pwd`
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
    73
    cd $IDEA_OUTPUT
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
    74
fi
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
    75
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    76
MAKE_DIR="$SCRIPT_DIR/../make"
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    77
IDEA_MAKE="$MAKE_DIR/idea"
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    78
IDEA_TEMPLATE="$IDEA_MAKE/template"
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    79
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    80
cp -r "$IDEA_TEMPLATE"/* "$IDEA_OUTPUT"
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    81
51612
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
    82
#override template
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    83
if [ -d "$TEMPLATES_OVERRIDE" ] ; then
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    84
    for file in `ls -p "$TEMPLATES_OVERRIDE" | grep -v /`; do
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    85
        cp "$TEMPLATES_OVERRIDE"/$file "$IDEA_OUTPUT"/
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    86
    done
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    87
fi
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    88
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    89
if [ "$VERBOSE" = "true" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    90
  echo "output dir: $IDEA_OUTPUT"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    91
  echo "idea template dir: $IDEA_TEMPLATE"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    92
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    93
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
    94
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
    95
cd $SCRIPT_DIR
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    96
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    97
. $IDEA_OUTPUT/env.cfg
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    98
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    99
# Expect MODULE_ROOTS, MODULE_NAMES, BOOT_JDK & SPEC to be set
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   100
if [ "x$MODULE_ROOTS" = "x" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   101
  echo "FATAL: MODULE_ROOTS is empty" >&2; exit 1
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 [ "x$MODULE_NAMES" = "x" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   105
  echo "FATAL: MODULE_NAMES is empty" >&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
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   108
if [ "x$BOOT_JDK" = "x" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   109
  echo "FATAL: BOOT_JDK is empty" >&2; exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   110
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   111
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   112
if [ "x$SPEC" = "x" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   113
  echo "FATAL: SPEC is empty" >&2; exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   114
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   115
51612
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   116
### Replace template variables
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   117
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   118
NUM_REPLACEMENTS=0
48667
f2344724a475 8196081: Add support for customized intellij project templates
mcimadamore
parents: 47217
diff changeset
   119
51612
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   120
replace_template_file() {
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   121
    for i in $(seq 1 $NUM_REPLACEMENTS); do
51657
0fd48caf8243 8210318: idea.sh script doesn't work on Mac
mcimadamore
parents: 51612
diff changeset
   122
      eval "sed \"s|\${FROM${i}}|\${TO${i}}|g\" $1 > $1.tmp"
0fd48caf8243 8210318: idea.sh script doesn't work on Mac
mcimadamore
parents: 51612
diff changeset
   123
      mv $1.tmp $1
51612
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   124
    done
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   125
}
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   126
51612
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   127
replace_template_dir() {
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   128
    for f in `find $1 -type f` ; do
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   129
        replace_template_file $f
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   130
    done
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   131
}
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   132
51612
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   133
add_replacement() {
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   134
    NUM_REPLACEMENTS=`expr $NUM_REPLACEMENTS + 1`
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   135
    eval FROM$NUM_REPLACEMENTS='$1'
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   136
    eval TO$NUM_REPLACEMENTS='$2'
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   137
}
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   138
51612
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   139
add_replacement "###MODULE_NAMES###" "$MODULE_NAMES"
52517
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   140
SPEC_DIR=`dirname $SPEC`
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   141
if [ "x$CYGPATH" = "x" ]; then
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   142
    add_replacement "###BUILD_DIR###" "$SPEC_DIR"
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   143
    add_replacement "###JTREG_HOME###" "$JT_HOME"
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   144
    add_replacement "###IMAGES_DIR###" "$SPEC_DIR/images/jdk"
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   145
    add_replacement "###ROOT_DIR###" "$TOPLEVEL_DIR"
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   146
    add_replacement "###IDEA_DIR###" "$IDEA_OUTPUT"
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   147
else
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   148
    add_replacement "###BUILD_DIR###" "`cygpath -am $SPEC_DIR`"
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   149
    add_replacement "###IMAGES_DIR###" "`cygpath -am $SPEC_DIR`/images/jdk"
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   150
    add_replacement "###ROOT_DIR###" "`cygpath -am $TOPLEVEL_DIR`"
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   151
    add_replacement "###IDEA_DIR###" "`cygpath -am $IDEA_OUTPUT`"
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   152
    if [ "x$JT_HOME" = "x" ]; then
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   153
      add_replacement "###JTREG_HOME###" ""
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   154
    else
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   155
      add_replacement "###JTREG_HOME###" "`cygpath -am $JT_HOME`"
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   156
    fi
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   157
fi
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   158
51612
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   159
SOURCE_PREFIX="<sourceFolder url=\"file://"
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   160
SOURCE_POSTFIX="\" isTestSource=\"false\" />"
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   161
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   162
for root in $MODULE_ROOTS; do
52517
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   163
    if [ "x$CYGPATH" != "x" ]; then
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   164
    	root=`cygpath -am $root`
59065e5d56ec 8213591: running bin/idea.sh in Cygwin: generated project cannot be imported
stuefe
parents: 51657
diff changeset
   165
    fi
51657
0fd48caf8243 8210318: idea.sh script doesn't work on Mac
mcimadamore
parents: 51612
diff changeset
   166
    SOURCES=$SOURCES" $SOURCE_PREFIX""$root""$SOURCE_POSTFIX"
51612
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   167
done
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   168
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   169
add_replacement "###SOURCE_ROOTS###" "$SOURCES"
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   170
bdac20c6c8dd 8210226: Add support for multiple project folders to idea.sh
mcimadamore
parents: 51565
diff changeset
   171
replace_template_dir "$IDEA_OUTPUT"
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   172
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   173
### Compile the custom Logger
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   174
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   175
CLASSES=$IDEA_OUTPUT/classes
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   176
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   177
if [ "x$ANT_HOME" = "x" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   178
   # try some common locations, before giving up
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   179
   if [ -f "/usr/share/ant/lib/ant.jar" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   180
     ANT_HOME="/usr/share/ant"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   181
   elif [ -f "/usr/local/Cellar/ant/1.9.4/libexec/lib/ant.jar" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   182
     ANT_HOME="/usr/local/Cellar/ant/1.9.4/libexec"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   183
   else
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   184
     echo "FATAL: cannot find ant. Try setting ANT_HOME." >&2; exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   185
   fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   186
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   187
CP=$ANT_HOME/lib/ant.jar
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   188
rm -rf $CLASSES; mkdir $CLASSES
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   189
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   190
if [ "x$CYGPATH" = "x" ] ; then ## CYGPATH may be set in env.cfg
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   191
  JAVAC_SOURCE_FILE=$IDEA_OUTPUT/src/idea/JdkIdeaAntLogger.java
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   192
  JAVAC_CLASSES=$CLASSES
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   193
  JAVAC_CP=$CP
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   194
else
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   195
  JAVAC_SOURCE_FILE=`cygpath -am $IDEA_OUTPUT/src/idea/JdkIdeaAntLogger.java`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   196
  JAVAC_CLASSES=`cygpath -am $CLASSES`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   197
  JAVAC_CP=`cygpath -am $CP`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   198
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   199
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   200
$BOOT_JDK/bin/javac -d $JAVAC_CLASSES -cp $JAVAC_CP $JAVAC_SOURCE_FILE