-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
115 lines (98 loc) · 3.12 KB
/
gulpfile.js
File metadata and controls
115 lines (98 loc) · 3.12 KB
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
115
/// <binding />
// Alphabetical Order
var debug = require("gulp-debug");
var foreach = require("gulp-foreach");
var fs = require('fs');
var gulp = require("gulp");
var msbuild = require("gulp-msbuild");
var nugetRestore = require('gulp-nuget-restore');
var runSequence = require("run-sequence");
var config;
if (fs.existsSync('./gulp-config.js.user')) {
config = require("./gulp-config.js.user")();
}
else {
config = require("./gulp-config.js")()
}
module.exports.config = config;
gulp.task("default", function (callback) {
config.runCleanBuilds = true;
return runSequence(
"01-Nuget-Restore",
"02-Publish-All-Projects",
callback);
});
gulp.task("01-Nuget-Restore", function (callback) {
return gulp.src("./" + config.solutionName + ".sln").pipe(nugetRestore());
});
gulp.task("02-Publish-All-Projects", function (callback) {
return runSequence(
"Build-Solution",
"Publish-Foundation-Projects",
"Publish-Feature-Projects",
"Publish-Project-Projects",
callback);
});
var publishStream = function (stream, dest) {
var targets = ["Build"];
return stream
.pipe(debug({ title: "Building project:" }))
.pipe(msbuild({
targets: targets,
configuration: config.buildConfiguration,
logCommand: false,
verbosity: config.buildVerbosity,
stdout: true,
errorOnFail: true,
maxcpucount: config.buildMaxCpuCount,
nodeReuse: false,
toolsVersion: config.buildToolsVersion,
properties: {
Platform: config.publishPlatform,
DeployOnBuild: "true",
DeployDefaultTarget: "WebPublish",
WebPublishMethod: "FileSystem",
DeleteExistingFiles: "false",
publishUrl: dest,
_FindDependencies: "false"
}
}));
};
var publishProjects = function (dest) {
return gulp
.src(['./src/' + dest + '/code/*.csproj'])
.pipe(foreach(function (stream, file) {
return publishStream(stream, config.websiteRoot);
}));
};
gulp.task("Build-Solution", function () {
var targets = ["Build"];
if (config.runCleanBuilds) {
targets = ["Clean", "Build"];
}
var solution = "./" + config.solutionName + ".sln";
return gulp.src(solution)
.pipe(msbuild({
targets: targets,
configuration: config.buildConfiguration,
logCommand: false,
verbosity: config.buildVerbosity,
stdout: true,
errorOnFail: true,
maxcpucount: config.buildMaxCpuCount,
nodeReuse: false,
toolsVersion: config.buildToolsVersion,
properties: {
Platform: config.buildPlatform
}
}));
});
gulp.task("Publish-Foundation-Projects", function () {
return publishProjects('Foundation');
});
gulp.task("Publish-Feature-Projects", function () {
return publishProjects('Feature');
});
gulp.task("Publish-Project-Projects", function () {
return publishProjects('Project/*');
});