-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
114 lines (97 loc) · 2.92 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
110
111
112
113
114
'use strict';
module.exports = function(grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
grunt.initConfig({
// Set this variables for different projects
projectName: 'h-dependency',
// These variables shouldn't be changed, but sometimes it might be necessary
srcPath: './',
solutionName: '<%= projectName %>.sln',
dotNetVersion: '4.5.0',
platform: 'Any CPU',
styleCopRules: 'Settings.StyleCop',
ruleSet: 'rules.ruleset',
nuspecFile: 'package.nuspec',
pkg: grunt.file.readJSON('package.json'),
assemblyinfo: {
options: {
files: ['<%= srcPath %><%= solutionName %>'],
info: {
version: '<%= pkg.version %>',
fileVersion: '<%= pkg.version %>',
company: 'hylasoft',
copyright: ' ',
product: '<%= projectName %>'
}
}
},
msbuild: {
release: {
src: ['<%= srcPath %><%= solutionName %>'],
options: {
projectConfiguration: 'Release',
platform: '<%= platform %>',
targets: ['Clean', 'Rebuild'],
buildParameters: {
StyleCopEnabled: false
}
}
},
debug: {
src: ['<%= srcPath %><%= solutionName %>'],
options: {
projectConfiguration: 'Debug',
platform: '<%= platform %>',
targets: ['Clean', 'Rebuild'],
buildParameters: {
StyleCopEnabled: true,
StyleCopTreatErrorsAsWarnings: false,
StyleCopOverrideSettingsFile: '../<%= styleCopRules %>',
RunCodeAnalysis: true,
CodeAnalysisRuleSet: '../<%= ruleSet %>',
TreatWarningsAsErrors: true
},
}
}
},
mstest: {
debug: {
src: ['<%= srcPath %>/**/bin/Debug/*.dll', '<%= srcPath %>/**/bin/Debug/*.exe'] // Points to test dll
}
},
nugetrestore: {
restore: {
src: '<%= srcPath %><%= solutionName %>',
dest: 'packages/'
}
},
nugetpack: {
dist: {
src: '<%= nuspecFile %>',
dest: '.',
options: {
version: '<%= pkg.version %>',
basePath: '<%= projectName %>/bin/Release',
includeReferencedProjects: true,
excludeEmptyDirectories: true,
verbose: true
}
}
},
nugetpush: {
src: '*.<%= pkg.version %>.nupkg',
options: {}
},
clean: {
nuget: ['*.nupkg'],
},
});
grunt.registerTask('default', ['build']);
grunt.registerTask('build', ['nugetrestore', 'msbuild:release']);
grunt.registerTask('test', ['nugetrestore', 'msbuild:debug', 'mstest']);
grunt.registerTask('release', ['test', 'assemblyinfo']);
grunt.registerTask('publishNuget', ['release', 'msbuild:release', 'nugetpack', 'nugetpush', 'clean:nuget']);
};