1 import org.jetbrains.jps.Jps
2 import static org.jetbrains.jps.idea.IdeaProjectLoader.*
4 includeTargets << new File("${guessHome(this)}/build/scripts/utils.gant")
7 requireProperty("buildNumber", requireProperty("build.number", "SNAPSHOT"))
8 requireProperty("out", "$home/out")
10 setProperty("version", "MaiaCE")
11 setProperty("vmoptions", "-Xms32m -Xmx256m -XX:MaxPermSize=150m -ea")
12 setProperty("system_selector", "IntelliJIdeaCE90")
22 def Paths(String home, String out) {
24 distWin = "$sandbox/dist.win"
25 distAll = "$sandbox/dist.all"
26 distUnix = "$sandbox/dist.unix"
27 distMac = "$sandbox/dist.mac"
29 artifacts = "$sandbox/artifacts"
33 setProperty("paths", new Paths(home, out))
35 def paths = new Paths(home, out)
37 def includeFile(String filename) {
38 Script s = groovyShell.parse(new File("$home/build/scripts/$filename"))
43 target(compile: "Compile project") {
46 project.stage("Cleaning up sandbox folder")
47 ant.delete(dir: paths.sandbox)
49 [paths.sandbox, paths.distWin, paths.distAll, paths.distUnix, paths.distMac, paths.artifacts].each {
54 format(property: "today.year", pattern: "yyyy")
57 project["javac"] = "$jdk/bin/javac"
58 project.targetFolder = "$out/classes"
60 project.makeProduction()
63 String appInfoFile() {
64 return "${this["community-resources"].output}/idea/IdeaApplicationInfo.xml"
67 def wire_build_date() {
68 ant.replace(token: "__BUILD_NUMBER__", value: buildNumber, file: appInfoFile())
69 ant.replace(token: "__BUILD_DATE__", value: DSTAMP, file: appInfoFile())
72 target('default': 'The default target') {
76 def layouts = includeFile("layouts.gant")
77 layouts.layoutFull(paths.distAll)
79 ant.echo(message: buildNumber, file: "$paths.distAll/build.txt")
80 ant.copy(todir: "$paths.distAll/license", preservelastmodified: "true") {
81 fileset(dir: "$home/license")
89 private def patchPropertiesFile(String where) {
90 ant.echo(file: "$where/bin/idea.properties", append: "true", message:
93 #-----------------------------------------------------------------------
94 # Change to 'disabled' if you need not to receive instant visual notifications about
95 # fatal errors that happen to IDEA or plugins installed.
96 #-----------------------------------------------------------------------
97 idea.fatal.error.notification=enabled
102 private def layoutWin() {
103 layout("$paths.distWin") {
105 fileset(dir: "$home/bin") { include(name: "*.*") }
106 fileset(dir: "$home/bin/win") { include(name: "*.*") }
110 patchPropertiesFile(paths.distWin)
111 ant.echo(file: "$paths.distWin/bin/idea.exe.vmoptions", message: vmoptions.replace(' ', '\n'))
113 ant.zip(zipfile: "$paths.artifacts/idea${buildNumber}.win.zip") {
114 fileset(dir: paths.distAll)
115 fileset(dir: paths.distWin)
119 private def layoutMac() {
120 project.stage("Cleaning up sandbox folder")
122 ant.copy(todir: "$paths.distMac/bin") {
123 fileset(dir: "$home/bin") { include(name: "*.*") }
124 fileset(dir: "$home/bin/nix")
125 fileset(dir: "$home/bin/mac")
128 patchPropertiesFile(paths.distMac)
130 ant.copy(todir: paths.distMac) {
131 fileset(dir: "$home/build/conf/mac")
134 ant.replace(file: "${paths.distMac}/Contents/Info.plist") {
135 replacefilter(token: "@@build@@", value: buildNumber)
138 replacefilter(token: "@@version@@", value: version)
139 replacefilter(token: "@@vmoptions@@", value: vmoptions)
140 replacefilter(token: "@@system_selector@@", value: system_selector)
143 def root = "$version-${buildNumber}.app"
144 ant.zip(zipfile: "$paths.artifacts/idea${buildNumber}.mac.zip") {
145 [paths.distAll, paths.distMac].each {
146 tarfileset(dir: it, prefix: root) {
147 exclude(name: "bin/*.sh")
148 exclude(name: "Contents/MacOS/idea")
152 tarfileset(dir: paths.distMac, filemode: "755", prefix: root) {
153 include(name: "bin/*.sh")
154 include(name: "Contents/MacOS/idea")
160 project.stage("tar.gz")
161 layout(paths.distUnix) {
163 fileset(dir: "$home/bin") { include(name: "*.*") }
164 fileset(dir: "$home/bin/linux") { include(name: "*.*") }
165 fileset(dir: "$home/bin/nix") { include(name: "*.*") }
169 patchPropertiesFile(paths.distUnix)
171 ant.echo(file: "$paths.distUnix/bin/idea.vmoptions", message: vmoptions.replace(' ', '\n') )
172 ant.fixcrlf(srcdir: "$paths.distUnix/bin", includes: "idea.vmoptions", eol: "unix")
173 ant.fixcrlf(srcdir: "$paths.distUnix/bin", includes: "*.sh", eol: "unix")
176 def tarRoot = "idea-$buildNumber"
177 def tarPath = "$paths.artifacts/idea${buildNumber}.tar"
178 ant.tar(tarfile: tarPath) {
179 [paths.distAll, paths.distUnix].each {
180 tarfileset(dir: it, prefix: tarRoot) {
181 exclude(name: "bin/*.sh")
185 tarfileset(dir: paths.distUnix, filemode: "755", prefix: tarRoot) {
186 include(name: "bin/*.sh")
190 ant.gzip(src: tarPath, zipfile: "${tarPath}.gz")
191 ant.delete(file: tarPath)