Added after build task in build-module generation (#1331)

* after build

* after build

* add root module

* add default after build

* Update project.ts

* revert

* after build

* add diusable

* update

* update
This commit is contained in:
NoriZC 2024-05-09 15:46:56 +08:00 коммит произвёл GitHub
Родитель c117b33764
Коммит 228c6aef23
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 19 добавлений и 3 удалений

Просмотреть файл

@ -2323,7 +2323,7 @@ export class CmdletClass extends Class {
if (operation.details.default.externalDocs) {
this.add(new Attribute(ExternalDocsAttribute, {
parameters: [`${new StringExpression(this.operation.details.default.externalDocs?.url ?? '')}`,
`${new StringExpression(this.operation.details.default.externalDocs?.description ?? '')}`]
`${new StringExpression(this.operation.details.default.externalDocs?.description ?? '')}`]
}));
}

Просмотреть файл

@ -148,6 +148,8 @@ export class Project extends codeDomProject {
public gitAttributes!: string;
public propertiesExcludedForTableview!: string;
public readme!: string;
public afterBuildTasksPath!: string;
public afterBuildTasksArgs!: string;
public dllName!: string;
public dll!: string;
public psd1!: string;
@ -327,6 +329,10 @@ export class Project extends codeDomProject {
this.gitIgnore = `${this.baseFolder}/.gitignore`;
this.gitAttributes = `${this.baseFolder}/.gitattributes`;
this.readme = `${this.baseFolder}/README.md`;
this.afterBuildTasksPath = await this.state.getValue('after-build-tasks-path', '');
const afterBuildTasksArgsDictionary: Dictionary<string> = await this.state.getValue<Dictionary<string>>('after-build-tasks-args', {});
this.afterBuildTasksArgs = JSON.stringify(afterBuildTasksArgsDictionary);
// excluded properties in table view
const excludedList = <Array<string>>(
@ -411,4 +417,4 @@ export class Project extends codeDomProject {
private convertToPsListAsString(items: Array<string>): string {
return items ? items.map((i) => `'${i}'`).join(', ') : 'undefined';
}
}
}

Просмотреть файл

@ -1,7 +1,7 @@
# ----------------------------------------------------------------------------------
${$project.pwshCommentHeader}
# ----------------------------------------------------------------------------------
param([switch]$NotIsolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs, [switch]$UX)
param([switch]$NotIsolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs, [switch]$UX, [Switch]$DisableAfterBuildTasks)
$ErrorActionPreference = 'Stop'
if($PSEdition -ne 'Core') {
@ -166,4 +166,14 @@ if (Test-Path (Join-Path $PSScriptRoot 'generate-portal-ux.ps1'))
. (Join-Path $PSScriptRoot 'generate-portal-ux.ps1')
}
if (-not $DisableAfterBuildTasks){
$afterBuildTasksPath = Join-Path $PSScriptRoot '${$project.afterBuildTasksPath}'
$afterBuildTasksArgs = ConvertFrom-Json '${$project.afterBuildTasksArgs}' -AsHashtable
if(Test-Path -Path $afterBuildTasksPath -PathType leaf){
Write-Host -ForegroundColor Green 'Running after build tasks...'
. $afterBuildTasksPath @afterBuildTasksArgs
}
}
Write-Host -ForegroundColor Green '-------------Done-------------'