зеркало из https://github.com/dotnet/pinvoke.git
Make azp/artifacts only warn when they can't find files
This commit is contained in:
Родитель
ecb32a2ad6
Коммит
13ab120e7f
|
@ -23,23 +23,28 @@ Function EnsureTrailingSlash($path) {
|
|||
Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse |% {
|
||||
$ArtifactName = $_.BaseName
|
||||
|
||||
(& $_).GetEnumerator() |% {
|
||||
$BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key), [UriKind]::Absolute)
|
||||
$_.Value |% {
|
||||
if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) {
|
||||
$_ = $_.FullName
|
||||
$fileGroups = & $_
|
||||
if (!$fileGroups -or $fileGroups.Count -eq 0) {
|
||||
Write-Warning "No files found for the `"$ArtifactName`" artifact."
|
||||
} else {
|
||||
$fileGroups.GetEnumerator() | % {
|
||||
$BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key), [UriKind]::Absolute)
|
||||
$_.Value | % {
|
||||
if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) {
|
||||
$_ = $_.FullName
|
||||
}
|
||||
|
||||
$artifact = New-Object -TypeName PSObject
|
||||
Add-Member -InputObject $artifact -MemberType NoteProperty -Name ArtifactName -Value $ArtifactName
|
||||
|
||||
$SourceFullPath = New-Object Uri ($BaseDirectory, $_)
|
||||
Add-Member -InputObject $artifact -MemberType NoteProperty -Name Source -Value $SourceFullPath.LocalPath
|
||||
|
||||
$RelativePath = [Uri]::UnescapeDataString($BaseDirectory.MakeRelative($SourceFullPath))
|
||||
Add-Member -InputObject $artifact -MemberType NoteProperty -Name ContainerFolder -Value (Split-Path $RelativePath)
|
||||
|
||||
Write-Output $artifact
|
||||
}
|
||||
|
||||
$artifact = New-Object -TypeName PSObject
|
||||
Add-Member -InputObject $artifact -MemberType NoteProperty -Name ArtifactName -Value $ArtifactName
|
||||
|
||||
$SourceFullPath = New-Object Uri ($BaseDirectory, $_)
|
||||
Add-Member -InputObject $artifact -MemberType NoteProperty -Name Source -Value $SourceFullPath.LocalPath
|
||||
|
||||
$RelativePath = [Uri]::UnescapeDataString($BaseDirectory.MakeRelative($SourceFullPath))
|
||||
Add-Member -InputObject $artifact -MemberType NoteProperty -Name ContainerFolder -Value (Split-Path $RelativePath)
|
||||
|
||||
Write-Output $artifact
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
|||
$artifactsRoot = "$RepoRoot\bin"
|
||||
}
|
||||
|
||||
if (!(Test-Path $artifactsRoot/build_logs)) { return }
|
||||
|
||||
@{
|
||||
"$artifactsRoot/build_logs" = (Get-ChildItem -Recurse "$artifactsRoot/build_logs")
|
||||
}
|
||||
|
|
|
@ -9,9 +9,11 @@ if ($env:SYSTEM_DEFAULTWORKINGDIRECTORY) {
|
|||
Set-Content -Path $_ -Value $content -Encoding UTF8
|
||||
}
|
||||
} else {
|
||||
Write-Warning "Azure Pipelines not detected. Machine-neutral token replacement skipped."
|
||||
Write-Warning "coverageResults: Azure Pipelines not detected. Machine-neutral token replacement skipped."
|
||||
}
|
||||
|
||||
if (!((Test-Path $RepoRoot\bin) -and (Test-Path $RepoRoot\obj))) { return }
|
||||
|
||||
@{
|
||||
$RepoRoot = (
|
||||
(Get-ChildItem "$RepoRoot\bin\coverage.cobertura.xml" -Recurse) +
|
||||
|
|
|
@ -6,6 +6,8 @@ if (!$BuildConfiguration) {
|
|||
|
||||
$PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration"
|
||||
|
||||
if (!(Test-Path $PackagesRoot)) { return }
|
||||
|
||||
@{
|
||||
"$PackagesRoot" = (Get-ChildItem $PackagesRoot -Recurse)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..")
|
||||
$ObjRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\obj")
|
||||
|
||||
if (!(Test-Path $ObjRoot)) { return }
|
||||
|
||||
@{
|
||||
"$RepoRoot\obj" = (
|
||||
(Get-ChildItem "$RepoRoot\obj\project.assets.json" -Recurse)
|
||||
"$ObjRoot" = (
|
||||
(Get-ChildItem "$ObjRoot\project.assets.json" -Recurse)
|
||||
);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче