forked from GoogleChrome/accessibility-developer-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
82 lines (72 loc) · 2.09 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
'git-describe': {
options: {
},
'run': {}
},
closurecompiler: {
minify: {
requiresConfig: 'git-revision',
files: {
"gen/axs_testing.js": [
"./lib/closure-library/closure/goog/base.js",
"./src/js/axs.js",
"./src/js/BrowserUtils.js",
"./src/js/Constants.js",
"./src/js/AccessibilityUtils.js",
"./src/js/Properties.js",
"./src/js/AuditRule.js",
"./src/js/AuditRules.js",
"./src/js/AuditResults.js",
"./src/js/Audit.js",
"./src/audits/*"
]
},
options: {
"language_in": "ECMASCRIPT5",
"formatting": "PRETTY_PRINT",
"summary_detail_level": 3,
"warning_level": "VERBOSE",
"compilation_level": "SIMPLE_OPTIMIZATIONS",
"output_wrapper": "'<%= grunt.file.read('scripts/output_wrapper.txt') %>'",
"externs": "./src/js/externs/externs.js"
}
}
},
qunit: {
all: ['test/index.html']
}
});
grunt.loadNpmTasks('grunt-closurecompiler');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.registerTask('git-describe', function() {
var _spawn = require("grunt-util-spawn")(grunt);
// Start async task
var done = this.async();
_spawn({
"cmd" : "git",
"args" : [ "rev-parse", "HEAD" ],
"opts" : {
"cwd" : "."
}
}, function(err, result) {
if (err) {
grunt.log.error(err).verbose.error(result);
done();
return;
}
grunt.event.emit('git-describe', result.stdout);
done();
});
});
grunt.registerTask('save-revision', function() {
grunt.event.once('git-describe', function (rev) {
grunt.log.writeln("Git Revision: " + rev);
grunt.config.set('git-revision', rev);
});
grunt.task.run('git-describe');
});
grunt.registerTask('default', ['save-revision', 'closurecompiler:minify', 'qunit']);
};