Unified build scripts
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Wed, 11 Jan 2012 14:33:21 +0000 (15:33 +0100)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Sun, 22 Jan 2012 15:15:56 +0000 (19:15 +0400)
21 files changed:
bin/mac/info_plist_parser.scpt [deleted file]
bin/mac/inspect.sh [new file with mode: 0644]
bin/nix/idea.sh [deleted file]
bin/nix/inspect.sh [deleted file]
bin/nix/inspect_diff.sh [deleted file]
bin/scripts/unix/idea.sh [new file with mode: 0755]
bin/scripts/unix/inspect.sh [new file with mode: 0644]
bin/scripts/win/append.bat [new file with mode: 0644]
bin/scripts/win/idea.bat [moved from bin/win/idea.bat with 51% similarity]
bin/scripts/win/inspect.bat [new file with mode: 0644]
bin/win/append.bat [deleted file]
bin/win/inspect.bat [deleted file]
bin/win/inspect_diff.bat [deleted file]
build/Install-Linux-tar.txt
build/images/idea_CE128.png [deleted file]
build/images/idea_CE16.png [deleted file]
build/images/idea_CE32.png [deleted file]
build/images/idea_CE48.png [deleted file]
build/scripts/dist.gant
build/scripts/utils.gant
license/yourkit-license-redist.txt

diff --git a/bin/mac/info_plist_parser.scpt b/bin/mac/info_plist_parser.scpt
deleted file mode 100644 (file)
index 2340dbd..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# argv: first argument is optional java architecture version ("64" or "32" bit)
-on run argv
-       # Determine path to "../../Contents/Info.plist"
-       tell application "Finder"
-               set binFolder to container of container of (path to me) as text
-               set the plistPath to (POSIX path of binFolder) & ("/Contents/Info.plist")
-       end tell
-       
-       # Fetch JVM system properties & VM options from Info.plist
-       tell application "System Events"
-               set the plistFile to property list file plistPath
-               # Java section
-               set javaOptionsSection to property list item "Java" of plistFile
-               
-               # Java | Properties sction
-               set jvmProperties to property list items of property list item "Properties" of javaOptionsSection
-               
-               # Collect system properties as -D$name=$value
-               set jvmSysPropertiesStr to ""
-               repeat with jvmProperty in jvmProperties
-                       set propertyKey to name of jvmProperty
-                       set propertyValue to value of jvmProperty
-                       set jvmSysPropertiesStr to jvmSysPropertiesStr & " -D" & propertyKey & "=" & propertyValue
-               end repeat
-               
-               # Collect vm options
-               set vmOptionsStr to ""
-               
-               if (count argv) = 1 then
-                       set javaArchitecture to item 1 of argv
-                       
-                       # Common VM options
-                       set vmOptionsStr to value of property list item "VMOptions" of javaOptionsSection
-                       
-                       # Architecture - specific
-                       if javaArchitecture = "64" then
-                               set vmOptionsStr to vmOptionsStr & " " & value of property list item "VMOptions.x86_64" of javaOptionsSection
-                       else if javaArchitecture = "32" then
-                               set vmOptionsStr to vmOptionsStr & " " & value of property list item "VMOptions.i386" of javaOptionsSection
-                       end if
-               end if
-               
-               return vmOptionsStr & " " & jvmSysPropertiesStr
-       end tell
-end run
\ No newline at end of file
diff --git a/bin/mac/inspect.sh b/bin/mac/inspect.sh
new file mode 100644 (file)
index 0000000..b135e03
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# ------------------------------------------------------
+# @@product_full@@ offline inspection script.
+# ------------------------------------------------------
+#
+
+export DEFAULT_PROJECT_PATH=`pwd`
+
+IDE_BIN_HOME="$(dirname "$0")"
+exec "$IDE_BIN_HOME/../Contents/MacOS/@@script_name@@" inspect $*
diff --git a/bin/nix/idea.sh b/bin/nix/idea.sh
deleted file mode 100755 (executable)
index 3236020..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-#!/bin/sh
-#
-# ------------------------------------------------------
-#  IntelliJ IDEA Startup Script for Unix
-# ------------------------------------------------------
-#
-
-# ---------------------------------------------------------------------
-#   Before you run IntelliJ IDEA specify the location of the
-#   JDK 1.6 installation directory which will be used for running it.
-
-JDK="$IDEA_JDK"
-if [ -z "$JDK" ]; then
-  OS_TYPE=`uname -s`
-  JDK="$JDK_HOME"
-  # if JDK_HOME not defined and JAVA_HOME looks correct (tools.jar isn't included in Mac OS X Java bundle)
-  if [ -z "$JDK" ] && ([ "$OS_TYPE" = "Darwin" -a -x "$JAVA_HOME/bin/java" ] || [ -f "$JAVA_HOME/lib/tools.jar" ]); then
-    JDK="$JAVA_HOME"
-  fi
-
-  if [ -z "$JDK" ]; then
-    # try to get the JDK path from java binary path
-    JAVA_BIN_PATH=`which java`
-    if [ -n "$JAVA_BIN_PATH" ]; then
-      if [ "$OS_TYPE" = "Darwin" ]; then
-        if [ -h "$JAVA_BIN_PATH" ]; then
-          JAVA_LOCATION=`readlink "$JAVA_BIN_PATH" | xargs dirname | xargs dirname | xargs dirname`
-          if [ -x "$JAVA_LOCATION/CurrentJDK/Home/bin/java" ]; then
-            JDK="$JAVA_LOCATION/CurrentJDK/Home"
-          fi
-        else
-          JAVA_LOCATION=`echo "$JAVA_BIN_PATH" | xargs dirname | xargs dirname`
-          if [ -f "$JAVA_LOCATION/lib/tools.jar" ]; then
-            JDK="$JAVA_LOCATION"
-          fi
-        fi
-      elif [ "$OS_TYPE" = "FreeBSD" ]; then
-        JAVA_LOCATION=`JAVAVM_DRYRUN=yes java | grep '^JAVA_HOME' | cut -c11-`
-        if [ -x "$JAVA_LOCATION/bin/java" ]; then
-          JDK="$JAVA_LOCATION"
-        fi
-      elif [ "$OS_TYPE" = "SunOS" ]; then
-        JAVA_LOCATION="/usr/jdk/latest"
-        if [ -x "$JAVA_LOCATION/bin/java" ]; then
-          JDK="$JAVA_LOCATION"
-        fi
-      fi
-      if [ -z "$JDK" -a -x "/bin/readlink" ]; then
-        JAVA_LOCATION=`readlink -f "$JAVA_BIN_PATH"`
-        case "$JAVA_LOCATION" in
-          */jre/bin/java)
-            JAVA_LOCATION=`echo "$JAVA_LOCATION" | xargs dirname | xargs dirname | xargs dirname` ;;
-          *)
-            JAVA_LOCATION=`echo "$JAVA_LOCATION" | xargs dirname | xargs dirname` ;;
-        esac
-        if [ -x "$JAVA_LOCATION/bin/java" ]; then
-          JDK="$JAVA_LOCATION"
-        fi
-      fi
-    fi
-  fi
-
-  if [ -z "$JDK" ]; then
-    echo "ERROR: cannot start IntelliJ IDEA."
-    echo "No JDK found. Please validate either IDEA_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation."
-    echo
-    echo "Press Enter to continue."
-    read IGNORE
-    exit 1
-  fi
-fi
-
-VERSION_LOG=`mktemp -t java.version.log.XXXXXX`
-$JDK/bin/java -version 2> "$VERSION_LOG"
-grep 'OpenJDK' "$VERSION_LOG"
-OPEN_JDK=$?
-grep '64-Bit' "$VERSION_LOG"
-BITS=$?
-rm "$VERSION_LOG"
-if [ $OPEN_JDK -eq 0 ]; then
-  echo "WARNING: You are launching IDE using OpenJDK Java runtime."
-  echo
-  echo "         THIS IS STRICTLY UNSUPPORTED DUE TO KNOWN PERFORMANCE AND GRAPHICS PROBLEMS!"
-  echo
-  echo "NOTE:    If you have both Oracle (Sun) JDK and OpenJDK installed"
-  echo "         please validate either IDEA_JDK, JDK_HOME, or JAVA_HOME environment variable points to valid Oracle (Sun) JDK installation."
-  echo "         See http://ow.ly/6TuKQ for more info on switching default JDK"
-  echo
-  echo "Press Enter to continue."
-  read IGNORE
-fi
-if [ $BITS -eq 0 ]; then
-  BITS="64"
-else
-  BITS=""
-fi
-
-#--------------------------------------------------------------------------
-#   Ensure the IDE_HOME var for this script points to the
-#   home directory where IntelliJ IDEA is installed on your system.
-
-SCRIPT_LOCATION=$0
-# step through symlinks to find where the script really is
-while [ -L "$SCRIPT_LOCATION" ]; do
-  SCRIPT_LOCATION=`readlink -e "$SCRIPT_LOCATION"`
-done
-
-IDE_HOME=`dirname "$SCRIPT_LOCATION"`/..
-IDE_BIN_HOME=`dirname "$SCRIPT_LOCATION"`
-
-if [ -n "$IDEA_PROPERTIES" ]; then
-  IDE_PROPERTIES_PROPERTY="-Didea.properties.file=\"$IDEA_PROPERTIES\""
-fi
-
-MAIN_CLASSNAME="$IDEA_MAIN_CLASS_NAME"
-if [ -z "$MAIN_CLASS_NAME" ]; then
-  MAIN_CLASS_NAME="com.intellij.idea.Main"
-fi
-
-VM_OPTIONS_FILE="$IDEA_VM_OPTIONS"
-if [ -z "$VM_OPTIONS_FILE" ]; then
-  VM_OPTIONS_FILE="$IDE_BIN_HOME/idea.vmoptions"
-fi
-
-# if VM options file exists - use it
-if [ -r "$VM_OPTIONS_FILE" ]; then
-  JVM_ARGS=`cat "$VM_OPTIONS_FILE" | grep -ve "^#.*" | tr '\n' ' '`
-  JVM_ARGS="$JVM_ARGS -Djb.vmOptionsFile=\"$VM_OPTIONS_FILE\""
-  # only extract properties (not VM options) from Info.plist
-  INFO_PLIST_PARSER_OPTIONS=""
-else
-  [ "$BITS" == "64" ] && INFO_PLIST_PARSER_OPTIONS=" 64" || INFO_PLIST_PARSER_OPTIONS=" 32"
-fi
-
-# in Mac OS X ./Contents/Info.plist describes all VM options & system properties
-if [ -f "$IDE_HOME/Contents/Info.plist" -a -z "$IDE_PROPERTIES_PROPERTY" ]; then
-  MAC_VM_OPTIONS="`osascript \"$IDE_BIN_HOME/info_plist_parser.scpt\"$INFO_PLIST_PARSER_OPTIONS`"
-fi
-
-REQUIRED_JVM_ARGS="-Xbootclasspath/a:../lib/boot.jar -Didea.paths.selector=@@system_selector@@ $IDE_PROPERTIES_PROPERTY $REQUIRED_JVM_ARGS"
-
-JVM_ARGS="$JVM_ARGS $REQUIRED_JVM_ARGS $MAC_VM_OPTIONS"
-
-CLASSPATH=../lib/bootstrap.jar
-CLASSPATH=$CLASSPATH:../lib/util.jar
-CLASSPATH=$CLASSPATH:../lib/jdom.jar
-CLASSPATH=$CLASSPATH:../lib/log4j.jar
-CLASSPATH=$CLASSPATH:../lib/extensions.jar
-CLASSPATH=$CLASSPATH:../lib/trove4j.jar
-CLASSPATH=$CLASSPATH:../lib/jna.jar
-CLASSPATH=$CLASSPATH:$JDK/lib/tools.jar
-CLASSPATH=$CLASSPATH:$IDEA_CLASSPATH
-export CLASSPATH
-
-LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
-export LD_LIBRARY_PATH
-
-cd "$IDE_BIN_HOME"
-while true ; do
-  eval $JDK/bin/java $JVM_ARGS -Djb.restart.code=88 $MAIN_CLASS_NAME $*
-  test $? -ne 88 && break
-done
diff --git a/bin/nix/inspect.sh b/bin/nix/inspect.sh
deleted file mode 100644 (file)
index 5fdfa97..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-export DEFAULT_PROJECT_PATH=`pwd`
-
-# Launch inspection tool
-IDEA_BIN_HOME="$( cd "$( dirname "$0" )" && pwd )"
-$IDEA_BIN_HOME/idea.sh inspect $*
\ No newline at end of file
diff --git a/bin/nix/inspect_diff.sh b/bin/nix/inspect_diff.sh
deleted file mode 100644 (file)
index d14cca3..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/sh
-#
-# ------------------------------------------------------
-#  IntelliJ IDEA Startup Script for Unix
-# ------------------------------------------------------
-#
-
-# ---------------------------------------------------------------------
-# Before you run IntelliJ IDEA specify the location of the
-# JDK 1.5 installation directory which will be used for running IDEA
-# ---------------------------------------------------------------------
-if [ -z "$IDEA_JDK" ]; then
-IDEA_JDK=$JDK_HOME
-if [ -z "$IDEA_JDK" ]; then
-echo ERROR: cannot start IntelliJ IDEA.
-echo No JDK found to run IDEA. Please validate either IDEA_JDK or JDK_HOME points to valid JDK installation
-fi
-fi
-
-#--------------------------------------------------------------------------
-#   Ensure the IDEA_HOME var for this script points to the
-#   home directory where IntelliJ IDEA is installed on your system.
-
-IDEA_HOME=`dirname "$0"`/..
-IDEA_BIN_HOME=`dirname "$0"`
-
-export JAVA_HOME
-export IDEA_HOME
-
-if [ -n "$IDEA_PROPERTIES" ]; then
-IDEA_PROPERTIES_PROPERTY=-Didea.properties.file=$IDEA_PROPERTIES
-fi
-
-if [ -z "$IDEA_INSPECT_DIFF_CLASS_NAME" ]; then
-IDEA_INSPECT_DIFF_CLASS_NAME="com.intellij.codeInspection.InspectionDiff"
-fi
-
-if [ -z "$IDEA_VM_OPTIONS" ]; then
-IDEA_VM_OPTIONS="$IDEA_HOME/bin/idea.vmoptions"
-fi
-
-REQUIRED_JVM_ARGS="-Xbootclasspath/a:../lib/boot.jar -Didea.paths.selector=@@system_selector@@ $IDEA_PROPERTIES_PROPERTY $REQUIRED_JVM_ARGS"
-JVM_ARGS=`tr '\n' ' ' < "$IDEA_VM_OPTIONS"`
-JVM_ARGS="$JVM_ARGS $REQUIRED_JVM_ARGS"
-
-CLASSPATH=../lib/bootstrap.jar
-CLASSPATH=$CLASSPATH:../lib/openapi.jar
-CLASSPATH=$CLASSPATH:../lib/util.jar
-CLASSPATH=$CLASSPATH:../lib/idea.jar
-CLASSPATH=$CLASSPATH:../lib/resources_en.jar
-CLASSPATH=$CLASSPATH:../lib/jdom.jar
-CLASSPATH=$CLASSPATH:../lib/log4j.jar
-CLASSPATH=$CLASSPATH:../lib/extensions.jar
-CLASSPATH=$CLASSPATH:../lib/trove4j.jar
-CLASSPATH=$CLASSPATH:$IDEA_JDK/lib/tools.jar
-CLASSPATH=$CLASSPATH:$IDEA_CLASSPATH
-
-export CLASSPATH
-
-LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
-export LD_LIBRARY_PATH
-
-cd "$IDEA_BIN_HOME"
-exec $IDEA_JDK/bin/java $JVM_ARGS $IDEA_INSPECT_DIFF_CLASS_NAME $*
diff --git a/bin/scripts/unix/idea.sh b/bin/scripts/unix/idea.sh
new file mode 100755 (executable)
index 0000000..5ae9475
--- /dev/null
@@ -0,0 +1,155 @@
+#!/bin/sh
+#
+# ---------------------------------------------------------------------
+# @@product_full@@ startup script.
+# ---------------------------------------------------------------------
+#
+
+OS_TYPE="`uname -s`"
+
+# ---------------------------------------------------------------------
+# Locate a JDK installation directory which will be used to ruin the IDE.
+# Try (in order): @@product_uc@@_JDK, JDK_HOME, JAVA_HOME, "java" in PATH.
+# ---------------------------------------------------------------------
+if [ -n "$@@product_uc@@_JDK" -a -x "$@@product_uc@@_JDK/bin/java" ]; then
+  JDK="$@@product_uc@@_JDK"
+elif [ -n "$JDK_HOME" -a -x "$JDK_HOME/bin/java" ]; then
+  JDK="$JDK_HOME"
+elif [ -n "$JAVA_HOME" -a -x "$JAVA_HOME/bin/java" ]; then
+  JDK="$JAVA_HOME"
+else
+  JAVA_BIN_PATH=`which java`
+  if [ -n "$JAVA_BIN_PATH" ]; then
+    if [ "$OS_TYPE" = "FreeBSD" ]; then
+      JAVA_LOCATION=`JAVAVM_DRYRUN=yes java | grep '^JAVA_HOME' | cut -c11-`
+      if [ -x "$JAVA_LOCATION/bin/java" ]; then
+        JDK="$JAVA_LOCATION"
+      fi
+    elif [ "$OS_TYPE" = "SunOS" ]; then
+      JAVA_LOCATION="/usr/jdk/latest"
+      if [ -x "$JAVA_LOCATION/bin/java" ]; then
+        JDK="$JAVA_LOCATION"
+      fi
+    fi
+
+    if [ -z "$JDK" -a -x "/bin/readlink" ]; then
+      JAVA_LOCATION=`readlink -f "$JAVA_BIN_PATH"`
+      case "$JAVA_LOCATION" in
+        */jre/bin/java)
+          JAVA_LOCATION=`echo "$JAVA_LOCATION" | xargs dirname | xargs dirname | xargs dirname` ;;
+        *)
+          JAVA_LOCATION=`echo "$JAVA_LOCATION" | xargs dirname | xargs dirname` ;;
+      esac
+      if [ -x "$JAVA_LOCATION/bin/java" ]; then
+        JDK="$JAVA_LOCATION"
+      fi
+    fi
+  fi
+fi
+
+if [ -z "$JDK" ]; then
+  echo "ERROR: cannot start @@product_full@@."
+  echo "No JDK found. Please validate either @@product_uc@@_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation."
+  echo
+  echo "Press Enter to continue."
+  read IGNORE
+  exit 1
+fi
+
+VERSION_LOG=`mktemp -t java.version.log.XXXXXX`
+$JDK/bin/java -version 2> "$VERSION_LOG"
+grep 'OpenJDK' "$VERSION_LOG"
+OPEN_JDK=$?
+grep '64-Bit' "$VERSION_LOG"
+BITS=$?
+rm "$VERSION_LOG"
+if [ $OPEN_JDK -eq 0 ]; then
+  echo "WARNING: You are launching the IDE using OpenJDK Java runtime."
+  echo
+  echo "         THIS IS STRICTLY UNSUPPORTED DUE TO KNOWN PERFORMANCE AND GRAPHICS PROBLEMS!"
+  echo
+  echo "NOTE:    If you have both Oracle (Sun) JDK and OpenJDK installed"
+  echo "         please validate either @@product_uc@@_JDK, JDK_HOME, or JAVA_HOME environment variable points to valid Oracle (Sun) JDK installation."
+  echo "         See http://ow.ly/6TuKQ for more info on switching default JDK."
+  echo
+  echo "Press Enter to continue."
+  read IGNORE
+fi
+if [ $BITS -eq 0 ]; then
+  BITS="64"
+else
+  BITS=""
+fi
+
+# ---------------------------------------------------------------------
+# Ensure IDE_HOME points to the directory where the IDE is installed.
+# ---------------------------------------------------------------------
+SCRIPT_LOCATION=$0
+while [ -L "$SCRIPT_LOCATION" ]; do
+  SCRIPT_LOCATION=`readlink -e "$SCRIPT_LOCATION"`
+done
+
+IDE_HOME=`dirname "$SCRIPT_LOCATION"`/..
+IDE_BIN_HOME=`dirname "$SCRIPT_LOCATION"`
+
+# ---------------------------------------------------------------------
+# Collect JVM options and properties.
+# ---------------------------------------------------------------------
+if [ -n "$@@product_uc@@_PROPERTIES" ]; then
+  IDE_PROPERTIES_PROPERTY="-Didea.properties.file=\"$@@product_uc@@_PROPERTIES\""
+fi
+
+MAIN_CLASS_NAME="$@@product_uc@@_MAIN_CLASS_NAME"
+if [ -z "$MAIN_CLASS_NAME" ]; then
+  MAIN_CLASS_NAME="com.intellij.idea.Main"
+fi
+
+VM_OPTIONS_FILE="$@@product_uc@@_VM_OPTIONS"
+if [ -z "$VM_OPTIONS_FILE" ]; then
+  VM_OPTIONS_FILE="$IDE_BIN_HOME/@@vm_options@@$BITS.vmoptions"
+fi
+
+if [ -r "$VM_OPTIONS_FILE" ]; then
+  VM_OPTIONS=`cat "$VM_OPTIONS_FILE" | grep -ve "^#.*" | tr '\n' ' '`
+  VM_OPTIONS="$VM_OPTIONS -Djb.vmOptionsFile=\"$VM_OPTIONS_FILE\""
+fi
+
+IS_EAP="@@isEap@@"
+if [ "$IS_EAP" = "true" ]; then
+  OS_NAME=`echo $OS_TYPE | tr '[:upper:]' '[:lower:]'`
+  AGENT_LIB="yjpagent-$OS_NAME$BITS"
+  if [ -f "$IDE_BIN_HOME/lib$AGENT_LIB.so" ]; then
+    AGENT="-agentlib:$AGENT_LIB=disablej2ee,disablecounts,disablealloc,sessionname=@@system_selector@@"
+  fi
+fi
+
+COMMON_JVM_ARGS="-Xbootclasspath/a:../lib/boot.jar -Didea.paths.selector=@@system_selector@@ $IDE_PROPERTIES_PROPERTY"
+IDE_JVM_ARGS="@@ide_jvm_args@@"
+ALL_JVM_ARGS="$VM_OPTIONS $COMMON_JVM_ARGS $IDE_JVM_ARGS $AGENT $REQUIRED_JVM_ARGS"
+
+TOOLS_JAR="@@tools_jar@@"
+CLASSPATH="../lib/bootstrap.jar"
+CLASSPATH="$CLASSPATH:../lib/util.jar"
+CLASSPATH="$CLASSPATH:../lib/jdom.jar"
+CLASSPATH="$CLASSPATH:../lib/log4j.jar"
+CLASSPATH="$CLASSPATH:../lib/extensions.jar"
+CLASSPATH="$CLASSPATH:../lib/trove4j.jar"
+CLASSPATH="$CLASSPATH:../lib/jna.jar"
+if [ "$TOOLS_JAR" = "true" ]; then
+  CLASSPATH="$CLASSPATH:$JDK/lib/tools.jar"
+fi
+if [ -n "$@@product_uc@@_CLASSPATH" ]; then
+  CLASSPATH="$CLASSPATH:$@@product_uc@@_CLASSPATH"
+fi
+export CLASSPATH
+
+export LD_LIBRARY_PATH="$IDE_BIN_HOME:$LD_LIBRARY_PATH"
+
+# ---------------------------------------------------------------------
+# Run the IDE.
+# ---------------------------------------------------------------------
+cd "$IDE_BIN_HOME"
+while true ; do
+  eval $JDK/bin/java $ALL_JVM_ARGS -Djb.restart.code=88 $MAIN_CLASS_NAME $*
+  test $? -ne 88 && break
+done
diff --git a/bin/scripts/unix/inspect.sh b/bin/scripts/unix/inspect.sh
new file mode 100644 (file)
index 0000000..4b4f140
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# ------------------------------------------------------
+# @@product_full@@ offline inspection script.
+# ------------------------------------------------------
+#
+
+export DEFAULT_PROJECT_PATH=`pwd`
+
+IDE_BIN_HOME="$(dirname "$0")"
+exec "$IDE_BIN_HOME/@@script_name@@" inspect $*
diff --git a/bin/scripts/win/append.bat b/bin/scripts/win/append.bat
new file mode 100644 (file)
index 0000000..abe6887
--- /dev/null
@@ -0,0 +1,14 @@
+IF NOT DEFINED ACC GOTO empty_acc
+IF "%SEPARATOR%" == "" GOTO no_separator
+SET ACC=%ACC%%SEPARATOR%%1
+GOTO end
+
+:no_separator
+SET ACC=%ACC% %1
+GOTO end
+
+:empty_acc
+SET ACC=%1
+GOTO end
+
+:end
similarity index 51%
rename from bin/win/idea.bat
rename to bin/scripts/win/idea.bat
index 604239cef6824e1f53b16df9e446d05d7d8b6c00..8b4d9c7ea8cef43d173a438f3b5b9d603ff32283 100644 (file)
@@ -1,47 +1,44 @@
 @ECHO OFF
 
 ::----------------------------------------------------------------------
-:: IntelliJ IDEA Startup Script
+:: @@product_full@@ startup script.
 ::----------------------------------------------------------------------
 
 :: ---------------------------------------------------------------------
-:: Location of the JDK 1.6 installation directory
-:: which will be used for running the IDE.
+:: Locate a JDK installation directory which will be used to ruin the IDE.
+:: Try (in order): @@product_uc@@_JDK, JDK_HOME, JAVA_HOME.
 :: ---------------------------------------------------------------------
-SET JDK=%IDEA_JDK%
+SET JDK=%@@product_uc@@_JDK%
 IF "%JDK%" == "" SET JDK=%JDK_HOME%
+IF "%JDK%" == "" SET JDK=%JAVA_HOME%
 IF "%JDK%" == "" GOTO error
 
-SET JAVA_EXE=%JDK%\jre\bin\java.exe
+SET JAVA_EXE=%JDK%\bin\java.exe
 IF NOT EXIST "%JAVA_EXE%" GOTO error
 
 :: ---------------------------------------------------------------------
-:: Location of the directory where the IDE is installed
-:: In most cases you do not need to change the settings below.
+:: Ensure IDE_HOME points to the directory where the IDE is installed.
 :: ---------------------------------------------------------------------
 SET IDE_BIN_DIR=%~dp0
 SET IDE_HOME=%IDE_BIN_DIR%\..
 
-SET MAIN_CLASS_NAME=%IDEA_MAIN_CLASS_NAME%
+SET MAIN_CLASS_NAME=%@@product_uc@@_MAIN_CLASS_NAME%
 IF "%MAIN_CLASS_NAME%" == "" SET MAIN_CLASS_NAME=com.intellij.idea.Main
 
-IF NOT "%IDEA_PROPERTIES%" == "" SET IDE_PROPERTIES_PROPERTY="-Didea.properties.file=%IDEA_PROPERTIES%"
+IF NOT "%@@product_uc@@_PROPERTIES%" == "" SET IDE_PROPERTIES_PROPERTY="-Didea.properties.file=%@@product_uc@@_PROPERTIES%"
 
 :: ---------------------------------------------------------------------
-:: You may specify your own JVM arguments in .vmoptions file.
-:: Put one option per line there.
+:: Collect JVM options and properties.
 :: ---------------------------------------------------------------------
-SET VM_OPTIONS_FILE=%IDE_BIN_DIR%\idea.exe.vmoptions
+SET VM_OPTIONS_FILE=%IDE_BIN_DIR%\@@vm_options@@.vmoptions
 SET ACC=
 FOR /F "usebackq delims=" %%i IN ("%VM_OPTIONS_FILE%") DO CALL "%IDE_BIN_DIR%\append.bat" "%%i"
 
-SET REQUIRED_JVM_ARGS="-Xbootclasspath/a:%IDE_HOME%/lib/boot.jar" -Didea.paths.selector=@@system_selector@@ %IDE_PROPERTIES_PROPERTY%
-SET SPECIAL_JVM_ARGS=
-SET JVM_ARGS=%ACC% %REQUIRED_JVM_ARGS% %SPECIAL_JVM_ARGS% %REQUIRED_IDEA_JVM_ARGS%
-
-SET OLD_PATH=%PATH%
-SET PATH=%IDE_BIN_DIR%;%PATH%
+SET COMMON_JVM_ARGS="-Xbootclasspath/a:%IDE_HOME%/lib/boot.jar" -Didea.paths.selector=@@system_selector@@ %IDE_PROPERTIES_PROPERTY%
+SET IDE_JVM_ARGS=@@ide_jvm_args@@
+SET ALL_JVM_ARGS=%ACC% %COMMON_JVM_ARGS% %IDE_JVM_ARGS% %REQUIRED_JVM_ARGS%
 
+SET TOOLS_JAR=@@tools_jar@@
 SET CLASS_PATH=%IDE_HOME%\lib\bootstrap.jar
 SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\util.jar
 SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\jdom.jar
@@ -49,24 +46,24 @@ SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\log4j.jar
 SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\extensions.jar
 SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\trove4j.jar
 SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\jna.jar
-SET CLASS_PATH=%CLASS_PATH%;%JDK%\lib\tools.jar
+IF "%TOOLS_JAR%" == "true" SET CLASS_PATH=%CLASS_PATH%;%JDK%\lib\tools.jar
+IF NOT "%@@product_uc@@_CLASS_PATH%" == "" SET CLASS_PATH=%CLASS_PATH%;%@@product_uc@@_CLASS_PATH%
 
 :: ---------------------------------------------------------------------
-:: You may specify additional class paths in IDEA_CLASS_PATH variable.
-:: It is a good idea to specify paths to your plugins in this variable.
+:: Run the IDE.
 :: ---------------------------------------------------------------------
-IF NOT "%IDEA_CLASS_PATH%" == "" SET CLASS_PATH=%CLASS_PATH%;%IDEA_CLASS_PATH%
+SET OLD_PATH=%PATH%
+SET PATH=%IDE_BIN_DIR%;%PATH%
 
-"%JAVA_EXE%" %JVM_ARGS% -cp "%CLASS_PATH%" %MAIN_CLASS_NAME% %*
+"%JAVA_EXE%" %ALL_JVM_ARGS% -cp "%CLASS_PATH%" %MAIN_CLASS_NAME% %*
 
 SET PATH=%OLD_PATH%
 GOTO end
 
 :error
-ECHO ---------------------------------------------------------------------
-ECHO ERROR: cannot start IntelliJ IDEA.
-ECHO No JDK found. Please validate either IDEA_JDK or JDK_HOME points to valid JDK installation.
-ECHO ---------------------------------------------------------------------
+ECHO ERROR: cannot start @@product_full@@.
+ECHO No JDK found. Please validate either @@product_uc@@_JDK, JDK_HOME or JAVA_HOME points to valid JDK installation.
+ECHO
 PAUSE
 
 :end
diff --git a/bin/scripts/win/inspect.bat b/bin/scripts/win/inspect.bat
new file mode 100644 (file)
index 0000000..e5c12bd
--- /dev/null
@@ -0,0 +1,10 @@
+@ECHO OFF
+
+::----------------------------------------------------------------------
+:: @@product_full@@ offline inspection script.
+::----------------------------------------------------------------------
+
+SET DEFAULT_PROJECT_PATH=%CD%
+
+SET IDE_BIN_DIR=%~dp0
+CALL "%IDE_BIN_DIR%\@@script_name@@" inspect %*
diff --git a/bin/win/append.bat b/bin/win/append.bat
deleted file mode 100644 (file)
index 37bd7f4..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-if not defined ACC goto emptyacc
-if "%SEPARATOR%" == "" goto noseparator
-set ACC=%ACC%%SEPARATOR%%1
-goto end
-
-:noseparator
-set ACC=%ACC% %1
-goto end
-
-:emptyacc
-set ACC=%1
-goto end
-
-:end
\ No newline at end of file
diff --git a/bin/win/inspect.bat b/bin/win/inspect.bat
deleted file mode 100644 (file)
index 2b524d9..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-@echo off
-call idea.bat inspect %*
diff --git a/bin/win/inspect_diff.bat b/bin/win/inspect_diff.bat
deleted file mode 100644 (file)
index eb1df39..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-@ECHO OFF
-
-::----------------------------------------------------------------------
-:: IntelliJ IDEA Startup Script
-::----------------------------------------------------------------------
-
-:: ---------------------------------------------------------------------
-:: Location of the JDK 1.6 installation directory
-:: which will be used for running the IDE.
-:: ---------------------------------------------------------------------
-SET JDK=%IDEA_JDK%
-IF "%JDK%" == "" SET JDK=%JDK_HOME%
-IF "%JDK%" == "" GOTO error
-
-SET JAVA_EXE=%JDK%\jre\bin\java.exe
-IF NOT EXIST "%JAVA_EXE%" GOTO error
-
-:: ---------------------------------------------------------------------
-:: Location of the directory where the IDE is installed
-:: In most cases you do not need to change the settings below.
-:: ---------------------------------------------------------------------
-SET IDE_BIN_DIR=%~dp0
-SET IDE_HOME=%IDE_BIN_DIR%\..
-
-SET MAIN_CLASS_NAME=%IDEA_INSPECT_DIFF_CLASS_NAME%
-IF "%MAIN_CLASS_NAME%" == "" SET MAIN_CLASS_NAME=com.intellij.codeInspection.InspectionDiff
-
-IF NOT "%IDEA_PROPERTIES%" == "" SET IDE_PROPERTIES_PROPERTY="-Didea.properties.file=%IDEA_PROPERTIES%"
-
-:: ---------------------------------------------------------------------
-:: You may specify your own JVM arguments in .vmoptions file.
-:: Put one option per line there.
-:: ---------------------------------------------------------------------
-SET VM_OPTIONS_FILE=%IDE_BIN_DIR%\idea.exe.vmoptions
-SET ACC=
-FOR /F "usebackq delims=" %%i IN ("%VM_OPTIONS_FILE%") DO CALL "%IDE_BIN_DIR%\append.bat" "%%i"
-
-SET REQUIRED_JVM_ARGS="-Xbootclasspath/a:%IDE_HOME%/lib/boot.jar" -Didea.paths.selector=@@system_selector@@ %IDE_PROPERTIES_PROPERTY%
-SET SPECIAL_JVM_ARGS=
-SET JVM_ARGS=%ACC% %REQUIRED_JVM_ARGS% %SPECIAL_JVM_ARGS% %REQUIRED_IDEA_JVM_ARGS%
-
-SET OLD_PATH=%PATH%
-SET PATH=%IDE_BIN_DIR%;%PATH%
-
-SET CLASS_PATH=%IDE_HOME%\lib\bootstrap.jar
-SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\idea.jar
-SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\resources_en.jar
-SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\openapi.jar
-SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\util.jar
-SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\jdom.jar
-SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\log4j.jar
-SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\extensions.jar
-SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\trove4j.jar
-SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\lib\jna.jar
-SET CLASS_PATH=%CLASS_PATH%;%JDK%\lib\tools.jar
-
-:: ---------------------------------------------------------------------
-:: You may specify additional class paths in IDEA_CLASS_PATH variable.
-:: It is a good idea to specify paths to your plugins in this variable.
-:: ---------------------------------------------------------------------
-IF NOT "%IDEA_CLASS_PATH%" == "" SET CLASS_PATH=%CLASS_PATH%;%IDEA_CLASS_PATH%
-
-"%JAVA_EXE%" %JVM_ARGS% -cp "%CLASS_PATH%" %MAIN_CLASS_NAME% %*
-
-SET PATH=%OLD_PATH%
-GOTO end
-
-:error
-ECHO ---------------------------------------------------------------------
-ECHO ERROR: cannot start IntelliJ IDEA.
-ECHO No JDK found. Please validate either IDEA_JDK or JDK_HOME points to valid JDK installation.
-ECHO ---------------------------------------------------------------------
-PAUSE
-
-:end
index d51b005ba33d8f1198797d105660415e7ddd5ed7..8c9f0481fd44f0ee0407be5d2f6321f3730131b2 100644 (file)
@@ -1,42 +1,42 @@
-IntelliJ IDEA
+@@product_full@@
 
 INSTALLATION INSTRUCTIONS
 ===============================================================================
 
   Linux Installation Instructions
   ------------------------------------------------------------------------------
-  1. Unpack the IntelliJ IDEA distribution file that you downloaded to
+  1. Unpack the @@product_full@@ distribution archive that you downloaded to
      where you wish to install the program. We will refer to this destination
      location as your {installation home} below.
 
   2. Open a console and cd into "{installation home}/bin" and type:
 
-       ./idea.sh
+       ./@@product@@.sh
 
      to start the application.
 
   3. [OPTIONAL] Add the "{installation home}/bin" to your PATH environmental
-     variable so that you may start IntelliJ IDEA from any directory.
+     variable so that you may start @@product_full@@ from any directory.
 
-  4. [OPTIONAL] To adjust the value of JVM heap size open idea.vmoptions and
-     modify the -Xms and -Xmx parameters.
+  4. [OPTIONAL] To adjust the value of JVM heap size open @@product@@.vmoptions
+     (@@product@@64.vmoptions for 64-bit JDK), and modify the -Xms and -Xmx parameters.
 
 
   [OPTIONAL] Changing location of "config" and "system" directory
   ------------------------------------------------------------------------------
-  By default IDEA stores all your settings under ~/.IntelliJIdea10/config directory
-  and stores data cache under ~/.IntelliJIdea10/system directory.
+  By default @@product_full@@ stores all your settings under ~/.@@system_selector@@/config directory
+  and stores data cache under ~/.@@system_selector@@/system directory.
   If you want to change these settings,
 
   1. Open a console and cd into "{installation home}/bin"
 
   2. Open file "idea.properties" in an editor. You should find strings like
 
-     idea.system.path=~/.IntelliJIdea10/system
+     idea.system.path=~/.@@settings_dir@@/system
 
      and
 
-     idea.config.path=~/.IntelliJIdea10/config
+     idea.config.path=~/.@@settings_dir@@/config
 
      and change them.
 
@@ -48,4 +48,4 @@ INSTALLATION INSTRUCTIONS
 
 Enjoy!
 
--IntelliJ IDEA Development Team
+-@@product_full@@ Development Team
diff --git a/build/images/idea_CE128.png b/build/images/idea_CE128.png
deleted file mode 100644 (file)
index 5b04015..0000000
Binary files a/build/images/idea_CE128.png and /dev/null differ
diff --git a/build/images/idea_CE16.png b/build/images/idea_CE16.png
deleted file mode 100644 (file)
index c0e931f..0000000
Binary files a/build/images/idea_CE16.png and /dev/null differ
diff --git a/build/images/idea_CE32.png b/build/images/idea_CE32.png
deleted file mode 100644 (file)
index 0c94898..0000000
Binary files a/build/images/idea_CE32.png and /dev/null differ
diff --git a/build/images/idea_CE48.png b/build/images/idea_CE48.png
deleted file mode 100644 (file)
index 225733c..0000000
Binary files a/build/images/idea_CE48.png and /dev/null differ
index dab08a968c34274c92a41756b7cfadb6144977b5..92ef5de51cb3e91577de0328b3fdbde53614ad71 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import org.jetbrains.jps.Jps
 import static org.jetbrains.jps.idea.IdeaProjectLoader.guessHome
 
@@ -21,15 +37,13 @@ class Paths {
     distAll = "$sandbox/dist.all.ce"
     distUnix = "$sandbox/dist.unix.ce"
     distMac = "$sandbox/dist.mac.ce"
-
     artifacts = "$sandbox/artifacts"
     artifacts_core = "$artifacts/core"
   }
 }
 
-setProperty("paths", new Paths(out))
-
 def paths = new Paths(out)
+setProperty("paths", paths)
 
 target(compile: "Compile project") {
   loadProject()
@@ -47,87 +61,76 @@ target(compile: "Compile project") {
   project.makeProduction()
 }
 
-String appInfoFile() {
+private String appInfoFile() {
   return "${this["community-resources"].output}/idea/IdeaApplicationInfo.xml"
 }
 
-def wire_build_date(String buildNumber) {
-  ant.tstamp()
-  ant.replace(token: "__BUILD_NUMBER__", value: buildNumber, file: appInfoFile())
-  ant.replace(token: "__BUILD_DATE__", value: DSTAMP, file: appInfoFile())
-}
-
 target('default': 'The default target') {
-  depends(compile)
+  depends([compile])
 
   // load ApplicationInfo.xml properties
   ant.xmlproperty(file: appInfoFile(), collapseAttributes: "true")
 
-  layoutAll(
-          buildNumber: "IC-$snapshot",
-          version: "IdeaX",
-          system_selector: "IdeaIC${p("component.version.major")}",
-          system_selector_mac: "IntelliJIdea${p("component.version.major")}CE",
-          home, out)
+  layoutAll([buildNumber: "IC-$snapshot",
+             system_selector: "IdeaIC${p("component.version.major")}",
+             tools_jar: true],
+            home, null, paths)
 }
 
-public def layoutAll(Map args, String home, String out) {
-  Paths paths = new Paths(out)
+def layoutAll(Map args, String home, String out, Paths _paths = null) {
+  Paths paths = _paths != null ? _paths : new Paths(out)
 
-  wire_build_date(args.buildNumber)
+  wireBuildDate(args.buildNumber, appInfoFile())
+  ant.echo(message: args.buildNumber, file: "$paths.distAll/build.txt")
 
   def layouts = includeFile("$home/build/scripts/layouts.gant")
   layouts.layoutFull(home, paths.distAll)
+  layouts.layout_core(home, paths.artifacts_core)
 
-  ant.echo(message: args.buildNumber, file: "$paths.distAll/build.txt")
-  ant.copy(todir: "$paths.distAll/license", preservelastmodified: "true") {
-    fileset(dir: "$home/license")
+  layout(paths.distAll) {
+    dir("bin") {
+      fileset(dir: "${home}/bin") { include(name: "*.*") }
+    }
+    dir("license") {
+      fileset(dir: "${home}/license")
+    }
+    fileset(file: "${home}/LICENSE.txt")
   }
+  patchPropertiesFile(paths.distAll)
 
-  ant.copy(file: "$home/LICENSE.txt", todir: "$paths.distAll", preservelastmodified: "true")
-
-  layoutMac(args, home, paths)
-  layoutLinux(args, home, paths)
   layoutWin(args, home, paths)
+  layoutMac(args, home, paths)
+  layoutUnix(args, home, paths)
 
-  layouts.layout_core(home, paths.artifacts_core)
+  buildWinZip("$paths.artifacts/idea${args.buildNumber}.win.zip", [paths.distAll, paths.distWin])
+
+  def macAppRoot = isEap() ? "${p("component.version.codename")}-${args.buildNumber}.app" : "IntelliJ IDEA ${p("component.version.major")} CE.app"
+  buildMacZip(macAppRoot, "$paths.artifacts/idea${args.buildNumber}.mac.zip", [paths.distAll, paths.distMac])
+
+  buildTarGz("idea-${args.buildNumber}", "$paths.artifacts/idea${args.buildNumber}.tar", [paths.distAll, paths.distUnix])
 }
 
-private def layoutWin(Map args, String home, Paths paths) {
-  layout("$paths.distWin") {
+private layoutWin(Map args, String home, Paths paths) {
+  String target = paths.distWin
+
+  layout(target) {
     dir("bin") {
-      fileset(dir: "$home/bin") { include(name: "*.*") }
       fileset(dir: "$home/bin/win")
     }
   }
 
-  ant.replace(file: "$paths.distWin/bin/idea.bat") {
-    replacefilter(token: "@@system_selector@@", value: args.system_selector)
-  }
-  ant.replace(file: "$paths.distWin/bin/inspect_diff.bat") {
-    replacefilter(token: "@@system_selector@@", value: args.system_selector)
-  }
-
-  patchPropertiesFile(paths.distWin)
-  ant.echo(file: "$paths.distWin/bin/idea.exe.vmoptions", message: vmoptions32().replace(' ', '\n'))
+  ant.copy(file: "$home/platform/icons/src/idea_CE.ico", tofile: "$target/bin/idea.ico")
 
-  def winZipPath = "$paths.artifacts/idea${args.buildNumber}.win.zip"
-  ant.zip(zipfile: winZipPath) {
-    fileset(dir: paths.distAll)
-    fileset(dir: paths.distWin)
-  }
-  notifyArtifactBuilt(winZipPath)
+  winScripts(target, home, "idea.bat", args)
+  winVMOptions(target, null, "idea.exe")
 }
 
-private def layoutMac(Map args, String home, Paths paths) {
-  project.stage("Cleaning up sandbox folder")
-  args["executable"] = "idea"
-  args["bundle_name"] = "IntelliJ IDEA"
-  args["bundleIdentifier"] = "com.jetbrains.intellij.ce"
-  args["platform_prefix"] = "Idea"
-  args["doc_types"] = """
-    <key>CFBundleDocumentTypes</key>
-    <array>
+private layoutMac(Map _args, String home, Paths paths) {
+  String target = paths.distMac
+
+  Map args = new HashMap(_args)
+  args.bundleIdentifier = "com.jetbrains.intellij.ce"
+  args.doc_types = """
       <dict>
         <key>CFBundleTypeExtensions</key>
         <array>
@@ -140,96 +143,24 @@ private def layoutMac(Map args, String home, Paths paths) {
         <key>CFBundleTypeRole</key>
         <string>Editor</string>
       </dict>
-    </array>
   """
-  args["idea.properties.path"] = "$home/bin/idea.properties"
-  if (!isEap()) {
-    args["idea.properties"] = ["idea.fatal.error.notification":"disabled"];
-  }
-  def system_selector = args.system_selector
-  // TODO remove the next line when system_selector for Mac and other OS will be unified
-  system_selector = args.system_selector_mac
-
-  layoutMacApp(paths.distMac, home, args)
-
-  layout(paths.distMac) {
-    dir("bin") {
-      fileset(dir: "$home/bin") { include(name: "*.*") }
-    }
-  }
-
-  ant.replace(file: "$paths.distMac/bin/idea.sh") {
-    replacefilter(token: "@@system_selector@@", value: system_selector)
-  }
-  ant.replace(file: "$paths.distMac/bin/inspect_diff.sh") {
-    replacefilter(token: "@@system_selector@@", value: system_selector)
-  }
-
-  patchPropertiesFile(paths.distMac)
-
-  def root = isEap() ? "${p("component.version.codename")}-${args.buildNumber}.app" : "IntelliJ IDEA ${p("component.version.major")} CE.app"
-
-  def macZipPath = "$paths.artifacts/idea${args.buildNumber}.mac.zip"
-  ant.zip(zipfile: macZipPath) {
-    [paths.distAll, paths.distMac].each {
-      tarfileset(dir: it, prefix: root) {
-        exclude(name: "bin/*.sh")
-        exclude(name: "bin/idea.properties")
-        exclude(name: "Contents/MacOS/idea")
-      }
-    }
-
-    tarfileset(dir: paths.distMac, filemode: "755", prefix: root) {
-      include(name: "bin/*.sh")
-      include(name: "Contents/MacOS/idea")
-    }
-  }
-  notifyArtifactBuilt(macZipPath)
+  args."idea.properties.path" = "$home/bin/idea.properties"
+  args.mac_no_yjp = true
+  layoutMacApp(target, home, args)
 }
 
-def layoutLinux(Map args, String home, Paths paths) {
-  project.stage("tar.gz")
-  layout(paths.distUnix) {
+private layoutUnix(Map args, String home, Paths paths) {
+  String target = paths.distUnix
+
+  layout(target) {
     dir("bin") {
-      fileset(dir: "$home/bin") { include(name: "*.*") }
       fileset(dir: "$home/bin/linux")
-      fileset(dir: "$home/bin/nix")
-      fileset(dir: "$home/build/images")
     }
-    fileset(dir: "$home/build", includes: "Install-Linux-tar.txt")
-  }
-
-  ant.replace(file: "$paths.distUnix/bin/idea.sh") {
-    replacefilter(token: "@@system_selector@@", value: args.system_selector)
-  }
-  ant.replace(file: "$paths.distUnix/bin/inspect_diff.sh") {
-    replacefilter(token: "@@system_selector@@", value: args.system_selector)
   }
 
-  patchPropertiesFile(paths.distUnix)
-
-  ant.echo(file: "$paths.distUnix/bin/idea.vmoptions", message: vmoptions32().replace(' ', '\n') )
-  ant.fixcrlf(srcdir: "$paths.distUnix/bin", includes: "idea.vmoptions", eol: "unix")
-  ant.fixcrlf(srcdir: "$paths.distUnix/bin", includes: "*.sh", eol: "unix")
-
-  def tarRoot = "idea-$args.buildNumber"
-  def tarPath = "$paths.artifacts/idea${args.buildNumber}.tar"
-  ant.tar(tarfile: tarPath) {
-    [paths.distAll, paths.distUnix].each {
-      tarfileset(dir: it, prefix: tarRoot) {
-        exclude(name: "bin/*.sh")
-        exclude(name: "bin/fsnotifier*")
-      }
-    }
-
-    tarfileset(dir: paths.distUnix, filemode: "755", prefix: tarRoot) {
-      include(name: "bin/*.sh")
-      include(name: "bin/fsnotifier*")
-    }
-  }
+  ant.copy(file: "$home/platform/icons/src/icon_CE.png", tofile: "$target/bin/idea.png")
 
-  def gzPath = "${tarPath}.gz"
-  ant.gzip(src: tarPath, zipfile: gzPath)
-  ant.delete(file: tarPath)
-  notifyArtifactBuilt(gzPath)
+  unixScripts(target, home, "idea.sh", args)
+  unixVMOptions(target, "idea")
+  unixReadme(target, home, args)
 }
index 7c0ad815631b68fc0f1766033b42b7dd9af458ea..c0db4e5f332e6496ed280badd395be8934a8fc4e 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import org.jetbrains.jps.Jps
 import org.jetbrains.jps.Module
 import org.jetbrains.jps.idea.IdeaProjectLoader
@@ -18,17 +34,20 @@ binding.setVariable("guessJdk", {
   return javaHome
 })
 
-binding.setVariable("includeFile", {String filepath ->
-  Script s = groovyShell.parse(new File(filepath))
+binding.setVariable("includeFile", {String filePath ->
+  Script s = groovyShell.parse(new File(filePath))
   s.setBinding(binding)
   s
 })
 
-
 binding.setVariable("isMac", {
   return System.getProperty("os.name").toLowerCase().startsWith("mac")
 })
 
+binding.setVariable("isWin", {
+  return System.getProperty("os.name").toLowerCase().startsWith("windows")
+})
+
 binding.setVariable("isEap", {
   return "true" == p("component.version.eap")
 })
@@ -37,8 +56,15 @@ binding.setVariable("mem32", "-Xms128m -Xmx512m -XX:MaxPermSize=250m -XX:Reserve
 binding.setVariable("mem64", "-Xms128m -Xmx800m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=64m")
 binding.setVariable("common_vmoptions", "-ea")
 
-binding.setVariable("vmoptions32", {"$mem32 $common_vmoptions"})
-binding.setVariable("vmoptions64", {"$mem64 $common_vmoptions"})
+binding.setVariable("vmOptions", { "$common_vmoptions ${isEap() ? '-XX:+HeapDumpOnOutOfMemoryError' : ''}".trim() })
+binding.setVariable("vmOptions32", { "$mem32 ${vmOptions()}".trim() })
+binding.setVariable("vmOptions64", { "$mem64 ${vmOptions()}".trim() })
+binding.setVariable("vmOptions32yjp", { String systemSelector ->
+  "${vmOptions32()} -agentlib:yjpagent=disablej2ee,disablecounts,disablealloc,sessionname=$systemSelector".trim()
+})
+binding.setVariable("vmOptions64yjp", { String systemSelector ->
+  "${vmOptions64()} -agentlib:yjpagent64=disablej2ee,disablecounts,disablealloc,sessionname=$systemSelector".trim()
+})
 
 binding.setVariable("isDefined", {String key ->
   try {
@@ -138,6 +164,42 @@ if (suspendUntilDebuggerConnect == 'y') {
 -------------------------------------------^------^------^------^------^------^------^-----------------------  
 """
 }
+
+binding.setVariable("patchFiles", { List files, Map args, String marker = "__" ->
+  files.each { file ->
+    args.each { arg ->
+      ant.replace(file: file, token: "${marker}${arg.key}${marker}", value:  arg.value)
+    }
+  }
+})
+
+binding.setVariable("copyAndPatchFile", { String file, String target, Map args, String marker = "__" ->
+  ant.copy(file: file, tofile: target, overwrite: "true") {
+    filterset(begintoken: marker, endtoken: marker) {
+      args.each {
+        filter(token: it.key, value: it.value)
+      }
+    }
+  }
+})
+
+binding.setVariable("copyAndPatchFiles", { Closure files, String target, Map args, String marker = "__" ->
+  ant.copy(todir: target, overwrite: "true") {
+    files()
+
+    filterset(begintoken: marker, endtoken: marker) {
+      args.each {
+        filter(token: it.key, value: it.value)
+      }
+    }
+  }
+})
+
+binding.setVariable("wireBuildDate", { String buildNumber, String appInfoFile ->
+  ant.tstamp()
+  patchFiles([appInfoFile], ["BUILD_NUMBER": buildNumber, "BUILD_DATE": DSTAMP])
+})
+
 binding.setVariable("commonJvmArgs", {
   return [
    "-ea",
@@ -152,7 +214,6 @@ binding.setVariable("commonJvmArgs", {
 
 binding.setVariable("layoutMacApp", { String path, String ch, Map args ->
   ant.copy(todir: "$path/bin") {
-    fileset(dir: "$ch/bin/nix")
     fileset(dir: "$ch/bin/mac")
   }
 
@@ -164,6 +225,7 @@ binding.setVariable("layoutMacApp", { String path, String ch, Map args ->
     format(property: "todayYear", pattern: "yyyy")
   }
 
+  String executable = args.executable != null ? args.executable : p("component.names.product").toLowerCase()
   String icns = "idea.icns"
   if (args.icns != null) {
     ant.delete(file: "$path/Contents/Resources/idea.icns")
@@ -171,28 +233,132 @@ binding.setVariable("layoutMacApp", { String path, String ch, Map args ->
     icns = new File((String)args.icns).getName();
   }
 
-  def version = isEap() ? "EAP " + args.buildNumber : p("component.version.major") + "." +  p("component.version.minor")
+  String fullName = args.fullName != null ? args.fullName : p("component.names.fullname")
+
+  String vmOptions = "${vmOptions()} -Xverify:none"
+  if (isEap() && !args.mac_no_yjp) {
+    vmOptions += " -agentlib:yjpagent=disablej2ee,disablecounts,disablealloc,sessionname=${args.system_selector}"
+  }
+
+  String version = isEap() ? "EAP $args.buildNumber" : "${p("component.version.major")}.${p("component.version.minor")}"
+
+  args.get("idea.properties", [:])["idea.fatal.error.notification"] = isEap() ? "enabled" : "disabled";
+  String properties = readIdeaProperties(args)
 
   ant.replace(file: "$path/Contents/Info.plist") {
     replacefilter(token: "@@build@@", value: args.buildNumber)
-    replacefilter(token: "@@doc_types@@", value: args.get("doc_types", ""))
-    replacefilter(token: "@@executable@@", value: args.executable)
+    replacefilter(token: "@@doc_types@@", value: ifNull(args.doc_types, ""))
+    replacefilter(token: "@@executable@@", value: executable)
     replacefilter(token: "@@icns@@", value: icns)
-    replacefilter(token: "@@bundle_name@@", value: args.bundle_name)
+    replacefilter(token: "@@bundle_name@@", value: fullName)
     replacefilter(token: "@@bundle_identifier@@", value: args.bundleIdentifier)
     replacefilter(token: "@@year@@", value: "$todayYear")
-
     replacefilter(token: "@@version@@", value: version)
-    replacefilter(token: "@@vmoptions@@", value: "$common_vmoptions -Xverify:none")
+    replacefilter(token: "@@vmoptions@@", value: vmOptions)
     replacefilter(token: "@@vmoptions32@@", value: "$mem32")
     replacefilter(token: "@@vmoptions64@@", value: "$mem64 -XX:+UseCompressedOops")
-    replacefilter(token: "@@idea_properties@@", value: readIdeaProperties(args))
+    replacefilter(token: "@@idea_properties@@", value: properties)
+  }
+
+  if (executable != "idea") {
+    ant.move(file: "$path/Contents/MacOS/idea", tofile: "$path/Contents/MacOS/$executable")
+  }
+
+  ant.replace(file: "$path/bin/inspect.sh") {
+    replacefilter(token: "@@product_full@@", value: fullName)
+    replacefilter(token: "@@script_name@@", value: executable)
+  }
+  if (args.inspect_script != null && args.inspect_script != "inspect") {
+    ant.move(file: "$path/bin/inspect.sh", tofile: "$path/bin/${args.inspect_script}.sh")
+  }
+})
+
+binding.setVariable("winScripts", { String target, String home, String name, Map args ->
+  String fullName = args.fullName != null ? args.fullName : p("component.names.fullname")
+  String product_uc = args.product_uc != null ? args.product_uc : p("component.names.product").toUpperCase()
+  String vm_options = args.vm_options != null ? args.vm_options : "${p("component.names.product").toLowerCase()}.exe"
+
+  ant.copy(todir: "$target/bin") {
+    fileset(dir: "$home/bin/scripts/win")
+
+    filterset(begintoken: "@@", endtoken: "@@") {
+      filter(token: "product_full", value: fullName)
+      filter(token: "product_uc", value: product_uc)
+      filter(token: "vm_options", value: vm_options)
+      filter(token: "isEap", value: isEap())
+      filter(token: "system_selector", value: args.system_selector)
+      filter(token: "ide_jvm_args", value: ifNull(args.ide_jvm_args, ""))
+      filter(token: "tools_jar", value: ifNull(args.tools_jar, false))
+      filter(token: "script_name", value: name)
+    }
+  }
+
+  if (name != "idea.bat") {
+    ant.move(file: "$target/bin/idea.bat", tofile: "$target/bin/$name")
+  }
+  if (args.inspect_script != null && args.inspect_script != "inspect") {
+    ant.move(file: "$target/bin/inspect.bat", tofile: "$target/bin/${args.inspect_script}.bat")
+  }
+
+  ant.fixcrlf(srcdir: "$target/bin", includes: "*.bat", eol: "dos")
+})
+
+private ifNull(v, defVal) { v != null ? v : defVal }
+
+binding.setVariable("unixScripts", { String target, String home, String name, Map args ->
+  String fullName = args.fullName != null ? args.fullName : p("component.names.fullname")
+  String product_uc = args.product_uc != null ? args.product_uc : p("component.names.product").toUpperCase()
+  String vm_options = args.vm_options != null ? args.vm_options : p("component.names.product").toLowerCase()
+
+  ant.copy(todir: "$target/bin") {
+    fileset(dir: "$home/bin/scripts/unix")
+
+    filterset(begintoken: "@@", endtoken: "@@") {
+      filter(token: "product_full", value: fullName)
+      filter(token: "product_uc", value: product_uc)
+      filter(token: "vm_options", value: vm_options)
+      filter(token: "isEap", value: isEap())
+      filter(token: "system_selector", value: args.system_selector)
+      filter(token: "ide_jvm_args", value: ifNull(args.ide_jvm_args, ""))
+      filter(token: "tools_jar", value: ifNull(args.tools_jar, false))
+      filter(token: "script_name", value: name)
+    }
+  }
+
+  if (name != "idea.sh") {
+    ant.move(file: "$target/bin/idea.sh", tofile: "$target/bin/$name")
+  }
+  if (args.inspect_script != null && args.inspect_script != "inspect") {
+    ant.move(file: "$target/bin/inspect.sh", tofile: "$target/bin/${args.inspect_script}.sh")
   }
 
-  if (args.executable != "idea") {
-    ant.move(file: "$path/Contents/MacOS/idea", tofile: "$path/Contents/MacOS/$args.executable")
+  ant.fixcrlf(srcdir: "$target/bin", includes: "*.sh", eol: "unix")
+})
+
+binding.setVariable("winVMOptions", { String target, String system_selector, String name, String name64 = null ->
+  def options = system_selector != null ? vmOptions32yjp(system_selector) : vmOptions32()
+  ant.echo(file: "$target/bin/${name}.vmoptions", message: options.replace(' ', '\n'))
+
+  if (name64 != null) {
+    options = system_selector != null ? vmOptions64yjp(system_selector) : vmOptions64()
+    ant.echo(file: "$target/bin/${name64}.vmoptions", message: options.replace(' ', '\n'))
   }
 
+  ant.fixcrlf(srcdir: "$target/bin", includes: "*.vmoptions", eol: "dos")
+})
+
+binding.setVariable("unixVMOptions", { String target, String name ->
+  ant.echo(file: "$target/bin/${name}.vmoptions", message: vmOptions32().replace(' ', '\n'))
+  ant.echo(file: "$target/bin/${name}64.vmoptions", message: vmOptions64().replace(' ', '\n'))
+  ant.fixcrlf(srcdir: "$target/bin", includes: "*.vmoptions", eol: "unix")
+})
+
+binding.setVariable("unixReadme", { String target, String home, Map args ->
+  String fullName = args.fullName != null ? args.fullName : p("component.names.fullname")
+  copyAndPatchFile("$home/build/Install-Linux-tar.txt", "$target/Install-Linux-tar.txt",
+                   ["product_full": fullName, "product": p("component.names.product").toLowerCase(),
+                    "system_selector": args.system_selector, "settings_dir": fullName.replace(" ", "")], "@@")
+  ant.fixcrlf(file: "$target/bin/Install-Linux-tar.txt", eol: "unix")
 })
 
 binding.setVariable("forceDelete", { String dirPath ->
@@ -218,34 +384,33 @@ binding.setVariable("forceDelete", { String dirPath ->
   }
 })
 
-binding.setVariable("patchPropertiesFile", { String where ->
-  ant.echo(file: "$where/bin/idea.properties", append: "true", message:
-           isEap() ?
-"""
+binding.setVariable("copyPropertiesFile", { String source, String target ->
+  ant.copy(file: source, tofile: "$target/bin/idea.properties", overwrite: "true")
+  patchPropertiesFile(target)
+})
 
+binding.setVariable("patchPropertiesFile", { String target ->
+  String message = (isEap() ? """
 #-----------------------------------------------------------------------
-# Change to 'disabled' if you do not need to receive instant visual notifications about
-# fatal errors that happen to an IDE or plugins installed.
+# Change to 'disabled' if you don't want to receive instant visual notifications
+# about fatal errors that happen to an IDE or plugins installed.
 #-----------------------------------------------------------------------
 idea.fatal.error.notification=enabled
 """
-
- :
-
-"""
-
+                 : """
 #-----------------------------------------------------------------------
-# Change to 'enabled' if you need to receive instant visual notifications about
-# fatal errors that happen to an IDE or plugins installed.
+# Change to 'enabled' if you want to receive instant visual notifications
+# about fatal errors that happen to an IDE or plugins installed.
 #-----------------------------------------------------------------------
 idea.fatal.error.notification=disabled
-"""
-)
+""")
+  ant.echo(file: "$target/bin/idea.properties", append: "true", message: message)
 })
 
-binding.setVariable("zipSources", {String home, String targetDir ->
-  def sources = "$targetDir/sources.zip"
+binding.setVariable("zipSources", { String home, String targetDir ->
+  String sources = "$targetDir/sources.zip"
   project.stage("zip sources to $sources")
+
   ant.mkdir(dir: targetDir)
   ant.delete(file: sources)
   ant.zip(destfile: sources) {
@@ -256,6 +421,8 @@ binding.setVariable("zipSources", {String home, String targetDir ->
       exclude(name: "**/testData/**")
     }
   }
+
+  notifyArtifactBuilt(sources)
 })
 
 /**
@@ -287,8 +454,6 @@ private String readIdeaProperties(Map args) {
   ideaProperties.load(ideaPropertiesFile);
   ideaPropertiesFile.close();
 
-  //Map properties =
-  def userCustomProperties = args.get("idea.properties")
   def defaultProperties = ["CVS_PASSFILE": "~/.cvspass",
                            "com.apple.mrj.application.live-resize": "false",
                            "idea.paths.selector": args.system_selector,
@@ -296,13 +461,17 @@ private String readIdeaProperties(Map args) {
                            "idea.smooth.progress": "false",
                            "apple.laf.useScreenMenuBar": "true",
                            "apple.awt.graphics.UseQuartz": "true",
-                           "apple.awt.fullscreencapturealldisplays": "false",
-                          ]
-  if (args.get("platform_prefix", null) != null) {
+                           "apple.awt.fullscreencapturealldisplays": "false"]
+  if (args.platform_prefix != null) {
     defaultProperties.put("idea.platform.prefix", args.platform_prefix)
   }
 
-  Map properties =  defaultProperties + (userCustomProperties != null ? userCustomProperties : [:]);
+  Map properties = defaultProperties
+  def customProperties = args.get("idea.properties")
+  if (customProperties != null) {
+    properties += customProperties
+  }
+
   properties.each {k, v ->
     if (v == null) {
       // if overridden with null - ignore property
@@ -327,3 +496,73 @@ private String readIdeaProperties(Map args) {
   }
   return buff.toString()
 }
+
+binding.setVariable("buildWinZip", { String zipPath, List paths ->
+  project.stage(".win.zip")
+
+  ant.zip(zipfile: zipPath) {
+    paths.each {
+      fileset(dir: it)
+    }
+  }
+
+  notifyArtifactBuilt(zipPath)
+})
+
+binding.setVariable("buildMacZip", { String zipRoot, String zipPath, List paths, List extraBins = [] ->
+  project.stage(".mac.zip")
+
+  ant.zip(zipfile: zipPath) {
+    paths.each {
+      zipfileset(dir: it, prefix: zipRoot) {
+        exclude(name: "bin/*.sh")
+        exclude(name: "bin/fsnotifier")
+        exclude(name: "bin/relaunch")
+        exclude(name: "bin/idea.properties")
+        exclude(name: "Contents/MacOS/*")
+        extraBins.each {
+          exclude(name: it)
+        }
+      }
+    }
+
+    paths.each {
+      zipfileset(dir: it, filemode: "755", prefix: zipRoot) {
+        include(name: "bin/*.sh")
+        include(name: "bin/fsnotifier")
+        include(name: "bin/relaunch")
+        include(name: "Contents/MacOS/*")
+        extraBins.each {
+          include(name: it)
+        }
+      }
+    }
+  }
+
+  notifyArtifactBuilt(zipPath)
+})
+
+binding.setVariable("buildTarGz", { String tarRoot, String tarPath, List paths ->
+  project.stage(".tar.gz")
+
+  ant.tar(tarfile: tarPath) {
+    paths.each {
+      tarfileset(dir: it, prefix: tarRoot) {
+        exclude(name: "bin/*.sh")
+        exclude(name: "bin/fsnotifier*")
+      }
+    }
+
+    paths.each {
+      tarfileset(dir: it, filemode: "755", prefix: tarRoot) {
+        include(name: "bin/*.sh")
+        include(name: "bin/fsnotifier*")
+      }
+    }
+  }
+
+  String gzPath = "${tarPath}.gz"
+  ant.gzip(src: tarPath, zipfile: gzPath)
+  ant.delete(file: tarPath)
+  notifyArtifactBuilt(gzPath)
+})
index 77a88b27ff41957fb5eb3a2f24d18a7a479e7204..bf1e44d8b91dc35ff94e153309767f7283e0925b 100644 (file)
@@ -1,7 +1,9 @@
 The following files can be redistributable under the license below:
 
 yjpagent.dll
-libyjpagent.so
+yjpagent64.dll
+libyjpagent-linux.so
+libyjpagent-linux64.so
 libyjpagent.jnilib
 yjp-controller-api-redist.jar