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("out", "$home/out")
17 def Paths(String out) {
19 distWin = "$sandbox/dist.win.ce"
20 distAll = "$sandbox/dist.all.ce"
21 distUnix = "$sandbox/dist.unix.ce"
22 distMac = "$sandbox/dist.mac.ce"
24 artifacts = "$sandbox/artifacts"
28 setProperty("paths", new Paths(out))
30 def paths = new Paths(out)
32 def includeFile(String filepath) {
33 Script s = groovyShell.parse(new File(filepath))
38 target(compile: "Compile project") {
41 project.stage("Cleaning up sandbox folder")
42 ant.delete(dir: paths.sandbox)
44 [paths.sandbox, paths.distWin, paths.distAll, paths.distUnix, paths.distMac, paths.artifacts].each {
49 format(property: "today.year", pattern: "yyyy")
52 project["javac"] = "$jdk/bin/javac"
53 project.targetFolder = "$out/classes"
55 project.makeProduction()
58 String appInfoFile() {
59 return "${this["community-resources"].output}/idea/IdeaApplicationInfo.xml"
62 def wire_build_date(String buildNumber) {
63 ant.replace(token: "__BUILD_NUMBER__", value: buildNumber, file: appInfoFile())
64 ant.replace(token: "__BUILD_DATE__", value: DSTAMP, file: appInfoFile())
67 target('default': 'The default target') {
70 buildNumber: "IC-90.SNAPSHOT",
72 system_selector: "IntelliJIdeaCE90",
74 vmoptions: "-Xms128m -Xmx512m -XX:MaxPermSize=250m -ea",
78 public def layoutAll(Map args, String home, String out) {
79 Paths paths = new Paths(out)
81 wire_build_date(args.buildNumber)
83 def layouts = includeFile("$home/build/scripts/layouts.gant")
84 layouts.layoutFull(home, paths.distAll)
86 ant.echo(message: args.buildNumber, file: "$paths.distAll/build.txt")
87 ant.copy(todir: "$paths.distAll/license", preservelastmodified: "true") {
88 fileset(dir: "$home/license")
91 ant.copy(file: "$home/LICENSE.txt", todir: "$paths.distAll", preservelastmodified: "true")
93 layoutMac(args, home, paths)
94 layoutLinux(args, home, paths)
95 layoutWin(args, home, paths)
98 private def patchPropertiesFile(String where) {
99 ant.echo(file: "$where/bin/idea.properties", append: "true", message:
102 #-----------------------------------------------------------------------
103 # Change to 'disabled' if you need not to receive instant visual notifications about
104 # fatal errors that happen to IDEA or plugins installed.
105 #-----------------------------------------------------------------------
106 idea.fatal.error.notification=enabled
111 private def layoutWin(Map args, String home, Paths paths) {
112 layout("$paths.distWin") {
114 fileset(dir: "$home/bin") { include(name: "*.*") }
115 fileset(dir: "$home/bin/win") { include(name: "*.*") }
119 patchPropertiesFile(paths.distWin)
120 ant.echo(file: "$paths.distWin/bin/idea.exe.vmoptions", message: args.vmoptions.replace(' ', '\n'))
122 ant.zip(zipfile: "$paths.artifacts/idea${args.buildNumber}.win.zip") {
123 fileset(dir: paths.distAll)
124 fileset(dir: paths.distWin)
128 private def layoutMac(Map args, String home, Paths paths) {
129 project.stage("Cleaning up sandbox folder")
131 ant.copy(todir: "$paths.distMac/bin") {
132 fileset(dir: "$home/bin") { include(name: "*.*") }
133 fileset(dir: "$home/bin/nix")
134 fileset(dir: "$home/bin/mac")
137 patchPropertiesFile(paths.distMac)
139 ant.copy(todir: paths.distMac) {
140 fileset(dir: "$home/build/conf/mac")
143 ant.replace(file: "${paths.distMac}/Contents/Info.plist") {
144 replacefilter(token: "@@build@@", value: args.buildNumber)
147 replacefilter(token: "@@version@@", value: args.version)
148 replacefilter(token: "@@vmoptions@@", value: args.vmoptions + " -Xverify:none -XX:+UseCompressedOOPS -XX:+DoEscapeAnalysis")
149 replacefilter(token: "@@system_selector@@", value: args.system_selector)
150 replacefilter(token: "@@jdk_req@@", value: args.jdk_req)
153 def root = "$args.version-${args.buildNumber}.app"
154 ant.zip(zipfile: "$paths.artifacts/idea${args.buildNumber}.mac.zip") {
155 [paths.distAll, paths.distMac].each {
156 tarfileset(dir: it, prefix: root) {
157 exclude(name: "bin/*.sh")
158 exclude(name: "Contents/MacOS/idea")
162 tarfileset(dir: paths.distMac, filemode: "755", prefix: root) {
163 include(name: "bin/*.sh")
164 include(name: "Contents/MacOS/idea")
169 def layoutLinux(Map args, String home, Paths paths) {
170 project.stage("tar.gz")
171 layout(paths.distUnix) {
173 fileset(dir: "$home/bin") { include(name: "*.*") }
174 fileset(dir: "$home/bin/linux") { include(name: "*.*") }
175 fileset(dir: "$home/bin/nix") { include(name: "*.*") }
179 patchPropertiesFile(paths.distUnix)
181 ant.echo(file: "$paths.distUnix/bin/idea.vmoptions", message: args.vmoptions.replace(' ', '\n') )
182 ant.fixcrlf(srcdir: "$paths.distUnix/bin", includes: "idea.vmoptions", eol: "unix")
183 ant.fixcrlf(srcdir: "$paths.distUnix/bin", includes: "*.sh", eol: "unix")
186 def tarRoot = "idea-$args.buildNumber"
187 def tarPath = "$paths.artifacts/idea${args.buildNumber}.tar"
188 ant.tar(tarfile: tarPath) {
189 [paths.distAll, paths.distUnix].each {
190 tarfileset(dir: it, prefix: tarRoot) {
191 exclude(name: "bin/*.sh")
195 tarfileset(dir: paths.distUnix, filemode: "755", prefix: tarRoot) {
196 include(name: "bin/*.sh")
200 ant.gzip(src: tarPath, zipfile: "${tarPath}.gz")
201 ant.delete(file: tarPath)