Skip to content

Commit

Permalink
Unset the SDKType environment variable for API Docs Gen (#45080)
Browse files Browse the repository at this point in the history
* Unset the SDKType environment variable for API Docs Gen

* Unsetting didn't work, try a different approach

* set /p:BuildInParallel=false on the build commands

* for the want of a quote, the kingdom fell

* change the mgmt build commands, if those work the if statements will be consolidated

* Remove libtype, everything is Taco Bell
  • Loading branch information
JimSuplizio authored Jul 19, 2024
1 parent 8ad44c5 commit 47fd179
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 48 deletions.
65 changes: 18 additions & 47 deletions doc/ApiDocGeneration/Generate-Api-Docs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ The Name of the servicedirectory, usually the name of the service e.g. core
.PARAMETER ArtifactsDirectoryName
Used in the case where the package directory name is different from the package name. e.g in cognitiveservice packages
.PARAMETER LibType
Specifies if its a client or management library
.PARAMETER RepoRoot
The root of the Azure-SDK-for-Net Repo
Expand All @@ -32,16 +29,14 @@ Directory Name: PopImport: https://azuresdkartifacts.blob.core.windows.net/azure
RepoRoot\doc\ApiDocGeneration
#>

[CmdletBinding()]
Param (
[Parameter(Mandatory = $True)]
$ArtifactName,
[Parameter(Mandatory = $True)]
$ServiceDirectory,
$ArtifactsDirectoryName,
[ValidateSet('client', 'management')]
$LibType = "client",
$RepoRoot = "${PSScriptRoot}/../..",
[Parameter(Mandatory = $True)]
$BinDirectory,
Expand All @@ -68,7 +63,9 @@ function UpdateDocIndexFiles([string]$docPath, [string] $mainJsPath) {
}

Write-Verbose "Name Reccuring paths with variable names"
if ([System.String]::IsNullOrEmpty($ArtifactsDirectoryName)) {$ArtifactsDirectoryName = $ArtifactName}
if ([System.String]::IsNullOrEmpty($ArtifactsDirectoryName)) {
$ArtifactsDirectoryName = $ArtifactName
}
$PackageLocation = "${ServiceDirectory}/${ArtifactsDirectoryName}"
$FrameworkDir = "${BinDirectory}/${ArtifactsDirectoryName}/dll-docs"
$ApiDir = "${FrameworkDir}/my-api"
Expand All @@ -83,10 +80,6 @@ $DocFxTool = "${BinDirectory}/docfx/docfx.exe"
$DocCommonGenDir = "${RepoRoot}/eng/common/docgeneration"
$GACampaignId = "UA-62780441-41"

if ($LibType -eq 'management') {
$ArtifactName = $ArtifactName.Substring($ArtifactName.LastIndexOf('.Management') + 1)
}

Write-Verbose "Package Location ${PackageLocation}"

Write-Verbose "Create Directories Required for Doc Generation"
Expand All @@ -101,41 +94,19 @@ mkdir $YamlOutDir
Write-Verbose "Creating DocOutDir '$DocOutDir'"
mkdir $DocOutDir

if ($LibType -eq 'client') {
Write-Verbose "Build Packages for Doc Generation - Client"
Write-Verbose "dotnet build '${RepoRoot}/eng/service.proj' /p:ServiceDirectory=$PackageLocation /p:IncludeTests=false /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false /p:OutputPath=$ApiDir"
dotnet build "${RepoRoot}/eng/service.proj" /p:ServiceDirectory=$PackageLocation /p:IncludeTests=false /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false /p:OutputPath=$ApiDir
if ($LASTEXITCODE -ne 0) {
Log-Warning "Build Packages for Doc Generation - Client failed with $LASTEXITCODE please see output above"
exit 0
}

Write-Verbose "Include Client Dependencies"
Write-Verbose "'${RepoRoot}/eng/service.proj' /p:ServiceDirectory=$PackageLocation /p:IncludeTests=false /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false /p:OutputPath=$ApiDependenciesDir /p:CopyLocalLockFileAssemblies=true"
dotnet build "${RepoRoot}/eng/service.proj" /p:ServiceDirectory=$PackageLocation /p:IncludeTests=false /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false /p:OutputPath=$ApiDependenciesDir /p:CopyLocalLockFileAssemblies=true
if ($LASTEXITCODE -ne 0) {
Log-Warning "Include Client Dependencies build failed with $LASTEXITCODE please see output above"
exit 0
}
} elseif ($LibType -eq 'management') {
# Management Package
Write-Verbose "Build Packages for Doc Generation - Management"
Write-Verbose "dotnet msbuild '${RepoRoot}/eng/mgmt.proj' /p:scope=$PackageLocation /p:OutputPath=$ApiDir -maxcpucount:1 -nodeReuse:false"
dotnet msbuild "${RepoRoot}/eng/mgmt.proj" /p:scope=$PackageLocation /p:OutputPath=$ApiDir -maxcpucount:1 -nodeReuse:false
if ($LASTEXITCODE -ne 0) {
Log-Warning "Build Packages for Doc Generation - Management failed with $LASTEXITCODE please see output above"
exit 0
}

Write-Verbose "Include Management Dependencies"
Write-Verbose "dotnet msbuild '${RepoRoot}/eng/mgmt.proj' /p:scope=$PackageLocation /p:OutputPath=$ApiDependenciesDir /p:CopyLocalLockFileAssemblies=true -maxcpucount:1 -nodeReuse:false"
dotnet msbuild "${RepoRoot}/eng/mgmt.proj" /p:scope=$PackageLocation /p:OutputPath=$ApiDependenciesDir /p:CopyLocalLockFileAssemblies=true -maxcpucount:1 -nodeReuse:false
if ($LASTEXITCODE -ne 0) {
Log-Warning "Include Management Dependencies build failed with $LASTEXITCODE please see output above"
exit 0
}
} else {
Log-Warning "'$LibType' is not a supported library type at this time."
Write-Verbose "Build Packages for Doc Generation - Client"
Write-Verbose "dotnet build '${RepoRoot}/eng/service.proj' /p:ServiceDirectory=$ServiceDirectory /p:Project=$ArtifactsDirectoryName /p:IncludeTests=false /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false /p:BuildInParallel=false /p:OutputPath=$ApiDir"
dotnet build "${RepoRoot}/eng/service.proj" /p:ServiceDirectory=$ServiceDirectory /p:Project=$ArtifactsDirectoryName /p:IncludeTests=false /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false /p:BuildInParallel=false /p:OutputPath=$ApiDir
if ($LASTEXITCODE -ne 0) {
Log-Warning "Build Packages for Doc Generation - Client failed with $LASTEXITCODE please see output above"
exit 0
}

Write-Verbose "Include Client Dependencies"
Write-Verbose "'${RepoRoot}/eng/service.proj' /p:ServiceDirectory=$ServiceDirectory /p:Project=$ArtifactsDirectoryName /p:IncludeTests=false /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false /p:BuildInParallel=false /p:OutputPath=$ApiDependenciesDir /p:CopyLocalLockFileAssemblies=true"
dotnet build "${RepoRoot}/eng/service.proj" /p:ServiceDirectory=$ServiceDirectory /p:Project=$ArtifactsDirectoryName /p:IncludeTests=false /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false /p:BuildInParallel=false /p:OutputPath=$ApiDependenciesDir /p:CopyLocalLockFileAssemblies=true
if ($LASTEXITCODE -ne 0) {
Log-Warning "Include Client Dependencies build failed with $LASTEXITCODE please see output above"
exit 0
}

Expand Down Expand Up @@ -212,4 +183,4 @@ $mutatedContent = $mutatedContent -replace $hrefRegex, '"./$1"'
Set-Content -Path $baseUrl -Value $mutatedContent -NoNewline

Write-Verbose "Compress and copy HTML into the staging Area"
Compress-Archive -Path "${DocOutHtmlDir}/*" -DestinationPath "${ArtifactStagingDirectory}/${ArtifactName}/${ArtifactName}.docs.zip" -CompressionLevel Fastest
Compress-Archive -Path "${DocOutHtmlDir}/*" -DestinationPath "${ArtifactStagingDirectory}/${ArtifactName}/${ArtifactName}.docs.zip" -CompressionLevel Fastest
1 change: 0 additions & 1 deletion eng/pipelines/templates/steps/archetype-sdk-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ steps:
-ArtifactName '${{artifact.name}}'
-ServiceDirectory '${{parameters.ServiceDirectory}}'
-ArtifactsDirectoryName '${{artifact.directoryName}}'
-LibType '${{parameters.LibType}}'
-RepoRoot $(Build.SourcesDirectory)
-BinDirectory $(Build.BinariesDirectory)
-DocGenDir ${{parameters.DocGenerationDir}}
Expand Down

0 comments on commit 47fd179

Please sign in to comment.