d51b554f9bc7b8abef067182a0e0701360195d29
[idea/community.git] / build / scripts / layouts.gant
1 /*
2  * Copyright 2000-2015 JetBrains s.r.o.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 import static org.jetbrains.jps.idea.IdeaProjectLoader.guessHome
17
18 includeTargets << new File("${guessHome(this)}/build/scripts/utils.gant")
19
20 target('default': "Developers update") {
21   //when IDEA CE is updated from IDEA UE sources project should be loaded from IDEA UE directory
22   String projectHome = isDefined("devIdeaHome") ? devIdeaHome : home
23   loadProjectFromPath(projectHome)
24   def patchedDescriptorDir = patchAppDescriptor(deploy)
25   layoutFull(home, deploy, patchedDescriptorDir)
26   ant.delete(dir: patchedDescriptorDir)
27 }
28
29 String appInfoFileName() {
30   return isDefined("productProperties") ? productProperties.appInfoFile() : "idea/IdeaApplicationInfo.xml"
31 }
32
33 boolean maySkipAndroidPlugin() {
34   return isDefined("productProperties") && productProperties.maySkipAndroidPlugin
35 }
36
37
38 String appInfoModule() {
39   return isDefined("productProperties") ? productProperties.appInfoModule : "community-resources"
40 }
41
42 String productCode() {
43   return isDefined("productProperties") ? productProperties.code : "IC"
44 }
45
46 void customLayout(String targetDirectory) {
47   if (isDefined("productProperties")) {
48     productProperties.customLayout(targetDirectory)
49   }
50 }
51
52 String relativeAndroidHome() {
53   return isDefined("productProperties") ? productProperties.relativeAndroidHome : "android"
54 }
55
56 String relativeAndroidToolsBaseHome() {
57   return isDefined("productProperties") ? productProperties.relativeAndroidToolsBaseHome : relativeAndroidHome() + "/tools-base"
58 }
59
60 List<String> getExcludedPlugins() {
61   return isDefined("productProperties") ? productProperties.excludedPlugins : []
62 }
63
64 String patchAppDescriptor(String targetDirectory) {
65   def patchedDirectory = "${targetDirectory}/../patched"
66
67   ant.delete(dir: patchedDirectory)
68
69   layout(patchedDirectory) {
70     module(appInfoModule()) {
71       include(name: appInfoFileName())
72     }
73   }
74
75   def code = productCode()
76   ant.replace(file: "$patchedDirectory/${appInfoFileName()}", token: "__BUILD_NUMBER__", value: "${code}-$snapshot")
77   ant.replace(file: "$patchedDirectory/${appInfoFileName()}", token: "__BUILD_DATE__", value: new Date().format("yyyyMMddHHmm"))
78
79   return patchedDirectory
80 }
81
82 def layoutFull(String home, String targetDirectory, String patchedDescriptorDir = null) {
83   projectBuilder.stage("layout to $targetDirectory")
84
85   List<String> jpsCommonModules = ["jps-model-impl", "jps-model-serialization"]
86   List<String> openapiModules = [platformApiModules,
87     "compiler-openapi",
88     "debugger-openapi",
89     "dom-openapi",
90     "execution-openapi",
91     "java-analysis-api",
92     "java-indexing-api",
93     "java-psi-api",
94     "jsp-openapi",
95     "jsp-base-openapi",
96     "openapi",
97     "remote-servers-java-api",
98     "testFramework-java",
99   ].flatten()
100
101   List<String> implementationModules = [platformImplementationModules,
102     "compiler-impl",
103     "debugger-impl",
104     "dom-impl",
105     "duplicates-analysis",
106     "execution-impl",
107     "external-system-impl",
108     "idea-ui",
109     "java-analysis-impl",
110     "java-indexing-impl",
111     "java-impl",
112     "java-psi-impl",
113     "java-structure-view",
114     "jsp-spi",
115     "manifest",
116     "platform-main",
117     "remote-servers-java-impl",
118     "structuralsearch",
119     "structuralsearch-java",
120     "testFramework",
121     "tests_bootstrap",
122     "typeMigration",
123     "ui-designer-core",
124   ].flatten()
125   implementationModules.removeAll(jpsCommonModules) //todo[nik] remove jps modules from platformImplementationModules instead and update layouts of minor IDEs accordingly
126
127   ant.patternset(id: "resources.included") {
128     include(name: "**/*.properties")
129     include(name: "fileTemplates/**/*")
130     include(name: "inspectionDescriptions/**/*")
131     include(name: "intentionDescriptions/**/*")
132     include(name: "tips/**/*")
133   }
134
135   ant.patternset(id: "resources.excluded") {
136     exclude(name: "**/*.properties")
137     exclude(name: "fileTemplates/**/*")
138     exclude(name: "fileTemplates")
139     exclude(name: "inspectionDescriptions/**/*")
140     exclude(name: "inspectionDescriptions")
141     exclude(name: "intentionDescriptions/**/*")
142     exclude(name: "intentionDescriptions")
143     exclude(name: "tips/**/*")
144     exclude(name: "tips")
145   }
146
147   def info = layout(targetDirectory) {
148     dir("lib") {
149       dir("rt") {
150         fileset(dir: "${home}/lib/rt", includesfile: "${home}/lib/rt/required_for_dist.txt")
151         jar("jps-plugin-system.jar") {
152           module("jps-plugin-system")
153         }
154       }
155
156       dir("libpty") {
157         fileset(dir: "$home/lib/libpty") {
158           exclude(name: "readme.txt")
159         }
160       }
161
162       jar("util.jar") {
163         module("util")
164         module("util-rt")
165       }
166
167       jar("openapi.jar") {
168         openapiModules.each { module it}
169       }
170
171       jar("annotations.jar") {
172         module("annotations-common")
173         module("annotations")
174       }
175       jar("jdkAnnotations.jar") {
176         fileset(dir: "${home}/java/jdkAnnotations")
177       }
178
179       jar("extensions.jar") { module("extensions")}
180
181       jar("idea.jar") {
182         implementationModules.each { module it}
183       }
184
185       jar("bootstrap.jar") { module("bootstrap") }
186
187       jar("jps-launcher.jar") { module("jps-launcher") }
188
189       jar("resources.jar") {
190         module("colorSchemes")
191         module("resources")
192         module("platform-resources")
193
194         def appInfoModule = appInfoModule()
195         def appInfoInCommunity = "community-resources".equals(appInfoModule)
196
197         if (appInfoInCommunity) {
198           module("community-resources") {
199             if (patchedDescriptorDir != null) {
200               exclude(name: appInfoFileName())
201             }
202           }
203         } else {
204           module("community-resources")
205           module(appInfoModule) {
206             if (patchedDescriptorDir != null) {
207               exclude(name: appInfoFileName())
208             }
209           }
210         }
211         if (patchedDescriptorDir != null) {
212           fileset(dir: patchedDescriptorDir)
213         }
214       }
215
216       jar("idea_rt.jar") { module("java-runtime")}
217
218       jar("forms_rt.jar") {
219         module("forms_rt")
220         module("forms-compiler")
221       }
222
223       jar("resources_en.jar") {
224         module("resources-en")
225         module("platform-resources-en")
226       }
227
228       jar("icons.jar") { module("icons") }
229       jar("boot.jar") { module("boot") }
230
231       jar("javac2.jar") {
232         module("javac2")
233         module("forms-compiler")
234         module("forms_rt")
235         module("instrumentation-util")
236       }
237
238       jar("jps-model.jar") {
239         jpsCommonModules.each { module it }
240       }
241       jar("jps-builders.jar") {
242         module("jps-builders")
243       }
244
245       fileset(dir: "$home/jps/lib") {
246         include(name: "optimizedFileManager.jar")
247       }
248
249       fileset(dir: "$home/lib", includesfile: "${home}/lib/required_for_dist.txt")
250
251       fileset(dir: "$home/build/kotlinc/lib") {
252         include(name: "kotlin-runtime.jar")
253         include(name: "kotlin-reflect.jar")
254       }
255
256       dir("src") {
257         fileset(dir: "$home/lib/src") {
258           include(name: "trove4j_src.jar")
259         }
260       }
261       fileset(dir: "$home/xml/relaxng/lib", includes: "*.jar")
262
263       dir("ant") {
264         fileset(dir: "$home/lib/ant") {
265           exclude(name: "**/src/**")
266         }
267       }
268     }
269
270     dir("redist") {
271       jar("annotations-java8.jar") {
272         module("annotations-common")
273         module("annotations-java8")
274       }
275     }
276
277     layoutCommunityPlugins(home, maySkipAndroidPlugin())
278
279     dir("plugins") {
280       dir("javaFX") {
281         dir("lib") {
282           jar("javaFX.jar") {
283             noResources("javaFX")
284             noResources("javaFX-CE")
285           }
286           resources(["javaFX", "javaFX-CE"])
287           jar("javaFX-jps-plugin.jar") {
288             module("javaFX-jps-plugin")
289           }
290           jar("common-javaFX-plugin.jar") {
291             module("common-javaFX-plugin")
292           }
293         }
294
295         fileset(dir: "${home}/plugins/javaFX/FxBuilderEmbedder/lib", includes: "embedder.jar");
296       }
297     }
298
299     dir("plugins") {
300       dir("IntelliLang") {
301         dir("lib") {
302           jar("IntelliLang.jar") {
303             module("IntelliLang")
304             module("IntelliLang-java")
305             module("IntelliLang-xml")
306           }
307           jar("intellilang-jps-plugin.jar") {
308             module("intellilang-jps-plugin")
309           }
310         }
311       }
312     }
313   }
314
315   // product specific custom layout
316   customLayout(targetDirectory)
317
318   printUnusedModules(info.usedModules)
319
320   reorder(home, targetDirectory)
321   return info
322 }
323
324 public def layoutCommunityPlugins(String home, boolean maySkipAndroidPlugin = false) {
325   if (!isDefined("pluginFilter") || pluginFilter.contains("android")) {
326     def androidHome = relativeAndroidHome()
327     def androidToolsBaseHome = relativeAndroidToolsBaseHome()
328     if (new File("$home/$androidHome").exists()) {
329       layoutAndroid("$home/$androidHome", "$home/$androidToolsBaseHome")
330     }
331     else {
332       def message = "Android plugin sources aren't found at ${androidHome}"
333       if (maySkipAndroidPlugin) {
334         projectBuilder.warning("$message. Android plugin is excluded from layout.")
335       }
336       else {
337         projectBuilder.error(message)
338       }
339     }
340   }
341
342   dir("plugins") {
343     def simplePlugins = ["copyright", "java-i18n", "hg4idea", "github"] //, "tasks-time-tracking"]
344
345     simplePlugins.each {
346       layoutPlugin it
347     }
348
349     layoutPlugin("ant", "ant", "antIntegration") {
350       jar("ant-jps-plugin.jar") {
351         module("ant-jps-plugin")
352       }
353     }
354     layoutPlugin("uiDesigner", "ui-designer", "uiDesigner") {
355       dir("jps") {
356         jar("ui-designer-jps-plugin.jar") {
357           module("ui-designer-jps-plugin")
358         }
359       }
360     }
361
362     pluginDir("properties") {
363       dir("lib") {
364         jar("properties.jar") {
365           module("properties-psi-api")
366           module("properties-psi-impl")
367           module("properties")
368         }
369       }
370     }
371
372     layoutPlugin("maven") {
373       jar("maven-jps-plugin.jar") {
374         module("maven-jps-plugin")
375       }
376       jar("maven-server-api.jar") {
377         module("maven-server-api")
378       }
379       jar("maven2-server-impl.jar") {
380         module("maven2-server-impl")
381       }
382       jar("maven3-server-common.jar") {
383         module("maven3-server-common")
384       }
385       jar("maven30-server-impl.jar") {
386         module("maven30-server-impl")
387       }
388       jar("maven32-server-impl.jar") {
389         module("maven32-server-impl")
390       }
391
392       jar("artifact-resolver-m2.jar") {
393         module("maven-artifact-resolver-m2")
394       }
395
396       jar("artifact-resolver-m3.jar") {
397         module("maven-artifact-resolver-m3")
398         module("maven-artifact-resolver-m2") {
399           include(name: 'org/jetbrains/idea/maven/artifactResolver/common/*')
400         }
401       }
402
403       jar("artifact-resolver-m31.jar") {
404         module("maven-artifact-resolver-m31")
405         module("maven-artifact-resolver-m2") {
406           include(name: 'org/jetbrains/idea/maven/artifactResolver/common/*')
407         }
408       }
409
410       dir("maven3-server-lib") {
411         fileset(dir: "$home/plugins/maven/maven3-server-common/lib") {include(name: "*.jar")}
412       }
413       dir("maven3") {
414         fileset(dir: "$home/plugins/maven/maven30-server-impl/lib/maven3")
415       }
416
417       dir("maven2-server-lib") {
418         fileset(dir: "$home/lib/") { include(name: "jaxb*.jar")}
419         fileset(dir: "$home/plugins/maven/maven2-server-impl/lib") {include(name: "*.jar")}
420       }
421       dir("maven2") {
422         fileset(dir: "$home/plugins/maven/maven2-server-impl/lib/maven2")
423       }
424
425       fileset(dir: "$home/plugins/maven/lib")
426       fileset(dir: "$home/plugins/maven/maven-server-api/lib")
427     }
428
429     layoutPlugin("gradle") {
430       jar("gradle-jps-plugin.jar") {
431         module("gradle-jps-plugin")
432       }
433
434       jar("gradle-tooling-extension-api.jar") {
435         module("gradle-tooling-extension-api")
436       }
437
438       jar("gradle-tooling-extension-impl.jar") {
439         module("gradle-tooling-extension-impl")
440       }
441       fileset(dir: "$home/plugins/gradle/lib") { include(name: "*.jar") }
442       // add kryo lib
443       fileset(dir: "$home/lib/") {
444         include(name: "kryo-*.jar")
445         include(name: "reflectasm-*.jar")
446         include(name: "objenesis-*.jar")
447         include(name: "minlog-*.jar")
448       }
449     }
450
451     layoutPlugin("git4idea") {
452       jar("git4idea-rt.jar") {
453         module("git4idea-rt")
454       }
455       jar("remote-servers-git.jar") {
456         moduleOptional("remote-servers-git")
457       }
458       fileset(dir: "$home/plugins/git4idea/lib") {
459         include(name: "trilead-ssh2.jar")
460       }
461       fileset(dir: "$home/plugins/git4idea/lib/ini4j") {
462         include(name: "ini4j*.jar")
463         exclude(name: "ini4j*sources.jar")
464       }
465     }
466
467     layoutPlugin("svn4idea") {
468       fileset(dir: "$home/plugins/svn4idea/lib", excludes: "**/svnkitsrc.zip")
469     }
470
471     layoutPlugin("junit", "junit", "idea-junit") {
472       jar("junit-rt.jar") {
473         module("junit_rt")
474       }
475     }
476
477     pluginDir("ByteCodeViewer") {
478       dir("lib") {
479         jar("byteCodeViewer.jar") {
480           noResources("ByteCodeViewer")
481         }
482       }
483     }
484
485     pluginDir("cvsIntegration") {
486       dir("lib") {
487         jar("cvs_util.jar") {noResources("cvs-core")}
488         jar("cvsIntegration.jar") {noResources("cvs-plugin")}
489         jar("javacvs-src.jar") {noResources("javacvs-src")}
490         jar("smartcvs-src.jar") {noResources("smartcvs-src")}
491
492         resources(["cvs-core", "cvs-plugin", "javacvs-src", "smartcvs-src"])
493
494         fileset(dir: "${home}/plugins/cvs/lib")
495       }
496     }
497
498     pluginDir("testng") {
499       dir("lib") {
500         jar("testng-plugin.jar") {
501           noResources("testng")
502           noResources("testng_rt")
503         }
504
505         resources("testng")
506
507         fileset(dir: "$home/plugins/testng/lib") {
508           include(name: "testng.jar")
509           include(name: "jcommander.jar")
510         }
511       }
512     }
513
514     layoutPlugin("xpath") {
515       dir("rt") {
516         jar("xslt-rt.jar") {module("xslt-rt")}
517       }
518     }
519
520     layoutPlugin("xslt-debugger") {
521       jar("xslt-debugger-engine.jar") {
522         module("xslt-debugger-engine") {
523           excludes: "lib"
524         }
525       }
526       fileset(dir: "$home/plugins/xslt-debugger/engine/lib") {
527         include(name: "**/rmi-stubs.jar")
528       }
529       dir("rt") {
530         jar("xslt-debugger-engine-impl.jar") {
531           module("xslt-debugger-engine-impl") {
532             exclude(name: "lib")
533             exclude(name: "**/*.jar")
534             exclude(name: "**/*.html")
535           }
536         }
537         fileset(dir: "$home/plugins/xslt-debugger/engine/impl/lib") {
538           include(name: "**/*.jar")
539           exclude(name: "**/rmi-stubs.jar")
540           include(name: "**/*.html")
541         }
542       }
543     }
544
545     pluginDir("Groovy") {
546       dir("lib") {
547         jar("Groovy.jar") {
548           module("jetgroovy")
549           module("groovy-psi") {
550             exclude(name: "standardDsls/**")
551           }
552           module("structuralsearch-groovy")
553         }
554         //layout of groovy jars must be consistent with GroovyBuilder.getGroovyRtRoot method
555         jar("groovy-jps-plugin.jar") {
556           module("groovy-jps-plugin")
557         }
558         jar("groovy_rt.jar") {
559           module("groovy_rt")
560         }
561         jar("groovy-rt-constants.jar") {
562           module("groovy-rt-constants")
563         }
564         dir("standardDsls") {
565           fileset(dir: "$home/plugins/groovy/groovy-psi/resources/standardDsls")
566         }
567         dir("agent") {
568           fileset(dir: "${home}/plugins/groovy/hotswap") {
569             include(name: "gragent.jar")
570           }
571         }
572
573
574         fileset(dir: "$home/plugins/groovy/groovy-psi/resources/conf")
575       }
576     }
577
578     pluginDir("tasks") {
579       dir("lib") {
580         jar("tasks-api.jar") { module("tasks-api") }
581         jar("jira.jar") { module("jira") }
582         jar("tasks-core.jar") { module("tasks-core") }
583         jar("jira.jar") { module("jira") }
584         jar("tasks-java.jar") { moduleOptional("tasks-java") }
585         fileset(dir: "${home}/plugins/tasks/tasks-core/lib") {
586           include(name: "**/*.jar")
587         }
588       }
589     }
590
591     layoutPlugin("devkit") {
592       jar("devkit-jps-plugin.jar") {
593         module("devkit-jps-plugin")
594       }
595       fileset(dir: "${home}/plugins/devkit/lib") {
596         include(name: "**/*.jar")
597       }
598     }
599     layoutPlugin("eclipse") {
600       jar("eclipse-jps-plugin.jar") {
601         module("eclipse-jps-plugin")
602       }
603       jar("common-eclipse-util.jar") {
604         module("common-eclipse-util")
605       }
606     }
607
608     layoutPlugin("terminal") {
609       fileset(dir: "$home/plugins/terminal/lib") {
610         include(name: "*.jar")
611         include(name: "*.in")
612       }
613     }
614
615     layoutPlugin("editorconfig") {
616       fileset(dir: "$home/plugins/editorconfig/lib") {
617         include(name: "**/*.jar")
618       }
619     }
620
621     pluginDir("coverage") {
622       dir("lib") {
623         jar("coverage.jar") {
624           noResources("coverage-common")
625           noResources("coverage")
626         }
627
628         jar("coverage_rt.jar") {
629           noResources("coverage_rt")
630         }
631
632         jar("resources_en.jar") {
633           module("coverage-common") {
634             patternset(refid: "resources.included")
635           }
636           module("coverage") {
637             patternset(refid: "resources.included")
638           }
639         }
640
641         fileset(dir: "${home}/plugins/coverage-common/lib") {
642           exclude(name: "finder.jar")
643           exclude(name: "**/coverage-src.zip")
644         }
645
646         fileset(dir: "${home}/plugins/coverage/lib", excludes: "**/jacoco_src.zip")
647       }
648     }
649
650     pluginDir("java-decompiler") {
651       dir("lib") {
652         jar("java-decompiler.jar") {
653           module("java-decompiler-engine")
654           module("java-decompiler-plugin")
655         }
656       }
657     }
658
659     pluginDir("Kotlin") {
660       fileset(dir: "${home}/build/kotlinc/plugin/Kotlin")
661     }
662
663     layoutPlugin("settings-repository") {
664       fileset(dir: "$home/plugins/settings-repository/lib", excludes: "**/*-sources.jar,**/*.xml,**/com/**,**/org/**,**/java/**")
665     }
666   }
667 }
668
669
670 def layoutPlugin(String moduleName) {
671   layoutPlugin(moduleName, moduleName, {})
672 }
673
674 def layoutPlugin(String moduleName, Closure custom) {
675   layoutPlugin(moduleName, moduleName, custom)
676 }
677
678 def layoutPlugin(String pluginName, String moduleName) {
679   layoutPlugin(pluginName, moduleName, {})
680 }
681
682 def layoutPlugin(String pluginName, String moduleName, Closure custom) {
683   layoutPlugin(pluginName, moduleName, pluginName, custom)
684 }
685
686 def layoutPlugin(String pluginName, String moduleName, String jarName) {
687   layoutPlugin(pluginName, moduleName, jarName, {})
688 }
689
690 def layoutPlugin(String pluginName, String moduleName, String jarName, Closure custom) {
691   if (isDefined("pluginFilter")) {
692     if (!pluginFilter.contains(moduleName) && !pluginFilter.contains(pluginName)) return
693   }
694
695   def excludedPlugins = getExcludedPlugins()
696   if (excludedPlugins.contains(moduleName) || excludedPlugins.contains(pluginName)) {
697     return
698   }
699
700   dir(pluginName) {
701     dir("lib") {
702       jar("${jarName}.jar") {
703         noResources(moduleName)
704       }
705
706       resources(moduleName)
707       custom()
708     }
709   }
710 }
711
712 def pluginDir(String dirName, Closure initializer) {
713   if (isDefined("pluginFilter")) {
714     if (!pluginFilter.contains(dirName)) return
715   }
716
717   def excludedPlugins = getExcludedPlugins()
718   if (excludedPlugins.contains(dirName)) {
719     return
720   }
721
722   dir(dirName) {
723     initializer()
724   }
725 }
726
727 private def resources(List<String> modules) {
728   jar("resources_en.jar") {
729     modules.each {
730       module(it) {
731         patternset(refid: "resources.included")
732       }
733     }
734   }
735 }
736
737 private def resources(String moduleName) {
738   jar("resources_en.jar") {
739     module(moduleName) {
740       patternset(refid: "resources.included")
741     }
742   }
743 }
744
745 private def noResources(String moduleName) {
746   module(moduleName) {
747     patternset(refid: "resources.excluded")
748   }
749 }
750
751 def moduleOptional(String name) {
752   if (isDefined("pluginFilter")) {
753     if (!pluginFilter.contains(name)) return
754   }
755
756   module(name)
757 }
758
759 def moduleOptional(String name, Closure init) {
760   if (isDefined("pluginFilter")) {
761     if (!pluginFilter.contains(name)) return
762   }
763
764   module(name, init)
765 }
766
767 def reorder(String home, String targetDirectory) {
768   projectBuilder.info("Reordering JARs in $targetDirectory")
769   ant.java(classname: "com.intellij.util.io.zip.ReorderJarsMain", fork: true, failonerror: true) {
770     arg(value: "${home}/build/order.txt")
771     arg(value: targetDirectory)
772     arg(value: targetDirectory)
773     arg(value: "${home}/lib")
774     classpath {
775       projectBuilder.moduleRuntimeClasspath(findModule("util"), false).each {
776         pathelement(location: it)
777       }
778     }
779   }
780 }
781
782 def layoutAndroid(String androidHome, String androidToolsBaseHome) {
783   dir("plugins") {
784     layoutPlugin("android") {
785       fileset(dir: "${androidHome}/android/lib") {
786         include(name: "**/*.jar")
787         exclude(name: "**/fest-*.jar")
788         exclude(name: "src/*.jar")
789       }
790
791       jar("android-common.jar") {
792         module("android-common")
793       }
794
795       jar("android-rt.jar") {
796         module("android-rt")
797       }
798
799       jar("common.jar") {
800         module("common")
801       }
802       jar("sdklib.jar") {
803         module("sdklib")
804       }
805       jar("sdk-common.jar") {
806         module("sdk-common")
807       }
808       jar("layoutlib-api.jar") {
809         module("layoutlib-api")
810       }
811       jar("manifest-merger.jar") {
812         module("manifest-merger")
813       }
814       jar("sdk-tools.jar") {
815         module("assetstudio")
816         module("ddmlib")
817         module("dvlib")
818         module("draw9patch")
819         module("lint-api")
820         module("lint-checks")
821         module("ninepatch")
822         module("perflib")
823       }
824       jar("androidAnnotations.jar") {
825         fileset(dir: "$androidHome/android/annotations")
826       }
827       dir("jps") {
828         jar("android-gradle-jps.jar") { module("android-gradle-jps") }
829       }
830       dir("device-art-resources") {
831         fileset(dir: "$androidHome/android/device-art-resources")
832       }
833
834       dir("jps") {
835         jar("android-jps-plugin.jar") { module("android-jps-plugin") }
836       }
837       dir("templates") {
838         fileset(dir: "$androidToolsBaseHome/templates")
839       }
840     }
841   }
842 }
843
844 def layoutJps(String home, String targetDir, String buildNumber, Closure additionalJars) {
845   layout(targetDir) {
846     zip("standalone-jps-${buildNumber}.zip") {
847       jar("util.jar") {
848         module("annotations-common")
849         module("annotations")
850         module("util-rt")
851         module("util")
852       }
853
854       jar("jps-launcher.jar") {
855         module("jps-launcher")
856       }
857
858       jar("jps-model.jar") {
859         module("jps-model-api")
860         module("jps-model-impl")
861         module("jps-model-serialization")
862       }
863       jar("jps-builders.jar") {
864         module("forms_rt")
865         module("forms-compiler")
866         module("instrumentation-util")
867         module("jps-builders")
868         module("jps-standalone-builder")
869         module("java-runtime")
870       }
871       jar("jps-plugin-system.jar") {
872         module("jps-plugin-system")
873       }
874       //layout of groovy jars must be consistent with GroovyBuilder.getGroovyRtRoots method
875       jar("groovy-jps-plugin.jar") {
876         module("groovy-jps-plugin")
877       }
878       jar("groovy_rt.jar") {
879         module("groovy_rt")
880       }
881       jar("groovy-rt-constants.jar") {
882         module("groovy-rt-constants")
883       }
884       jar("ui-designer-jps-plugin.jar") { module("ui-designer-jps-plugin") }
885
886
887       jar("maven-jps-plugin.jar") { module("maven-jps-plugin") }
888       jar("gradle-jps-plugin.jar") { module("gradle-jps-plugin") }
889       fileset(dir: "$home/plugins/maven/maven30-server-impl/lib/maven3/lib") {include(name: "plexus-utils-*.jar")}
890
891       jar("eclipse-jps-plugin.jar") {
892         module("common-eclipse-util")
893         module("eclipse-jps-plugin")
894       }
895       jar("devkit-jps-plugin.jar") { module("devkit-jps-plugin") }
896       jar("intellilang-jps-plugin.jar") { module("intellilang-jps-plugin") }
897       fileset(dir: "$home/lib") {
898         include(name: "jdom.jar")
899         include(name: "jna.jar")
900         include(name: "trove4j.jar")
901         include(name: "asm-all.jar")
902         include(name: "nanoxml-*.jar")
903         include(name: "protobuf-*.jar")
904         include(name: "cli-parser-*.jar")
905         include(name: "log4j.jar")
906         include(name: "jgoodies-forms.jar")
907         include(name: "ecj*.jar")
908         include(name: "jsr166e.jar")
909         include(name: "netty-all-*.jar")
910         include(name: "snappy-in-java-*.jar")
911       }
912       fileset(dir: "$home/jps/lib") {
913         include(name: "optimizedFileManager.jar")
914       }
915       jar("ant-jps-plugin.jar") { module("ant-jps-plugin") }
916       additionalJars()
917     }
918     jar("jps-build-test-${buildNumber}.jar") {
919       moduleTests("jps-builders")
920       moduleTests("jps-model-tests")
921       moduleTests("jps-serialization-tests")
922     }
923   }
924 }
925
926 def layout_core(String home, String target) {
927   layout(target) {
928     jar("intellij-core.jar") {
929       module("util-rt")
930       module("util")
931       module("core-api")
932       module("core-impl")
933       module("boot")
934       module("extensions")
935       module("java-psi-api")
936       module("java-psi-impl")
937     }
938
939     jar("annotations.jar") {
940       module("annotations-common")
941       module("annotations")
942     }
943
944     jar("intellij-core-analysis.jar") {
945       analysisApiModules.each { module it; }
946       analysisImplModules.each { module it; }
947     }
948
949     fileset(dir: "$home/lib") {
950       include(name: "guava-17.0.jar")
951       include(name: "picocontainer.jar")
952       include(name: "trove4j.jar")
953       include(name: "asm.jar")
954       include(name: "asm-commons.jar")
955       include(name: "cli-parser-1.1.jar")
956       include(name: "snappy-in-java-0.3.1.jar")
957       include(name: "jayatana-1.2.4.jar")
958       include(name: "imgscalr-lib-4.2.jar")
959     }
960   }
961 }