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)
82 ant.xmlproperty(file: appInfoFile(), collapseAttributes: "true")
84 def layouts = includeFile("$home/build/scripts/layouts.gant")
85 layouts.layoutFull(home, paths.distAll)
87 ant.echo(message: args.buildNumber, file: "$paths.distAll/build.txt")
88 ant.copy(todir: "$paths.distAll/license", preservelastmodified: "true") {
89 fileset(dir: "$home/license")
92 ant.copy(file: "$home/LICENSE.txt", todir: "$paths.distAll", preservelastmodified: "true")
94 layoutMac(args, home, paths)
95 layoutLinux(args, home, paths)
96 layoutWin(args, home, paths)
100 return "true" == p("component.version.eap")
103 private def patchPropertiesFile(String where) {
104 ant.echo(file: "$where/bin/idea.properties", append: "true", message:
108 #-----------------------------------------------------------------------
109 # Change to 'disabled' if you need not to receive instant visual notifications about
110 # fatal errors that happen to IDEA or plugins installed.
111 #-----------------------------------------------------------------------
112 idea.fatal.error.notification=enabled
119 #-----------------------------------------------------------------------
120 # Change to 'eanbled' if you need to receive instant visual notifications about
121 # fatal errors that happen to IDEA or plugins installed.
122 #-----------------------------------------------------------------------
123 idea.fatal.error.notification=disabled
128 private def layoutWin(Map args, String home, Paths paths) {
129 layout("$paths.distWin") {
131 fileset(dir: "$home/bin") { include(name: "*.*") }
132 fileset(dir: "$home/bin/win") { include(name: "*.*") }
136 patchPropertiesFile(paths.distWin)
137 ant.echo(file: "$paths.distWin/bin/idea.exe.vmoptions", message: args.vmoptions.replace(' ', '\n'))
139 ant.zip(zipfile: "$paths.artifacts/idea${args.buildNumber}.win.zip") {
140 fileset(dir: paths.distAll)
141 fileset(dir: paths.distWin)
145 private def layoutMac(Map args, String home, Paths paths) {
146 project.stage("Cleaning up sandbox folder")
148 ant.copy(todir: "$paths.distMac/bin") {
149 fileset(dir: "$home/bin") { include(name: "*.*") }
150 fileset(dir: "$home/bin/nix")
151 fileset(dir: "$home/bin/mac")
154 patchPropertiesFile(paths.distMac)
156 ant.copy(todir: paths.distMac) {
157 fileset(dir: "$home/build/conf/mac")
160 def version = isEap() ? p("component.version.codename") : p("component.version.major") + "." + p("component.version.minor")
162 ant.replace(file: "${paths.distMac}/Contents/Info.plist") {
163 replacefilter(token: "@@build@@", value: args.buildNumber)
165 replacefilter(token: "@@version@@", value: version)
166 replacefilter(token: "@@vmoptions@@", value: args.vmoptions + " -Xverify:none -XX:+UseCompressedOOPS")
167 replacefilter(token: "@@system_selector@@", value: args.system_selector)
168 replacefilter(token: "@@jdk_req@@", value: args.jdk_req)
171 def root = isEap() ? "${version}-${args.buildNumbder}.app" : "IntelliJ IDEA ${version} CE.app"
173 ant.zip(zipfile: "$paths.artifacts/idea${args.buildNumber}.mac.zip") {
174 [paths.distAll, paths.distMac].each {
175 tarfileset(dir: it, prefix: root) {
176 exclude(name: "bin/*.sh")
177 exclude(name: "Contents/MacOS/idea")
181 tarfileset(dir: paths.distMac, filemode: "755", prefix: root) {
182 include(name: "bin/*.sh")
183 include(name: "Contents/MacOS/idea")
188 def layoutLinux(Map args, String home, Paths paths) {
189 project.stage("tar.gz")
190 layout(paths.distUnix) {
192 fileset(dir: "$home/bin") { include(name: "*.*") }
193 fileset(dir: "$home/bin/linux") { include(name: "*.*") }
194 fileset(dir: "$home/bin/nix") { include(name: "*.*") }
198 patchPropertiesFile(paths.distUnix)
200 ant.echo(file: "$paths.distUnix/bin/idea.vmoptions", message: args.vmoptions.replace(' ', '\n') )
201 ant.fixcrlf(srcdir: "$paths.distUnix/bin", includes: "idea.vmoptions", eol: "unix")
202 ant.fixcrlf(srcdir: "$paths.distUnix/bin", includes: "*.sh", eol: "unix")
205 def tarRoot = "idea-$args.buildNumber"
206 def tarPath = "$paths.artifacts/idea${args.buildNumber}.tar"
207 ant.tar(tarfile: tarPath) {
208 [paths.distAll, paths.distUnix].each {
209 tarfileset(dir: it, prefix: tarRoot) {
210 exclude(name: "bin/*.sh")
214 tarfileset(dir: paths.distUnix, filemode: "755", prefix: tarRoot) {
215 include(name: "bin/*.sh")
219 ant.gzip(src: tarPath, zipfile: "${tarPath}.gz")
220 ant.delete(file: tarPath)