From f0f2f8c75ffbc7ad8b5f6b500982f3bc973ae15b Mon Sep 17 00:00:00 2001 From: "FAREAST\\chunyu" Date: Thu, 7 Nov 2024 11:05:56 +0800 Subject: [PATCH 1/2] add version and readMe or typespecProject --- eng/scripts/Invoke-GenerateAndBuildV2.ps1 | 2 ++ eng/scripts/automation/GenerateAndBuildLib.ps1 | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/eng/scripts/Invoke-GenerateAndBuildV2.ps1 b/eng/scripts/Invoke-GenerateAndBuildV2.ps1 index 50ab22aa9308d..47c61f9785adc 100644 --- a/eng/scripts/Invoke-GenerateAndBuildV2.ps1 +++ b/eng/scripts/Invoke-GenerateAndBuildV2.ps1 @@ -87,6 +87,7 @@ for ($i = 0; $i -le $readmeFiles.Count - 1; $i++) { $autorestConfigYaml = ConvertTo-YAML $yml } Invoke-GenerateAndBuildSDK -readmeAbsolutePath $readme -sdkRootPath $sdkPath -autorestConfigYaml "$autorestConfigYaml" -downloadUrlPrefix "$downloadUrlPrefix" -generatedSDKPackages $generatedSDKPackages + $generatedSDKPackages[$generatedSDKPackages.Count - 1]['readmeMd'] = @($readmeFile) } #update services without readme.md @@ -156,6 +157,7 @@ if ($relatedTypeSpecProjectFolder) { -generatedSDKPackages $generatedSDKPackages ` -specRepoRoot $swaggerDir } + $generatedSDKPackages[$generatedSDKPackages.Count - 1]['typespecProject'] = @($typespecRelativeFolder) } } $outputJson = [PSCustomObject]@{ diff --git a/eng/scripts/automation/GenerateAndBuildLib.ps1 b/eng/scripts/automation/GenerateAndBuildLib.ps1 index 5d0d78f46803e..2da16c8ff8d48 100644 --- a/eng/scripts/automation/GenerateAndBuildLib.ps1 +++ b/eng/scripts/automation/GenerateAndBuildLib.ps1 @@ -891,7 +891,11 @@ function GeneratePackage() $ciFilePath = "sdk/$service/ci.mgmt.yml" } + # get the sdk version + $projectFile = Join-Path $srcPath "$packageName.csproj" + $version=([xml](Get-Content $projectFile)).Project.PropertyGroup.Version $packageDetails = @{ + version=$version; packageName="$packageName"; result=$result; path=@("$path", "$ciFilePath"); @@ -899,7 +903,7 @@ function GeneratePackage() artifacts=$artifacts; apiViewArtifact=$apiViewArtifact; language=".Net"; - changelog=$changelog + changelog=$changelog; } if ($null -ne $installInstructions) { From 1573e150ed49327c27754f6ae81b452bf45104a0 Mon Sep 17 00:00:00 2001 From: "FAREAST\\chunyu" Date: Fri, 8 Nov 2024 10:47:18 +0800 Subject: [PATCH 2/2] check the version existence --- eng/scripts/automation/GenerateAndBuildLib.ps1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/eng/scripts/automation/GenerateAndBuildLib.ps1 b/eng/scripts/automation/GenerateAndBuildLib.ps1 index 2da16c8ff8d48..58206af3573dd 100644 --- a/eng/scripts/automation/GenerateAndBuildLib.ps1 +++ b/eng/scripts/automation/GenerateAndBuildLib.ps1 @@ -892,8 +892,15 @@ function GeneratePackage() } # get the sdk version + $version = "" $projectFile = Join-Path $srcPath "$packageName.csproj" - $version=([xml](Get-Content $projectFile)).Project.PropertyGroup.Version + $csproj = new-object xml + $csproj.PreserveWhitespace = $true + $csproj.Load($projectFile) + $versionNode = ($csproj | Select-Xml "Project/PropertyGroup/Version").Node + if ($versionNode) { + $version = $versionNode.InnerText + } $packageDetails = @{ version=$version; packageName="$packageName";