diff --git a/bin/libbreakgen.so b/bin/linux/libbreakgen.so similarity index 100% rename from bin/libbreakgen.so rename to bin/linux/libbreakgen.so diff --git a/bin/log.xml b/bin/log.xml index 8668dcf95f39..d2e12a68ecfc 100644 --- a/bin/log.xml +++ b/bin/log.xml @@ -1,7 +1,7 @@ - - - + + + diff --git a/bin/fsnotifier b/bin/mac/fsnotifier similarity index 100% rename from bin/fsnotifier rename to bin/mac/fsnotifier diff --git a/bin/libquaqua.jnilib b/bin/mac/libquaqua.jnilib similarity index 100% rename from bin/libquaqua.jnilib rename to bin/mac/libquaqua.jnilib diff --git a/bin/libquaqua64.jnilib b/bin/mac/libquaqua64.jnilib similarity index 100% rename from bin/libquaqua64.jnilib rename to bin/mac/libquaqua64.jnilib diff --git a/bin/idea.sh b/bin/nix/idea.sh similarity index 100% rename from bin/idea.sh rename to bin/nix/idea.sh diff --git a/bin/inspect.sh b/bin/nix/inspect.sh similarity index 100% rename from bin/inspect.sh rename to bin/nix/inspect.sh diff --git a/bin/inspect_diff.sh b/bin/nix/inspect_diff.sh similarity index 100% rename from bin/inspect_diff.sh rename to bin/nix/inspect_diff.sh diff --git a/bin/append.bat b/bin/win/append.bat similarity index 100% rename from bin/append.bat rename to bin/win/append.bat diff --git a/bin/breakgen.dll b/bin/win/breakgen.dll similarity index 100% rename from bin/breakgen.dll rename to bin/win/breakgen.dll diff --git a/bin/focuskiller.dll b/bin/win/focuskiller.dll similarity index 100% rename from bin/focuskiller.dll rename to bin/win/focuskiller.dll diff --git a/bin/focuskiller64.dll b/bin/win/focuskiller64.dll similarity index 100% rename from bin/focuskiller64.dll rename to bin/win/focuskiller64.dll diff --git a/bin/fsnotifier.exe b/bin/win/fsnotifier.exe similarity index 100% rename from bin/fsnotifier.exe rename to bin/win/fsnotifier.exe diff --git a/bin/idea.bat b/bin/win/idea.bat similarity index 100% rename from bin/idea.bat rename to bin/win/idea.bat diff --git a/bin/inspect.bat b/bin/win/inspect.bat similarity index 100% rename from bin/inspect.bat rename to bin/win/inspect.bat diff --git a/bin/inspect_diff.bat b/bin/win/inspect_diff.bat similarity index 100% rename from bin/inspect_diff.bat rename to bin/win/inspect_diff.bat diff --git a/bin/restarter.exe b/bin/win/restarter.exe similarity index 100% rename from bin/restarter.exe rename to bin/win/restarter.exe diff --git a/bin/vistalauncher.exe b/bin/win/vistalauncher.exe similarity index 100% rename from bin/vistalauncher.exe rename to bin/win/vistalauncher.exe diff --git a/build/mac/Info.plist b/build/conf/mac/Contents/Info.plist similarity index 85% rename from build/mac/Info.plist rename to build/conf/mac/Contents/Info.plist index 3c7c31659e6c..6f2aebc5440f 100644 --- a/build/mac/Info.plist +++ b/build/conf/mac/Contents/Info.plist @@ -34,11 +34,11 @@ CFBundleSignature ???? CFBundleGetInfoString - IntelliJ IDEA @@major@@.@@minor@@, build @@@@. Copyright JetBrains s.r.o., (c) 2000-2009 + IntelliJ IDEA @@version@@, build @@build@@. Copyright JetBrains s.r.o., (c) 2000-2009 CFBundleShortVersionString - @@major@@.@@minor@@ + @@version@@ CFBundleVersion - @@@@ + @@build@@ Java ClassPath @@ -70,11 +70,11 @@ com.apple.mrj.application.live-resize false idea.config.path - ~/Library/Preferences/IntelliJIDEA90 + ~/Library/Preferences/@@system_selector@@/ idea.system.path - ~/Library/Caches/IntelliJIDEA90/ + ~/Library/Caches/@@system_selector@@/ idea.plugins.path - ~/Library/Application Support/IntelliJIDEA90/ + ~/Library/Application Support/@@system_selector@@/ java.endorsed.dirs idea.smooth.progress @@ -86,8 +86,10 @@ apple.awt.fullscreencapturealldisplays false + VMOptions - -Xms32m -Xmx256m -XX:MaxPermSize=150m -Xbootclasspath/a:../lib/boot.jar -ea + @@vmoptions@@ -Xbootclasspath/a:../lib/boot.jar + WorkingDirectory $APP_PACKAGE/bin diff --git a/build/mac/idea b/build/conf/mac/Contents/MacOS/idea similarity index 100% rename from build/mac/idea rename to build/conf/mac/Contents/MacOS/idea diff --git a/build/images/idea/idea.icns b/build/conf/mac/Contents/Resources/idea.icns similarity index 100% rename from build/images/idea/idea.icns rename to build/conf/mac/Contents/Resources/idea.icns diff --git a/lib/quaqua.jar b/build/conf/mac/lib/quaqua.jar similarity index 100% rename from lib/quaqua.jar rename to build/conf/mac/lib/quaqua.jar diff --git a/build/scripts/dist.gant b/build/scripts/dist.gant index 1389add4e8cd..a289242cf72f 100644 --- a/build/scripts/dist.gant +++ b/build/scripts/dist.gant @@ -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) +} + diff --git a/build/scripts/layouts.gant b/build/scripts/layouts.gant index c65d89c31e15..9683c8be3b88 100644 --- a/build/scripts/layouts.gant +++ b/build/scripts/layouts.gant @@ -55,6 +55,7 @@ def layoutFull(String targetDirectory) { //noinspection GroovyAssignabilityCheck List implementationModules = [platformImplementationModules(), "notNull", + "platform-main", "java-impl", "compiler-impl", "debugger-impl", diff --git a/platform/platform-impl/src/com/intellij/idea/LoggerFactory.java b/platform/platform-impl/src/com/intellij/idea/LoggerFactory.java index 28236eeb15a8..0e17ba69ca23 100644 --- a/platform/platform-impl/src/com/intellij/idea/LoggerFactory.java +++ b/platform/platform-impl/src/com/intellij/idea/LoggerFactory.java @@ -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 +} diff --git a/platform/util/src/com/intellij/openapi/application/PathManager.java b/platform/util/src/com/intellij/openapi/application/PathManager.java index 673b3708eefc..6922b39293c5 100644 --- a/platform/util/src/com/intellij/openapi/application/PathManager.java +++ b/platform/util/src/com/intellij/openapi/application/PathManager.java @@ -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 { diff --git a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java index 391cf7c4ccf4..f51dabfe2f36 100644 --- a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java +++ b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java @@ -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; + } }