forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.defines.js
More file actions
68 lines (58 loc) · 3.2 KB
/
Copy pathrollup.config.defines.js
File metadata and controls
68 lines (58 loc) · 3.2 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
//! Licensed to the .NET Foundation under one or more agreements.
//! The .NET Foundation licenses this file to you under the MIT license.
/* eslint-disable no-console */
import gitCommitInfo from "git-commit-info";
if (process.env.ContinuousIntegrationBuild === undefined) {
throw new Error("ContinuousIntegrationBuild environment variable is not defined");
}
if (process.env.Configuration === undefined) {
throw new Error("Configuration environment variable is not defined");
}
if (process.env.ProductVersion === undefined) {
throw new Error("ProductVersion environment variable is not defined");
}
export const configuration = process.env.Configuration !== "Release" && process.env.Configuration !== "RELEASE" ? "Debug" : "Release";
export const runtimeFlavor = process.env.RuntimeFlavor || "CoreCLR";
export const productVersion = process.env.ProductVersion;
export const isContinuousIntegrationBuild = process.env.ContinuousIntegrationBuild === "true" ? true : false;
export const staticLibDestination = process.env.StaticLibDestination || `../../artifacts/obj/native/net${productVersion}-browser-${configuration}-wasm/lib`;
console.log(`Rollup configuration: Configuration=${configuration}, RuntimeFlavor=${runtimeFlavor}, ProductVersion=${productVersion}, ContinuousIntegrationBuild=${isContinuousIntegrationBuild}`);
export const banner = "//! Licensed to the .NET Foundation under one or more agreements.\n//! The .NET Foundation licenses this file to you under the MIT license.\n//! This is generated file, see src/native/rollup.config.js\n\n";
export const banner_dts = banner + "//! This is not considered public API with backward compatibility guarantees. \n";
export const keep_classnames = /(ManagedObject|ManagedError|Span|ArraySegment)/;
export const keep_fnames = /(dotnetUpdateInternals|dotnetUpdateInternalsSubscriber)/;
export const reserved = [
"_ems_", "Module",
"dotnetInternals", "dotnetUpdateInternals", "dotnetUpdateInternalsSubscriber", "dotnetInitializeModule",
"dotnetLogger", "dotnetAssert", "dotnetApi",
"dotnetLoaderExports", "dotnetRuntimeExports", "dotnetBrowserHostExports", "dotnetInteropJSExports",
"dotnetNativeBrowserExports", "dotnetBrowserUtilsExports", "dotnetDiagnosticsExports",
];
export const externalDependencies = ["module", "process", "perf_hooks", "node:crypto"];
export const artifactsObjDir = "../../artifacts/obj";
export const isDebug = ((process.env.Configuration || "Debug").toLowerCase() !== "release");
export let gitHash;
try {
const gitInfo = gitCommitInfo();
gitHash = gitInfo.hash;
} catch (e) {
gitHash = "unknown";
}
export const envConstants = {
productVersion,
configuration,
runtimeFlavor,
gitHash,
isContinuousIntegrationBuild,
};
/* eslint-disable quotes */
export const inlinefastCheck = [
{
pattern: 'dotnetAssert\\.fastCheck\\(([^,]*), \\(\\) => *`([^`]*)`\\);',
replacement: (match) => `if (!(${match[1]})) throw new Error(\`Assert failed: ${match[2]}\`); // inlined fastCheck`
},
{
pattern: 'dotnetAssert\\.fastCheck\\(([^,]*), \\(\\) => *"([^"]*)"\\);',
replacement: (match) => `if (!(${match[1]})) throw new Error(\`Assert failed: ${match[2]}\`); // inlined fastCheck`
},
];