-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathjsmake.dotnet.DotNetUtils.js
67 lines (66 loc) · 2.39 KB
/
jsmake.dotnet.DotNetUtils.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
jsmake.dotnet = {};
jsmake.dotnet.DotNetUtils = function () {
this._nugetPath = 'tools/nuget/NuGet.exe';
this._nunitPath = 'lib/NUnit.2.5.10.11092/tools/nunit-console.exe';
this._frameworkVersion = '4.0.30319';
};
jsmake.dotnet.DotNetUtils.prototype = {
updateNuGet: function () {
jsmake.Sys.createRunner(this._nugetPath).args('update').run();
},
downloadNuGetPackages: function (packages, outputDirectory) {
jsmake.Utils.each(packages, function (pkg) {
jsmake.Sys.createRunner(this._nugetPath)
.args('install', pkg)
.args('-OutputDirectory', outputDirectory)
.run();
}, this);
},
deployToNuGet: function (projFile, outputDirectory, deploySymbols) {
var runner = jsmake.Sys.createRunner(this._nugetPath);
runner.args('pack');
runner.args('-OutputDirectory', outputDirectory);
if (deploySymbols) {
runner.args('-sym');
}
runner.args(projFile);
runner.run();
var packages = jsmake.Fs.createScanner(outputDirectory)
.include('*.nupkg')
.exclude('*.symbols.nupkg')
.scan();
jsmake.Sys.createRunner(this._nugetPath)
.args('push', packages[0])
.run();
},
runMSBuild: function (projectPath, targets, parameters) {
var runner = jsmake.Sys.createRunner(jsmake.Fs.combinePaths(jsmake.Sys.getEnvVar('SystemRoot'), 'Microsoft.NET', 'Framework', 'v' + this._frameworkVersion, 'MSBuild.exe'));
runner.args(projectPath, '/verbosity:minimal', '/nologo');
if (targets) {
runner.args('/t:' + jsmake.Utils.toArray(targets).join(';'));
}
if (parameters) {
parameters = jsmake.Utils.map(parameters, function (val, key) { return key + '="' + val + '"'; });
runner.args('/p:' + parameters.join(';'));
}
runner.run();
},
writeAssemblyInfo: function (path, attributes) {
/*
Mapping between Assembly attributes and properties visible in windows explorer:
AssemblyTitle => File description
AssemblyProduct => Product name
AssemblyCopyright => Copyright
AssemblyTrademark => Legal trademark
AssemblyFileVersion => File version
AssemblyInformationalVersion => Product version
*/
var rows = jsmake.Utils.map(attributes, function (value, name) {
return '[assembly: System.Reflection.' + name + '("' + value + '")]';
}, this);
jsmake.Fs.writeFile(path, rows.join('\n'));
},
runNUnit: function (dllPaths) {
jsmake.Sys.createRunner(this._nunitPath).args('/nologo', dllPaths).run();
}
};