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/*jslint vars:true, regexp:true, nomen:true*/
2424/*global module, require, process*/
2525
2626module . exports = function ( grunt ) {
2727 "use strict" ;
28-
28+
2929 var fs = require ( "fs" ) ,
3030 common = require ( "./common" ) ( grunt ) ,
3131 q = require ( "q" ) ,
@@ -34,20 +34,20 @@ module.exports = function (grunt) {
3434 resolve = common . resolve ,
3535 platform = common . platform ( ) ,
3636 _ = grunt . util . _ ;
37-
37+
3838 function getBracketsEnv ( ) {
3939 var env = _ . extend ( process . env ) ;
40-
40+
4141 env . BRACKETS_SRC = resolve ( grunt . config ( "git.www.repo" ) ) ;
4242 env . BRACKETS_APP_NAME = grunt . config ( "build.name" ) ;
43-
43+
4444 return env ;
4545 }
46-
46+
4747 // task: full-build
4848 grunt . registerTask ( "full-build" , [ "git" , "create-project" , "build-www" , "build" , "stage" , "package" ] ) ;
4949 grunt . registerTask ( "installer" , [ "full-build" , "build-installer" ] ) ;
50-
50+
5151 // task: build
5252 grunt . registerTask ( "build" , "Build shell executable. Run 'grunt full-build' to update repositories, build the shell and package www files." , function ( wwwBranch , shellBranch ) {
5353 grunt . task . run ( "build-" + platform ) ;
@@ -63,11 +63,11 @@ module.exports = function (grunt) {
6363 return false ;
6464 }
6565 } ) ;
66-
66+
6767 // task: build-mac
6868 grunt . registerTask ( "build-mac" , "Build mac shell" , function ( ) {
6969 var done = this . async ( ) ;
70-
70+
7171 spawn ( [
7272 "xcodebuild -project appshell.xcodeproj -config Release clean" ,
7373 "xcodebuild -project appshell.xcodeproj -config Release build"
@@ -83,44 +83,44 @@ module.exports = function (grunt) {
8383 done ( false ) ;
8484 } ) ;
8585 } ) ;
86-
86+
8787 // task: build-win
8888 grunt . registerTask ( "build-win" , "Build windows shell" , function ( ) {
8989 var done = this . async ( ) ;
90-
90+
9191 spawn ( "cmd.exe /c scripts\\build_projects.bat" ) . then ( function ( ) {
9292 done ( ) ;
9393 } , function ( err ) {
9494 grunt . log . error ( err ) ;
9595 done ( false ) ;
9696 } ) ;
9797 } ) ;
98-
98+
9999 // task: build-linux
100100 grunt . registerTask ( "build-linux" , "Build linux shell" , function ( ) {
101101 var done = this . async ( ) ;
102-
102+
103103 spawn ( "make" ) . then ( function ( ) {
104104 done ( ) ;
105105 } , function ( err ) {
106106 grunt . log . error ( err ) ;
107107 done ( false ) ;
108108 } ) ;
109109 } ) ;
110-
110+
111111 // task: git
112112 grunt . registerMultiTask ( "git" , "Pull specified repo branch from origin" , function ( ) {
113113 var repo = this . data . repo ;
114-
114+
115115 if ( ! repo ) {
116116 grunt . fail . fatal ( "Missing repo config" ) ;
117117 }
118-
118+
119119 repo = resolve ( repo ) ;
120-
120+
121121 if ( this . data . branch ) {
122122 grunt . log . writeln ( "Updating repo " + this . target + " at " + repo + " to branch " + this . data . branch ) ;
123-
123+
124124 var done = this . async ( ) ,
125125 promise = spawn ( [
126126 "git fetch origin" ,
@@ -129,7 +129,7 @@ module.exports = function (grunt) {
129129 "git submodule sync" ,
130130 "git submodule update --init --recursive"
131131 ] , { cwd : repo } ) ;
132-
132+
133133 promise . then ( function ( ) {
134134 done ( ) ;
135135 } , function ( err ) {
@@ -140,84 +140,75 @@ module.exports = function (grunt) {
140140 grunt . log . writeln ( "Skipping fetch for " + this . target + " repo" ) ;
141141 }
142142 } ) ;
143-
143+
144144 // task: stage
145145 grunt . registerTask ( "stage" , "Stage release files" , function ( ) {
146146 // stage platform-specific binaries
147147 grunt . task . run ( [ "clean:staging-" + platform , "stage-" + platform ] ) ;
148148 } ) ;
149-
149+
150150 // task: stage-mac
151151 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" ) ;
164155 } ) ;
165-
156+
166157 // task: stage-win
167158 grunt . registerTask ( "stage-win" , "Stage win executable files" , function ( ) {
168159 // stage platform-specific binaries, then package www files
169160 grunt . task . run ( "copy:win" ) ;
170161 } ) ;
171-
162+
172163 // task: stage-linux
173164 grunt . registerTask ( "stage-linux" , "Stage linux executable files" , function ( ) {
174165 // stage platform-specific binaries, then package www files
175166 grunt . task . run ( "copy:linux" ) ;
176167 } ) ;
177-
168+
178169 // task: package
179170 grunt . registerTask ( "package" , "Package www files" , function ( ) {
180171 grunt . task . run ( [ "clean:www" , "copy:www" , "copy:samples" ] ) ;
181172 } ) ;
182-
173+
183174 // task: build-installer
184175 grunt . registerTask ( "build-installer" , "Build installer" , function ( ) {
185176 // TODO update brackets.config.json
186177 grunt . task . run ( [ "clean:installer-" + platform , "build-installer-" + platform ] ) ;
187178 } ) ;
188-
179+
189180 // task: build-installer-mac
190181 grunt . registerTask ( "build-installer-mac" , "Build mac installer" , function ( ) {
191182 var done = this . async ( ) ;
192-
183+
193184 spawn ( [ "bash buildInstaller.sh" ] , { cwd : resolve ( "installer/mac" ) , env : getBracketsEnv ( ) } ) . then ( function ( ) {
194185 done ( ) ;
195186 } , function ( err ) {
196187 grunt . log . error ( err ) ;
197188 done ( false ) ;
198189 } ) ;
199190 } ) ;
200-
191+
201192 // task: build-installer-win
202193 grunt . registerTask ( "build-installer-win" , "Build windows installer" , function ( ) {
203194 var done = this . async ( ) ;
204-
195+
205196 spawn ( [ "cmd.exe /c ant.bat -f brackets-win-install-build.xml" ] , { cwd : resolve ( "installer/win" ) , env : getBracketsEnv ( ) } ) . then ( function ( ) {
206197 done ( ) ;
207198 } , function ( err ) {
208199 grunt . log . error ( err ) ;
209200 done ( false ) ;
210201 } ) ;
211202 } ) ;
212-
203+
213204 // task: build-installer-linux
214205 grunt . registerTask ( "build-installer-linux" , "Build linux installer" , function ( ) {
215206 grunt . task . requires ( [ "package" ] ) ;
216-
207+
217208 var template = grunt . file . read ( "installer/linux/debian/control" ) ,
218209 templateData = { } ,
219210 content ;
220-
211+
221212 // populate debian control template fields
222213 templateData . version = grunt . file . readJSON ( grunt . config ( "config-json" ) ) . version ;
223214 templateData . size = 0 ;
@@ -228,14 +219,14 @@ module.exports = function (grunt) {
228219 templateData . size += fs . statSync ( abspath ) . size ;
229220 } ) ;
230221 templateData . size = Math . round ( templateData . size / 1000 ) ;
231-
222+
232223 // write file
233224 content = grunt . template . process ( template , { data : templateData } ) ;
234225 grunt . file . write ( "installer/linux/debian/package-root/DEBIAN/control" , content ) ;
235-
226+
236227 var done = this . async ( ) ,
237228 release = semver . parse ( grunt . config ( "pkg" ) . version ) . minor ;
238-
229+
239230 spawn ( [ "bash build_installer.sh" ] , { cwd : resolve ( "installer/linux" ) , env : getBracketsEnv ( ) } ) . then ( function ( ) {
240231 return common . rename ( "installer/linux/brackets.deb" , "installer/linux/Brackets Release " + release + " " + common . arch ( ) + "-bit.deb" ) ;
241232 } ) . then ( function ( ) {
@@ -247,7 +238,7 @@ module.exports = function (grunt) {
247238 } ) ;
248239
249240 // task: build-linux-archive
250- grunt . registerTask ( "build-linux-archive" , "Build portable Linux .tar.gz" , function ( ) {
241+ grunt . registerTask ( "build-linux-archive" , "Build portable Linux .tar.gz" , function ( ) {
251242 grunt . task . requires ( [ "package" ] ) ;
252243
253244 var done = this . async ( ) ,
0 commit comments