This repository has been archived by the owner on Sep 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
dotnet-publish.js
64 lines (64 loc) · 3.23 KB
/
dotnet-publish.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
"use strict";
(function () {
const { publish } = requireModule("gulp-dotnet-cli"), resolveMasks = requireModule("resolve-masks"), env = requireModule("env"), gulp = requireModule("gulp");
env.associate([
env.DOTNET_PUBLISH_BUILD_CONFIGURATION,
env.DOTNET_PUBLISH_RUNTIMES,
env.OUTPUT,
env.DOTNET_DISABLE_BUILD_SERVERS,
env.DOTNET_PUBLISH_VERSION_SUFFIX,
env.DOTNET_PUBLISH_SELF_CONTAINED,
env.DOTNET_PUBLISH_MANIFEST,
env.DOTNET_PUBLISH_USE_CURRENT_RUNTIME,
env.DOTNET_PUBLISH_ARCH,
env.DOTNET_PUBLISH_OS,
env.DOTNET_PUBLISH_FRAMEWORK,
env.DOTNET_PUBLISH_NO_BUILD,
env.DOTNET_PUBLISH_NO_RESTORE,
env.DOTNET_PUBLISH_VERBOSITY,
env.DOTNET_PUBLISH_CONTAINER,
env.DOTNET_PUBLISH_CONTAINER_IMAGE_NAME,
env.DOTNET_PUBLISH_CONTAINER_IMAGE_TAG,
env.DOTNET_PUBLISH_CONTAINER_REGISTRY,
env.MSBUILD_PROPERTIES
], "dotnet-publish");
gulp.task("dotnet-publish", "Performs `dotnet publish` on all non-test projects in the tree", () => {
/**
* @type DotNetPublishOptions
*/
const publishOpts = {
configuration: env.resolve(env.DOTNET_PUBLISH_BUILD_CONFIGURATION, env.BUILD_CONFIGURATION),
runtime: env.resolve(env.DOTNET_PUBLISH_RUNTIMES),
output: env.resolve(env.OUTPUT),
disableBuildServers: env.resolveFlag(env.DOTNET_DISABLE_BUILD_SERVERS),
versionSuffix: env.resolve(env.DOTNET_PUBLISH_VERSION_SUFFIX),
selfContained: env.resolveFlag(env.DOTNET_PUBLISH_SELF_CONTAINED),
manifest: env.resolve(env.DOTNET_PUBLISH_MANIFEST),
useCurrentRuntime: env.resolveFlag(env.DOTNET_PUBLISH_USE_CURRENT_RUNTIME),
arch: env.resolve(env.DOTNET_PUBLISH_ARCH),
os: env.resolve(env.DOTNET_PUBLISH_OS),
framework: env.resolve(env.DOTNET_PUBLISH_FRAMEWORK),
noBuild: env.resolveFlag(env.DOTNET_PUBLISH_NO_BUILD),
noRestore: env.resolveFlag(env.DOTNET_PUBLISH_NO_RESTORE),
target: "[ not set ]",
verbosity: env.resolve(env.DOTNET_PUBLISH_VERBOSITY),
msbuildProperties: env.resolveMap(env.MSBUILD_PROPERTIES),
publishContainer: env.resolveFlag(env.DOTNET_PUBLISH_CONTAINER),
containerImageName: env.resolve(env.DOTNET_PUBLISH_CONTAINER_IMAGE_NAME),
containerImageTag: env.resolve(env.DOTNET_PUBLISH_CONTAINER_IMAGE_TAG),
containerRegistry: env.resolve(env.DOTNET_PUBLISH_CONTAINER_REGISTRY)
// TODO: include env drivers for msbuild props:
// PublishTrimmed
// PublishSingleFile
// IncludeNativeLibrariesForSelfExtract
// DebugType (perhaps DOTNET_PUBLISH_DEBUG=None?)
// DebugSymbols (flag - False)
// EnableCompressionInSingleFile (flag - True)
// -> perhaps DOTNET_PUBLISH_SELF_CONTAINED should set these appropriately, with opt-out via env vars
};
const publishMasks = resolveMasks(env.DOTNET_PUBLISH_INCLUDE, [env.DOTNET_PUBLISH_EXCLUDE, env.DOTNET_PUBLISH_ADDITIONAL_EXCLUDE]);
return gulp
.src(publishMasks)
.pipe(publish(publishOpts));
});
})();