improve locking naming
parent
053a4a8963
commit
048f9386a8
|
@ -5501,27 +5501,25 @@ const cloud_runner_folders_1 = __nccwpck_require__(13527);
|
|||
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
||||
class TaskParameterSerializer {
|
||||
static createCloudRunnerEnvironmentVariables(buildParameters) {
|
||||
let result = this.uniqBy([
|
||||
const result = this.uniqBy([
|
||||
...[
|
||||
{ name: 'BUILD_TARGET', value: buildParameters.targetPlatform },
|
||||
{ name: 'GITHUB_TOKEN', value: process.env.GITHUB_TOKEN },
|
||||
],
|
||||
...TaskParameterSerializer.serializeFromObject(buildParameters),
|
||||
...TaskParameterSerializer.readInput(),
|
||||
...TaskParameterSerializer.readCloudRunerOptions(),
|
||||
...cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getSecrets(cloud_runner_custom_hooks_1.CloudRunnerCustomHooks.getHooks(buildParameters.commandHooks)),
|
||||
]
|
||||
.filter((x) => !TaskParameterSerializer.blocked.has(x.name) &&
|
||||
.filter((x) => !TaskParameterSerializer.blockedParameterNames.has(x.name) &&
|
||||
x.value !== '' &&
|
||||
x.value !== undefined &&
|
||||
x.name !== `CUSTOM_JOB` &&
|
||||
x.name !== `CI_CUSTOM_JOB` &&
|
||||
x.value !== `undefined`)
|
||||
.map((x) => {
|
||||
x.name = TaskParameterSerializer.ToEnvVarFormat(x.name);
|
||||
x.name = `CI_${TaskParameterSerializer.ToEnvVarFormat(x.name)}`;
|
||||
x.value = `${x.value}`;
|
||||
return x;
|
||||
}), (item) => item.name);
|
||||
result = result.filter((x) => !result.some((y) => y.name === `CI_${x}`));
|
||||
cloud_runner_logger_1.default.log(JSON.stringify(result, undefined, 4));
|
||||
return result;
|
||||
}
|
||||
|
@ -5537,7 +5535,7 @@ class TaskParameterSerializer {
|
|||
const buildParameters = new build_parameters_1.default();
|
||||
const keys = [
|
||||
...new Set(Object.getOwnPropertyNames(process.env)
|
||||
.filter((x) => !this.blocked.has(x) && x.startsWith('CI_'))
|
||||
.filter((x) => !this.blockedParameterNames.has(x) && x.startsWith('CI_'))
|
||||
.map((x) => TaskParameterSerializer.UndoEnvVarFormat(x))),
|
||||
];
|
||||
for (const element of keys) {
|
||||
|
@ -5550,6 +5548,9 @@ class TaskParameterSerializer {
|
|||
static readInput() {
|
||||
return TaskParameterSerializer.serializeFromType(__1.Input);
|
||||
}
|
||||
static readCloudRunerOptions() {
|
||||
return TaskParameterSerializer.serializeFromType(cloud_runner_options_1.default);
|
||||
}
|
||||
static ToEnvVarFormat(input) {
|
||||
return cloud_runner_options_1.default.ToEnvVarFormat(input);
|
||||
}
|
||||
|
@ -5568,10 +5569,10 @@ class TaskParameterSerializer {
|
|||
}
|
||||
static serializeFromObject(buildParameters) {
|
||||
const array = [];
|
||||
const keys = Object.getOwnPropertyNames(buildParameters).filter((x) => !this.blocked.has(x));
|
||||
const keys = Object.getOwnPropertyNames(buildParameters).filter((x) => !this.blockedParameterNames.has(x));
|
||||
for (const element of keys) {
|
||||
array.push({
|
||||
name: `CI_${TaskParameterSerializer.ToEnvVarFormat(element)}`,
|
||||
name: TaskParameterSerializer.ToEnvVarFormat(element),
|
||||
value: buildParameters[element],
|
||||
});
|
||||
}
|
||||
|
@ -5630,7 +5631,17 @@ class TaskParameterSerializer {
|
|||
}
|
||||
}
|
||||
exports.TaskParameterSerializer = TaskParameterSerializer;
|
||||
TaskParameterSerializer.blocked = new Set(['0', 'length', 'prototype', '', 'unityVersion']);
|
||||
TaskParameterSerializer.blockedParameterNames = new Set([
|
||||
'0',
|
||||
'length',
|
||||
'prototype',
|
||||
'',
|
||||
'unityVersion',
|
||||
'CACHE_UNITY_INSTALLATION_ON_MAC',
|
||||
'RUNNER_TEMP_PATH',
|
||||
'NAME',
|
||||
'CUSTOM_JOB',
|
||||
]);
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -11,11 +11,21 @@ import { CloudRunnerFolders } from './cloud-runner-folders';
|
|||
import CloudRunnerLogger from './cloud-runner-logger';
|
||||
|
||||
export class TaskParameterSerializer {
|
||||
static readonly blocked = new Set(['0', 'length', 'prototype', '', 'unityVersion']);
|
||||
static readonly blockedParameterNames: Set<string> = new Set([
|
||||
'0',
|
||||
'length',
|
||||
'prototype',
|
||||
'',
|
||||
'unityVersion',
|
||||
'CACHE_UNITY_INSTALLATION_ON_MAC',
|
||||
'RUNNER_TEMP_PATH',
|
||||
'NAME',
|
||||
'CUSTOM_JOB',
|
||||
]);
|
||||
public static createCloudRunnerEnvironmentVariables(
|
||||
buildParameters: BuildParameters,
|
||||
): CloudRunnerEnvironmentVariable[] {
|
||||
let result: CloudRunnerEnvironmentVariable[] = this.uniqBy(
|
||||
const result: CloudRunnerEnvironmentVariable[] = this.uniqBy(
|
||||
[
|
||||
...[
|
||||
{ name: 'BUILD_TARGET', value: buildParameters.targetPlatform },
|
||||
|
@ -23,26 +33,24 @@ export class TaskParameterSerializer {
|
|||
],
|
||||
...TaskParameterSerializer.serializeFromObject(buildParameters),
|
||||
...TaskParameterSerializer.readInput(),
|
||||
...TaskParameterSerializer.readCloudRunerOptions(),
|
||||
...CloudRunnerCustomHooks.getSecrets(CloudRunnerCustomHooks.getHooks(buildParameters.commandHooks)),
|
||||
]
|
||||
.filter(
|
||||
(x) =>
|
||||
!TaskParameterSerializer.blocked.has(x.name) &&
|
||||
!TaskParameterSerializer.blockedParameterNames.has(x.name) &&
|
||||
x.value !== '' &&
|
||||
x.value !== undefined &&
|
||||
x.name !== `CUSTOM_JOB` &&
|
||||
x.name !== `CI_CUSTOM_JOB` &&
|
||||
x.value !== `undefined`,
|
||||
)
|
||||
.map((x) => {
|
||||
x.name = TaskParameterSerializer.ToEnvVarFormat(x.name);
|
||||
x.name = `CI_${TaskParameterSerializer.ToEnvVarFormat(x.name)}`;
|
||||
x.value = `${x.value}`;
|
||||
|
||||
return x;
|
||||
}),
|
||||
(item: CloudRunnerEnvironmentVariable) => item.name,
|
||||
);
|
||||
result = result.filter((x) => !result.some((y) => y.name === `CI_${x}`));
|
||||
CloudRunnerLogger.log(JSON.stringify(result, undefined, 4));
|
||||
|
||||
return result;
|
||||
|
@ -64,7 +72,7 @@ export class TaskParameterSerializer {
|
|||
const keys = [
|
||||
...new Set(
|
||||
Object.getOwnPropertyNames(process.env)
|
||||
.filter((x) => !this.blocked.has(x) && x.startsWith('CI_'))
|
||||
.filter((x) => !this.blockedParameterNames.has(x) && x.startsWith('CI_'))
|
||||
.map((x) => TaskParameterSerializer.UndoEnvVarFormat(x)),
|
||||
),
|
||||
];
|
||||
|
@ -82,6 +90,10 @@ export class TaskParameterSerializer {
|
|||
return TaskParameterSerializer.serializeFromType(Input);
|
||||
}
|
||||
|
||||
private static readCloudRunerOptions() {
|
||||
return TaskParameterSerializer.serializeFromType(CloudRunnerOptions);
|
||||
}
|
||||
|
||||
public static ToEnvVarFormat(input: string): string {
|
||||
return CloudRunnerOptions.ToEnvVarFormat(input);
|
||||
}
|
||||
|
@ -106,10 +118,10 @@ export class TaskParameterSerializer {
|
|||
|
||||
private static serializeFromObject(buildParameters: any) {
|
||||
const array: any[] = [];
|
||||
const keys = Object.getOwnPropertyNames(buildParameters).filter((x) => !this.blocked.has(x));
|
||||
const keys = Object.getOwnPropertyNames(buildParameters).filter((x) => !this.blockedParameterNames.has(x));
|
||||
for (const element of keys) {
|
||||
array.push({
|
||||
name: `CI_${TaskParameterSerializer.ToEnvVarFormat(element)}`,
|
||||
name: TaskParameterSerializer.ToEnvVarFormat(element),
|
||||
value: buildParameters[element],
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue