summaryrefslogtreecommitdiff
path: root/updater
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2014-03-10 14:45:16 -0700
committerTor Norbye <tnorbye@google.com>2014-03-10 21:44:32 +0000
commit869f44d03c83dbaf7429b1c8c2ff82f33920dedf (patch)
tree692580c33ff11dd96e405d07662f6c05d0c37642 /updater
parentdd7dafee94f064b00f0d3e30b87c7dfa234f16c6 (diff)
downloadidea-869f44d03c83dbaf7429b1c8c2ff82f33920dedf.tar.gz
Merge remote-tracking branch 'aosp/snapshot-master' into merge
Conflicts: platform/bootstrap/src/com/intellij/idea/Main.java platform/lang-impl/src/com/intellij/openapi/file/exclude/EnforcedPlainTextFileTypeManager.java platform/lang-impl/src/com/intellij/openapi/file/exclude/PersistentFileSetManager.java updater/src/com/intellij/updater/Runner.java Change-Id: I515792652054e4857affba47efbcaa36cb385d32 (cherry picked from commit 132117747ccf002d6f09f7c410e0d9e29214bec5)
Diffstat (limited to 'updater')
-rwxr-xr-xupdater/src/com/intellij/updater/Runner.java45
-rw-r--r--updater/testSrc/com/intellij/updater/DigesterTest.java2
-rw-r--r--updater/testSrc/com/intellij/updater/RunnerTest.java2
-rw-r--r--updater/testSrc/com/intellij/updater/UpdaterTestCase.java2
4 files changed, 24 insertions, 27 deletions
diff --git a/updater/src/com/intellij/updater/Runner.java b/updater/src/com/intellij/updater/Runner.java
index 9a88ea491eeb..d0143a946b0c 100755
--- a/updater/src/com/intellij/updater/Runner.java
+++ b/updater/src/com/intellij/updater/Runner.java
@@ -24,15 +24,13 @@ public class Runner {
private static final String NEW_BUILD_DESCRIPTION = "new.build.description";
public static void main(String[] args) throws Exception {
- if (args.length >= 7 && "create".equals(args[0])) {
+ if (args.length >= 6 && "create".equals(args[0])) {
String oldVersionDesc = args[1];
String newVersionDesc = args[2];
String oldFolder = args[3];
String newFolder = args[4];
String patchFile = args[5];
-
- String logFolder = args[6];
- initLogger(logFolder);
+ initLogger();
List<String> ignoredFiles = extractFiles(args, "ignored");
List<String> criticalFiles = extractFiles(args, "critical");
@@ -40,8 +38,7 @@ public class Runner {
create(oldVersionDesc, newVersionDesc, oldFolder, newFolder, patchFile, ignoredFiles, criticalFiles, optionalFiles);
}
else if (args.length >= 2 && "install".equals(args[0])) {
- // install [--exit0] <destination_folder> [log_directory]
- int max = 3;
+ // install [--exit0] <destination_folder>
int nextArg = 1;
// Default install exit code is SwingUpdaterUI.RESULT_REQUIRES_RESTART (42) unless overridden to be 0.
@@ -50,13 +47,10 @@ public class Runner {
if (args[nextArg].equals("--exit0")) {
useExitCode0 = true;
nextArg++;
- max++;
}
String destFolder = args[nextArg++];
-
- String logFolder = args.length >= max ? args[nextArg] : null;
- initLogger(logFolder);
+ initLogger();
logger.info("destFolder: " + destFolder);
install(useExitCode0, destFolder);
@@ -72,7 +66,8 @@ public class Runner {
return fileLogDir.isDirectory() && fileLogDir.canWrite() && fileLogDir.getUsableSpace() >= 1000000;
}
- private static String getLogDir(String logFolder) {
+ private static String getLogDir() {
+ String logFolder = System.getProperty("idea.updater.log");
if (logFolder == null || !isValidLogDir(logFolder)) {
logFolder = System.getProperty("java.io.tmpdir");
if (!isValidLogDir(logFolder)) {
@@ -82,9 +77,9 @@ public class Runner {
return logFolder;
}
- public static void initLogger(String logFolder) {
+ public static void initLogger() {
if (logger == null) {
- logFolder = getLogDir(logFolder);
+ String logFolder = getLogDir();
FileAppender update = new FileAppender();
update.setFile(new File(logFolder, "idea_updater.log").getAbsolutePath());
@@ -97,7 +92,6 @@ public class Runner {
updateError.setFile(new File(logFolder, "idea_updater_error.log").getAbsolutePath());
updateError.setLayout(new PatternLayout("%d{dd MMM yyyy HH:mm:ss} %-5p %C{1}.%M - %m%n"));
updateError.setThreshold(Level.ERROR);
- // The error(s) from an old run of the updater (if there were) could be found in idea_updater.log file
updateError.setAppend(false);
updateError.activateOptions();
@@ -239,17 +233,20 @@ public class Runner {
in.close();
}
- SwingUtilities.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- }
- catch (Exception ignore) {
- printStackTrace(ignore);
+ // todo[r.sh] to delete in IDEA 14 (after a full circle of platform updates)
+ if (System.getProperty("swing.defaultlaf") == null) {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ }
+ catch (Exception ignore) {
+ printStackTrace(ignore);
+ }
}
- }
- });
+ });
+ }
new SwingUpdaterUI(props.getProperty(OLD_BUILD_DESCRIPTION),
props.getProperty(NEW_BUILD_DESCRIPTION),
diff --git a/updater/testSrc/com/intellij/updater/DigesterTest.java b/updater/testSrc/com/intellij/updater/DigesterTest.java
index a7ec965359ee..3b524f8288e9 100644
--- a/updater/testSrc/com/intellij/updater/DigesterTest.java
+++ b/updater/testSrc/com/intellij/updater/DigesterTest.java
@@ -10,12 +10,12 @@ import static org.junit.Assert.assertEquals;
public class DigesterTest extends UpdaterTestCase {
@Test
public void testBasics() throws Exception {
+ Runner.initLogger();
Map<String, Long> checkSums = Digester.digestFiles(getDataDir(), Collections.<String>emptyList(), TEST_UI);
assertEquals(12, checkSums.size());
assertEquals(CHECKSUMS.README_TXT, (long)checkSums.get("Readme.txt"));
assertEquals(CHECKSUMS.FOCUSKILLER_DLL, (long)checkSums.get("bin/focuskiller.dll"));
assertEquals(CHECKSUMS.BOOTSTRAP_JAR, (long)checkSums.get("lib/bootstrap.jar"));
- Runner.initLogger(System.getProperty("java.io.tmpdir"));
}
} \ No newline at end of file
diff --git a/updater/testSrc/com/intellij/updater/RunnerTest.java b/updater/testSrc/com/intellij/updater/RunnerTest.java
index 4813db1711b3..22464a0fa053 100644
--- a/updater/testSrc/com/intellij/updater/RunnerTest.java
+++ b/updater/testSrc/com/intellij/updater/RunnerTest.java
@@ -11,7 +11,7 @@ public class RunnerTest extends UpdaterTestCase {
@Test
public void testExtractingFiles() throws Exception {
String[] args = {"bar", "ignored=xxx;yyy;zzz/zzz", "critical=", "ignored=aaa", "baz", "critical=ccc"};
- Runner.initLogger(System.getProperty("java.io.tmpdir"));
+ Runner.initLogger();
assertEquals(Arrays.asList("xxx", "yyy", "zzz/zzz", "aaa"),
Runner.extractFiles(args, "ignored"));
diff --git a/updater/testSrc/com/intellij/updater/UpdaterTestCase.java b/updater/testSrc/com/intellij/updater/UpdaterTestCase.java
index 82d7bbe860c7..dea5fbdd7c6d 100644
--- a/updater/testSrc/com/intellij/updater/UpdaterTestCase.java
+++ b/updater/testSrc/com/intellij/updater/UpdaterTestCase.java
@@ -25,7 +25,7 @@ public abstract class UpdaterTestCase {
@Before
public void setUp() throws Exception {
- Runner.initLogger(System.getProperty("java.io.tmpdir"));
+ Runner.initLogger();
myTempDirFixture = IdeaTestFixtureFactory.getFixtureFactory().createTempDirTestFixture();
myTempDirFixture.setUp();