@uipath/packager-tool-workflowcompiler 1.202.0-preview.141 → 1.202.0-preview.142
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -8
- package/src/i18n/index.ts +0 -45
- package/src/i18n/locales/de.json +0 -41
- package/src/i18n/locales/en.ts +0 -62
- package/src/i18n/locales/es-MX.json +0 -41
- package/src/i18n/locales/es.json +0 -41
- package/src/i18n/locales/fr.json +0 -41
- package/src/i18n/locales/ja.json +0 -41
- package/src/i18n/locales/ko.json +0 -41
- package/src/i18n/locales/pt-BR.json +0 -41
- package/src/i18n/locales/pt.json +0 -41
- package/src/i18n/locales/ro.json +0 -41
- package/src/i18n/locales/ru.json +0 -41
- package/src/i18n/locales/tr.json +0 -41
- package/src/i18n/locales/zh-CN.json +0 -41
- package/src/i18n/locales/zh-TW.json +0 -41
- package/src/i18n/locales/zu.json +0 -41
- package/src/index.ts +0 -28
- package/src/output-entry.ts +0 -53
- package/src/workflow-cleanup-details.ts +0 -4
- package/src/workflow-compiler-config.ts +0 -57
- package/src/workflow-compiler-executor.ts +0 -530
- package/src/workflow-compiler-path-resolver.ts +0 -302
- package/src/workflow-compiler-tool-factory.ts +0 -82
- package/src/workflow-compiler-tool.ts +0 -519
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
import { execFileSync } from "node:child_process";
|
|
2
|
-
import { homedir, platform } from "node:os";
|
|
3
|
-
import type {
|
|
4
|
-
IFileSystem,
|
|
5
|
-
IToolLogger,
|
|
6
|
-
} from "@uipath/solutionpackager-tool-core";
|
|
7
|
-
import {
|
|
8
|
-
Path,
|
|
9
|
-
TemporaryStorageService,
|
|
10
|
-
translate,
|
|
11
|
-
} from "@uipath/solutionpackager-tool-core";
|
|
12
|
-
import { workflowCompilerConfig } from "./workflow-compiler-config.js";
|
|
13
|
-
|
|
14
|
-
const NUGET_FEED_URL = "https://pkgs.uipath.com/internal/index.json";
|
|
15
|
-
|
|
16
|
-
const WORKFLOW_COMPILER_DLL_NAME = "UiPath.WorkflowCompiler.dll";
|
|
17
|
-
|
|
18
|
-
const PLATFORM_PACKAGE_IDS: Record<string, string> = {
|
|
19
|
-
win32: "UiPath.WorkflowCompiler.Windows",
|
|
20
|
-
darwin: "UiPath.WorkflowCompiler.macOS",
|
|
21
|
-
linux: "UiPath.WorkflowCompiler.Linux",
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const RESTORE_CSPROJ_TEMPLATE = `<Project Sdk="Microsoft.NET.Sdk">
|
|
25
|
-
<PropertyGroup>
|
|
26
|
-
<TargetFramework>net8.0</TargetFramework>
|
|
27
|
-
</PropertyGroup>
|
|
28
|
-
<ItemGroup>
|
|
29
|
-
<PackageReference Include="{packageId}" Version="{version}" />
|
|
30
|
-
</ItemGroup>
|
|
31
|
-
</Project>`;
|
|
32
|
-
|
|
33
|
-
const EMPTY_NUGET_CONFIG = `<?xml version="1.0" encoding="utf-8"?>
|
|
34
|
-
<configuration>
|
|
35
|
-
</configuration>`;
|
|
36
|
-
|
|
37
|
-
export interface IWorkflowCompilerPathResolver {
|
|
38
|
-
getCompilerPathAsync(): Promise<string>;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Resolves and caches the workflow compiler DLL path. The executor always
|
|
43
|
-
* launches `dotnet <dll>`, so the resolved path must point at a managed
|
|
44
|
-
* assembly (UiPath.WorkflowCompiler.dll) on every platform.
|
|
45
|
-
*
|
|
46
|
-
* Resolution chain:
|
|
47
|
-
* 1. In-memory cache (subsequent calls)
|
|
48
|
-
* 2. Explicit config path (`workflowCompilerConfig.workflowCompilerPath`)
|
|
49
|
-
* 3. `UIPATH_WORKFLOWCOMPILER_LOCATION` env var — full path to .dll (pipelines / offline)
|
|
50
|
-
* 4. NuGet global packages cache
|
|
51
|
-
* 5. `dotnet restore` to populate NuGet cache, then (4) again
|
|
52
|
-
*/
|
|
53
|
-
export class WorkflowCompilerPathResolver
|
|
54
|
-
implements IWorkflowCompilerPathResolver
|
|
55
|
-
{
|
|
56
|
-
private static instance: IWorkflowCompilerPathResolver | null = null;
|
|
57
|
-
private cachedPath: string | null = null;
|
|
58
|
-
private pendingResolution: Promise<string> | null = null;
|
|
59
|
-
|
|
60
|
-
private readonly tempStorage: TemporaryStorageService;
|
|
61
|
-
|
|
62
|
-
constructor(
|
|
63
|
-
private readonly logger: IToolLogger,
|
|
64
|
-
private readonly fileSystem: IFileSystem,
|
|
65
|
-
) {
|
|
66
|
-
this.tempStorage = new TemporaryStorageService(fileSystem);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
static getInstance(
|
|
70
|
-
logger: IToolLogger,
|
|
71
|
-
fileSystem: IFileSystem,
|
|
72
|
-
): IWorkflowCompilerPathResolver {
|
|
73
|
-
if (!WorkflowCompilerPathResolver.instance) {
|
|
74
|
-
WorkflowCompilerPathResolver.instance =
|
|
75
|
-
new WorkflowCompilerPathResolver(logger, fileSystem);
|
|
76
|
-
}
|
|
77
|
-
return WorkflowCompilerPathResolver.instance;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
async getCompilerPathAsync(): Promise<string> {
|
|
81
|
-
if (this.cachedPath) {
|
|
82
|
-
this.logger.info(
|
|
83
|
-
translate.t(
|
|
84
|
-
"toolWorkflowcompiler.pathResolver.info.usingCached",
|
|
85
|
-
{ path: this.cachedPath },
|
|
86
|
-
),
|
|
87
|
-
);
|
|
88
|
-
return this.cachedPath;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// In-process coalescing only: dedupes concurrent callers within this
|
|
92
|
-
// Node process. Parallel `uip` invocations each run their own restore;
|
|
93
|
-
// NuGet's own per-package lock handles cross-process coordination of
|
|
94
|
-
// the cache.
|
|
95
|
-
if (this.pendingResolution) {
|
|
96
|
-
return this.pendingResolution;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
this.pendingResolution = this.resolveCompilerPath();
|
|
100
|
-
this.cachedPath = await this.pendingResolution;
|
|
101
|
-
this.logger.info(
|
|
102
|
-
translate.t("toolWorkflowcompiler.pathResolver.info.resolved", {
|
|
103
|
-
path: this.cachedPath,
|
|
104
|
-
}),
|
|
105
|
-
);
|
|
106
|
-
return this.cachedPath;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
private async resolveCompilerPath(): Promise<string> {
|
|
110
|
-
this.logger.info("[PathResolver] resolveCompilerPath started");
|
|
111
|
-
|
|
112
|
-
if (workflowCompilerConfig.workflowCompilerPath) {
|
|
113
|
-
this.logger.info(
|
|
114
|
-
translate.t(
|
|
115
|
-
"toolWorkflowcompiler.pathResolver.info.usingExplicitPath",
|
|
116
|
-
{ path: workflowCompilerConfig.workflowCompilerPath },
|
|
117
|
-
),
|
|
118
|
-
);
|
|
119
|
-
return workflowCompilerConfig.workflowCompilerPath;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
this.logger.info(
|
|
123
|
-
translate.t("toolWorkflowcompiler.pathResolver.info.resolving"),
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
const envPath = await this.findInEnvLocation();
|
|
127
|
-
if (envPath) return envPath;
|
|
128
|
-
|
|
129
|
-
const version = workflowCompilerConfig.workflowCompilerVersion;
|
|
130
|
-
const compilerPath = this.getNuGetCompilerPath(version);
|
|
131
|
-
|
|
132
|
-
this.logger.info(
|
|
133
|
-
translate.t(
|
|
134
|
-
"toolWorkflowcompiler.pathResolver.info.checkingNuGetCache",
|
|
135
|
-
{ path: compilerPath },
|
|
136
|
-
),
|
|
137
|
-
);
|
|
138
|
-
if (await this.fileSystem.exists(compilerPath)) {
|
|
139
|
-
this.logger.info(
|
|
140
|
-
translate.t(
|
|
141
|
-
"toolWorkflowcompiler.pathResolver.info.foundInNuGetCache",
|
|
142
|
-
),
|
|
143
|
-
);
|
|
144
|
-
return compilerPath;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
this.logger.info(
|
|
148
|
-
translate.t(
|
|
149
|
-
"toolWorkflowcompiler.pathResolver.info.notFoundStartingInstall",
|
|
150
|
-
),
|
|
151
|
-
);
|
|
152
|
-
return this.restoreAndResolve(compilerPath, version);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
private async findInEnvLocation(): Promise<string | null> {
|
|
156
|
-
const location = process.env.UIPATH_WORKFLOWCOMPILER_LOCATION;
|
|
157
|
-
if (!location) return null;
|
|
158
|
-
|
|
159
|
-
this.logger.info(
|
|
160
|
-
translate.t(
|
|
161
|
-
"toolWorkflowcompiler.pathResolver.info.checkingEnvVar",
|
|
162
|
-
{ path: location },
|
|
163
|
-
),
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
// Env var must point to UiPath.WorkflowCompiler.dll. The executor
|
|
167
|
-
// always launches via `dotnet <dll>`; .exe apphost paths are not
|
|
168
|
-
// accepted because they cannot be loaded as managed assemblies.
|
|
169
|
-
if (
|
|
170
|
-
location.endsWith(".dll") &&
|
|
171
|
-
(await this.fileSystem.exists(location))
|
|
172
|
-
) {
|
|
173
|
-
this.logger.info(
|
|
174
|
-
translate.t(
|
|
175
|
-
"toolWorkflowcompiler.pathResolver.info.foundViaEnv",
|
|
176
|
-
),
|
|
177
|
-
);
|
|
178
|
-
return location;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
private async restoreAndResolve(
|
|
185
|
-
compilerPath: string,
|
|
186
|
-
version: string,
|
|
187
|
-
): Promise<string> {
|
|
188
|
-
const packageId = this.getPackageId();
|
|
189
|
-
const tempDir = await this.tempStorage.getTempFolderPath();
|
|
190
|
-
|
|
191
|
-
try {
|
|
192
|
-
this.logger.info(
|
|
193
|
-
translate.t(
|
|
194
|
-
"toolWorkflowcompiler.pathResolver.info.restoringPackage",
|
|
195
|
-
{ packageName: packageId, version, platform: platform() },
|
|
196
|
-
),
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
const csproj = RESTORE_CSPROJ_TEMPLATE.replace(
|
|
200
|
-
"{packageId}",
|
|
201
|
-
packageId,
|
|
202
|
-
).replace("{version}", version);
|
|
203
|
-
await this.fileSystem.writeFile(
|
|
204
|
-
Path.join(tempDir, "restore.csproj"),
|
|
205
|
-
csproj,
|
|
206
|
-
);
|
|
207
|
-
await this.fileSystem.writeFile(
|
|
208
|
-
Path.join(tempDir, "nuget.config"),
|
|
209
|
-
EMPTY_NUGET_CONFIG,
|
|
210
|
-
);
|
|
211
|
-
|
|
212
|
-
this.logger.info(
|
|
213
|
-
translate.t(
|
|
214
|
-
"toolWorkflowcompiler.pathResolver.info.runningDotnetRestore",
|
|
215
|
-
),
|
|
216
|
-
);
|
|
217
|
-
try {
|
|
218
|
-
execFileSync(
|
|
219
|
-
"dotnet",
|
|
220
|
-
[
|
|
221
|
-
"restore",
|
|
222
|
-
"--source",
|
|
223
|
-
NUGET_FEED_URL,
|
|
224
|
-
"--source",
|
|
225
|
-
"https://api.nuget.org/v3/index.json",
|
|
226
|
-
],
|
|
227
|
-
{
|
|
228
|
-
cwd: tempDir,
|
|
229
|
-
stdio: "pipe",
|
|
230
|
-
},
|
|
231
|
-
);
|
|
232
|
-
} catch (error: unknown) {
|
|
233
|
-
const err = error as Record<string, unknown>;
|
|
234
|
-
const stderr = err?.stderr ? String(err.stderr).trim() : "";
|
|
235
|
-
const stdout = err?.stdout ? String(err.stdout).trim() : "";
|
|
236
|
-
const details =
|
|
237
|
-
stderr ||
|
|
238
|
-
stdout ||
|
|
239
|
-
(error instanceof Error ? error.message : String(error));
|
|
240
|
-
throw new Error(
|
|
241
|
-
translate.t(
|
|
242
|
-
"toolWorkflowcompiler.pathResolver.errors.dotnetRestoreFailed",
|
|
243
|
-
{ details },
|
|
244
|
-
),
|
|
245
|
-
);
|
|
246
|
-
}
|
|
247
|
-
this.logger.info(
|
|
248
|
-
translate.t(
|
|
249
|
-
"toolWorkflowcompiler.pathResolver.info.restoreCompleted",
|
|
250
|
-
),
|
|
251
|
-
);
|
|
252
|
-
|
|
253
|
-
if (!(await this.fileSystem.exists(compilerPath))) {
|
|
254
|
-
throw new Error(
|
|
255
|
-
translate.t(
|
|
256
|
-
"toolWorkflowcompiler.pathResolver.errors.compilerNotFoundAfterRestore",
|
|
257
|
-
),
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
this.logger.info(
|
|
262
|
-
translate.t(
|
|
263
|
-
"toolWorkflowcompiler.pathResolver.info.installCompleted",
|
|
264
|
-
),
|
|
265
|
-
);
|
|
266
|
-
return compilerPath;
|
|
267
|
-
} finally {
|
|
268
|
-
this.logger.info(
|
|
269
|
-
translate.t(
|
|
270
|
-
"toolWorkflowcompiler.pathResolver.info.cleaningUp",
|
|
271
|
-
),
|
|
272
|
-
);
|
|
273
|
-
await this.tempStorage.cleanup();
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
private getPackageId(): string {
|
|
278
|
-
const packageId = PLATFORM_PACKAGE_IDS[platform()];
|
|
279
|
-
if (!packageId) {
|
|
280
|
-
throw new Error(
|
|
281
|
-
translate.t(
|
|
282
|
-
"toolWorkflowcompiler.pathResolver.errors.unsupportedPlatform",
|
|
283
|
-
{ platform: platform() },
|
|
284
|
-
),
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
return packageId;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
private getNuGetCompilerPath(version: string): string {
|
|
291
|
-
const cacheRoot =
|
|
292
|
-
process.env.NUGET_PACKAGES ??
|
|
293
|
-
Path.join(homedir(), ".nuget", "packages");
|
|
294
|
-
return Path.join(
|
|
295
|
-
cacheRoot,
|
|
296
|
-
this.getPackageId().toLowerCase(),
|
|
297
|
-
version.toLowerCase(),
|
|
298
|
-
"WorkflowCompiler",
|
|
299
|
-
WORKFLOW_COMPILER_DLL_NAME,
|
|
300
|
-
);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { execSync } from "node:child_process";
|
|
2
|
-
import {
|
|
3
|
-
type IFileSystem,
|
|
4
|
-
type IProjectToolFactory,
|
|
5
|
-
type IToolLogger,
|
|
6
|
-
type ProjectOperationContext,
|
|
7
|
-
type ProjectTool,
|
|
8
|
-
type ProjectType,
|
|
9
|
-
ProjectTypes,
|
|
10
|
-
translate,
|
|
11
|
-
} from "@uipath/solutionpackager-tool-core";
|
|
12
|
-
import {
|
|
13
|
-
DEFAULT_DOTNET_PATH,
|
|
14
|
-
workflowCompilerConfig,
|
|
15
|
-
} from "./workflow-compiler-config.js";
|
|
16
|
-
import { WorkflowCompilerTool } from "./workflow-compiler-tool.js";
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Factory for creating a workflow compiler tool.
|
|
20
|
-
* Handles Process, Library, WebApp, and Tests project types.
|
|
21
|
-
*/
|
|
22
|
-
export class WorkflowCompilerToolFactory implements IProjectToolFactory {
|
|
23
|
-
/**
|
|
24
|
-
* Process-lifetime cache of a successful `dotnet --version` lookup.
|
|
25
|
-
* Negative results are not cached so a one-off failure does not pin
|
|
26
|
-
* the factory across the rest of the process.
|
|
27
|
-
*/
|
|
28
|
-
private static cachedDotnetAvailable: boolean | undefined;
|
|
29
|
-
|
|
30
|
-
readonly supportedTypes: readonly ProjectType[] = [
|
|
31
|
-
ProjectTypes.Process,
|
|
32
|
-
ProjectTypes.Library,
|
|
33
|
-
ProjectTypes.Tests,
|
|
34
|
-
ProjectTypes.WebApp,
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
async createAsync(
|
|
38
|
-
logger: IToolLogger,
|
|
39
|
-
fileSystem: IFileSystem,
|
|
40
|
-
context?: ProjectOperationContext,
|
|
41
|
-
): Promise<ProjectTool> {
|
|
42
|
-
if (!this.isPinnedByCaller() && !this.isDotnetAvailable()) {
|
|
43
|
-
throw new Error(
|
|
44
|
-
translate.t("toolWorkflowcompiler.errors.dotnetNotAvailable"),
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
return new WorkflowCompilerTool(fileSystem, logger, context);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* True when the caller has supplied both the compiler and the dotnet host to
|
|
52
|
-
* run it with — i.e. it resolved its own .NET and neither the NuGet-restore
|
|
53
|
-
* fallback nor a machine-wide install is involved.
|
|
54
|
-
*
|
|
55
|
-
* The preflight below asks PATH for an SDK. A pinned host is typically a
|
|
56
|
-
* runtime-only bundle (Studio/Robot ship the runtime, never the SDK), which
|
|
57
|
-
* cannot answer `dotnet --version` at all — that is an SDK verb. Probing it
|
|
58
|
-
* can therefore only reject a configuration that works, so a caller that has
|
|
59
|
-
* pinned both is trusted and the tool is created unconditionally.
|
|
60
|
-
*/
|
|
61
|
-
private isPinnedByCaller(): boolean {
|
|
62
|
-
return (
|
|
63
|
-
workflowCompilerConfig.workflowCompilerPath !== undefined &&
|
|
64
|
-
workflowCompilerConfig.dotnetPath !== DEFAULT_DOTNET_PATH
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
private isDotnetAvailable(): boolean {
|
|
69
|
-
if (WorkflowCompilerToolFactory.cachedDotnetAvailable !== undefined) {
|
|
70
|
-
return WorkflowCompilerToolFactory.cachedDotnetAvailable;
|
|
71
|
-
}
|
|
72
|
-
try {
|
|
73
|
-
execSync("dotnet --version", {
|
|
74
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
75
|
-
});
|
|
76
|
-
WorkflowCompilerToolFactory.cachedDotnetAvailable = true;
|
|
77
|
-
return true;
|
|
78
|
-
} catch {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|