|
| 1 | +/* |
| 2 | + * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. |
| 3 | + * |
| 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 |
| 9 | + * Software is furnished to do so, subject to the following conditions: |
| 10 | + * |
| 11 | + * The above copyright notice and this permission notice shall be included in |
| 12 | + * all copies or substantial portions of the Software. |
| 13 | + * |
| 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, |
| 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 |
| 20 | + * DEALINGS IN THE SOFTWARE. |
| 21 | + * |
| 22 | + */ |
| 23 | +/*global module, require*/ |
| 24 | +module.exports = function (grunt) { |
| 25 | + 'use strict'; |
| 26 | + |
| 27 | + var common = require("./tasks/lib/common")(grunt); |
| 28 | + |
| 29 | + // Project configuration. |
| 30 | + grunt.initConfig({ |
| 31 | + pkg : grunt.file.readJSON("package.json"), |
| 32 | + meta : { |
| 33 | + src : [ |
| 34 | + 'src/**/*.js', |
| 35 | + '!src/thirdparty/**', |
| 36 | + '!src/widgets/bootstrap-*.js', |
| 37 | + '!src/extensions/**/unittest-files/**/*.js', |
| 38 | + '!src/extensions/**/thirdparty/**/*.js', |
| 39 | + '!src/extensions/dev/**', |
| 40 | + '!src/extensions/disabled/**', |
| 41 | + '!**/node_modules/**/*.js', |
| 42 | + '!src/**/*-min.js', |
| 43 | + '!src/**/*.min.js' |
| 44 | + ], |
| 45 | + test : [ |
| 46 | + 'test/**/*.js', |
| 47 | + '!test/perf/*-files/**/*.js', |
| 48 | + '!test/spec/*-files/**/*.js', |
| 49 | + '!test/smokes/**', |
| 50 | + '!test/temp/**', |
| 51 | + '!test/thirdparty/**', |
| 52 | + '!test/**/node_modules/**/*.js' |
| 53 | + ], |
| 54 | + grunt: [ |
| 55 | + 'Gruntfile.js', |
| 56 | + 'tasks/**/*.js' |
| 57 | + ], |
| 58 | + /* specs that can run in phantom.js */ |
| 59 | + specs : [ |
| 60 | + 'test/spec/CommandManager-test.js', |
| 61 | + //'test/spec/LanguageManager-test.js', |
| 62 | + //'test/spec/PreferencesManager-test.js', |
| 63 | + 'test/spec/ViewUtils-test.js' |
| 64 | + ] |
| 65 | + }, |
| 66 | + watch: { |
| 67 | + all : { |
| 68 | + files: ['**/*', '!**/node_modules/**'], |
| 69 | + tasks: ['jshint'] |
| 70 | + }, |
| 71 | + grunt : { |
| 72 | + files: ['<%= meta.grunt %>', 'tasks/**/*'], |
| 73 | + tasks: ['jshint:grunt'] |
| 74 | + }, |
| 75 | + src : { |
| 76 | + files: ['<%= meta.src %>', 'src/**/*'], |
| 77 | + tasks: ['jshint:src'] |
| 78 | + }, |
| 79 | + test : { |
| 80 | + files: ['<%= meta.test %>', 'test/**/*'], |
| 81 | + tasks: ['jshint:test'] |
| 82 | + } |
| 83 | + }, |
| 84 | + /* FIXME (jasonsanjose): how to handle extension tests */ |
| 85 | + jasmine : { |
| 86 | + src : 'undefined.js', /* trick the default runner to run without importing src files */ |
| 87 | + options : { |
| 88 | + junit : { |
| 89 | + path: 'test/results', |
| 90 | + consolidate: true |
| 91 | + }, |
| 92 | + specs : '<%= meta.specs %>', |
| 93 | + /* Keep in sync with test/SpecRunner.html dependencies */ |
| 94 | + vendor : [ |
| 95 | + 'src/thirdparty/jquery-1.7.js', |
| 96 | + 'src/thirdparty/CodeMirror2/lib/codemirror.js', |
| 97 | + 'src/thirdparty/CodeMirror2/lib/util/dialog.js', |
| 98 | + 'src/thirdparty/CodeMirror2/lib/util/searchcursor.js', |
| 99 | + 'src/thirdparty/CodeMirror2/addon/edit/closetag.js', |
| 100 | + 'src/thirdparty/CodeMirror2/addon/selection/active-line.js', |
| 101 | + 'src/thirdparty/mustache/mustache.js', |
| 102 | + 'src/thirdparty/path-utils/path-utils.min', |
| 103 | + 'src/thirdparty/less-1.3.0.min.js' |
| 104 | + ], |
| 105 | + helpers : [ |
| 106 | + 'test/spec/PhantomHelper.js' |
| 107 | + ], |
| 108 | + template : require('grunt-template-jasmine-requirejs'), |
| 109 | + templateOptions: { |
| 110 | + requireConfig : { |
| 111 | + baseUrl: 'src', |
| 112 | + paths: { |
| 113 | + 'test' : '../test', |
| 114 | + 'perf' : '../test/perf', |
| 115 | + 'spec' : '../test/spec', |
| 116 | + 'text' : 'thirdparty/text', |
| 117 | + 'i18n' : 'thirdparty/i18n' |
| 118 | + } |
| 119 | + } |
| 120 | + } |
| 121 | + } |
| 122 | + }, |
| 123 | + jshint: { |
| 124 | + all: [ |
| 125 | + '<%= meta.grunt %>', |
| 126 | + '<%= meta.src %>', |
| 127 | + '<%= meta.test %>' |
| 128 | + ], |
| 129 | + grunt: '<%= meta.grunt %>', |
| 130 | + src: '<%= meta.src %>', |
| 131 | + test: '<%= meta.test %>', |
| 132 | + /* use strict options to mimic JSLINT until we migrate to JSHINT in Brackets */ |
| 133 | + options: { |
| 134 | + jshintrc: '.jshintrc' |
| 135 | + } |
| 136 | + }, |
| 137 | + shell: { |
| 138 | + repo: grunt.option("shell-repo") || "../brackets-shell", |
| 139 | + mac: "<%= shell.repo %>/installer/mac/staging/<%= pkg.name %>.app", |
| 140 | + win: "<%= shell.repo %>/installer/win/staging/<%= pkg.name %>.exe" |
| 141 | + } |
| 142 | + }); |
| 143 | + |
| 144 | + // load dependencies |
| 145 | + grunt.loadTasks('tasks'); |
| 146 | + grunt.loadNpmTasks('grunt-contrib-jasmine'); |
| 147 | + grunt.loadNpmTasks('grunt-contrib-jshint'); |
| 148 | + grunt.loadNpmTasks('grunt-contrib-watch'); |
| 149 | + |
| 150 | + // task: install |
| 151 | + grunt.registerTask('install', ['write-config']); |
| 152 | + |
| 153 | + // task: test |
| 154 | + //grunt.registerTask('test', ['jshint', 'jasmine']); |
| 155 | + grunt.registerTask('test', ['jshint']); |
| 156 | + |
| 157 | + // task: set-sprint |
| 158 | + // Update sprint number in package.json and rewrite src/config.json |
| 159 | + grunt.registerTask('set-sprint', ['update-sprint-number', 'write-config']); |
| 160 | + |
| 161 | + // Default task. |
| 162 | + grunt.registerTask('default', ['test']); |
| 163 | +}; |
0 commit comments