common/bin/idea.sh
author dchuyko
Mon, 21 Aug 2017 14:57:44 +0200
changeset 46252 15f3e60ff095
parent 37976 9cc5debe0f47
permissions -rw-r--r--
8186438: 'configure' fails to find installed libfreetype on Ubuntu AArch64 Reviewed-by: erikj
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() {
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    28
      echo "usage: $0 [-h|--help] [-v|--verbose] [-o|--output <path>] [modules]+" 
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`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    33
PWD=`pwd`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    34
cd $SCRIPT_DIR; SCRIPT_DIR=`pwd`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    35
cd ../../; TOP=`pwd`; cd $PWD
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    36
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    37
IDEA_OUTPUT=$TOP/.idea
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    38
VERBOSE="false"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    39
while [ $# -gt 0 ]
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    40
do
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    41
  case $1 in
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    42
    -h | --help )
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    43
      usage
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    44
      ;;
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    45
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    46
    -v | --vebose )
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    47
      VERBOSE="true"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    48
      ;;
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    49
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    50
    -o | --output )
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    51
      IDEA_OUTPUT=$2
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    52
      shift
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    53
      ;;
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    54
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    55
    -*)  # bad option
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    56
      usage
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    57
      ;;
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    58
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    59
     * )  # non option
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    60
      break
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    61
      ;;
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    62
  esac
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    63
  shift
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    64
done
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    65
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    66
mkdir $IDEA_OUTPUT || exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    67
cd $IDEA_OUTPUT; IDEA_OUTPUT=`pwd`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    68
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    69
IDEA_MAKE="$TOP/make/idea"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    70
IDEA_TEMPLATE="$IDEA_MAKE/template"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    71
IML_TEMPLATE="$IDEA_TEMPLATE/jdk.iml"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    72
ANT_TEMPLATE="$IDEA_TEMPLATE/ant.xml"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    73
IDEA_IML="$IDEA_OUTPUT/jdk.iml"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    74
IDEA_ANT="$IDEA_OUTPUT/ant.xml"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    75
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    76
if [ "$VERBOSE" = "true" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    77
  echo "output dir: $IDEA_OUTPUT"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    78
  echo "idea template dir: $IDEA_TEMPLATE"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    79
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    80
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    81
if [ ! -f "$IML_TEMPLATE" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    82
  echo "FATAL: cannot find $IML_TEMPLATE" >&2; exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    83
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    84
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    85
if [ ! -f "$ANT_TEMPLATE" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    86
  echo "FATAL: cannot find $ANT_TEMPLATE" >&2; exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    87
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    88
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    89
cp -r "$IDEA_TEMPLATE"/* "$IDEA_OUTPUT"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    90
cd $TOP ; make -f "$IDEA_MAKE/idea.gmk" -I make/common idea MAKEOVERRIDES= OUT=$IDEA_OUTPUT/env.cfg MODULES="$*" || exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    91
cd $SCRIPT_DIR
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    92
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    93
. $IDEA_OUTPUT/env.cfg
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    94
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    95
# Expect MODULE_ROOTS, MODULE_NAMES, BOOT_JDK & SPEC to be set
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    96
if [ "x$MODULE_ROOTS" = "x" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    97
  echo "FATAL: MODULE_ROOTS is empty" >&2; exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    98
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
    99
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   100
if [ "x$MODULE_NAMES" = "x" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   101
  echo "FATAL: MODULE_NAMES 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$BOOT_JDK" = "x" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   105
  echo "FATAL: BOOT_JDK 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$SPEC" = "x" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   109
  echo "FATAL: SPEC 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
SOURCE_FOLDER="      <sourceFolder url=\"file://\$MODULE_DIR\$/####\" isTestSource=\"false\" />"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   113
SOURCE_FOLDERS_DONE="false"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   114
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   115
addSourceFolder() {
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   116
  root=$@
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   117
  relativePath="`echo "$root" | sed -e s@"$TOP/\(.*$\)"@"\1"@`"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   118
  folder="`echo "$SOURCE_FOLDER" | sed -e s@"\(.*/\)####\(.*\)"@"\1$relativePath\2"@`"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   119
  printf "%s\n" "$folder" >> $IDEA_IML
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   120
}
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   121
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   122
### Generate project iml
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   123
RELATIVE_BUILD_DIR="`dirname $SPEC | sed -e s@"$TOP/\(.*$\)"@"\1"@`"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   124
rm -f $IDEA_IML
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   125
while IFS= read -r line
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   126
do
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   127
  if echo "$line" | egrep "^ .* <sourceFolder.*####" > /dev/null ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   128
    if [ "$SOURCE_FOLDERS_DONE" = "false" ] ; then 
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   129
      SOURCE_FOLDERS_DONE="true"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   130
      for root in $MODULE_ROOTS; do
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   131
         addSourceFolder $root
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   132
      done
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   133
    fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   134
  elif echo "$line" | egrep "^ .* <excludeFolder.*####" > /dev/null ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   135
    ul="`echo "$line" | sed -e s@"\(.*/\)####\(.*\)"@"\1$RELATIVE_BUILD_DIR\2"@`"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   136
    printf "%s\n" "$ul" >> $IDEA_IML 
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   137
  else
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   138
    printf "%s\n" "$line" >> $IDEA_IML
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   139
  fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   140
done < "$IML_TEMPLATE"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   141
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   142
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   143
MODULE_NAME="        <property name=\"module.name\" value=\"####\" />"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   144
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   145
addModuleName() {
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   146
  mn="`echo "$MODULE_NAME" | sed -e s@"\(.*\)####\(.*\)"@"\1$MODULE_NAMES\2"@`"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   147
  printf "%s\n" "$mn" >> $IDEA_ANT
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   148
}
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   149
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   150
BUILD_DIR="        <property name=\"build.target.dir\" value=\"####\" />"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   151
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   152
addBuildDir() {
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   153
  DIR=`dirname $SPEC`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   154
  mn="`echo "$BUILD_DIR" | sed -e s@"\(.*\)####\(.*\)"@"\1$DIR\2"@`"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   155
  printf "%s\n" "$mn" >> $IDEA_ANT
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   156
}
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   157
37976
9cc5debe0f47 8157061: Add support for running jtreg tests from IntelliJ project
mcimadamore
parents: 37861
diff changeset
   158
JTREG_HOME="        <property name=\"jtreg.home\" value=\"####\" />"
9cc5debe0f47 8157061: Add support for running jtreg tests from IntelliJ project
mcimadamore
parents: 37861
diff changeset
   159
9cc5debe0f47 8157061: Add support for running jtreg tests from IntelliJ project
mcimadamore
parents: 37861
diff changeset
   160
addJtregHome() {
9cc5debe0f47 8157061: Add support for running jtreg tests from IntelliJ project
mcimadamore
parents: 37861
diff changeset
   161
  DIR=`dirname $SPEC`
9cc5debe0f47 8157061: Add support for running jtreg tests from IntelliJ project
mcimadamore
parents: 37861
diff changeset
   162
  mn="`echo "$JTREG_HOME" | sed -e s@"\(.*\)####\(.*\)"@"\1$JT_HOME\2"@`"
9cc5debe0f47 8157061: Add support for running jtreg tests from IntelliJ project
mcimadamore
parents: 37861
diff changeset
   163
  printf "%s\n" "$mn" >> $IDEA_ANT
9cc5debe0f47 8157061: Add support for running jtreg tests from IntelliJ project
mcimadamore
parents: 37861
diff changeset
   164
}
9cc5debe0f47 8157061: Add support for running jtreg tests from IntelliJ project
mcimadamore
parents: 37861
diff changeset
   165
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   166
### Generate ant.xml
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   167
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   168
rm -f $IDEA_ANT
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   169
while IFS= read -r line
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   170
do
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   171
  if echo "$line" | egrep "^ .* <property name=\"module.name\"" > /dev/null ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   172
    addModuleName
37976
9cc5debe0f47 8157061: Add support for running jtreg tests from IntelliJ project
mcimadamore
parents: 37861
diff changeset
   173
  elif echo "$line" | egrep "^ .* <property name=\"jtreg.home\"" > /dev/null ; then
9cc5debe0f47 8157061: Add support for running jtreg tests from IntelliJ project
mcimadamore
parents: 37861
diff changeset
   174
    addJtregHome
37861
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   175
  elif echo "$line" | egrep "^ .* <property name=\"build.target.dir\"" > /dev/null ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   176
    addBuildDir
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   177
  else
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   178
    printf "%s\n" "$line" >> $IDEA_ANT
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   179
  fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   180
done < "$ANT_TEMPLATE"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   181
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   182
### Compile the custom Logger
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   183
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   184
CLASSES=$IDEA_OUTPUT/classes
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   185
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   186
if [ "x$ANT_HOME" = "x" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   187
   # try some common locations, before giving up
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   188
   if [ -f "/usr/share/ant/lib/ant.jar" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   189
     ANT_HOME="/usr/share/ant"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   190
   elif [ -f "/usr/local/Cellar/ant/1.9.4/libexec/lib/ant.jar" ] ; then
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   191
     ANT_HOME="/usr/local/Cellar/ant/1.9.4/libexec"
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   192
   else
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   193
     echo "FATAL: cannot find ant. Try setting ANT_HOME." >&2; exit 1
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   194
   fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   195
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   196
CP=$ANT_HOME/lib/ant.jar
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   197
rm -rf $CLASSES; mkdir $CLASSES
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   198
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   199
if [ "x$CYGPATH" = "x" ] ; then ## CYGPATH may be set in env.cfg
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   200
  JAVAC_SOURCE_FILE=$IDEA_OUTPUT/src/idea/JdkIdeaAntLogger.java
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   201
  JAVAC_CLASSES=$CLASSES
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   202
  JAVAC_CP=$CP
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   203
else
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   204
  JAVAC_SOURCE_FILE=`cygpath -am $IDEA_OUTPUT/src/idea/JdkIdeaAntLogger.java`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   205
  JAVAC_CLASSES=`cygpath -am $CLASSES`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   206
  JAVAC_CP=`cygpath -am $CP`
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   207
fi
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   208
53d85619d7fe 8074716: IntelliJ IDEA project support
chegar
parents:
diff changeset
   209
$BOOT_JDK/bin/javac -d $JAVAC_CLASSES -cp $JAVAC_CP $JAVAC_SOURCE_FILE