|
36831ec
mzgol authored
|
||
| 1 | 'use strict'; | |
| 2 | ||
|
79b51d5
geddski authored
|
||
| 3 | var files = require('./angularFiles').files; | |
| 4 | var util = require('./lib/grunt/utils.js'); | |
|
d1214af
petebacondarwin authored
|
||
| 5 | var versionInfo = require('./lib/versions/version-info'); | |
|
265f0b5
petebacondarwin authored
|
||
| 6 | var path = require('path'); | |
|
79b51d5
geddski authored
|
||
| 7 | ||
| 8 | module.exports = function(grunt) { | |
| 9 | //grunt plugins | |
|
e7ac7aa
gdi2290 authored
|
||
| 10 | require('load-grunt-tasks')(grunt); | |
| 11 | ||
|
79b51d5
geddski authored
|
||
| 12 | grunt.loadTasks('lib/grunt'); | |
|
6bdaa4b
jeffbcross authored
|
||
| 13 | grunt.loadNpmTasks('angular-benchpress'); | |
|
79b51d5
geddski authored
|
||
| 14 | ||
|
d1214af
petebacondarwin authored
|
||
| 15 | var NG_VERSION = versionInfo.currentVersion; | |
|
aa249ae
tbosch authored
|
||
| 16 | NG_VERSION.cdn = versionInfo.cdnVersion; | |
|
8a96393
geddski authored
|
||
| 17 | var dist = 'angular-'+ NG_VERSION.full; | |
|
79b51d5
geddski authored
|
||
| 18 | ||
| 19 | //global beforeEach | |
| 20 | util.init(); | |
| 21 | ||
| 22 | ||
| 23 | //config | |
| 24 | grunt.initConfig({ | |
| 25 | NG_VERSION: NG_VERSION, | |
|
6bdaa4b
jeffbcross authored
|
||
| 26 | bp_build: { | |
| 27 | options: { | |
| 28 | buildPath: 'build/benchmarks', | |
| 29 | benchmarksPath: 'benchmarks' | |
| 30 | } | |
| 31 | }, | |
|
2c2adbc
vojtajina authored
|
||
| 32 | parallel: { | |
| 33 | travis: { | |
| 34 | tasks: [ | |
|
b72ea59
petebacondarwin authored
|
||
| 35 | util.parallelTask(['test:unit', 'test:promises-aplus', 'tests:docs'], {stream: true}), | |
|
7909ebe
vojtajina authored
|
||
| 36 | util.parallelTask(['test:e2e']) | |
|
2c2adbc
vojtajina authored
|
||
| 37 | ] | |
| 38 | } | |
| 39 | }, | |
| 40 | ||
|
79b51d5
geddski authored
|
||
| 41 | connect: { | |
| 42 | devserver: { | |
| 43 | options: { | |
| 44 | port: 8000, | |
|
5fd39e0
IgorMinar authored
|
||
| 45 | hostname: '0.0.0.0', | |
|
79b51d5
geddski authored
|
||
| 46 | base: '.', | |
| 47 | keepalive: true, | |
| 48 | middleware: function(connect, options){ | |
| 49 | return [ | |
|
b9479ee
tbosch authored
|
||
| 50 | util.conditionalCsp(), | |
|
79b51d5
geddski authored
|
||
| 51 | util.rewrite(), | |
| 52 | connect.favicon('images/favicon.ico'), | |
| 53 | connect.static(options.base), | |
| 54 | connect.directory(options.base) | |
| 55 | ]; | |
| 56 | } | |
| 57 | } | |
| 58 | }, | |
|
2c2adbc
vojtajina authored
|
||
| 59 | testserver: { | |
| 60 | options: { | |
|
b73c46c
vojtajina authored
|
||
| 61 | // We use end2end task (which does not start the webserver) | |
| 62 | // and start the webserver as a separate process (in travis_build.sh) | |
| 63 | // to avoid https://github.com/joyent/libuv/issues/826 | |
| 64 | port: 8000, | |
| 65 | hostname: '0.0.0.0', | |
|
2c2adbc
vojtajina authored
|
||
| 66 | middleware: function(connect, options){ | |
| 67 | return [ | |
| 68 | function(req, resp, next) { | |
| 69 | // cache get requests to speed up tests on travis | |
| 70 | if (req.method === 'GET') { | |
| 71 | resp.setHeader('Cache-control', 'public, max-age=3600'); | |
| 72 | } | |
| 73 | ||
| 74 | next(); | |
| 75 | }, | |
|
b9479ee
tbosch authored
|
||
| 76 | util.conditionalCsp(), | |
|
2c2adbc
vojtajina authored
|
||
| 77 | connect.favicon('images/favicon.ico'), | |
| 78 | connect.static(options.base) | |
| 79 | ]; | |
| 80 | } | |
| 81 | } | |
| 82 | } | |
|
79b51d5
geddski authored
|
||
| 83 | }, | |
| 84 | ||
| 85 | ||
|
05b41ee
matsko authored
|
||
| 86 | tests: { | |
|
c2e215f
vojtajina authored
|
||
| 87 | jqlite: 'karma-jqlite.conf.js', | |
| 88 | jquery: 'karma-jquery.conf.js', | |
|
b72ea59
petebacondarwin authored
|
||
| 89 | docs: 'karma-docs.conf.js', | |
|
7aef2d5
juliemr authored
|
||
| 90 | modules: 'karma-modules.conf.js' | |
|
79b51d5
geddski authored
|
||
| 91 | }, | |
| 92 | ||
| 93 | ||
| 94 | autotest: { | |
|
c2e215f
vojtajina authored
|
||
| 95 | jqlite: 'karma-jqlite.conf.js', | |
|
63c1e5b
IgorMinar authored
|
||
| 96 | jquery: 'karma-jquery.conf.js', | |
|
77c4fc6
matsko authored
|
||
| 97 | modules: 'karma-modules.conf.js', | |
|
b72ea59
petebacondarwin authored
|
||
| 98 | docs: 'karma-docs.conf.js' | |
|
79b51d5
geddski authored
|
||
| 99 | }, | |
| 100 | ||
| 101 | ||
|
84467d8
juliemr authored
|
||
| 102 | protractor: { | |
|
0e85ca9
juliemr authored
|
||
| 103 | normal: 'protractor-conf.js', | |
|
39c82f3
juliemr authored
|
||
| 104 | travis: 'protractor-travis-conf.js', | |
|
0e85ca9
juliemr authored
|
||
| 105 | jenkins: 'protractor-jenkins-conf.js' | |
|
2ed4ad5
juliemr authored
|
||
| 106 | }, | |
| 107 | ||
| 108 | ||
|
e848099
jamestalmage authored
|
||
| 109 | clean: { | |
| 110 | build: ['build'], | |
| 111 | tmp: ['tmp'] | |
| 112 | }, | |
|
79b51d5
geddski authored
|
||
| 113 | ||
|
934a95d
petebacondarwin authored
|
||
| 114 | jshint: { | |
|
05ef1bd
James Brewer authored
|
||
| 115 | options: { | |
| 116 | jshintrc: true, | |
| 117 | }, | |
|
36831ec
mzgol authored
|
||
| 118 | node: { | |
| 119 | files: { src: ['*.js', 'lib/**/*.js'] }, | |
| 120 | }, | |
|
accd35b
shahata authored
|
||
| 121 | tests: { | |
| 122 | files: { src: 'test/**/*.js' }, | |
| 123 | }, | |
|
934a95d
petebacondarwin authored
|
||
| 124 | ng: { | |
| 125 | files: { src: files['angularSrc'] }, | |
| 126 | }, | |
| 127 | ngAnimate: { | |
| 128 | files: { src: 'src/ngAnimate/**/*.js' }, | |
| 129 | }, | |
| 130 | ngCookies: { | |
| 131 | files: { src: 'src/ngCookies/**/*.js' }, | |
| 132 | }, | |
| 133 | ngLocale: { | |
| 134 | files: { src: 'src/ngLocale/**/*.js' }, | |
| 135 | }, | |
|
0f4016c
matsko authored
|
||
| 136 | ngMessages: { | |
| 137 | files: { src: 'src/ngMessages/**/*.js' }, | |
| 138 | }, | |
|
934a95d
petebacondarwin authored
|
||
| 139 | ngMock: { | |
| 140 | files: { src: 'src/ngMock/**/*.js' }, | |
| 141 | }, | |
| 142 | ngResource: { | |
| 143 | files: { src: 'src/ngResource/**/*.js' }, | |
| 144 | }, | |
| 145 | ngRoute: { | |
| 146 | files: { src: 'src/ngRoute/**/*.js' }, | |
| 147 | }, | |
| 148 | ngSanitize: { | |
| 149 | files: { src: 'src/ngSanitize/**/*.js' }, | |
| 150 | }, | |
| 151 | ngScenario: { | |
| 152 | files: { src: 'src/ngScenario/**/*.js' }, | |
| 153 | }, | |
| 154 | ngTouch: { | |
| 155 | files: { src: 'src/ngTouch/**/*.js' }, | |
|
d1434c9
arbus authored
|
||
| 156 | }, | |
| 157 | ngAria: { | |
| 158 | files: {src: 'src/ngAria/**/*.js'}, | |
|
934a95d
petebacondarwin authored
|
||
| 159 | } | |
| 160 | }, | |
|
79b51d5
geddski authored
|
||
| 161 | ||
|
7f4edaf
IgorMinar authored
|
||
| 162 | jscs: { | |
| 163 | src: ['src/**/*.js', 'test/**/*.js'], | |
| 164 | options: { | |
| 165 | config: ".jscs.json" | |
| 166 | } | |
| 167 | }, | |
| 168 | ||
|
79b51d5
geddski authored
|
||
| 169 | build: { | |
| 170 | scenario: { | |
| 171 | dest: 'build/angular-scenario.js', | |
| 172 | src: [ | |
|
9e7cb3c
mzgol authored
|
||
| 173 | 'bower_components/jquery/dist/jquery.js', | |
|
79b51d5
geddski authored
|
||
| 174 | util.wrap([files['angularSrc'], files['angularScenario']], 'ngScenario/angular') | |
| 175 | ], | |
| 176 | styles: { | |
| 177 | css: ['css/angular.css', 'css/angular-scenario.css'] | |
| 178 | } | |
| 179 | }, | |
| 180 | angular: { | |
| 181 | dest: 'build/angular.js', | |
| 182 | src: util.wrap([files['angularSrc']], 'angular'), | |
| 183 | styles: { | |
| 184 | css: ['css/angular.css'], | |
|
a86cf20
tbosch authored
|
||
| 185 | generateCspCssFile: true, | |
|
79b51d5
geddski authored
|
||
| 186 | minify: true | |
| 187 | } | |
| 188 | }, | |
| 189 | loader: { | |
| 190 | dest: 'build/angular-loader.js', | |
|
934a95d
petebacondarwin authored
|
||
| 191 | src: util.wrap(files['angularLoader'], 'loader') | |
|
79b51d5
geddski authored
|
||
| 192 | }, | |
|
94ec84e
btford authored
|
||
| 193 | touch: { | |
| 194 | dest: 'build/angular-touch.js', | |
|
934a95d
petebacondarwin authored
|
||
| 195 | src: util.wrap(files['angularModules']['ngTouch'], 'module') | |
|
707c65d
|
||
| 196 | }, | |
|
79b51d5
geddski authored
|
||
| 197 | mocks: { | |
| 198 | dest: 'build/angular-mocks.js', | |
|
5bd6596
davemo authored
|
||
| 199 | src: util.wrap(files['angularModules']['ngMock'], 'module'), | |
|
79b51d5
geddski authored
|
||
| 200 | strict: false | |
| 201 | }, | |
| 202 | sanitize: { | |
| 203 | dest: 'build/angular-sanitize.js', | |
|
934a95d
petebacondarwin authored
|
||
| 204 | src: util.wrap(files['angularModules']['ngSanitize'], 'module') | |
|
79b51d5
geddski authored
|
||
| 205 | }, | |
| 206 | resource: { | |
| 207 | dest: 'build/angular-resource.js', | |
|
934a95d
petebacondarwin authored
|
||
| 208 | src: util.wrap(files['angularModules']['ngResource'], 'module') | |
|
79b51d5
geddski authored
|
||
| 209 | }, | |
|
0f4016c
matsko authored
|
||
| 210 | messages: { | |
| 211 | dest: 'build/angular-messages.js', | |
| 212 | src: util.wrap(files['angularModules']['ngMessages'], 'module') | |
| 213 | }, | |
|
81923f1
matsko authored
|
||
| 214 | animate: { | |
| 215 | dest: 'build/angular-animate.js', | |
|
934a95d
petebacondarwin authored
|
||
| 216 | src: util.wrap(files['angularModules']['ngAnimate'], 'module') | |
|
81923f1
matsko authored
|
||
| 217 | }, | |
|
5599b55
IgorMinar authored
|
||
| 218 | route: { | |
| 219 | dest: 'build/angular-route.js', | |
|
934a95d
petebacondarwin authored
|
||
| 220 | src: util.wrap(files['angularModules']['ngRoute'], 'module') | |
|
5599b55
IgorMinar authored
|
||
| 221 | }, | |
|
79b51d5
geddski authored
|
||
| 222 | cookies: { | |
| 223 | dest: 'build/angular-cookies.js', | |
|
934a95d
petebacondarwin authored
|
||
| 224 | src: util.wrap(files['angularModules']['ngCookies'], 'module') | |
|
e848099
jamestalmage authored
|
||
| 225 | }, | |
|
d1434c9
arbus authored
|
||
| 226 | aria: { | |
| 227 | dest: 'build/angular-aria.js', | |
| 228 | src: util.wrap(files['angularModules']['ngAria'], 'module') | |
| 229 | }, | |
|
e848099
jamestalmage authored
|
||
| 230 | "promises-aplus-adapter": { | |
| 231 | dest:'tmp/promises-aplus-adapter++.js', | |
| 232 | src:['src/ng/q.js','lib/promises-aplus/promises-aplus-test-adapter.js'] | |
|
79b51d5
geddski authored
|
||
| 233 | } | |
| 234 | }, | |
| 235 | ||
| 236 | ||
| 237 | min: { | |
| 238 | angular: 'build/angular.js', | |
|
81923f1
matsko authored
|
||
| 239 | animate: 'build/angular-animate.js', | |
|
79b51d5
geddski authored
|
||
| 240 | cookies: 'build/angular-cookies.js', | |
| 241 | loader: 'build/angular-loader.js', | |
|
14f5734
matsko authored
|
||
| 242 | messages: 'build/angular-messages.js', | |
|
94ec84e
btford authored
|
||
| 243 | touch: 'build/angular-touch.js', | |
|
79b51d5
geddski authored
|
||
| 244 | resource: 'build/angular-resource.js', | |
|
5599b55
IgorMinar authored
|
||
| 245 | route: 'build/angular-route.js', | |
|
d1434c9
arbus authored
|
||
| 246 | sanitize: 'build/angular-sanitize.js', | |
| 247 | aria: 'build/angular-aria.js' | |
|
79b51d5
geddski authored
|
||
| 248 | }, | |
| 249 | ||
| 250 | ||
|
31631b2
btford authored
|
||
| 251 | "ddescribe-iit": { | |
| 252 | files: [ | |
|
e9fad96
juliemr authored
|
||
| 253 | 'src/**/*.js', | |
|
31631b2
btford authored
|
||
| 254 | 'test/**/*.js', | |
|
e9fad96
juliemr authored
|
||
| 255 | '!test/ngScenario/DescribeSpec.js', | |
|
d9b90d7
matsko authored
|
||
| 256 | '!src/ng/directive/attrs.js', // legitimate xit here | |
|
e9fad96
juliemr authored
|
||
| 257 | '!src/ngScenario/**/*.js' | |
|
31631b2
btford authored
|
||
| 258 | ] | |
| 259 | }, | |
| 260 | ||
| 261 | "merge-conflict": { | |
| 262 | files: [ | |
| 263 | 'src/**/*', | |
| 264 | 'test/**/*', | |
| 265 | 'docs/**/*', | |
| 266 | 'css/**/*' | |
| 267 | ] | |
| 268 | }, | |
| 269 | ||
|
79b51d5
geddski authored
|
||
| 270 | copy: { | |
| 271 | i18n: { | |
| 272 | files: [ | |
| 273 | { src: 'src/ngLocale/**', dest: 'build/i18n/', expand: true, flatten: true } | |
| 274 | ] | |
| 275 | } | |
| 276 | }, | |
| 277 | ||
| 278 | ||
| 279 | compress: { | |
| 280 | build: { | |
|
79a88ec
IgorMinar authored
|
||
| 281 | options: {archive: 'build/' + dist +'.zip', mode: 'zip'}, | |
|
36831ec
mzgol authored
|
||
| 282 | src: ['**'], | |
| 283 | cwd: 'build', | |
| 284 | expand: true, | |
| 285 | dot: true, | |
| 286 | dest: dist + '/' | |
|
79b51d5
geddski authored
|
||
| 287 | } | |
| 288 | }, | |
| 289 | ||
|
e848099
jamestalmage authored
|
||
| 290 | shell:{ | |
| 291 | "promises-aplus-tests":{ | |
| 292 | options:{ | |
| 293 | //stdout:true, | |
| 294 | stderr:true, | |
| 295 | failOnError:true | |
| 296 | }, | |
|
265f0b5
petebacondarwin authored
|
||
| 297 | command:path.normalize('./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js') | |
|
e848099
jamestalmage authored
|
||
| 298 | } | |
| 299 | }, | |
| 300 | ||
|
79b51d5
geddski authored
|
||
| 301 | ||
| 302 | write: { | |
| 303 | versionTXT: {file: 'build/version.txt', val: NG_VERSION.full}, | |
| 304 | versionJSON: {file: 'build/version.json', val: JSON.stringify(NG_VERSION)} | |
|
8c10db3
tbosch authored
|
||
| 305 | }, | |
| 306 | ||
| 307 | bump: { | |
| 308 | options: { | |
| 309 | files: ['package.json'], | |
| 310 | commit: false, | |
| 311 | createTag: false, | |
| 312 | push: false | |
| 313 | } | |
|
79b51d5
geddski authored
|
||
| 314 | } | |
| 315 | }); | |
| 316 | ||
| 317 | ||
| 318 | //alias tasks | |
|
2a4f92e
petebacondarwin authored
|
||
| 319 | grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['jshint', 'jscs', 'package','test:unit','test:promises-aplus', 'tests:docs', 'test:protractor']); | |
|
953fa4c
matsko authored
|
||
| 320 | grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']); | |
| 321 | grunt.registerTask('test:jquery', 'Run the jQuery unit tests with Karma', ['tests:jquery']); | |
| 322 | grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['tests:modules']); | |
|
b72ea59
petebacondarwin authored
|
||
| 323 | grunt.registerTask('test:docs', 'Run the doc-page tests with Karma', ['package', 'tests:docs']); | |
|
953fa4c
matsko authored
|
||
| 324 | grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['tests:jqlite', 'tests:jquery', 'tests:modules']); | |
|
84467d8
juliemr authored
|
||
| 325 | grunt.registerTask('test:protractor', 'Run the end to end tests with Protractor and keep a test server running in the background', ['webdriver', 'connect:testserver', 'protractor:normal']); | |
|
39c82f3
juliemr authored
|
||
| 326 | grunt.registerTask('test:travis-protractor', 'Run the end to end tests with Protractor for Travis CI builds', ['connect:testserver', 'protractor:travis']); | |
| 327 | grunt.registerTask('test:ci-protractor', 'Run the end to end tests with Protractor for Jenkins CI builds', ['webdriver', 'connect:testserver', 'protractor:jenkins']); | |
|
7aef2d5
juliemr authored
|
||
| 328 | grunt.registerTask('test:e2e', 'Alias for test:protractor', ['test:protractor']); | |
|
e848099
jamestalmage authored
|
||
| 329 | grunt.registerTask('test:promises-aplus',['build:promises-aplus-adapter','shell:promises-aplus-tests']); | |
|
05b41ee
matsko authored
|
||
| 330 | ||
|
aa5a162
ksheedlo authored
|
||
| 331 | grunt.registerTask('minify', ['bower','clean', 'build', 'minall']); | |
|
79b51d5
geddski authored
|
||
| 332 | grunt.registerTask('webserver', ['connect:devserver']); | |
|
aa5a162
ksheedlo authored
|
||
| 333 | grunt.registerTask('package', ['bower','clean', 'buildall', 'minall', 'collect-errors', 'docs', 'copy', 'write', 'compress']); | |
|
7f4edaf
IgorMinar authored
|
||
| 334 | grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict', 'jshint', 'jscs']); | |
|
79b51d5
geddski authored
|
||
| 335 | grunt.registerTask('default', ['package']); | |
| 336 | }; |