mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CE installer
This commit is contained in:
+3
-3
@@ -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">
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
<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>
|
||||
@@ -70,11 +70,11 @@
|
||||
<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>
|
||||
@@ -86,8 +86,10 @@
|
||||
<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>
|
||||
+166
-9
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ def layoutFull(String targetDirectory) {
|
||||
//noinspection GroovyAssignabilityCheck
|
||||
List<String> implementationModules = [platformImplementationModules(),
|
||||
"notNull",
|
||||
"platform-main",
|
||||
"java-impl",
|
||||
"compiler-impl",
|
||||
"debugger-impl",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user