2 * Copyright 2000-2015 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 import static org.jetbrains.jps.idea.IdeaProjectLoader.guessHome
18 includeTargets << new File("${guessHome(this)}/build/scripts/utils.gant")
20 target('default': "Developers update") {
21 def patchedDescriptorDir = patchAppDescriptor(deploy)
22 layoutFull(home, deploy, patchedDescriptorDir)
23 ant.delete(dir: patchedDescriptorDir)
26 String appInfoFileName() {
27 return "idea/IdeaApplicationInfo.xml"
30 String patchAppDescriptor(String targetDirectory) {
31 def patchedDirectory = "${targetDirectory}/../patched"
33 ant.delete(dir: patchedDirectory)
35 layout(patchedDirectory) {
36 module("community-resources") {
37 include(name: appInfoFileName())
41 ant.replace(file: "$patchedDirectory/${appInfoFileName()}", token: "__BUILD_NUMBER__", value: "IC-$snapshot")
42 ant.replace(file: "$patchedDirectory/${appInfoFileName()}", token: "__BUILD_DATE__", value: new Date().format("yyyyMMddHHmm"))
44 return patchedDirectory
47 def layoutFull(String home, String targetDirectory, String patchedDescriptorDir = null) {
48 projectBuilder.stage("layout to $targetDirectory")
50 List<String> jpsCommonModules = ["jps-model-impl", "jps-model-serialization"]
51 List<String> openapiModules = [platformApiModules,
62 "remote-servers-java-api",
66 List<String> implementationModules = [platformImplementationModules,
70 "duplicates-analysis",
72 "external-system-impl",
78 "java-structure-view",
82 "remote-servers-java-impl",
84 "structuralsearch-java",
90 implementationModules.removeAll(jpsCommonModules) //todo[nik] remove jps modules from platformImplementationModules instead and update layouts of minor IDEs accordingly
92 ant.patternset(id: "resources.included") {
93 include(name: "**/*.properties")
94 include(name: "fileTemplates/**/*")
95 include(name: "inspectionDescriptions/**/*")
96 include(name: "intentionDescriptions/**/*")
97 include(name: "tips/**/*")
100 ant.patternset(id: "resources.excluded") {
101 exclude(name: "**/*.properties")
102 exclude(name: "fileTemplates/**/*")
103 exclude(name: "fileTemplates")
104 exclude(name: "inspectionDescriptions/**/*")
105 exclude(name: "inspectionDescriptions")
106 exclude(name: "intentionDescriptions/**/*")
107 exclude(name: "intentionDescriptions")
108 exclude(name: "tips/**/*")
109 exclude(name: "tips")
112 def info = layout(targetDirectory) {
115 fileset(dir: "${home}/lib/rt", includesfile: "${home}/lib/rt/required_for_dist.txt")
116 jar("jps-plugin-system.jar") {
117 module("jps-plugin-system")
122 fileset(dir: "$home/lib/libpty") {
123 exclude(name: "readme.txt")
133 openapiModules.each { module it}
136 jar("annotations.jar") { module("annotations")}
137 jar("jdkAnnotations.jar") {
138 fileset(dir: "${home}/java/jdkAnnotations")
141 jar("extensions.jar") { module("extensions")}
144 implementationModules.each { module it}
147 jar("bootstrap.jar") { module("bootstrap") }
149 jar("jps-launcher.jar") { module("jps-launcher") }
151 jar("resources.jar") {
152 module("colorSchemes")
154 module("platform-resources")
155 module("community-resources") {
156 if (patchedDescriptorDir != null) {
157 exclude(name: appInfoFileName())
160 if (patchedDescriptorDir != null) {
161 fileset(dir: patchedDescriptorDir)
165 jar("idea_rt.jar") { module("java-runtime")}
167 jar("forms_rt.jar") {
169 module("forms-compiler")
172 jar("resources_en.jar") {
173 module("resources-en")
174 module("platform-resources-en")
177 jar("icons.jar") { module("icons") }
178 jar("boot.jar") { module("boot") }
182 module("forms-compiler")
184 module("instrumentation-util")
187 jar("jps-model.jar") {
188 jpsCommonModules.each { module it }
190 jar("jps-server.jar") {
191 module("jps-builders")
194 fileset(dir: "$home/jps/lib") {
195 include(name: "optimizedFileManager.jar")
198 fileset(dir: "$home/lib", includesfile: "${home}/lib/required_for_dist.txt")
201 fileset(dir: "$home/lib/src") {
202 include(name: "trove4j_src.jar")
205 fileset(dir: "$home/xml/relaxng/lib", includes: "*.jar")
208 fileset(dir: "$home/lib/ant") {
209 exclude(name: "**/src/**")
214 layoutCommunityPlugins(home)
220 noResources("javaFX")
221 noResources("javaFX-CE")
223 resources(["javaFX", "javaFX-CE"])
224 jar("javaFX-jps-plugin.jar") {
225 module("javaFX-jps-plugin")
227 jar("common-javaFX-plugin.jar") {
228 module("common-javaFX-plugin")
232 fileset(dir: "${home}/plugins/javaFX/FxBuilderEmbedder/lib", includes: "embedder.jar");
239 jar("IntelliLang.jar") {
240 module("IntelliLang")
241 module("IntelliLang-java")
242 module("IntelliLang-xml")
244 jar("intellilang-jps-plugin.jar") {
245 module("intellilang-jps-plugin")
252 printUnusedModules(info.usedModules)
254 //reorder(targetDirectory)
258 public def layoutCommunityPlugins(String home) {
259 if (!isDefined("maySkipAndroidPlugin") || new File("$home/android").exists()) {
260 layoutAndroid("$home/android")
263 projectBuilder.warning("Android plugin sources aren't found at $home/android. Android plugin is excluded from layout.")
267 def simplePlugins = ["copyright", "java-i18n", "hg4idea", "github"] //, "tasks-time-tracking"]
273 layoutPlugin("ant", "ant", "antIntegration") {
274 jar("ant-jps-plugin.jar") {
275 module("ant-jps-plugin")
278 layoutPlugin("uiDesigner", "ui-designer", "uiDesigner") {
280 jar("ui-designer-jps-plugin.jar") {
281 module("ui-designer-jps-plugin")
286 pluginDir("properties") {
288 jar("properties.jar") {
289 module("properties-psi-api")
290 module("properties-psi-impl")
296 layoutPlugin("maven") {
297 jar("maven-jps-plugin.jar") {
298 module("maven-jps-plugin")
300 jar("maven-server-api.jar") {
301 module("maven-server-api")
303 jar("maven2-server-impl.jar") {
304 module("maven2-server-impl")
306 jar("maven3-server-common.jar") {
307 module("maven3-server-common")
309 jar("maven30-server-impl.jar") {
310 module("maven30-server-impl")
312 jar("maven32-server-impl.jar") {
313 module("maven32-server-impl")
316 jar("artifact-resolver-m2.jar") {
317 module("maven-artifact-resolver-m2")
320 jar("artifact-resolver-m3.jar") {
321 module("maven-artifact-resolver-m3")
322 module("maven-artifact-resolver-m2") {
323 include(name: 'org/jetbrains/idea/maven/artifactResolver/common/*')
327 jar("artifact-resolver-m31.jar") {
328 module("maven-artifact-resolver-m31")
329 module("maven-artifact-resolver-m2") {
330 include(name: 'org/jetbrains/idea/maven/artifactResolver/common/*')
334 dir("maven3-server-lib") {
335 fileset(dir: "$home/plugins/maven/maven3-server-common/lib") {include(name: "*.jar")}
338 fileset(dir: "$home/plugins/maven/maven30-server-impl/lib/maven3")
341 dir("maven2-server-lib") {
342 fileset(dir: "$home/lib/") { include(name: "jaxb*.jar")}
343 fileset(dir: "$home/plugins/maven/maven2-server-impl/lib") {include(name: "*.jar")}
346 fileset(dir: "$home/plugins/maven/maven2-server-impl/lib/maven2")
349 fileset(dir: "$home/plugins/maven/lib") {exclude(name: "plexus-utils-*") }
350 fileset(dir: "$home/plugins/maven/maven-server-api/lib")
353 layoutPlugin("gradle") {
354 jar("gradle-jps-plugin.jar") {
355 module("gradle-jps-plugin")
358 jar("gradle-tooling-extension-api.jar") {
359 module("gradle-tooling-extension-api")
362 jar("gradle-tooling-extension-impl.jar") {
363 module("gradle-tooling-extension-impl")
365 fileset(dir: "$home/plugins/gradle/lib") { include(name: "*.jar") }
367 fileset(dir: "$home/lib/") {
368 include(name: "kryo-*.jar")
369 include(name: "reflectasm-*.jar")
370 include(name: "objenesis-*.jar")
371 include(name: "minlog-*.jar")
375 layoutPlugin("git4idea") {
376 jar("git4idea-rt.jar") {
377 module("git4idea-rt")
379 jar("remote-servers-git.jar") {
380 moduleOptional("remote-servers-git")
382 fileset(dir: "$home/plugins/git4idea/lib") {
383 include(name: "trilead-ssh2.jar")
385 fileset(dir: "$home/plugins/git4idea/lib/ini4j") {
386 include(name: "ini4j*.jar")
387 exclude(name: "ini4j*sources.jar")
391 layoutPlugin("svn4idea") {
392 fileset(dir: "$home/plugins/svn4idea/lib", excludes: "**/svnkitsrc.zip")
395 layoutPlugin("junit", "junit", "idea-junit") {
396 jar("junit-rt.jar") {
401 pluginDir("ByteCodeViewer") {
403 jar("byteCodeViewer.jar") {
404 noResources("ByteCodeViewer")
409 pluginDir("cvsIntegration") {
411 jar("cvs_util.jar") {noResources("cvs-core")}
412 jar("cvsIntegration.jar") {noResources("cvs-plugin")}
413 jar("javacvs-src.jar") {noResources("javacvs-src")}
414 jar("smartcvs-src.jar") {noResources("smartcvs-src")}
416 resources(["cvs-core", "cvs-plugin", "javacvs-src", "smartcvs-src"])
418 fileset(dir: "${home}/plugins/cvs/lib")
422 pluginDir("testng") {
424 jar("testng-plugin.jar") {
425 noResources("testng")
426 noResources("testng_rt")
431 fileset(dir: "$home/plugins/testng/lib") {
432 include(name: "testng.jar")
437 layoutPlugin("xpath") {
439 jar("xslt-rt.jar") {module("xslt-rt")}
443 layoutPlugin("xslt-debugger") {
444 jar("xslt-debugger-engine.jar") {
445 module("xslt-debugger-engine") {
449 fileset(dir: "$home/plugins/xslt-debugger/engine/lib") {
450 include(name: "**/rmi-stubs.jar")
453 jar("xslt-debugger-engine-impl.jar") {
454 module("xslt-debugger-engine-impl") {
456 exclude(name: "**/*.jar")
457 exclude(name: "**/*.html")
460 fileset(dir: "$home/plugins/xslt-debugger/engine/impl/lib") {
461 include(name: "**/*.jar")
462 exclude(name: "**/rmi-stubs.jar")
463 include(name: "**/*.html")
468 pluginDir("Groovy") {
472 module("groovy-psi") {
473 exclude(name: "standardDsls/**")
475 module("structuralsearch-groovy")
477 //layout of groovy jars must be consistent with GroovyBuilder.getGroovyRtRoot method
478 jar("groovy-jps-plugin.jar") {
479 module("groovy-jps-plugin")
481 jar("groovy_rt.jar") {
484 jar("groovy-rt-constants.jar") {
485 module("groovy-rt-constants")
487 dir("standardDsls") {
488 fileset(dir: "$home/plugins/groovy/groovy-psi/resources/standardDsls")
491 fileset(dir: "${home}/plugins/groovy/hotswap") {
492 include(name: "gragent.jar")
497 fileset(dir: "$home/plugins/groovy/groovy-psi/resources/conf")
503 jar("tasks-api.jar") { module("tasks-api") }
504 jar("jira.jar") { module("jira") }
505 jar("tasks-core.jar") { module("tasks-core") }
506 jar("jira.jar") { module("jira") }
507 jar("tasks-java.jar") { moduleOptional("tasks-java") }
508 fileset(dir: "${home}/plugins/tasks/tasks-core/lib") {
509 include(name: "**/*.jar")
514 layoutPlugin("devkit") {
515 jar("devkit-jps-plugin.jar") {
516 module("devkit-jps-plugin")
518 fileset(dir: "${home}/plugins/devkit/lib") {
519 include(name: "**/*.jar")
522 layoutPlugin("eclipse") {
523 jar("eclipse-jps-plugin.jar") {
524 module("eclipse-jps-plugin")
526 jar("common-eclipse-util.jar") {
527 module("common-eclipse-util")
531 layoutPlugin("terminal") {
532 fileset(dir: "$home/plugins/terminal/lib") {
533 include(name: "*.jar")
534 include(name: "*.in")
538 layoutPlugin("editorconfig") {
539 fileset(dir: "$home/plugins/editorconfig/lib") {
540 include(name: "**/*.jar")
544 pluginDir("coverage") {
546 jar("coverage.jar") {
547 noResources("coverage-common")
548 noResources("coverage")
551 jar("coverage_rt.jar") {
552 noResources("coverage_rt")
555 jar("resources_en.jar") {
556 module("coverage-common") {
557 patternset(refid: "resources.included")
560 patternset(refid: "resources.included")
564 fileset(dir: "${home}/plugins/coverage-common/lib") {
565 exclude(name: "finder.jar")
566 exclude(name: "**/coverage-src.zip")
569 fileset(dir: "${home}/plugins/coverage/lib", excludes: "**/jacoco_src.zip")
573 pluginDir("java-decompiler") {
575 jar("java-decompiler.jar") {
576 module("java-decompiler-engine")
577 module("java-decompiler-plugin")
585 def layoutPlugin(String moduleName) {
586 layoutPlugin(moduleName, moduleName, {})
589 def layoutPlugin(String moduleName, Closure custom) {
590 layoutPlugin(moduleName, moduleName, custom)
593 def layoutPlugin(String pluginName, String moduleName) {
594 layoutPlugin(pluginName, moduleName, {})
597 def layoutPlugin(String pluginName, String moduleName, Closure custom) {
598 layoutPlugin(pluginName, moduleName, pluginName, custom)
601 def layoutPlugin(String pluginName, String moduleName, String jarName) {
602 layoutPlugin(pluginName, moduleName, jarName, {})
605 def layoutPlugin(String pluginName, String moduleName, String jarName, Closure custom) {
606 if (isDefined("pluginFilter")) {
607 if (!pluginFilter.contains(moduleName) && !pluginFilter.contains(pluginName)) return
612 jar("${jarName}.jar") {
613 noResources(moduleName)
616 resources(moduleName)
622 def pluginDir(String dirName, Closure initializer) {
623 if (isDefined("pluginFilter")) {
624 if (!pluginFilter.contains(dirName)) return
632 private def resources(List<String> modules) {
633 jar("resources_en.jar") {
636 patternset(refid: "resources.included")
642 private def resources(String moduleName) {
643 jar("resources_en.jar") {
645 patternset(refid: "resources.included")
650 private def noResources(String moduleName) {
652 patternset(refid: "resources.excluded")
656 def moduleOptional(String name) {
657 if (isDefined("pluginFilter")) {
658 if (!pluginFilter.contains(name)) return
664 def moduleOptional(String name, Closure init) {
665 if (isDefined("pluginFilter")) {
666 if (!pluginFilter.contains(name)) return
672 def reorder(String home, String targetDirectory) {
673 if (findModule("util") != null) {
674 ant.java(classname: "com.intellij.util.io.zip.ReorderJarsMain", fork: "true") {
675 arg(value: "$home/build/order.txt")
676 arg(value: targetDirectory)
677 arg(value: targetDirectory)
678 arg(value: "$home/lib")
680 pathelement(location: projectBuilder.moduleOutput(findModule("util")))
681 pathelement(location: projectBuilder.moduleOutput(findModule("util-rt")))
682 pathelement(location: "$home/lib/jna.jar")
683 pathelement(location: "$home/lib/trove4j.jar")
689 def layoutAndroid(String androidHome) {
691 layoutPlugin("android") {
692 fileset(dir: "${androidHome}/android/lib") {
693 include(name: "**/*.jar")
694 exclude(name: "**/fest-*.jar")
695 exclude(name: "src/*.jar")
698 jar("android-common.jar") {
699 module("android-common")
702 jar("android-rt.jar") {
712 jar("sdk-common.jar") {
715 jar("layoutlib-api.jar") {
716 module("layoutlib-api")
718 jar("manifest-merger.jar") {
719 module("manifest-merger")
721 jar("sdk-tools.jar") {
722 module("assetstudio")
727 module("lint-checks")
731 jar("androidAnnotations.jar") {
732 fileset(dir: "$androidHome/android/annotations")
735 jar("android-gradle-jps.jar") { module("android-gradle-jps") }
737 dir("device-art-resources") {
738 fileset(dir: "$androidHome/android/device-art-resources")
742 jar("android-jps-plugin.jar") { module("android-jps-plugin") }
745 fileset(dir: "$androidHome/tools-base/templates")
751 def layoutJps(String home, String targetDir, String buildNumber, Closure additionalJars) {
753 zip("standalone-jps-${buildNumber}.zip") {
755 module("annotations")
760 jar("jps-launcher.jar") {
761 module("jps-launcher")
764 jar("jps-model.jar") {
765 module("jps-model-api")
766 module("jps-model-impl")
767 module("jps-model-serialization")
769 jar("jps-builders.jar") {
771 module("forms-compiler")
772 module("instrumentation-util")
773 module("jps-builders")
774 module("jps-standalone-builder")
775 module("java-runtime")
777 jar("jps-plugin-system.jar") {
778 module("jps-plugin-system")
780 jar("groovy-jps-plugin.jar") {
781 module("groovy-jps-plugin")
782 module("groovy-rt-constants")
784 jar("groovy_rt.jar") {
787 jar("ui-designer-jps-plugin.jar") { module("ui-designer-jps-plugin") }
790 jar("maven-jps-plugin.jar") { module("maven-jps-plugin") }
791 jar("gradle-jps-plugin.jar") { module("gradle-jps-plugin") }
792 fileset(dir: "$home/plugins/maven/maven30-server-impl/lib/maven3/lib") {include(name: "plexus-utils-*.jar")}
794 jar("eclipse-jps-plugin.jar") {
795 module("common-eclipse-util")
796 module("eclipse-jps-plugin")
798 jar("devkit-jps-plugin.jar") { module("devkit-jps-plugin") }
799 jar("intellilang-jps-plugin.jar") { module("intellilang-jps-plugin") }
800 fileset(dir: "$home/lib") {
801 include(name: "jdom.jar")
802 include(name: "jna.jar")
803 include(name: "trove4j.jar")
804 include(name: "asm-all.jar")
805 include(name: "nanoxml-*.jar")
806 include(name: "protobuf-*.jar")
807 include(name: "cli-parser-*.jar")
808 include(name: "log4j.jar")
809 include(name: "jgoodies-forms.jar")
810 include(name: "ecj*.jar")
811 include(name: "jsr166e.jar")
812 include(name: "netty-all-*.jar")
814 fileset(dir: "$home/jps/lib") {
815 include(name: "optimizedFileManager.jar")
817 jar("ant-jps-plugin.jar") { module("ant-jps-plugin") }
820 jar("jps-build-test-${buildNumber}.jar") {
821 moduleTests("jps-builders")
822 moduleTests("jps-model-tests")
823 moduleTests("jps-serialization-tests")
828 def layout_core(String home, String target) {
830 jar("intellij-core.jar") {
837 module("java-psi-api")
838 module("java-psi-impl")
841 jar("annotations.jar") {
842 module("annotations")
845 jar("intellij-core-analysis.jar") {
846 analysisApiModules.each { module it; }
847 analysisImplModules.each { module it; }
850 fileset(dir: "$home/lib") {
851 include(name: "guava-17.0.jar")
852 include(name: "picocontainer.jar")
853 include(name: "trove4j.jar")
854 include(name: "asm.jar")
855 include(name: "asm-commons.jar")
856 include(name: "cli-parser-1.1.jar")
857 include(name: "snappy-in-java-0.3.1.jar")
858 include(name: "jayatana-1.2.4.jar")
859 include(name: "imgscalr-lib-4.2.jar")