Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ steps:
PRTitle: "Docs.MS Readme Update."
BaseBranchName: smoke-test
WorkingDirectory: ${{parameters.WorkingDirectory}}/repo
ScriptDirectory: ${{parameters.WorkingDirectory}}/${{parameters.ScriptDirectory}}
ScriptDirectory: ${{parameters.WorkingDirectory}}/${{parameters.ScriptDirectory}}
68 changes: 53 additions & 15 deletions eng/common/scripts/artifact-metadata-parsing.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,21 @@ function ParseMavenPackage($pkg, $workingDirectory) {
$pkgId = $contentXML.project.artifactId
$pkgVersion = $contentXML.project.version
$groupId = if ($contentXML.project.groupId -eq $null) { $contentXML.project.parent.groupId } else { $contentXML.project.groupId }
$releaseNotes = ""
$readmeContent = ""

# if it's a snapshot. return $null (as we don't want to create tags for this, but we also don't want to fail)
if ($pkgVersion.Contains("SNAPSHOT")) {
return $null
}

$releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation @(Get-ChildItem -Path $pkg.DirectoryName -Recurse -Include "$($pkg.Basename)-changelog.md")[0]
$changeLogLoc = @(Get-ChildItem -Path $pkg.DirectoryName -Recurse -Include "$($pkg.Basename)-changelog.md")[0]
if ($changeLogLoc) {
$releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation $changeLogLoc
}

$readmeContentLoc = @(Get-ChildItem -Path $pkg.DirectoryName -Recurse -Include "$($pkg.Basename)-readme.md")[0]
if (Test-Path -Path $readmeContentLoc) {
if ($readmeContentLoc) {
$readmeContent = Get-Content -Raw $readmeContentLoc
}

Expand Down Expand Up @@ -155,15 +160,23 @@ function ResolvePkgJson($workFolder) {
function ParseNPMPackage($pkg, $workingDirectory) {
$workFolder = "$workingDirectory$($pkg.Basename)"
$origFolder = Get-Location
$releaseNotes = ""
$readmeContent = ""

New-Item -ItemType Directory -Force -Path $workFolder
cd $workFolder

tar -xzf $pkg

$packageJSON = ResolvePkgJson -workFolder $workFolder | Get-Content | ConvertFrom-Json
$releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation @(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0]

$changeLogLoc = @(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0]
if ($changeLogLoc) {
$releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation $changeLogLoc
}

$readmeContentLoc = @(Get-ChildItem -Path $workFolder -Recurse -Include "README.md")[0]
if (Test-Path -Path $readmeContentLoc) {
if ($readmeContentLoc) {
$readmeContent = Get-Content -Raw $readmeContentLoc
}

Expand Down Expand Up @@ -208,15 +221,22 @@ function ParseNugetPackage($pkg, $workingDirectory) {
$workFolder = "$workingDirectory$($pkg.Basename)"
$origFolder = Get-Location
$zipFileLocation = "$workFolder/$($pkg.Basename).zip"
$releaseNotes = ""
$readmeContent = ""

New-Item -ItemType Directory -Force -Path $workFolder

Copy-Item -Path $pkg -Destination $zipFileLocation
Expand-Archive -Path $zipFileLocation -DestinationPath $workFolder
[xml] $packageXML = Get-ChildItem -Path "$workFolder/*.nuspec" | Get-Content
$releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation @(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0]

$changeLogLoc = @(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0]
if ($changeLogLoc) {
$releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation $changeLogLoc
}

$readmeContentLoc = @(Get-ChildItem -Path $workFolder -Recurse -Include "README.md")[0]
if (Test-Path -Path $readmeContentLoc) {
if ($readmeContentLoc) {
$readmeContent = Get-Content -Raw $readmeContentLoc
}

Expand Down Expand Up @@ -269,12 +289,19 @@ function ParsePyPIPackage($pkg, $workingDirectory) {

$workFolder = "$workingDirectory$($pkg.Basename)"
$origFolder = Get-Location
New-Item -ItemType Directory -Force -Path $workFolder
$releaseNotes = ""
$readmeContent = ""

New-Item -ItemType Directory -Force -Path $workFolder
Expand-Archive -Path $pkg -DestinationPath $workFolder
$releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation @(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0]

$changeLogLoc = @(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0]
if ($changeLogLoc) {
$releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation $changeLogLoc
}

$readmeContentLoc = @(Get-ChildItem -Path $workFolder -Recurse -Include "README.md")[0]
if (Test-Path -Path $readmeContentLoc) {
if ($readmeContentLoc) {
$readmeContent = Get-Content -Raw $readmeContentLoc
}
Remove-Item $workFolder -Force -Recurse -ErrorAction SilentlyContinue
Expand All @@ -291,23 +318,28 @@ function ParsePyPIPackage($pkg, $workingDirectory) {
function ParseCArtifact($pkg, $workingDirectory) {
$packageInfo = Get-Content -Raw -Path $pkg | ConvertFrom-JSON
$packageArtifactLocation = (Get-ItemProperty $pkg).Directory.FullName
$releaseNotes = ""
$readmeContent = ""

$releaseNotes = ExtractReleaseNotes -changeLogLocation @(Get-ChildItem -Path $packageArtifactLocation -Recurse -Include "CHANGELOG.md")[0]

$changeLogLoc = @(Get-ChildItem -Path $packageArtifactLocation -Recurse -Include "CHANGELOG.md")[0]
if ($changeLogLoc)
{
$releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation $changeLogLoc
}

$readmeContentLoc = @(Get-ChildItem -Path $packageArtifactLocation -Recurse -Include "README.md")[0]
if (Test-Path -Path $readmeContentLoc) {
if ($readmeContentLoc) {
$readmeContent = Get-Content -Raw $readmeContentLoc
}

return New-Object PSObject -Property @{
PackageId = $packageInfo.name
PackageId = ''
PackageVersion = $packageInfo.version
# Artifact info is always considered deployable for C becasue it is not
# deployed anywhere. Dealing with duplicate tags happens downstream in
# CheckArtifactShaAgainstTagsList
Deployable = $true
ReleaseNotes = $releaseNotes
ReadmeContent = $readmeContent
}
}

Expand Down Expand Up @@ -410,10 +442,16 @@ function VerifyPackages($pkgRepository, $artifactLocation, $workingDirectory, $a
exit(1)
}

$tag = if ($parsedPackage.packageId) {
"$($parsedPackage.packageId)_$($parsedPackage.PackageVersion)"
} else {
$parsedPackage.PackageVersion
}

$pkgList += New-Object PSObject -Property @{
PackageId = $parsedPackage.PackageId
PackageVersion = $parsedPackage.PackageVersion
Tag = ($parsedPackage.PackageId + "_" + $parsedPackage.PackageVersion)
Tag = $tag
ReleaseNotes = $parsedPackage.ReleaseNotes
ReadmeContent = $parsedPackage.ReadmeContent
}
Expand Down
24 changes: 16 additions & 8 deletions eng/common/scripts/copy-docs-to-blobstorage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,17 @@ if ($Language -eq "java")
jar -xf "$($Item.FullName)"
Set-Location $CurrentLocation

# If javadocs are produced for a library with source, there will always be an
# index.html. If this file doesn't exist in the UnjarredDocumentationPath then
# this is a sourceless library which means there are no javadocs and nothing
# should be uploaded to blob storage.
$IndexHtml = Join-Path -Path $UnjarredDocumentationPath -ChildPath "index.html"
if (!(Test-Path -path $IndexHtml))
{
Write-Host "$($PkgName) does not have an index.html file, skippping."
continue
}

# Get the POM file for the artifact we're processing
$PomFile = $Item.FullName.Substring(0,$Item.FullName.LastIndexOf(("-javadoc.jar"))) + ".pom"
Write-Host "PomFile $($PomFile)"
Expand Down Expand Up @@ -334,14 +345,11 @@ if ($Language -eq "java")
if ($Language -eq "c")
{
# The documentation publishing process for C differs from the other
# langauges in this file because this script is invoked once per library
# langauges in this file because this script is invoked for the whole SDK
# publishing. It is not, for example, invoked once per service publishing.
# This is also the case for other langauge publishing steps above... Those
# loops are left over from previous versions of this script which were used
# to publish multiple docs packages in a single invocation.
# There is a similar situation for other langauge publishing steps above...
# Those loops are left over from previous versions of this script which were
# used to publish multiple docs packages in a single invocation.
$pkgInfo = Get-Content $DocLocation/package-info.json | ConvertFrom-Json
$pkgName = $pkgInfo.name
$pkgVersion = $pkgInfo.version

Upload-Blobs -DocDir $DocLocation -PkgName $pkgName -DocVersion $pkgVersion
Upload-Blobs -DocDir $DocLocation -PkgName 'docs' -DocVersion $pkgInfo.version
}
Loading