Snapshot 568f05589922685b8c8f9a2f2f465043b8128542 from master branch of git://git.jetbrains.org/idea/community.git

Change-Id: I47fe8cb5d8a3c9876cd4c313dca1a8cc531288ec
diff --git a/build/scripts/dist.gant b/build/scripts/dist.gant
index 2bf5b8c..ce60329 100644
--- a/build/scripts/dist.gant
+++ b/build/scripts/dist.gant
@@ -100,7 +100,7 @@
   ant.echo(message: args.buildNumber, file: "$paths.distAll/build.txt")
 
   def layouts = includeFile("$home/build/scripts/layouts.gant")
-  layouts.layoutFull(home, paths.distAll)
+  layouts.layoutFull(home, paths.distAll, null)
   layouts.layout_core(home, paths.artifacts_core)
   notifyArtifactBuilt(paths.artifacts_core)
   layouts.layout_core_upsource(home, paths.artifacts_core_upsource)
@@ -120,6 +120,7 @@
       fileset(dir: "${home}/license")
     }
     fileset(file: "${home}/LICENSE.txt")
+    fileset(file: "${home}/NOTICE.txt")
   }
   patchPropertiesFile(paths.distAll, args + [appendices: ["$home/build/conf/ideaCE.properties"]])
 
diff --git a/build/scripts/layouts.gant b/build/scripts/layouts.gant
index 3994579..6e03801 100644
--- a/build/scripts/layouts.gant
+++ b/build/scripts/layouts.gant
@@ -49,27 +49,35 @@
 
   //noinspection GroovyAssignabilityCheck
   List<String> openapiModules = [platformApiModules,
-          "java-psi-api", "java-indexing-api", "openapi", "testFramework-java", "debugger-openapi", "compiler-openapi", "dom-openapi", "execution-openapi",
-          "jsp-openapi", "jsp-base-openapi"].flatten()
+    "java-psi-api",
+    "java-analysis-api",
+    "java-indexing-api",
+    "openapi",
+    "testFramework-java",
+    "debugger-openapi",
+    "compiler-openapi",
+    "dom-openapi",
+    "execution-openapi",
+    "jsp-openapi",
+    "jsp-base-openapi"].flatten()
 
   //noinspection GroovyAssignabilityCheck
   List<String> implementationModules = [platformImplementationModules,
-          "testFramework",
-          "tests_bootstrap",
-          "instrumentation-util",
-          "platform-main",
-          "java-psi-impl",
-          "java-indexing-impl",
-          "java-impl",
-          "java-analysis-impl",
-          "analysis-impl",
-          "compiler-impl",
-          "debugger-impl",
-          "dom-impl",
-          "execution-impl",
-          "jsp-spi",
-          "idea-ui",
-          "external-system-impl"
+    "compiler-impl",
+    "debugger-impl",
+    "dom-impl",
+    "execution-impl",
+    "external-system-impl",
+    "idea-ui",
+    "instrumentation-util",
+    "java-analysis-impl",
+    "java-indexing-impl",
+    "java-impl",
+    "java-psi-impl",
+    "jsp-spi",
+    "platform-main",
+    "testFramework",
+    "tests_bootstrap",
           ].flatten()
 
   ant.patternset(id: "resources.included") {
@@ -221,13 +229,13 @@
   //reorder(targetDirectory)
 }
 
-public def layoutCommunityPlugins(String home, String androidHome=null) {
-  if (androidHome == null) {
-    androidHome = "$home/plugins/android"
+public def layoutCommunityPlugins(String home) {
+  if (isDefined("androidPluginHome")) {
+    layoutAndroid(p("androidPluginHome"))
   }
 
   dir("plugins") {
-    def simplePlugins = ["commander", "copyright", "properties", "java-i18n", "hg4idea", "github", "ui-designer-core", "tasks-time-tracking"]
+    def simplePlugins = ["commander", "copyright", "properties", "java-i18n", "hg4idea", "github", "ui-designer-core"] //, "tasks-time-tracking"]
 
     simplePlugins.each {
       layoutPlugin it
@@ -238,7 +246,11 @@
         module("ant-jps-plugin")
       }
     }
-    layoutPlugin("InspectionGadgets", "InspectionGadgetsPlugin")
+    layoutPlugin("InspectionGadgets", "InspectionGadgetsPlugin") {
+      jar("InspectionGadgetsAnalysis.jar") {
+        module("InspectionGadgetsAnalysis")
+      }
+    }
     layoutPlugin("IntentionPowerPack", "IntentionPowerPackPlugin")
     layoutPlugin("ToString", "generate-tostring", "toString")
     layoutPlugin("uiDesigner", "ui-designer", "uiDesigner") {
@@ -454,29 +466,12 @@
       }
     }
 
-    layoutPlugin("android") {
-      fileset(dir: "${androidHome}/lib") {
-        include(name: "**/*.jar")
-        exclude(name: "**/ddmlib_1.jar")
-        exclude(name: "src/*.jar")
+    layoutPlugin("terminal") {
+      jar("terminal.jar") {
+        module("terminal")
       }
-
-      jar("android-common.jar") {
-        module("android-common")
-      }
-
-      jar("android-rt.jar") {
-        module("android-rt")
-      }
-
-      dir("jps") {
-        jar("android-jps-plugin.jar") { module("android-jps-plugin") }
-      }
-    }
-
-    layoutPlugin("android-designer") {
-      jar("android-designer.jar") {
-        module("android-designer")
+      fileset(dir: "$home/plugins/terminal/lib") {
+        include(name: "*.jar")
       }
     }
   }
@@ -587,6 +582,67 @@
   }
 }
 
+def layoutAndroid(String androidHome) {
+  dir("plugins") {
+    layoutPlugin("android") {
+      fileset(dir: "${androidHome}/android/lib") {
+        include(name: "**/*.jar")
+        exclude(name: "**/ddmlib_1.jar")
+        exclude(name: "src/*.jar")
+      }
+
+      jar("android-common.jar") {
+        module("android-common")
+      }
+
+      jar("android-rt.jar") {
+        module("android-rt")
+      }
+
+      jar("common.jar") {
+        module("common")
+      }
+      jar("sdklib.jar") {
+        module("sdklib")
+      }
+      jar("layoutlib-api.jar") {
+        module("layoutlib-api")
+      }
+      jar("sdk-tools.jar") {
+        module("assetstudio")
+        module("ddmlib")
+        module("dvlib")
+        module("draw9patch")
+        module("lint-cli")
+        module("lint-api")
+        module("lint-checks")
+        module("manifest-merger")
+        module("ninepatch")
+        module("sdk-common")
+      }
+      jar("androidAnnotations.jar") {
+        fileset(dir: "$androidHome/android/annotations")
+      }
+      dir("jps") {
+        jar("android-gradle-jps.jar") { module("android-gradle-jps") }
+      }
+      dir("device-art-resources") {
+        fileset(dir: "$androidHome/android/device-art-resources")
+      }
+
+      dir("jps") {
+        jar("android-jps-plugin.jar") { module("android-jps-plugin") }
+      }
+    }
+
+    layoutPlugin("android-designer") {
+      jar("android-designer.jar") {
+        module("android-designer")
+      }
+    }
+  }
+}
+
 def layoutCommunityJps(String home, String target) {
   layout(target) {
     jar("util.jar") {
@@ -616,15 +672,6 @@
     }
     jar("ui-designer-jps-plugin.jar") { module("ui-designer-jps-plugin") }
 
-    jar("android-jps-plugin.jar") {
-      module("android-jps-plugin")
-      module("android-common")
-      module("android-rt")
-    }
-    fileset(dir: "${home}/plugins/android/lib") {
-      include(name: "**/*.jar")
-      exclude(name: "**/ddmlib_1.jar")
-    }
 
     jar("maven-jps-plugin.jar") { module("maven-jps-plugin") }
     fileset(dir: "$home/plugins/maven/maven3-server-impl/lib/maven3/lib") {include(name: "plexus-utils-*.jar")}
@@ -669,6 +716,8 @@
       module("extensions")
       module("java-psi-api")
       module("java-psi-impl")
+      module("analysis-api")
+      module("analysis-impl")
     }
 
     jar("annotations.jar") {
@@ -713,6 +762,7 @@
       module("analysis-impl")
       module("java-analysis-api")
       module("java-analysis-impl")
+      module("InspectionGadgetsAnalysis")
     }
 
     jar("annotations.jar") {
diff --git a/build/scripts/libLicenses.gant b/build/scripts/libLicenses.gant
index ee9af7e..54dc1f7 100644
--- a/build/scripts/libLicenses.gant
+++ b/build/scripts/libLicenses.gant
@@ -202,7 +202,7 @@
 libraryLicense(name: "JSch", libraryName: "JSch", version: "0.1.49", license: "BSD", url: "http://www.jcraft.com/jsch/", licenseUrl: "http://www.jcraft.com/jsch/LICENSE.txt")
 libraryLicense(name: "JUnit", libraryName: "JUnit3", version: "3.8.1", license: "CPL 1.0", url: "http://junit.org/")
 libraryLicense(name: "JUnit", libraryName: "JUnit4", version: "4.8", license: "CPL 1.0", url: "http://junit.org/")
-libraryLicense(name: "Log4j", libraryName: "Log4J", version: "1.2", license: "Apache 2.0", url: "http://logging.apache.org/log4j/1.2/index.html", licenseUrl: "http://logging.apache.org/license.html")
+libraryLicense(name: "Log4j", libraryName: "Log4J", version: "1.2.17", license: "Apache 2.0", url: "http://logging.apache.org/log4j/1.2/index.html", licenseUrl: "http://logging.apache.org/license.html")
 libraryLicense(name: "Maven", version: "2.2.1", license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://maven.apache.org/license.html")
 libraryLicense(name: "plexus-util", version: "2.0.6", license: "Apache 2.0", url: "http://maven.apache.org/", libraryNames:['plexus-utils-2.0.6.jar'], licenseUrl: "http://apache.org/licenses/LICENSE-2.0")
 libraryLicense(name: "aether-api", version: "1.11", libraryNames: ["aether-api-1.11.jar"], license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://maven.apache.org/license.html")
@@ -247,8 +247,8 @@
 libraryLicense(name: "XML-RPC", libraryName: "XmlRPC", version: "2.0", license: "Apache 2.0", url: "http://ws.apache.org/xmlrpc/xmlrpc2/", licenseUrl: "http://ws.apache.org/xmlrpc/xmlrpc2/license.html")
 libraryLicense(name: "XStream", version: "1.4.3", license: "BSD", url: "http://xstream.codehaus.org/", licenseUrl: "http://xstream.codehaus.org/license.html")
 libraryLicense(name: "YourKit Java Profiler", libraryName: "yjp-controller-api-redist.jar", version: "8.0.x", license: "link (commercial license)", url: "http://yourkit.com/", licenseUrl: "http://www.yourkit.com/purchase/license.html")
-libraryLicense(name: "protobuf", version: "2.3.0", license: "New BSD", url: "http://code.google.com/p/protobuf/", licenseUrl: "http://code.google.com/p/protobuf/source/browse/trunk/COPYING.txt?r=367")
-libraryLicense(name: "Netty", libraryName: "Netty", version: "3.6.3", license: "Apache 2.0", url: "http://netty.io", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
+libraryLicense(name: "protobuf", version: "2.5.0", license: "New BSD", url: "http://code.google.com/p/protobuf/", licenseUrl: "http://code.google.com/p/protobuf/source/browse/trunk/COPYING.txt?r=367")
+libraryLicense(name: "Netty", libraryName: "Netty", version: "3.6.6", license: "Apache 2.0", url: "http://netty.io", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
 libraryLicense(name: "Kryo", libraryName: "Kryo", version: "1.04", license: "New BSD License", url: "http://code.google.com/p/kryo/", licenseUrl: "http://www.opensource.org/licenses/bsd-license.php")
 libraryLicense(name: "Snappy-Java", libraryName: "Snappy-Java", version: "1.1.0-M3", license: "Apache 2.0", url: "http://code.google.com/p/snappy-java/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
 libraryLicense(name: "Cucumber-Java", libraryName: "cucumber-java", version: "1.0.14", license: "MIT License", url: "https://github.com/cucumber/cucumber-jvm/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html")
diff --git a/build/scripts/utils.gant b/build/scripts/utils.gant
index dec5a0e..7a5798b 100644
--- a/build/scripts/utils.gant
+++ b/build/scripts/utils.gant
@@ -243,42 +243,44 @@
 ])
 
 binding.setVariable("platformApiModules", [
-        "core-api",
-        "indexing-api",
-        "projectModel-api",
-        "jps-model-api",
-        "platform-api",
-        "lvcs-api",
-        "lang-api",
-        "analysis-api",
-        "vcs-api",
-        "usageView",
-        "xdebugger-api",
-        "xml-openapi",
-        "external-system-api",
+  "analysis-api",
+  "core-api",
+  "external-system-api",
+  "indexing-api",
+  "jps-model-api",
+  "lang-api",
+  "lvcs-api",
+  "projectModel-api",
+  "platform-api",
+  "usageView",
+  "vcs-api",
+  "xdebugger-api",
+  "xml-openapi",
+  "xml-psi-api",
 ])
 
 
 binding.setVariable("platformImplementationModules", [
-        "core-impl",
-        "indexing-impl",
-        "jps-model-impl",
-        "jps-model-serialization",
-        "projectModel-impl",
-        "platform-impl",
-        "vcs-impl",
-        "lang-impl",
-        "analysis-impl",
-        "testRunner",
-        "smRunner",
-        "xdebugger-impl",
-        "xml",
-        "relaxng",
-        "lvcs-impl",
-        "spellchecker",
-        "images",
-        "RegExpSupport",
-        "dvcs"
+  "analysis-impl",
+  "core-impl",
+  "dvcs",
+  "images",
+  "indexing-impl",
+  "jps-model-impl",
+  "jps-model-serialization",
+  "lang-impl",
+  "lvcs-impl",
+  "projectModel-impl",
+  "platform-impl",
+  "vcs-impl",
+  "testRunner",
+  "smRunner",
+  "relaxng",
+  "RegExpSupport",
+  "spellchecker",
+  "xdebugger-impl",
+  "xml",
+  "xml-psi-impl",
 ])
 
 binding.setVariable("layoutMacApp", { String path, String ch, Map args ->