@@ -14,48 +14,37 @@ The root directory of the staged artifacts. The PackageInfo files will be in the
1414PackageInfo subdirectory. The whl files are going to be in the subdirectory which
1515is the same as the artifact's name but artifact name in the file's name will have
1616 underscores instead of dashes.
17-
18- . PARAMETER ArtifactsList
19- The list of artifacts to gather namespaces for, this is only done for libraries that are
20- producing docs.
21- -ArtifactsList ('${{ convertToJson(parameters.Artifacts) }}' | ConvertFrom-Json)
2217#>
2318[CmdletBinding ()]
2419Param (
2520 [Parameter (Mandatory = $True )]
26- [string ] $ArtifactStagingDirectory ,
27- [Parameter (Mandatory = $true )]
28- [array ] $ArtifactsList
21+ [string ] $ArtifactStagingDirectory
2922)
3023
3124$ArtifactsList = $ArtifactsList | Where-Object -Not " skipPublishDocMs"
3225
3326. (Join-Path $PSScriptRoot " .." common scripts common.ps1)
3427
35- if (-not $ArtifactsList ) {
36- Write-Host " ArtifactsList is empty, nothing to process. This can happen if skipPublishDocMs is set to true for all libraries being built."
37- exit 0
38- }
39-
4028Write-Host " ArtifactStagingDirectory=$ArtifactStagingDirectory "
4129if (-not (Test-Path - Path $ArtifactStagingDirectory )) {
4230 LogError " ArtifactStagingDirectory '$ArtifactStagingDirectory ' does not exist."
4331 exit 1
4432}
4533
46- Write-Host " "
47- Write-Host " ArtifactsList:"
48- $ArtifactsList | Format-Table - Property Name | Out-String | Write-Host
49-
5034$packageInfoDirectory = Join-Path $ArtifactStagingDirectory " PackageInfo"
51-
5235$foundError = $false
53- # At this point the packageInfo files should have been already been created.
54- # The only thing being done here is adding or updating namespaces for libraries
55- # that will be producing docs.
56- foreach ($artifact in $ArtifactsList ) {
36+ $artifacts = Get-ChildItem - Path $packageInfoDirectory - File - Filter " *.json"
37+ $artifacts | Format-Table - Property Name | Out-String | Write-Host
38+
39+ if (-not $artifacts ) {
40+ Write-Host " Zero artifacts were discovered, nothing to process. This can happen if skipPublishDocMs is set to true for all libraries being built."
41+ exit 0
42+ }
43+
44+ # by this point, the PackageInfo folder will have a json file for each artifact
45+ # we simply need to read each file, get the appropriate metadata, and add the namespaces if necessary
46+ foreach ($packageInfoFile in $artifacts ) {
5747 # Get the version from the packageInfo file
58- $packageInfoFile = Join-Path $packageInfoDirectory " $ ( $artifact.Name ) .json"
5948 Write-Host " processing $ ( $packageInfoFile.FullName ) "
6049 $packageInfo = ConvertFrom-Json (Get-Content $packageInfoFile - Raw)
6150 $version = $packageInfo.Version
@@ -69,8 +58,7 @@ foreach($artifact in $ArtifactsList) {
6958 $WhlFile = Get-ChildItem - Path $WhlDir - File - Filter " $whlName -$version *.whl"
7059
7160 if (! (Test-Path $WhlFile - PathType Leaf)) {
72- LogError " Whl file for, $ ( $packageInfo.Name ) , was not found in $WhlDir . Please ensure that a .whl file is being produced for the library."
73- $foundError = $true
61+ Write-Host " Whl file for, $ ( $packageInfo.Name ) , was not found in $WhlDir . Unable to update package namespaces."
7462 continue
7563 }
7664 $namespaces = Get-NamespacesFromWhlFile $packageInfo.Name $version - PythonWhlFile $WhlFile
0 commit comments