Merge remote-tracking branch 'origin/master'
authorAnna Kozlova <anna.kozlova@jetbrains.com>
Fri, 18 Jul 2014 19:57:34 +0000 (21:57 +0200)
committerAnna Kozlova <anna.kozlova@jetbrains.com>
Fri, 18 Jul 2014 19:57:34 +0000 (21:57 +0200)
13 files changed:
.idea/libraries/Eclipse.xml
java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ErrorPaneConfigurable.java
lib/ecj-4.3.2.jar [deleted file]
lib/ecj-4.4.jar [new file with mode: 0644]
lib/required_for_dist.txt
platform/core-api/src/com/intellij/openapi/progress/ProgressIndicatorProvider.java
platform/core-api/src/com/intellij/openapi/progress/ProgressManager.java
platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java
platform/platform-impl/src/com/intellij/idea/IdeaLogger.java
platform/platform-impl/src/com/intellij/idea/StartupUtil.java
platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java
platform/util/src/com/intellij/openapi/util/BuildNumber.java
python/helpers/pycharm/lettuce_runner.py [new file with mode: 0644]

index 0e496f809fd90ae3a827ca4fbb1f2c6c6a939c8e..dc3840d522fc81a7eec5858dd78a497cfbe46c00 100644 (file)
@@ -1,11 +1,11 @@
 <component name="libraryTable">
   <library name="Eclipse">
     <CLASSES>
-      <root url="jar://$PROJECT_DIR$/lib/ecj-4.3.2.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ecj-4.4.jar!/" />
     </CLASSES>
     <JAVADOC />
     <SOURCES>
-      <root url="jar://$PROJECT_DIR$/lib/src/ecjsrc-4.3.2.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/src/ecjsrc-4.4.jar!/" />
     </SOURCES>
   </library>
 </component>
\ No newline at end of file
index ba50a9f60714f4681c03bd373de754185f502c2d..67b988bc78665e50a2565285fc7ca9fc2bbe8e86 100644 (file)
@@ -67,11 +67,11 @@ public class ErrorPaneConfigurable extends JPanel implements Configurable, Dispo
                       "<header><style type='text/css'>" +
                       "body {" +
                       "  color: #333333;" +
-                      "  font-family: '" + UIUtil.getLabelFont().getName() + "';" +
+                      "  font-family: '" + UIUtil.getLabelFont().getName() + ",serif';" +
                       "  font-size: " + UIUtil.getLabelFont().getSize() + ";" +
                       "}" +
                       "li {" +
-                      "  margin-bottom: 3;" +
+                      "  margin-bottom: 5;" +
                       "}" +
                       "ol {" +
                       "}" +
@@ -79,7 +79,7 @@ public class ErrorPaneConfigurable extends JPanel implements Configurable, Dispo
                       " text-decoration: none;" +
                       "}" +
                       "</style>" +
-                      "</headear>" +
+                      "</header>" +
                       "<body>";
         int i = 0;
         html += "<ol>";
@@ -96,7 +96,7 @@ public class ErrorPaneConfigurable extends JPanel implements Configurable, Dispo
             description = "Module <a href='module://" + moduleName + "'>" + moduleName + "</a> " + description.substring(end + 1);
           }
           if (error.canBeFixed()) {
-            description += " <a href='fix://" + i + "'>Fix</a>";
+            description += " <a href='fix://" + i + "'>[Fix]</a>";
           }
           html+= "<li>" + description + "</li>";
         }
diff --git a/lib/ecj-4.3.2.jar b/lib/ecj-4.3.2.jar
deleted file mode 100644 (file)
index fd4c47a..0000000
Binary files a/lib/ecj-4.3.2.jar and /dev/null differ
diff --git a/lib/ecj-4.4.jar b/lib/ecj-4.4.jar
new file mode 100644 (file)
index 0000000..98f82dc
Binary files /dev/null and b/lib/ecj-4.4.jar differ
index 77d0b5b11961c3f99f9df036a72d53ac3b6fe0b5..6ea1f4d542ec8fdffa842baabae1286beb167e30 100644 (file)
@@ -14,7 +14,7 @@ httpclient-4.3.2.jar
 fluent-hc-4.3.2.jar
 freemarker.jar
 httpmime-4.3.2.jar
-ecj-4.3.2.jar
+ecj-4.4.jar
 groovy-all-2.2.1.jar
 gson-2.2.4.jar
 guava-17.0.jar
index 0f50f8d05ecf41624c7fcd439b0f25c576ecc981..c6b69bc6dc27ccdfbd0080bbddedde109375c5e8 100644 (file)
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
  */
 public abstract class ProgressIndicatorProvider {
   @Nullable
-  public static ProgressIndicatorProvider ourInstance;
+  public static volatile ProgressIndicatorProvider ourInstance;
 
   @Nullable
   public static ProgressIndicatorProvider getInstance() {
@@ -36,22 +36,27 @@ public abstract class ProgressIndicatorProvider {
 
   @Nullable
   public static ProgressIndicator getGlobalProgressIndicator() {
-    return ourInstance != null ? ourInstance.getProgressIndicator() : null;
+    ProgressIndicatorProvider provider = ourInstance;
+    return provider != null ? provider.getProgressIndicator() : null;
   }
 
   public abstract NonCancelableSection startNonCancelableSection();
 
   @NotNull
   public static NonCancelableSection startNonCancelableSectionIfSupported() {
-    return ourInstance != null ? ourInstance.startNonCancelableSection() : NonCancelableSection.EMPTY;
+    ProgressIndicatorProvider provider = ourInstance;
+    return provider != null ? provider.startNonCancelableSection() : NonCancelableSection.EMPTY;
   }
 
   public static volatile boolean ourNeedToCheckCancel = false;
   public static void checkCanceled() throws ProcessCanceledException {
     // smart optimization! There's a thread started in ProgressManagerImpl, that set's this flag up once in 10 milliseconds
-    if (ourNeedToCheckCancel && ourInstance != null) {
-      ourInstance.doCheckCanceled();
-      ourNeedToCheckCancel = false;
+    if (ourNeedToCheckCancel) {
+      ProgressIndicatorProvider provider = ourInstance;
+      if (provider != null) {
+        provider.doCheckCanceled();
+        ourNeedToCheckCancel = false;
+      }
     }
   }
 }
index a319700b4be2746c55cd87a42f18a9a07de10e77..d65e4367f1306ea741a04b7b54ce3faff5ae3812 100644 (file)
@@ -50,13 +50,14 @@ public abstract class ProgressManager {
     };
   }
 
-  private static ProgressManager ourInstance;
+  private static volatile ProgressManager ourInstance;
 
   public static ProgressManager getInstance() {
-    if (ourInstance == null) {
-      ourInstance = ServiceManager.getService(ProgressManager.class);
+    ProgressManager progressManager = ourInstance;
+    if (progressManager == null) {
+      ourInstance = progressManager = ServiceManager.getService(ProgressManager.class);
     }
-    return ourInstance;
+    return progressManager;
   }
 
   public abstract boolean hasProgressIndicator();
index 78ce83cc5154c0cdedd3d13b100966d5b111dafd..62fbfa502c798c50004d802ccd0200fda7627991 100644 (file)
@@ -409,7 +409,7 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
       }
     }
     else {
-      buffer.append(getBuild().asString());
+      buffer.append(getBuild().asStringWithAllDetails());
     }
     return buffer.toString();
   }
index 3a8f7334864077ceedf82b6bef3cdb82ac854397..67a7c0f88532fd02c8b66c10e708d43801591c38 100644 (file)
@@ -199,7 +199,7 @@ public class IdeaLogger extends Logger {
       @Override
       public String getInfo() {
         final ApplicationInfoEx info = ApplicationInfoImpl.getShadowInstance();
-        return info.getFullApplicationName() + "  " + "Build #" + info.getBuild().asString();
+        return info.getFullApplicationName() + "  " + "Build #" + info.getBuild().asStringWithAllDetails();
       }
     };
   }
index 611e1a6ba607f66fa3ab385e6296f121439077a9..10f9c7365cfea51ce9a55861564ebb07d424e934 100644 (file)
@@ -319,7 +319,7 @@ public class StartupUtil {
     ApplicationInfo appInfo = ApplicationInfoImpl.getShadowInstance();
     ApplicationNamesInfo namesInfo = ApplicationNamesInfo.getInstance();
     String buildDate = new SimpleDateFormat("dd MMM yyyy HH:ss", Locale.US).format(appInfo.getBuildDate().getTime());
-    log.info("IDE: " + namesInfo.getFullProductName() + " (build #" + appInfo.getBuild() + ", " + buildDate + ")");
+    log.info("IDE: " + namesInfo.getFullProductName() + " (build #" + appInfo.getBuild().asStringWithAllDetails() + ", " + buildDate + ")");
     log.info("OS: " + SystemInfoRt.OS_NAME + " (" + SystemInfoRt.OS_VERSION + ", " + SystemInfo.OS_ARCH + ")");
     log.info("JRE: " + System.getProperty("java.runtime.version", "-") + " (" + System.getProperty("java.vendor", "-") + ")");
     log.info("JVM: " + System.getProperty("java.vm.version", "-") + " (" + System.getProperty("java.vm.name", "-") + ")");
index c198f6d0fa33c7541104eede79cd961bdb37b558..6bfc56df439950c2ba85d0dacb60f6827c5b7cae 100644 (file)
@@ -809,6 +809,7 @@ public class AbstractPopup implements JBPopup {
     myPopup.getWindow().pack();
 
     myPopup.setRequestFocus(myRequestFocus);
+    LOG.debug("popup window size: " + myPopup.getWindow().getSize());
     myPopup.show();
 
     final Window window = SwingUtilities.getWindowAncestor(myContent);
index 9555e2b7ea4c5b94d43b19432939252bf2f66c4b..22cf77504a6368b83751bc7ff9622178938c83ca 100644 (file)
@@ -52,14 +52,14 @@ public class BuildNumber implements Comparable<BuildNumber> {
   }
 
   public String asString() {
-    return asString(true);
+    return asString(true, false);
   }
 
   public String asStringWithoutProductCode() {
-    return asString(false);
+    return asString(false, false);
   }
 
-  private String asString(boolean includeProductCode) {
+  private String asString(boolean includeProductCode, boolean withBuildAttempt) {
     StringBuilder builder = new StringBuilder();
 
     if (includeProductCode && !StringUtil.isEmpty(myProductCode)) {
@@ -75,7 +75,7 @@ public class BuildNumber implements Comparable<BuildNumber> {
       builder.append(SNAPSHOT);
     }
 
-    if (myAttemptInfo != null) {
+    if (withBuildAttempt && myAttemptInfo != null) {
       builder.append('.').append(myAttemptInfo);
     }
 
@@ -275,4 +275,8 @@ public class BuildNumber implements Comparable<BuildNumber> {
   public boolean isSnapshot() {
     return myBuildNumber == Integer.MAX_VALUE;
   }
+
+  public String asStringWithAllDetails() {
+    return asString(true, true);
+  }
 }
diff --git a/python/helpers/pycharm/lettuce_runner.py b/python/helpers/pycharm/lettuce_runner.py
new file mode 100644 (file)
index 0000000..6aaa566
--- /dev/null
@@ -0,0 +1,132 @@
+# coding=utf-8
+"""
+BDD lettuce framework runner
+"""
+__author__ = 'Ilya.Kazakevich'
+import os
+from lettuce.exceptions import ReasonToFail
+import time
+import sys
+import tcmessages
+import lettuce
+from lettuce import core
+
+
+# Error message about unsupported outlines
+_NO_OUTLINE_ERROR = "Outline scenarios are not supported due to https://github.com/gabrielfalcao/lettuce/issues/451"
+
+
+class LettuceRunner(object):
+    """
+    TODO: Runs lettuce
+    """
+
+    def __init__(self, base_dir):
+        """
+        :param base_dir base directory to run tests in
+        :type base_dir: str
+
+        """
+        self.base_dir = base_dir
+        self.runner = lettuce.Runner(base_dir)
+        self.messages = tcmessages.TeamcityServiceMessages()
+        self.test_start_time = None
+
+    def report_tests(self):
+        """
+        :returns : number of tests
+        :rtype : int
+        """
+        result = 0
+        for feature_file in self.runner.loader.find_feature_files():
+            feature = core.Feature.from_file(feature_file)
+            for scenario in feature.scenarios:
+                assert isinstance(scenario, core.Scenario), scenario
+                if not scenario.outlines:
+                    result += len(scenario.steps)
+        self.messages.testCount(result)
+
+    def report_scenario_started(self, scenario):
+        """
+        Reports scenario launched
+        :type scenario core.Scenario
+        :param scenario: scenario
+        """
+        if scenario.outlines:
+            self.messages.testIgnored(scenario.name,
+                                      _NO_OUTLINE_ERROR)
+            scenario.steps = []  # Clear to prevent running. TODO: Fix when this issue fixed
+            scenario.background = None  # TODO: undocumented
+            return
+        self.report_suite(True, scenario.name, scenario.described_at)
+
+    def report_suite(self, is_start, name, described_at):
+        """
+        Reports some suite (scenario, feature, background etc) is started or stopped
+        :param is_start: started or not
+        :param name: suite name
+        :param described_at: where it is described (file, line)
+        :return:
+        """
+        if is_start:
+            self.messages.testSuiteStarted(name, self._gen_location(described_at))
+        else:
+            self.messages.testSuiteFinished(name)
+
+    def report_step(self, is_start, step):
+        """
+        Reports step start / stop
+        :param is_start: true if step started
+        :type step core.Step
+        :param step: step
+        """
+        test_name = step.sentence
+        if is_start:
+            self.test_start_time = time.time()
+            self.messages.testStarted(test_name, self._gen_location(step.described_at))
+        elif step.passed:
+            duration = 0
+            if self.test_start_time:
+                duration = long(time.time() - self.test_start_time)
+            self.messages.testFinished(test_name, duration=duration)
+            self.test_start_time = None
+        elif step.failed:
+            reason = step.why
+            assert isinstance(reason, ReasonToFail), reason
+            self.messages.testFailed(test_name, message=reason.exception, details=reason.traceback)
+
+    def _gen_location(self, description):
+        """
+        :param description: "described_at" (file, line)
+        :return: location in format file:line by "described_at"
+        """
+        return "file:///{}/{}:{}".format(self.base_dir, description.file, description.line)
+
+    def run(self):
+        """
+        Launches runner
+        """
+        self.report_tests()
+        self.messages.testMatrixEntered()
+
+        lettuce.before.each_feature(lambda f: self.report_suite(True, f.name, f.described_at))
+        lettuce.after.each_feature(lambda f: self.report_suite(False, f.name, f.described_at))
+
+        lettuce.before.each_scenario(lambda s: self.report_scenario_started(s))
+        lettuce.after.each_scenario(lambda s: self.report_suite(False, s.name, s.described_at))
+
+        lettuce.before.each_background(
+            lambda b, *args: self.report_suite(True, "Scenario background", b.feature.described_at))
+        lettuce.after.each_background(
+            lambda b, *args: self.report_suite(False, "Scenario background", b.feature.described_at))
+
+        lettuce.before.each_step(lambda s: self.report_step(True, s))
+        lettuce.after.each_step(lambda s: self.report_step(False, s))
+
+        self.runner.run()
+
+
+if __name__ == "__main__":
+    path = sys.argv[1] if len(sys.argv) > 1 else "."
+    assert os.path.exists(path), "{} does not exist".format(path)
+    LettuceRunner(path).run()
\ No newline at end of file