-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGruntfile.js
109 lines (94 loc) · 3.08 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
var relSolutionPath = 'src/Nancy.AspNet.WebSockets.sln',
solutionConfig = 'Release';
module.exports = function (grunt) {
var version = grunt.file.read('VERSION').trim();
grunt.log.writeln('Version is ' + version);
grunt.initConfig({
msbuild: {
options: {
maxCpuCount: 4,
buildParameters: {
WarningLevel: 2
},
verbosity: 'quiet',
projectConfiguration: [solutionConfig],
},
clean: {
src: [relSolutionPath],
options: {
targets: ['Clean'],
}
},
dev: {
src: [relSolutionPath],
options: {
targets: ['Build'],
}
}
},
nugetrestore: {
restore: {
src: 'src/**/packages.config',
dest: 'src/packages'
}
},
nugetpack: {
dist: {
src: 'src/**/*.nuspec',
dest: 'dist/',
options: {
version: version
}
}
},
exec: {
jstest: {
command: 'src\\packages\\Chutzpah.3.3.1\\tools\\chutzpah.console.exe src\\Nancy.AspNet.WebSockets.Sample.Tests\\JavaScript'
}
},
nunit: {
test: {
files: {
src: [relSolutionPath]
}
},
options: {
path: 'src/packages/NUnit.Runners.2.6.4/tools',
config: solutionConfig,
noshadow: true,
labels: true
}
},
replace: {
version: {
src: ['src/CommonAssemblyInfo.cs'],
overwrite: true,
replacements: [{
from: /(Assembly(Informational)?Version)\("[0-9.]+"\)/g,
to: '$1("' + version + '")'
}]
}
},
shell: {
test: {
command: 'powershell .\\testWebConfigTransforms.ps1'
}
},
clean_: ['dist/*']
});
grunt.loadNpmTasks('grunt-nuget');
grunt.loadNpmTasks('grunt-msbuild');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-nunit-runner');
grunt.loadNpmTasks('grunt-text-replace');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-shell');
// Since our public task is named clean, we need to rename the one from grunt-contrib-clean.
grunt.task.renameTask('clean', 'clean_');
grunt.registerTask('clean', ['clean_', 'msbuild:clean']);
grunt.registerTask('package-restore', ['nugetrestore:restore']);
grunt.registerTask('compile', ['clean', 'package-restore', 'replace:version', 'msbuild:dev']);
grunt.registerTask('test', ['compile', 'exec:jstest', 'nunit:test', 'shell:test']);
grunt.registerTask('package', ['test', 'nugetpack']);
grunt.registerTask('default', ['test']);
};