Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.

Commit 1cb3e04

Browse files
committed
Merge pull request #485 from adobe/ingo/fix-set-release-number-appshell
accept 1.0 version number for set-release task
2 parents 7f3facf + 5dad738 commit 1cb3e04

File tree

6 files changed

+83
-77
lines changed

6 files changed

+83
-77
lines changed

appshell/mac/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>0.45.0</string>
22+
<string>1.0.0</string>
2323
<key>CFBundleShortVersionString</key>
24-
<string>0.45.0</string>
24+
<string>1.0.0</string>
2525
<key>NSMainNibFile</key>
2626
<string>MainMenu</string>
2727
<key>NSPrincipalClass</key>

appshell/version.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
3232
//
3333

3434
VS_VERSION_INFO VERSIONINFO
35-
FILEVERSION 0,45,0,0
35+
FILEVERSION 1,0,0,0
3636
/* PRODUCTVERSION 1,0,0,0 */
3737
FILEOS VOS__WINDOWS32
3838
FILETYPE VFT_APP
@@ -43,7 +43,7 @@ BEGIN
4343
BEGIN
4444
VALUE "CompanyName", "brackets.io\0"
4545
VALUE "FileDescription", "\0"
46-
VALUE "FileVersion", "Release 0.45\0"
46+
VALUE "FileVersion", "Release 1.0.0\0"
4747
VALUE "ProductName", APP_NAME "\0"
4848
VALUE "ProductVersion", "\0"
4949
VALUE "LegalCopyright", "(c) 2012 Adobe Systems, Inc.\0"

installer/mac/buildInstaller.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
#!/bin/bash
1+
#!/bin/bash
22

33
# config
44
releaseName="Brackets"
5-
dmgName="${releaseName} Release 0.45"
5+
version="1.0"
6+
dmgName="${releaseName} Release ${version}"
67
format="bzip2"
78
encryption="none"
89
tmpLayout="./dropDmgConfig/layouts/tempLayout"

installer/win/brackets-win-install-build.xml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project name="Brackets Windows installer" basedir="." xmlns:antcontrib="antlib:net.sf.antcontrib"
33
default="build.mul">
4-
4+
55
<!-- Key locations on disk -->
66
<property name="wix.base" value="C:\Program Files (x86)\Windows Installer XML v3.5"/>
7-
7+
88
<property name="brackets.staging" value=".\staging"/>
9-
10-
9+
10+
1111
<!-- Product & version labeling -->
1212
<!-- See also: product name definitions in Brackets_<locale>.wxl -->
1313
<property name="product.shortname" value="Brackets"/>
14-
<property name="product.release.number.major" value="0"/>
15-
<property name="product.release.number.minor" value="45"/>
14+
<property name="product.release.number.major" value="1"/>
15+
<property name="product.release.number.minor" value="0"/>
1616
<property name="product.version.number" value="${product.release.number.major}.${product.release.number.minor}"/>
1717
<property name="product.version.name" value="Release ${product.version.number}"/>
1818
<property name="product.fullname" value="Brackets ${product.version.name}"/>
1919
<property name="product.manufacturer" value="brackets.io"/>
2020
<property name="product.registry.root" value="${product.shortname}"/>
21-
22-
21+
22+
2323
<!-- Installer properties -->
2424
<property name="heat.cmd" value="${wix.base}/bin/heat.exe"/>
2525
<property name="candle.cmd" value="${wix.base}/bin/candle.exe"/>
2626
<property name="light.cmd" value="${wix.base}/bin/light.exe"/>
2727
<property name="msitran.cmd" value="${wix.base}/bin/MsiTran.exe"/>
2828
<property name="wisubstg.cmd" value="${wix.base}/bin/WiSubStg.vbs"/>
29-
30-
29+
30+
3131
<!-- Build WIX installer -->
32-
32+
3333
<target name="build.english" >
3434
<echo level="info">Building English installer for build: ${product.version.name} </echo>
3535
<!-- heat, candle, light-->
3636
<echo message="Generating fileset."/>
3737
<exec dir="" executable="${heat.cmd}">
3838
<arg line="dir ${brackets.staging} -cg BRACKETSHARVESTMANAGER -gg -scom -sreg -sfrag -srd -dr INSTALLDIR -out bracketsharvestmanager.wxs"/>
3939
</exec>
40-
40+
4141
<echo message="Prepping installer source."/>
4242
<exec dir="" executable="${candle.cmd}">
4343
<arg line="Brackets.wxs
@@ -79,9 +79,9 @@ default="build.mul">
7979
BrowseDlg.wixobj
8080
VerifyReadyDlg.wixobj
8181
-out '${product.fullname}.msi'
82-
-loc Brackets_en-us.wxl"/>
82+
-loc Brackets_en-us.wxl"/>
8383
</exec>
84-
84+
8585
</target>
8686

8787
<target name="build.french" >
@@ -171,34 +171,34 @@ default="build.mul">
171171
operation='+' operand2='1' datatype='int'/>
172172
<echo>${new.build.number}</echo>
173173
</target>
174-
174+
175175
<target name="post.build" depends=""></target>
176176
<!-- codesign msi file -->
177177
<target name="codesign.installer.win" description="runs signtool on msi file">
178178
<property name="cert.file" value="C:/Certificates/CS_Certs/Adobe_Systems_CS.cer"/>
179179
<property name="cert.name" value="Adobe Systems Incorporated"/>
180180
<!--
181181
<property name="cert.file" value="C:/Certificates/CS_Certs/Adobe_testcodesigner.cer"/>
182-
<property name="cert.name" value="AdobeTestCodeSigning"/>
182+
<property name="cert.name" value="AdobeTestCodeSigning"/>
183183
-->
184184

185185
<codesign.file.win file="${product.fullname}.msi" cert.file="${cert.file}" cert.name="${cert.name}"/>
186186
</target>
187-
188-
187+
188+
189189
<!-- Cleanup targets -->
190-
190+
191191
<target name="clean" depends="clean.temp"
192192
description="Remove all Wix generated files from installer\win">
193193
<delete><fileset dir="." includes="*.msi" /></delete>
194194
</target>
195-
195+
196196
<target name="clean.temp"
197197
description="Remove intermediate Wix files from installer\win, leaving final MSI in place">
198198
<delete file="bracketsharvestmanager.wxs" />
199199
<delete file="fr-fr.mst" />
200200
<delete><fileset dir="." includes="*.wixobj" /></delete>
201201
<delete><fileset dir="." includes="*.wixpdb" /></delete>
202202
</target>
203-
203+
204204
</project>

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Brackets-Shell",
3-
"version": "0.45.0-0",
3+
"version": "1.0.0-0",
44
"homepage": "http://brackets.io",
55
"issues": {
66
"url": "http://github.com/adobe/brackets-shell/issues"
@@ -21,11 +21,11 @@
2121
"grunt-curl": "2.0.2",
2222
"grunt-shell": "0.2.1",
2323
"q": "0.9.2",
24-
"semver": "2.0.11"
24+
"semver": "^4.1.0"
2525
},
2626
"scripts": {
2727
"preinstall": "bash -c 'mv appshell.gyp .appshell.gyp'",
2828
"install": "",
2929
"postinstall": "bash -c 'mv .appshell.gyp appshell.gyp;'"
3030
}
31-
}
31+
}

tasks/set-release.js

Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,47 @@
11
/*
22
* Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
3-
*
3+
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
5-
* copy of this software and associated documentation files (the "Software"),
6-
* to deal in the Software without restriction, including without limitation
7-
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8-
* and/or sell copies of the Software, and to permit persons to whom the
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
99
* Software is furnished to do so, subject to the following conditions:
10-
*
10+
*
1111
* The above copyright notice and this permission notice shall be included in
1212
* all copies or substantial portions of the Software.
13-
*
13+
*
1414
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1616
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2020
* DEALINGS IN THE SOFTWARE.
21-
*
21+
*
2222
*/
2323
/*global module, require*/
2424

2525
module.exports = function (grunt) {
2626
"use strict";
27-
28-
var common = require("./common")(grunt);
27+
28+
var common = require("./common")(grunt),
29+
semver = require("semver");
2930

3031
function safeReplace(content, regexp, replacement) {
32+
if (!regexp.test(content)) {
33+
grunt.fail.fatal("Regexp " + regexp + " did not match");
34+
}
35+
3136
var newContent = content.replace(regexp, replacement);
3237

3338
if (newContent === content) {
34-
grunt.fail.fatal("Regexp " + regexp + " did not match");
39+
grunt.log.warn("Buildnumber for ", regexp, "hasn't been updated, because it's already set.");
3540
}
3641

3742
return newContent;
3843
}
39-
44+
4045
// task: set-release
4146
grunt.registerTask("set-release", "Update occurrences of release number for all native installers and binaries", function () {
4247
var packageJsonPath = "package.json",
@@ -46,68 +51,68 @@ module.exports = function (grunt) {
4651
wxsPath = "installer/win/Brackets.wxs",
4752
versionRcPath = "appshell/version.rc",
4853
infoPlistPath = "appshell/mac/Info.plist",
49-
release = grunt.option("release") || 0,
50-
versionShort = packageJSON.version.substr(0, packageJSON.version.indexOf("-")),
51-
text;
52-
53-
// replace release number in short version, e.g. N.<release>.N
54-
versionShort = versionShort.replace(/([0-9]+\.)([0-9]+)(\.[0-9]+)/, "$1" + release + "$3");
54+
release = grunt.option("release") || "",
55+
text,
56+
newVersion;
5557

56-
if (!release) {
57-
grunt.fail.fatal("Please specify a release. e.g. grunt set-release --release=21");
58+
if (!release || !semver.valid(release)) {
59+
grunt.fail.fatal("Please specify a release. e.g. grunt set-release --release=1.0.0");
5860
}
59-
61+
62+
newVersion = semver.parse(release);
63+
6064
// 1. Update package.json
61-
packageJSON.version = safeReplace(
62-
packageJSON.version,
63-
/([0-9]+\.)([0-9]+)([\.\-a-zA-Z0-9]*)?/,
64-
"$1" + release + "$3"
65-
);
65+
packageJSON.version = newVersion.version + "-0";
6666
common.writeJSON(packageJsonPath, packageJSON);
67-
67+
6868
// 2. Open installer/win/brackets-win-install-build.xml and change `product.release.number`
6969
text = grunt.file.read(winInstallerBuildXmlPath);
7070
text = safeReplace(
7171
text,
72-
/<property name="product\.release\.number\.minor" value="([0-9]+)"\/>/,
73-
'<property name="product.release.number.minor" value="' + release + '"/>'
72+
/<property name="product\.release\.number\.major" value="(\d+)"\/>/,
73+
'<property name="product.release.number.major" value="' + newVersion.major + '"/>'
74+
);
75+
text = safeReplace(
76+
text,
77+
/<property name="product\.release\.number\.minor" value="(\d+)"\/>/,
78+
'<property name="product.release.number.minor" value="' + newVersion.minor + '"/>'
7479
);
7580
grunt.file.write(winInstallerBuildXmlPath, text);
76-
81+
7782
// 3. Open installer/mac/buildInstaller.sh and change `dmgName`
7883
text = grunt.file.read(buildInstallerScriptPath);
7984
text = safeReplace(
8085
text,
81-
/( Release [0-9]+\.)([0-9]+)/,
82-
"$1" + release
86+
/version="\d+\.\d+"/,
87+
"version=\"" + newVersion.major + "." + newVersion.minor + "\""
8388
);
8489
grunt.file.write(buildInstallerScriptPath, text);
85-
90+
8691
// 4. Open appshell/version.rc and change `FILEVERSION` and `"FileVersion"`
8792
text = grunt.file.read(versionRcPath);
8893
text = safeReplace(
8994
text,
90-
/(FILEVERSION\s+[0-9]+,)([0-9]+)/,
91-
"$1" + release
95+
/(FILEVERSION\s+)\d+,\d+,\d+,\d+/,
96+
"$1" + newVersion.major + "," + newVersion.minor + "," + newVersion.patch + "," + (newVersion.build.length ? newVersion.build : "0")
9297
);
9398
text = safeReplace(
9499
text,
95-
/(Release [0-9]+\.)([0-9]+)/,
96-
"$1" + release
100+
/(Release )([\d+.]+)/,
101+
"$1" + newVersion.version
97102
);
98103
grunt.file.write(versionRcPath, text);
99-
100-
// 5. Open appshell/mac/Info.plist and change `CFBundleShortVersionString` and `CFBundleVersion`text = grunt.file.read(wxsPath);
104+
105+
// 5. Open appshell/mac/Info.plist and change `CFBundleShortVersionString` and `CFBundleVersion`
101106
text = grunt.file.read(infoPlistPath);
102107
text = safeReplace(
103108
text,
104-
/(<key>CFBundleVersion<\/key>\s*<string>)([0-9]+\.[0-9]+\.[0-9]+)(<\/string>)/,
105-
"$1" + versionShort + "$3"
109+
/(<key>CFBundleVersion<\/key>\s*<string>)(\d+\.\d+\.\d+)(<\/string>)/,
110+
"$1" + newVersion.version + "$3"
106111
);
107112
text = safeReplace(
108113
text,
109-
/(<key>CFBundleShortVersionString<\/key>\s*<string>)([0-9]+\.[0-9]+\.[0-9]+)(<\/string>)/,
110-
"$1" + versionShort + "$3"
114+
/(<key>CFBundleShortVersionString<\/key>\s*<string>)(\d+\.\d+\.\d+)(<\/string>)/,
115+
"$1" + newVersion.version + "$3"
111116
);
112117
grunt.file.write(infoPlistPath, text);
113118
});

0 commit comments

Comments
 (0)