Skip to content

Commit

Permalink
resolves #34, allow setting NodeReuse and passing custom args
Browse files Browse the repository at this point in the history
  • Loading branch information
bertvanbrakel committed Apr 26, 2016
1 parent dff8567 commit c57b3e4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .gitignore
@@ -1,6 +1,8 @@
node_modules/
.idea/

# Ignore backup and temp files
*~

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
Expand All @@ -22,4 +24,4 @@ build/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
Nunit-Test-Results.xml
Nunit-Test-Results.xml
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -35,6 +35,8 @@ grunt.initConfig({
buildParameters: {
WarningLevel: 2
},
nodeReuse:false,
customArgs:[ '/noautoresponse', '/detailedsummary'],
verbosity: 'quiet'
}
}
Expand All @@ -50,8 +52,10 @@ grunt.initConfig({
| targets | Targets to run | Build
| version | .NET version | 4.0
| maxCpuCount | Number of cores to use | 1
| nodeReuse | If msbuild should hang around | false
| consoleLoggerParameters | Customize Console Logger
| buildParameters | Additional [properties](http://msdn.microsoft.com/en-us/library/ms171458.aspx)
| customArgs | Additional args, see [MSBuild Command-Line Reference](http://msdn.microsoft.com/en-us/library/ms164311.aspx)
| verbosity | Verbosity level (quiet, minimal, normal, detailed or diagnostic) | normal

For more information, see [MSBuild Command-Line Reference](http://msdn.microsoft.com/en-us/library/ms164311.aspx).
Expand Down
20 changes: 15 additions & 5 deletions tasks/msbuild.js
Expand Up @@ -26,10 +26,12 @@ module.exports = function(grunt) {
var options = this.options({
targets: ['Build'],
buildParameters: {},
customArgs:[],
failOnError: true,
verbosity: 'normal',
processor: '',
nologo: true
nologo: true,
nodeReuse: true
});

if (!options.projectConfiguration) {
Expand Down Expand Up @@ -132,21 +134,29 @@ module.exports = function(grunt) {
}
}

if (options.consoleLoggerParameters) {
if (options.consoleLoggerParameters) {
grunt.verbose.writeln('Using clp:' + options.consoleLoggerParameters);
args.push('/clp:' + options.consoleLoggerParameters);
}
args.push('/clp:' + options.consoleLoggerParameters);
}

args.push('/property:Configuration=' + options.projectConfiguration);

if (options.platform) {
args.push('/p:Platform=' + options.platform);
}


if (!options.nodeReuse) {
args.push('/nodeReuse:false');
}

for (var buildArg in options.buildParameters) {
args.push('/property:' + buildArg + '=' + options.buildParameters[buildArg]);
}

for (var customArg in options.customArgs) {
args.push(customArg);
}

return args;
}

Expand Down
1 change: 1 addition & 0 deletions tests/vs/multiple-project-files/gruntfile.js
Expand Up @@ -18,6 +18,7 @@ module.exports = function(grunt) {
WarningLevel: 2,
OutputPath: 'bin\\Debug'
},
customArgs:['/nr:false'],
verbosity: 'quiet'
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/vs/single-project-file/gruntfile.js
Expand Up @@ -15,6 +15,7 @@ module.exports = function (grunt) {
WarningLevel: 2,
OutputPath: 'bin\\Debug'
},
nodeReuse:false,
verbosity: 'minimal',
execOptions: {
maxBuffer: 1000 * 1024
Expand Down

0 comments on commit c57b3e4

Please sign in to comment.