1 import com.intellij.openapi.util.SystemInfo
3 target(nsis: 'Build nsis windows installer') {
8 return getProperty(key)
11 def nsis_installer(pathsToInclude, stringsFile, pathsFile, outNamePrefix, includeToolsJar = true, associateIpr = true,
12 system_selector = getProperty("system_selector"), failOnSignError = false, outFileName = null,
13 boolean hasBundledJRE = false) {
14 // p.s: Groovy reevaluates default value of system_selector on each call, so it always uses actual property value.
16 if (outFileName == null) {
17 outFileName = "${outNamePrefix}${buildNumber}"
20 ant.taskdef(name: "nsis", classname: "com.intellij.internalUtilities.ant.NsiFiles", classpath: "${home}/community/build/lib/NsiFiles.jar")
22 def box = paths.sandbox
23 ant.mkdir(dir: "$box/bin")
24 ant.mkdir(dir: "$box/nsiconf")
27 ant.copy(todir: "$box/bin") {
28 fileset(dir: "${box}/jdk.win/jre") {
29 include(name: "**/msvcr71.dll")
34 ant.copy(todir: "$box/nsiconf") {
35 fileset(dir: "$home/community/build/conf/nsis") {
37 exclude(name: "version*")
38 exclude(name: "strings*")
39 exclude(name: "paths*")
44 ant.copy(file: "$home/community/build/conf/nsis/version.eap.nsi",
45 tofile: "$box/nsiconf/version.nsi", overwrite: true)
48 ant.copy(file: "$home/community/build/conf/nsis/version.nsi",
49 tofile: "$box/nsiconf/version.nsi", overwrite: true)
51 ant.copy(file: pathsFile, toFile: "$box/nsiconf/paths.nsi", overwrite: true)
53 ant.nsis(instfile: "$box/nsiconf/idea_win.nsh", uninstfile: "$box/nsiconf/unidea_win.nsh") {
55 fileset(dir: it, includes: "**/*") {
56 exclude(name: "**/idea.properties")
57 exclude(name: "**/*.vmoptions")
60 fileset(dir: box, includes: "bin/msvcr71.dll")
62 fileset(dir: "${box}/jdk.win", includes: "jre/**/*")
66 ant.replace(file: "$stringsFile") {
67 replacefilter(token: "__VERSION_MAJOR__", value: p("component.version.major"))
68 replacefilter(token: "__VERSION_MINOR__", value: p("component.version.minor"))
70 ant.copy(file: stringsFile, toFile: "$box/nsiconf/strings.nsi", overwrite: true)
72 ant.replace(file: "$box/nsiconf/version.nsi") {
73 replacefilter(token: "__BUILD_NUMBER__", value: buildNumber)
74 replacefilter(token: "__VERSION_MAJOR__", value: p("component.version.major"))
75 replacefilter(token: "__VERSION_MINOR__", value: p("component.version.minor"))
76 replacefilter(token: "__PRODUCT_PATHS_SELECTOR__", value: system_selector)
79 ant.unzip(src: "$home/build/tools/NSIS.zip", dest: box)
80 if (SystemInfo.isWindows) {
81 ant.exec(command: "\"${box}/NSIS/makensis.exe\"" +
82 " /DBASE_DIR=\"$home\"" +
83 " /DCOMMUNITY_DIR=\"$home/community\"" +
84 " /DIPR=\"${associateIpr}\"" +
85 " /DOUT_FILE=\"${outFileName}\"" +
86 " /DOUT_DIR=\"$paths.artifacts\"" +
87 " \"${box}/nsiconf/idea.nsi\"")
89 else if (SystemInfo.isLinux) {
90 ant.exec(command: "makensis" +
91 " '-X!AddPluginDir \"${box}/NSIS/Plugins\"'" +
92 " '-X!AddIncludeDir \"${box}/NSIS/Include\"'" +
93 " -DBASE_DIR=\"$home\"" +
94 " -DCOMMUNITY_DIR=\"$home/community\"" +
95 " -DIPR=\"${associateIpr}\"" +
96 " -DOUT_FILE=\"${outFileName}\"" +
97 " -DOUT_DIR=\"$paths.artifacts\"" +
98 " \"${box}/nsiconf/idea.nsi\"")
102 projectBuilder.stage("Signing binaries")
103 executeExternalAnt(["dirName": "${paths.artifacts}", "fileName": "${outFileName}.exe"], "$home/build/signBuild.xml")
104 projectBuilder.stage("Signing done")
106 return "${paths.artifacts}/${outFileName}.exe"