PsiChangeTracker tests
[fedora-idea.git] / build / scripts / layouts.gant
bloba5957d07ba413ba603c406cef76ab4445f6d5125
1 import org.jetbrains.jps.Module
2 import static org.jetbrains.jps.idea.IdeaProjectLoader.*
4 includeTargets << new File("${guessHome(this)}/build/scripts/utils.gant")
6 target('default' : "Developers update") {
7   layoutFull(home, deploy)
10 def module(String name) {
11   ant.module(name: name)
12   markUsed(name)
15 def module(String name, Closure init) {
16   ant.module(name: name, init)
17   markUsed(name)
20 private def markUsed(String name) {
21   def module = project.modules[name]
22   // Can be null in "Developers update" since we are not actually loading modules.xml
23   if (module != null) {
24     module["used"] = true
25   }
28 private List platformImplementationModules() {
29   return [
30           "platform-impl",
31           "vcs-impl",
32           "lang-impl",
33           "testRunner",
34           "smRunner",
35           "xdebugger-impl",
36           "testFramework",
37           "xml",
38           "lvcs-impl",
39   ]
42 private List<String> platformApiModules() {
43   return ["platform-api", "lvcs-api", "lang-api", "vcs-api", "usageView", "xdebugger-api", "xml-openapi"]
46 def layoutFull(String home, String targetDirectory) {
47   project.stage("layout to $targetDirectory")
49   //noinspection GroovyAssignabilityCheck
50   List<String> openapiModules = [platformApiModules(),
51           "openapi", "testFramework-java", "debugger-openapi", "compiler-openapi", "dom-openapi", "execution-openapi",
52           "jsp-openapi"/*, "jam-support-openapi",
53           "jam-support-openspi"*/].flatten()
55   //noinspection GroovyAssignabilityCheck
56   List<String> implementationModules = [platformImplementationModules(),
57           "notNull",
58           "platform-main",
59           "java-impl",
60           "compiler-impl",
61           "debugger-impl",
62           "dom-impl",
63           "execution-impl",
64           "jsp-spi",
65           "idea-ui",
66           "RegExpSupport"].flatten()
68   ant.patternset(id: "resources.included") {
69     include(name: "**/*.properties")
70     include(name: "fileTemplates/**/*")
71     include(name: "inspectionDescriptions/**/*")
72     include(name: "intentionDescriptions/**/*")
73     include(name: "tips/**/*")
74   }
76   ant.patternset(id: "resources.excluded") {
77     exclude(name: "**/*.properties")
78     exclude(name: "fileTemplates/**/*")
79     exclude(name: "fileTemplates")
80     exclude(name: "inspectionDescriptions/**/*")
81     exclude(name: "inspectionDescriptions")
82     exclude(name: "intentionDescriptions/**/*")
83     exclude(name: "intentionDescriptions")
84     exclude(name: "tips/**/*")
85     exclude(name: "tips")
86   }
88   layout(targetDirectory) {
89     dir("lib") {
90       jar("util.jar") { module("util") }
91       jar("idea-jsp-openapi.jar") { module("jsp-base-openapi") }
93       jar("openapi.jar") {
94         openapiModules.each { module it}
95       }
97       jar("annotations.jar") { module("annotations")}
98       jar("extensions.jar") { module("extensions")}
100       jar("idea.jar") {
101         implementationModules.each { module it}
102       }
104       jar("bootstrap.jar") { module("bootstrap")}
105       jar("resources.jar") {
106         module("resources")
107         module("platform-resources")
108         module("community-resources")
109       }
111       jar("idea_rt.jar") { module("java-runtime")}
113       jar("forms_rt.jar") {
114         module("forms_rt")
115         module("forms-compiler")
116       }
118       jar("resources_en.jar") {
119         module("resources-en")
120         module("platform-resources-en")
121       }
123       jar("icons.jar") { module("icons") }
124       jar("boot.jar") { module("boot") }
126       jar("javac2.jar") {
127         module("javac2")
128         module("forms-compiler")
129         module("forms_rt")
130         module("notNull")
131       }
133       fileset(dir: "$home/lib") {
134         include(name: "*.jar")
135         exclude(name: "eawtstub.jar")
136       }
138       fileset(dir: "$home/lib/src") {
139         include(name: "trove4j_changes.txt")
140         include(name: "trove4j_src.jar")
141       }
143       dir("ant") {
144         fileset(dir: "$home/lib/ant") {
145           exclude(name: "**/src/**")
146         }
147       }
148     }
150     dir("plugins") {
151       def simplePlugins = ["commander", "copyright", "properties", "java-i18n"]
153       simplePlugins.each {
154         layoutPlugin it
155       }
157       layoutPlugin("ant", "ant", "antIntegration")
158       layoutPlugin("InspectionGadgets", "InspectionGadgetsPlugin")
159       layoutPlugin("IntelliLang", "IntelliLangJava")
160       layoutPlugin("IntentionPowerPack", "IntentionPowerPackPlugin")
161       layoutPlugin("ToString", "generate-tostring", "toString")
163       layoutPlugin("SpellChecker", "spellchecker", "spellchecker-core") {
164         fileset(dir: "$home/plugins/spellchecker/lib")
165       }
168       layoutPlugin("maven") {
169         fileset(dir: "$home/plugins/maven/lib")
170       }
173       layoutPlugin("git4idea") {
174         fileset(dir: "$home/plugins/git4idea/lib", excludes: "**/trilead-ssh2-src.zip")
175       }
177       layoutPlugin("svn4idea") {
178         fileset(dir: "$home/plugins/svn4idea/lib", excludes: "**/svnkitsrc.zip")
179       }
182       dir("junit") {
183         dir("lib") {
184           jar("junit-rt.jar") {
185             module("junit_rt")
186           }
187           jar("idea-junit.jar") {
188             noResources("junit")
189           }
190           resources("junit")
191         }
192       }
195       dir("cvsIntegration") {
196         dir("lib") {
197           jar("cvs_util.jar") {noResources("cvs-core")}
198           jar("cvsIntegration.jar") {noResources("cvs-plugin")}
199           jar("javacvs-src.jar") {noResources("javacvs-src")}
200           jar("smartcvs-src.jar") {noResources("smartcvs-src")}
202           resources(["cvs-core", "cvs-plugin", "javacvs-src", "smartcvs-src"])
204           fileset(dir: "${home}/plugins/cvs/lib")
205         }
206       }
209       dir("uiDesigner") {
210         dir("lib") {
211           jar("uiDesigner.jar") {
212             noResources("ui-designer")
213           }
214           resources("ui-designer")
215         }
216       }
218       dir("testng") {
219         dir("lib") {
220           jar("testng.jar") {
221             noResources("testng")
222             noResources("testng_rt")
223           }
225           resources("testng")
227           fileset(dir: "$home/plugins/testng/lib") {
228             include(name: "testng-jdk15.jar")
229           }
230         }
232         dir("lib-jdk14") {
233           fileset(dir: "$home/plugins/testng/lib") {
234             include(name: "testng-jdk14.jar")
235           }
236         }
237       }
240       dir("Groovy") {
241         dir("lib") {
242           jar("Groovy.jar") {
243             module("jetgroovy") {
244               exclude(name: "standardDsls/**")
245             }
246           }
248           jar("groovy_rt.jar") {module("groovy-rt")}
249           dir("standardDsls") {
250             fileset(dir: "$home/plugins/groovy/resources/standardDsls")
251           }
253           fileset(dir: "$home/plugins/groovy/resources/conf")
254           fileset(dir: "${home}/plugins/groovy/lib")
255         }
256       }
257     }
258   }
260   printUnusedModules()
262   //reorder(targetDirectory)
265 def printUnusedModules() {
266   project.modules.values().each {Module m ->
267     if (m["used"] == null && hasSourceRoots(m)) {
268       project.warning("Module ${m.getName()} is not used in project layout")
269     }
270   }
273 boolean hasSourceRoots(Module module) {
274   !module.sourceRoots.isEmpty()
277 def layoutPlugin(String moduleName) {
278   layoutPlugin(moduleName, moduleName, {})
281 def layoutPlugin(String moduleName, Closure custom) {
282   layoutPlugin(moduleName, moduleName, custom)
285 def layoutPlugin(String pluginName, String moduleName) {
286   layoutPlugin(pluginName, moduleName, {})
289 def layoutPlugin(String pluginName, String moduleName, Closure custom) {
290   layoutPlugin(pluginName, moduleName, pluginName, custom)
293 def layoutPlugin(String pluginName, String moduleName, String jarName) {
294   layoutPlugin(pluginName, moduleName, jarName, {})
297 def layoutPlugin(String pluginName, String moduleName, String jarName, Closure custom) {
298   dir(pluginName) {
299     dir("lib") {
300       jar("${jarName}.jar") {
301         noResources(moduleName)
302       }
304       resources(moduleName)
305       custom()
306     }
307   }
310 private def resources(List<String> modules) {
311   jar("resources_en.jar") {
312     modules.each {
313       module(it) {
314         patternset(refid: "resources.included")
315       }
316     }
317   }
320 private def resources(String moduleName) {
321   jar("resources_en.jar") {
322     module(moduleName) {
323       patternset(refid: "resources.included")
324     }
325   }
328 private def noResources(String moduleName) {
329   module(moduleName) {
330     patternset(refid: "resources.excluded")
331   }
334 def reorder(String home, String targetDirectory) {
335   if (isDefined("util")) {
336     ant.java(classname: "com.intellij.util.io.zip.ReorderJarsMain", fork: "true") {
337       arg(value: "$home/build/order.txt")
338       arg(value: targetDirectory)
339       arg(value: targetDirectory)
340       arg(value: "$home/lib")
341       classpath {
342         pathelement(location: util.output)
343       }
344     }
345   }