CE installer
authorMaxim Shafirov <max@jetbrains.com>
Fri, 11 Sep 2009 12:28:29 +0000 (16:28 +0400)
committerMaxim Shafirov <max@jetbrains.com>
Fri, 11 Sep 2009 12:28:29 +0000 (16:28 +0400)
27 files changed:
bin/linux/libbreakgen.so [moved from bin/libbreakgen.so with 100% similarity]
bin/log.xml
bin/mac/fsnotifier [moved from bin/fsnotifier with 100% similarity]
bin/mac/libquaqua.jnilib [moved from bin/libquaqua.jnilib with 100% similarity]
bin/mac/libquaqua64.jnilib [moved from bin/libquaqua64.jnilib with 100% similarity]
bin/nix/idea.sh [moved from bin/idea.sh with 100% similarity]
bin/nix/inspect.sh [moved from bin/inspect.sh with 100% similarity]
bin/nix/inspect_diff.sh [moved from bin/inspect_diff.sh with 100% similarity]
bin/win/append.bat [moved from bin/append.bat with 100% similarity]
bin/win/breakgen.dll [moved from bin/breakgen.dll with 100% similarity]
bin/win/focuskiller.dll [moved from bin/focuskiller.dll with 100% similarity]
bin/win/focuskiller64.dll [moved from bin/focuskiller64.dll with 100% similarity]
bin/win/fsnotifier.exe [moved from bin/fsnotifier.exe with 100% similarity]
bin/win/idea.bat [moved from bin/idea.bat with 100% similarity]
bin/win/inspect.bat [moved from bin/inspect.bat with 100% similarity]
bin/win/inspect_diff.bat [moved from bin/inspect_diff.bat with 100% similarity]
bin/win/restarter.exe [moved from bin/restarter.exe with 100% similarity]
bin/win/vistalauncher.exe [moved from bin/vistalauncher.exe with 100% similarity]
build/conf/mac/Contents/Info.plist [moved from build/mac/Info.plist with 85% similarity]
build/conf/mac/Contents/MacOS/idea [moved from build/mac/idea with 100% similarity]
build/conf/mac/Contents/Resources/idea.icns [moved from build/images/idea/idea.icns with 100% similarity]
build/conf/mac/lib/quaqua.jar [moved from lib/quaqua.jar with 100% similarity]
build/scripts/dist.gant
build/scripts/layouts.gant
platform/platform-impl/src/com/intellij/idea/LoggerFactory.java
platform/util/src/com/intellij/openapi/application/PathManager.java
platform/util/src/com/intellij/openapi/util/io/FileUtil.java

similarity index 100%
rename from bin/libbreakgen.so
rename to bin/linux/libbreakgen.so
index 8668dcf95f397a4b0cce9fc2a3e0cf09eb0d42b9..d2e12a68ecfc293a5863037d42be387a3a45610a 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version='1.0' encoding='ISO-8859-1' ?>
-<!DOCTYPE log4j:configuration SYSTEM "file:$APPLICATION_DIR$/bin/log4j.dtd">
-
-<log4j:configuration>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+    
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
   <appender name="CONSOLE-WARN" class="org.apache.log4j.ConsoleAppender">
     <param name="target" value="System.err"/>
     <layout class="org.apache.log4j.PatternLayout">
similarity index 100%
rename from bin/fsnotifier
rename to bin/mac/fsnotifier
similarity index 100%
rename from bin/idea.sh
rename to bin/nix/idea.sh
similarity index 100%
rename from bin/inspect.sh
rename to bin/nix/inspect.sh
similarity index 100%
rename from bin/inspect_diff.sh
rename to bin/nix/inspect_diff.sh
similarity index 100%
rename from bin/append.bat
rename to bin/win/append.bat
similarity index 100%
rename from bin/breakgen.dll
rename to bin/win/breakgen.dll
similarity index 100%
rename from bin/focuskiller.dll
rename to bin/win/focuskiller.dll
similarity index 100%
rename from bin/fsnotifier.exe
rename to bin/win/fsnotifier.exe
similarity index 100%
rename from bin/idea.bat
rename to bin/win/idea.bat
similarity index 100%
rename from bin/inspect.bat
rename to bin/win/inspect.bat
similarity index 100%
rename from bin/restarter.exe
rename to bin/win/restarter.exe
similarity index 85%
rename from build/mac/Info.plist
rename to build/conf/mac/Contents/Info.plist
index 3c7c31659e6c42808dbe924315c1e2952ab75c21..6f2aebc5440f1a67acb6e183312ac26eb5833463 100644 (file)
     <key>CFBundleSignature</key>
     <string>????</string>
     <key>CFBundleGetInfoString</key>
-    <string>IntelliJ IDEA @@major@@.@@minor@@, build @@@@. Copyright JetBrains s.r.o., (c) 2000-2009</string>
+    <string>IntelliJ IDEA @@version@@, build @@build@@. Copyright JetBrains s.r.o., (c) 2000-2009</string>
     <key>CFBundleShortVersionString</key>
-    <string>@@major@@.@@minor@@</string>
+    <string>@@version@@</string>
     <key>CFBundleVersion</key>
-    <string>@@@@</string>
+    <string>@@build@@</string>
     <key>Java</key>
    <dict>
       <key>ClassPath</key>
         <key>com.apple.mrj.application.live-resize</key>
         <string>false</string>
         <key>idea.config.path</key>
-        <string>~/Library/Preferences/IntelliJIDEA90</string>
+        <string>~/Library/Preferences/@@system_selector@@/</string>
         <key>idea.system.path</key>
-        <string>~/Library/Caches/IntelliJIDEA90/</string>
+        <string>~/Library/Caches/@@system_selector@@/</string>
         <key>idea.plugins.path</key>
-        <string>~/Library/Application Support/IntelliJIDEA90/</string>
+        <string>~/Library/Application Support/@@system_selector@@/</string>
         <key>java.endorsed.dirs</key>
         <string></string>
         <key>idea.smooth.progress</key>
         <key>apple.awt.fullscreencapturealldisplays</key>
         <string>false</string>
       </dict>
+
       <key>VMOptions</key>
-      <string>-Xms32m -Xmx256m -XX:MaxPermSize=150m -Xbootclasspath/a:../lib/boot.jar -ea</string>
+      <string>@@vmoptions@@ -Xbootclasspath/a:../lib/boot.jar</string>
+
       <key>WorkingDirectory</key>
       <string>$APP_PACKAGE/bin</string>
    </dict>
similarity index 100%
rename from lib/quaqua.jar
rename to build/conf/mac/lib/quaqua.jar
index 1389add4e8cd72184ebb6887596c426f835b24ad..a289242cf72f6459d33a17fb641e7d5e751a2f8f 100644 (file)
@@ -4,7 +4,35 @@ import static org.jetbrains.jps.idea.IdeaProjectLoader.*
 includeTargets << new File("${guessHome(this)}/build/scripts/utils.gant")
 includeTool << Jps
 
-requireProperty("out", "$home/out/classes")
+requireProperty("buildNumber", requireProperty("build.number", "SNAPSHOT"))
+requireProperty("out", "$home/out")
+
+setProperty("version", "MaiaCE")
+setProperty("vmoptions", "-Xms32m -Xmx256m -XX:MaxPermSize=150m -ea")
+setProperty("system_selector", "IntelliJIdeaCE90")
+
+class Paths {
+  final sandbox
+  final distWin
+  final distAll
+  final distUnix
+  final distMac
+  final artifacts
+
+  def Paths(String home, String out) {
+    sandbox = out
+    distWin = "$sandbox/dist.win"
+    distAll = "$sandbox/dist.all"
+    distUnix = "$sandbox/dist.unix"
+    distMac = "$sandbox/dist.mac"
+
+    artifacts = "$sandbox/artifacts"
+  }
+}
+
+setProperty("paths", new Paths(home, out))
+
+def paths = new Paths(home, out)
 
 def includeFile(String filename) {
   Script s = groovyShell.parse(new File("$home/build/scripts/$filename"))
@@ -14,23 +42,152 @@ def includeFile(String filename) {
 
 target(compile: "Compile project") {
   loadProject()
+
+  project.stage("Cleaning up sandbox folder")
+  ant.delete(dir: paths.sandbox)
+
+  [paths.sandbox, paths.distWin, paths.distAll, paths.distUnix, paths.distMac, paths.artifacts].each {
+    ant.mkdir(dir: it)
+  }
+
+  ant.tstamp() {
+    format(property: "today.year", pattern: "yyyy")
+  }
+
   project["javac"] = "$jdk/bin/javac"
-  project.targetFolder = out
+  project.targetFolder = "$out/classes"
   project.clean()
   project.makeProduction()
 }
 
+String appInfoFile() {
+  return "${this["community-resources"].output}/idea/IdeaApplicationInfo.xml"
+}
+
+def wire_build_date() {
+  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)
+  wire_build_date()
+
   def layouts = includeFile("layouts.gant")
-  def sandbox = "$home/out/release"
+  layouts.layoutFull(paths.distAll)
 
-  def layoutFolder = "$sandbox/dist.all"
-  layouts.layoutFull(layoutFolder)
+  ant.echo(message: buildNumber, file: "$paths.distAll/build.txt")
+  ant.copy(todir: "$paths.distAll/license", preservelastmodified: "true") {
+    fileset(dir: "$home/license")
+  }
 
-  def artifacts = "$sandbox/artifacts"
-  ant.mkdir(dir: artifacts)
-  ant.zip(zipfile: "$artifacts/idea.zip") {
-    fileset(dir: layoutFolder)
+  layoutMac()
+  layoutLinux()
+  layoutWin()
+}
+
+private def patchPropertiesFile(String where) {
+  ant.echo(file: "$where/bin/idea.properties", append: "true", message:
+           """
+
+#-----------------------------------------------------------------------
+# Change to 'disabled' if you need not to receive instant visual notifications about
+# fatal errors that happen to IDEA or plugins installed.
+#-----------------------------------------------------------------------
+idea.fatal.error.notification=enabled
+"""
+  )
+}
+
+private def layoutWin() {
+  layout("$paths.distWin") {
+    dir("bin") {
+      fileset(dir: "$home/bin") { include(name: "*.*") }
+      fileset(dir: "$home/bin/win") { include(name: "*.*") }
+    }
+  }
+
+  patchPropertiesFile(paths.distWin)
+  ant.echo(file: "$paths.distWin/bin/idea.exe.vmoptions", message: vmoptions.replace(' ', '\n'))
+
+  ant.zip(zipfile: "$paths.artifacts/idea${buildNumber}.win.zip") {
+    fileset(dir: paths.distAll)
+    fileset(dir: paths.distWin)
+  }
+}
+
+private def layoutMac() {
+  project.stage("Cleaning up sandbox folder")
+
+  ant.copy(todir: "$paths.distMac/bin") {
+    fileset(dir: "$home/bin") { include(name: "*.*") }
+    fileset(dir: "$home/bin/nix")
+    fileset(dir: "$home/bin/mac")
+  }
+
+  patchPropertiesFile(paths.distMac)
+
+  ant.copy(todir: paths.distMac) {
+    fileset(dir: "$home/build/conf/mac")
+  }
+
+  ant.replace(file: "${paths.distMac}/Contents/Info.plist") {
+    replacefilter(token: "@@build@@", value: buildNumber)
+
+
+    replacefilter(token: "@@version@@", value: version)
+    replacefilter(token: "@@vmoptions@@", value: vmoptions)
+    replacefilter(token: "@@system_selector@@", value: system_selector)
+  }
+
+  def root = "$version-${buildNumber}.app"
+  ant.zip(zipfile: "$paths.artifacts/idea${buildNumber}.mac.zip") {
+    [paths.distAll, paths.distMac].each {
+      tarfileset(dir: it, prefix: root) {
+        exclude(name: "bin/*.sh")
+        exclude(name: "Contents/MacOS/idea")
+      }
+    }
+
+    tarfileset(dir: paths.distMac, filemode: "755", prefix: root) {
+      include(name: "bin/*.sh")
+      include(name: "Contents/MacOS/idea")
+    }
   }
 }
+
+def layoutLinux() {
+  project.stage("tar.gz")
+  layout(paths.distUnix) {
+    dir("bin") {
+      fileset(dir: "$home/bin") { include(name: "*.*") }
+      fileset(dir: "$home/bin/linux") { include(name: "*.*") }
+      fileset(dir: "$home/bin/nix") { include(name: "*.*") }
+    }
+  }
+
+  patchPropertiesFile(paths.distUnix)
+
+  ant.echo(file: "$paths.distUnix/bin/idea.vmoptions", message: vmoptions.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-$buildNumber"
+  def tarPath = "$paths.artifacts/idea${buildNumber}.tar"
+  ant.tar(tarfile: tarPath) {
+    [paths.distAll, paths.distUnix].each {
+      tarfileset(dir: it, prefix: tarRoot) {
+        exclude(name: "bin/*.sh")
+      }
+    }
+
+    tarfileset(dir: paths.distUnix, filemode: "755", prefix: tarRoot) {
+      include(name: "bin/*.sh")
+    }
+  }
+
+  ant.gzip(src: tarPath, zipfile: "${tarPath}.gz")
+  ant.delete(file: tarPath)
+}
+
index c65d89c31e15280377fa9da6e6aee340b0dac499..9683c8be3b88f11fb2e389c3476bcc301b63b44a 100644 (file)
@@ -55,6 +55,7 @@ def layoutFull(String targetDirectory) {
   //noinspection GroovyAssignabilityCheck
   List<String> implementationModules = [platformImplementationModules(),
           "notNull",
+          "platform-main",
           "java-impl",
           "compiler-impl",
           "debugger-impl",
index 28236eeb15a8402dcac5bcfe28efb03817d27d92..0e17ba69ca23262c35a0cd5f2e74529656c241de 100644 (file)
@@ -56,11 +56,11 @@ public class LoggerFactory implements Logger.Factory {
       */
 
       System.setProperty("log4j.defaultInitOverride", "true");
-      String fileName = PathManager.getBinPath() + File.separator + "log.xml";
-      File logXmlFile = new File(fileName);
-      if (!logXmlFile.exists()) {
-        throw new RuntimeException("log.xml file does not exist! Path: [" + fileName + "]");
+      File logXmlFile = FileUtil.findFirstThatExist(PathManager.getHomePath() + "/bin/log.xml", PathManager.getHomePath() + "/community/bin/log.xml");
+      if (logXmlFile == null) {
+        throw new RuntimeException("log.xml file does not exist! Path: [ $home/bin/log.xml]");
       }
+
       String text = new String(FileUtil.loadFileText(logXmlFile));
       text = StringUtil.replace(text, SYSTEM_MACRO, StringUtil.replace(PathManager.getSystemPath(), "\\", "\\\\"));
       text = StringUtil.replace(text, APPLICATION_MACRO, StringUtil.replace(PathManager.getHomePath(), "\\", "\\\\"));
@@ -73,15 +73,8 @@ public class LoggerFactory implements Logger.Factory {
       File file = new File(new File(PathManager.getSystemPath()), LOG_DIR);
       file.mkdirs();
 
-      DOMConfigurator domConfigurator = new DOMConfigurator();
-      try {
-        domConfigurator.doConfigure(new StringReader(text), LogManager.getLoggerRepository());
-      }
-      catch (ClassCastException e) {
-        // shit :-E
-        System.out.println("log.xml content:\n" + text);
-        throw e;
-      }
+      new DOMConfigurator().doConfigure(new StringReader(text), LogManager.getLoggerRepository());
+
       myInitialized = true;
     }
     catch (Exception e) {
@@ -118,4 +111,4 @@ public class LoggerFactory implements Logger.Factory {
     }
     return result;
   }
-}
\ No newline at end of file
+}
index 673b3708eefcd68b05cfffa998f5e6b25467cc86..6922b39293c5ec44f791ea90eddc751d1b52e1c2 100644 (file)
@@ -1,27 +1,29 @@
 /*
- * Copyright 2000-2007 JetBrains s.r.o.
+ * Copyright 2000-2009 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
+ *  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
+ *  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.
+ *  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.
  */
+
 package com.intellij.openapi.application;
 
 import com.intellij.openapi.util.NamedJDOMExternalizable;
 import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.util.SystemProperties;
 import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.Nullable;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import java.io.*;
 import java.net.URL;
@@ -32,7 +34,6 @@ import java.util.Set;
 
 public class PathManager {
   @NonNls private static final String PROPERTIES_FILE = "idea.properties.file";
-  @NonNls private static final String IDEA_PROPERTIES = "idea.properties";
   @NonNls private static final String PROPERTY_SYSTEM_PATH = "idea.system.path";
   @NonNls private static final String PROPERTY_CONFIG_PATH = "idea.config.path";
   @NonNls private static final String PROPERTY_PLUGINS_PATH = "idea.plugins.path";
@@ -53,17 +54,6 @@ public class PathManager {
   @NonNls private static final String BIN_FOLDER = "bin";
   @NonNls private static final String OPTIONS_FOLDER = "options";
 
-  private static final FileFilter BIN_FOLDER_FILE_FILTER = new FileFilter() {
-    public boolean accept(File pathname) {
-      return pathname.isDirectory() && BIN_FOLDER.equalsIgnoreCase(pathname.getName());
-    }
-  };
-  private static final FileFilter PROPERTIES_FILE_FILTER = new FileFilter() {
-    public boolean accept(File pathname) {
-      return pathname.isFile() && IDEA_PROPERTIES.equalsIgnoreCase(pathname.getName());
-    }
-  };
-
   public static String getHomePath() {
     if (ourHomePath != null) return ourHomePath;
 
@@ -79,7 +69,8 @@ public class PathManager {
 
         do {
           final String parent = root.getParent();
-          assert parent != null : "No parent found for " + root + "; " + BIN_FOLDER + " folder with " + IDEA_PROPERTIES + " file not found";
+          assert parent != null : "No parent found for " + root + "; " + BIN_FOLDER + " folder with " +
+                                  "idea.properties" + " file not found";
           root = new File(parent).getAbsoluteFile(); // one step back to get folder
         }
         while (root != null && !isIdeaHome(root));
@@ -100,16 +91,8 @@ public class PathManager {
   }
 
   private static boolean isIdeaHome(final File root) {
-    final File[] files = root.listFiles(BIN_FOLDER_FILE_FILTER);
-    if (files != null && files.length > 0) {
-      for (File binFolder : files) {
-        final File[] binFolderContents = binFolder.listFiles(PROPERTIES_FILE_FILTER);
-        if (binFolderContents != null && binFolderContents.length > 0) {
-          return true;
-        }
-      }
-    }
-    return false;
+    return new File(root, FileUtil.toSystemDependentName("bin/idea.properties")).exists() ||
+           new File(root, FileUtil.toSystemDependentName("community/bin/idea.properties")).exists();
   }
 
   public static String getLibPath() {
@@ -309,16 +292,15 @@ public class PathManager {
   }
 
   public static void loadProperties() {
-    String propFilePath = System.getProperty(PROPERTIES_FILE);
-    if (StringUtil.isEmptyOrSpaces(propFilePath) || !new File(propFilePath).exists()) {
-      propFilePath = SystemProperties.getUserHome() + File.separator + IDEA_PROPERTIES;
-      if (StringUtil.isEmptyOrSpaces(propFilePath) || !new File(propFilePath).exists()) {
-        propFilePath = getBinPath() + File.separator + IDEA_PROPERTIES;
-      }
-    }
 
-    File propFile = new File(propFilePath);
-    if (propFile.exists()) {
+    File propFile = FileUtil.findFirstThatExist(
+      System.getProperty(PROPERTIES_FILE),
+      SystemProperties.getUserHome() + "/idea.properties",
+      getHomePath() + "/bin/idea.properties",
+      getHomePath() + "/community/bin/idea.properties"
+    );
+
+    if (propFile != null) {
       InputStream fis = null;
       try {
         fis = new BufferedInputStream(new FileInputStream(propFile));
@@ -335,7 +317,7 @@ public class PathManager {
       }
       catch (IOException e) {
         //noinspection HardCodedStringLiteral
-        System.out.println("Problem reading from property file: " + propFilePath);
+        System.err.println("Problem reading from property file: " + propFile.getPath());
       }
       finally{
         try {
index 391cf7c4ccf4a853d3d4231dc569a199f165c318..f51dabfe2f36ca1dde473fbf8f6466fb59b82056 100644 (file)
@@ -13,6 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
+
 package com.intellij.openapi.util.io;
 
 import com.intellij.CommonBundle;
@@ -967,4 +968,16 @@ public class FileUtil {
     }
     return true;
   }
+
+  @Nullable
+  public static File findFirstThatExist(String... paths) {
+    for (String path : paths) {
+      if (!StringUtil.isEmptyOrSpaces(path)) {
+        File file = new File(toSystemDependentName(path));
+        if (file.exists()) return file;
+      }
+    }
+
+    return null;
+  }
 }