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)
15 def module(String name, Closure init) {
16 ant.module(name: name, init)
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
28 private List platformImplementationModules() {
43 private List<String> platformApiModules() {
44 return ["platform-api", "lvcs-api", "lang-api", "vcs-api", "usageView", "xdebugger-api", "xml-openapi"]
47 def layoutFull(String home, String targetDirectory) {
48 project.stage("layout to $targetDirectory")
50 //noinspection GroovyAssignabilityCheck
51 List<String> openapiModules = [platformApiModules(),
52 "openapi", "testFramework-java", "debugger-openapi", "compiler-openapi", "dom-openapi", "execution-openapi",
53 "jsp-openapi", "jsp-base-openapi"].flatten()
55 //noinspection GroovyAssignabilityCheck
56 List<String> implementationModules = [platformImplementationModules(),
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/**/*")
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/**/*")
88 layout(targetDirectory) {
90 jar("util.jar") { module("util") }
93 openapiModules.each { module it}
96 jar("annotations.jar") { module("annotations")}
97 jar("extensions.jar") { module("extensions")}
100 implementationModules.each { module it}
103 jar("bootstrap.jar") { module("bootstrap")}
104 jar("resources.jar") {
106 module("platform-resources")
107 module("community-resources")
110 jar("idea_rt.jar") { module("java-runtime")}
112 jar("forms_rt.jar") {
114 module("forms-compiler")
117 jar("resources_en.jar") {
118 module("resources-en")
119 module("platform-resources-en")
122 jar("icons.jar") { module("icons") }
123 jar("boot.jar") { module("boot") }
127 module("forms-compiler")
132 fileset(dir: "$home/lib") {
133 include(name: "*.jar")
134 exclude(name: "eawtstub.jar")
137 fileset(dir: "$home/lib/src") {
138 include(name: "trove4j_changes.txt")
139 include(name: "trove4j_src.jar")
143 fileset(dir: "$home/lib/ant") {
144 exclude(name: "**/src/**")
150 def simplePlugins = ["commander", "copyright", "properties", "java-i18n", "devkit", "eclipse"]
156 layoutPlugin("ant", "ant", "antIntegration")
157 layoutPlugin("InspectionGadgets", "InspectionGadgetsPlugin")
158 layoutPlugin("IntelliLang", "IntelliLangJava")
159 layoutPlugin("IntentionPowerPack", "IntentionPowerPackPlugin")
160 layoutPlugin("ToString", "generate-tostring", "toString")
162 layoutPlugin("SpellChecker", "spellchecker", "spellchecker-core") {
163 fileset(dir: "$home/plugins/spellchecker/lib")
167 layoutPlugin("maven") {
168 fileset(dir: "$home/plugins/maven/lib")
172 layoutPlugin("git4idea") {
173 fileset(dir: "$home/plugins/git4idea/lib", excludes: "**/trilead-ssh2-src.zip")
176 layoutPlugin("svn4idea") {
177 fileset(dir: "$home/plugins/svn4idea/lib", excludes: "**/svnkitsrc.zip")
183 jar("junit-rt.jar") {
186 jar("idea-junit.jar") {
194 dir("cvsIntegration") {
196 jar("cvs_util.jar") {noResources("cvs-core")}
197 jar("cvsIntegration.jar") {noResources("cvs-plugin")}
198 jar("javacvs-src.jar") {noResources("javacvs-src")}
199 jar("smartcvs-src.jar") {noResources("smartcvs-src")}
201 resources(["cvs-core", "cvs-plugin", "javacvs-src", "smartcvs-src"])
203 fileset(dir: "${home}/plugins/cvs/lib")
210 jar("uiDesigner.jar") {
211 noResources("ui-designer")
213 resources("ui-designer")
220 noResources("testng")
221 noResources("testng_rt")
226 fileset(dir: "$home/plugins/testng/lib") {
227 include(name: "testng-jdk15.jar")
232 fileset(dir: "$home/plugins/testng/lib") {
233 include(name: "testng-jdk14.jar")
242 module("jetgroovy") {
243 exclude(name: "standardDsls/**")
247 jar("groovy_rt.jar") {module("groovy-rt")}
248 dir("standardDsls") {
249 fileset(dir: "$home/plugins/groovy/resources/standardDsls")
252 fileset(dir: "$home/plugins/groovy/resources/conf")
253 fileset(dir: "${home}/plugins/groovy/lib")
261 //reorder(targetDirectory)
264 def printUnusedModules() {
265 project.modules.values().each {Module m ->
266 if (m["used"] == null && hasSourceRoots(m)) {
267 project.warning("Module ${m.getName()} is not used in project layout")
272 boolean hasSourceRoots(Module module) {
273 !module.sourceRoots.isEmpty()
276 def layoutPlugin(String moduleName) {
277 layoutPlugin(moduleName, moduleName, {})
280 def layoutPlugin(String moduleName, Closure custom) {
281 layoutPlugin(moduleName, moduleName, custom)
284 def layoutPlugin(String pluginName, String moduleName) {
285 layoutPlugin(pluginName, moduleName, {})
288 def layoutPlugin(String pluginName, String moduleName, Closure custom) {
289 layoutPlugin(pluginName, moduleName, pluginName, custom)
292 def layoutPlugin(String pluginName, String moduleName, String jarName) {
293 layoutPlugin(pluginName, moduleName, jarName, {})
296 def layoutPlugin(String pluginName, String moduleName, String jarName, Closure custom) {
299 jar("${jarName}.jar") {
300 noResources(moduleName)
303 resources(moduleName)
309 private def resources(List<String> modules) {
310 jar("resources_en.jar") {
313 patternset(refid: "resources.included")
319 private def resources(String moduleName) {
320 jar("resources_en.jar") {
322 patternset(refid: "resources.included")
327 private def noResources(String moduleName) {
329 patternset(refid: "resources.excluded")
333 def reorder(String home, String targetDirectory) {
334 if (isDefined("util")) {
335 ant.java(classname: "com.intellij.util.io.zip.ReorderJarsMain", fork: "true") {
336 arg(value: "$home/build/order.txt")
337 arg(value: targetDirectory)
338 arg(value: targetDirectory)
339 arg(value: "$home/lib")
341 pathelement(location: util.output)