1
1
/*
2
2
* Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
3
- *
3
+ *
4
4
* 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
9
9
* Software is furnished to do so, subject to the following conditions:
10
- *
10
+ *
11
11
* The above copyright notice and this permission notice shall be included in
12
12
* all copies or substantial portions of the Software.
13
- *
13
+ *
14
14
* 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,
16
16
* 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
20
20
* DEALINGS IN THE SOFTWARE.
21
- *
21
+ *
22
22
*/
23
23
/*jslint vars:true, regexp:true, nomen:true*/
24
24
/*global module, require, process*/
25
25
26
26
module . exports = function ( grunt ) {
27
27
"use strict" ;
28
-
28
+
29
29
var fs = require ( "fs" ) ,
30
30
common = require ( "./common" ) ( grunt ) ,
31
31
q = require ( "q" ) ,
@@ -34,20 +34,20 @@ module.exports = function (grunt) {
34
34
resolve = common . resolve ,
35
35
platform = common . platform ( ) ,
36
36
_ = grunt . util . _ ;
37
-
37
+
38
38
function getBracketsEnv ( ) {
39
39
var env = _ . extend ( process . env ) ;
40
-
40
+
41
41
env . BRACKETS_SRC = resolve ( grunt . config ( "git.www.repo" ) ) ;
42
42
env . BRACKETS_APP_NAME = grunt . config ( "build.name" ) ;
43
-
43
+
44
44
return env ;
45
45
}
46
-
46
+
47
47
// task: full-build
48
48
grunt . registerTask ( "full-build" , [ "git" , "create-project" , "build-www" , "build" , "stage" , "package" ] ) ;
49
49
grunt . registerTask ( "installer" , [ "full-build" , "build-installer" ] ) ;
50
-
50
+
51
51
// task: build
52
52
grunt . registerTask ( "build" , "Build shell executable. Run 'grunt full-build' to update repositories, build the shell and package www files." , function ( wwwBranch , shellBranch ) {
53
53
grunt . task . run ( "build-" + platform ) ;
@@ -63,11 +63,11 @@ module.exports = function (grunt) {
63
63
return false ;
64
64
}
65
65
} ) ;
66
-
66
+
67
67
// task: build-mac
68
68
grunt . registerTask ( "build-mac" , "Build mac shell" , function ( ) {
69
69
var done = this . async ( ) ;
70
-
70
+
71
71
spawn ( [
72
72
"xcodebuild -project appshell.xcodeproj -config Release clean" ,
73
73
"xcodebuild -project appshell.xcodeproj -config Release build"
@@ -83,44 +83,44 @@ module.exports = function (grunt) {
83
83
done ( false ) ;
84
84
} ) ;
85
85
} ) ;
86
-
86
+
87
87
// task: build-win
88
88
grunt . registerTask ( "build-win" , "Build windows shell" , function ( ) {
89
89
var done = this . async ( ) ;
90
-
90
+
91
91
spawn ( "cmd.exe /c scripts\\build_projects.bat" ) . then ( function ( ) {
92
92
done ( ) ;
93
93
} , function ( err ) {
94
94
grunt . log . error ( err ) ;
95
95
done ( false ) ;
96
96
} ) ;
97
97
} ) ;
98
-
98
+
99
99
// task: build-linux
100
100
grunt . registerTask ( "build-linux" , "Build linux shell" , function ( ) {
101
101
var done = this . async ( ) ;
102
-
102
+
103
103
spawn ( "make" ) . then ( function ( ) {
104
104
done ( ) ;
105
105
} , function ( err ) {
106
106
grunt . log . error ( err ) ;
107
107
done ( false ) ;
108
108
} ) ;
109
109
} ) ;
110
-
110
+
111
111
// task: git
112
112
grunt . registerMultiTask ( "git" , "Pull specified repo branch from origin" , function ( ) {
113
113
var repo = this . data . repo ;
114
-
114
+
115
115
if ( ! repo ) {
116
116
grunt . fail . fatal ( "Missing repo config" ) ;
117
117
}
118
-
118
+
119
119
repo = resolve ( repo ) ;
120
-
120
+
121
121
if ( this . data . branch ) {
122
122
grunt . log . writeln ( "Updating repo " + this . target + " at " + repo + " to branch " + this . data . branch ) ;
123
-
123
+
124
124
var done = this . async ( ) ,
125
125
promise = spawn ( [
126
126
"git fetch origin" ,
@@ -129,7 +129,7 @@ module.exports = function (grunt) {
129
129
"git submodule sync" ,
130
130
"git submodule update --init --recursive"
131
131
] , { cwd : repo } ) ;
132
-
132
+
133
133
promise . then ( function ( ) {
134
134
done ( ) ;
135
135
} , function ( err ) {
@@ -140,84 +140,75 @@ module.exports = function (grunt) {
140
140
grunt . log . writeln ( "Skipping fetch for " + this . target + " repo" ) ;
141
141
}
142
142
} ) ;
143
-
143
+
144
144
// task: stage
145
145
grunt . registerTask ( "stage" , "Stage release files" , function ( ) {
146
146
// stage platform-specific binaries
147
147
grunt . task . run ( [ "clean:staging-" + platform , "stage-" + platform ] ) ;
148
148
} ) ;
149
-
149
+
150
150
// task: stage-mac
151
151
grunt . registerTask ( "stage-mac" , "Stage mac executable files" , function ( ) {
152
- var done = this . async ( ) ;
153
-
154
- // this should have been a grunt-contrib-copy task "copy:mac", but something goes wrong when creating the .app folder
155
- spawn ( [
156
- "mkdir installer/mac/staging" ,
157
- "cp -R xcodebuild/Release/" + grunt . config ( "build.name" ) + ".app installer/mac/staging/"
158
- ] ) . then ( function ( ) {
159
- done ( ) ;
160
- } , function ( err ) {
161
- grunt . log . error ( err ) ;
162
- done ( false ) ;
163
- } ) ;
152
+ // stage platform-specific binaries, then package www files
153
+ grunt . task . run ( "copy:mac" ) ;
154
+ grunt . task . run ( "copy:cefplist" ) ;
164
155
} ) ;
165
-
156
+
166
157
// task: stage-win
167
158
grunt . registerTask ( "stage-win" , "Stage win executable files" , function ( ) {
168
159
// stage platform-specific binaries, then package www files
169
160
grunt . task . run ( "copy:win" ) ;
170
161
} ) ;
171
-
162
+
172
163
// task: stage-linux
173
164
grunt . registerTask ( "stage-linux" , "Stage linux executable files" , function ( ) {
174
165
// stage platform-specific binaries, then package www files
175
166
grunt . task . run ( "copy:linux" ) ;
176
167
} ) ;
177
-
168
+
178
169
// task: package
179
170
grunt . registerTask ( "package" , "Package www files" , function ( ) {
180
171
grunt . task . run ( [ "clean:www" , "copy:www" , "copy:samples" ] ) ;
181
172
} ) ;
182
-
173
+
183
174
// task: build-installer
184
175
grunt . registerTask ( "build-installer" , "Build installer" , function ( ) {
185
176
// TODO update brackets.config.json
186
177
grunt . task . run ( [ "clean:installer-" + platform , "build-installer-" + platform ] ) ;
187
178
} ) ;
188
-
179
+
189
180
// task: build-installer-mac
190
181
grunt . registerTask ( "build-installer-mac" , "Build mac installer" , function ( ) {
191
182
var done = this . async ( ) ;
192
-
183
+
193
184
spawn ( [ "bash buildInstaller.sh" ] , { cwd : resolve ( "installer/mac" ) , env : getBracketsEnv ( ) } ) . then ( function ( ) {
194
185
done ( ) ;
195
186
} , function ( err ) {
196
187
grunt . log . error ( err ) ;
197
188
done ( false ) ;
198
189
} ) ;
199
190
} ) ;
200
-
191
+
201
192
// task: build-installer-win
202
193
grunt . registerTask ( "build-installer-win" , "Build windows installer" , function ( ) {
203
194
var done = this . async ( ) ;
204
-
195
+
205
196
spawn ( [ "cmd.exe /c ant.bat -f brackets-win-install-build.xml" ] , { cwd : resolve ( "installer/win" ) , env : getBracketsEnv ( ) } ) . then ( function ( ) {
206
197
done ( ) ;
207
198
} , function ( err ) {
208
199
grunt . log . error ( err ) ;
209
200
done ( false ) ;
210
201
} ) ;
211
202
} ) ;
212
-
203
+
213
204
// task: build-installer-linux
214
205
grunt . registerTask ( "build-installer-linux" , "Build linux installer" , function ( ) {
215
206
grunt . task . requires ( [ "package" ] ) ;
216
-
207
+
217
208
var template = grunt . file . read ( "installer/linux/debian/control" ) ,
218
209
templateData = { } ,
219
210
content ;
220
-
211
+
221
212
// populate debian control template fields
222
213
templateData . version = grunt . file . readJSON ( grunt . config ( "config-json" ) ) . version ;
223
214
templateData . size = 0 ;
@@ -228,15 +219,15 @@ module.exports = function (grunt) {
228
219
templateData . size += fs . statSync ( abspath ) . size ;
229
220
} ) ;
230
221
templateData . size = Math . round ( templateData . size / 1000 ) ;
231
-
222
+
232
223
// write file
233
224
content = grunt . template . process ( template , { data : templateData } ) ;
234
225
grunt . file . write ( "installer/linux/debian/package-root/DEBIAN/control" , content ) ;
235
-
226
+
236
227
var done = this . async ( ) ,
237
228
version = semver . parse ( grunt . config ( "pkg" ) . version ) ,
238
229
release = version . major + "." + version . minor ;
239
-
230
+
240
231
spawn ( [ "bash build_installer.sh" ] , { cwd : resolve ( "installer/linux" ) , env : getBracketsEnv ( ) } ) . then ( function ( ) {
241
232
return common . rename ( "installer/linux/brackets.deb" , "installer/linux/Brackets Release " + release + " " + common . arch ( ) + "-bit.deb" ) ;
242
233
} ) . then ( function ( ) {
@@ -248,7 +239,7 @@ module.exports = function (grunt) {
248
239
} ) ;
249
240
250
241
// task: build-linux-archive
251
- grunt . registerTask ( "build-linux-archive" , "Build portable Linux .tar.gz" , function ( ) {
242
+ grunt . registerTask ( "build-linux-archive" , "Build portable Linux .tar.gz" , function ( ) {
252
243
grunt . task . requires ( [ "package" ] ) ;
253
244
254
245
var done = this . async ( ) ,
0 commit comments