From f1ce19eb03e74da77c6f579feb6ef74c70e2d5ec Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Thu, 4 Dec 2025 18:02:42 +0000 Subject: [PATCH 1/7] Add error logging when a service has no publishable packages --- eng/scripts/Language-Settings.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index d085a398fc5..d2a725df193 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -51,6 +51,11 @@ function Get-AllPackageInfoFromRepo ([string] $ServiceDirectory) { | Select-Object -ExpandProperty packages | Where-Object { $_.manifest_path.StartsWith($searchPath) -and $null -eq $_.publish } + if (!$packages) { + LogError "No publishable packages found in service directory: $ServiceDirectory" + return @() + } + $packageManifests = @{} foreach ($package in $packages) { if ($package.manifest_path -replace '\\', '/' -match '/sdk/([^/]+)/') { @@ -120,7 +125,7 @@ function Get-AllPackageInfoFromRepo ([string] $ServiceDirectory) { function Get-rust-AdditionalValidationPackagesFromPackageSet ($packagesWithChanges, $diff, $allPackageProperties) { # if the change was in a service directory, but not in a package directory, test all the packages in the service directory [array]$serviceFiles = ($diff.ChangedFiles + $diff.DeletedFiles) | ForEach-Object { $_ -replace '\\', '/' } | Where-Object { $_ -match "^sdk/.+/" } - + # remove files that target any specific package foreach ($package in $allPackageProperties) { $packagePathPattern = "^$( [Regex]::Escape($package.DirectoryPath.Replace('\', '/')) )/" From b490a94a976f8a519149f9892d615ceb93561213 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Thu, 4 Dec 2025 18:03:56 +0000 Subject: [PATCH 2/7] Set publishing=true in servicebus Cargo.toml --- sdk/servicebus/azure_messaging_servicebus/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/servicebus/azure_messaging_servicebus/Cargo.toml b/sdk/servicebus/azure_messaging_servicebus/Cargo.toml index d9f8302a3f1..9241a2f4c11 100644 --- a/sdk/servicebus/azure_messaging_servicebus/Cargo.toml +++ b/sdk/servicebus/azure_messaging_servicebus/Cargo.toml @@ -14,7 +14,7 @@ documentation = "https://docs.rs/azure_messaging_servicebus" keywords = ["sdk", "azure", "messaging", "cloud", "servicebus"] categories = ["api-bindings"] edition.workspace = true -publish = false +publish = true [dependencies] async-lock.workspace = true From 0c4cd29823a7bfa1ee5fb0b343a8c7f0ab7f3a8d Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Thu, 4 Dec 2025 10:14:36 -0800 Subject: [PATCH 3/7] Update sdk/servicebus/azure_messaging_servicebus/Cargo.toml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- sdk/servicebus/azure_messaging_servicebus/Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/servicebus/azure_messaging_servicebus/Cargo.toml b/sdk/servicebus/azure_messaging_servicebus/Cargo.toml index 9241a2f4c11..78cb4f4d3c4 100644 --- a/sdk/servicebus/azure_messaging_servicebus/Cargo.toml +++ b/sdk/servicebus/azure_messaging_servicebus/Cargo.toml @@ -14,7 +14,6 @@ documentation = "https://docs.rs/azure_messaging_servicebus" keywords = ["sdk", "azure", "messaging", "cloud", "servicebus"] categories = ["api-bindings"] edition.workspace = true -publish = true [dependencies] async-lock.workspace = true From c66391e0b3fe1bb13934482b43374a16681d0214 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Thu, 4 Dec 2025 19:05:11 +0000 Subject: [PATCH 4/7] Keep publish = false --- sdk/servicebus/azure_messaging_servicebus/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/servicebus/azure_messaging_servicebus/Cargo.toml b/sdk/servicebus/azure_messaging_servicebus/Cargo.toml index 78cb4f4d3c4..d9f8302a3f1 100644 --- a/sdk/servicebus/azure_messaging_servicebus/Cargo.toml +++ b/sdk/servicebus/azure_messaging_servicebus/Cargo.toml @@ -14,6 +14,7 @@ documentation = "https://docs.rs/azure_messaging_servicebus" keywords = ["sdk", "azure", "messaging", "cloud", "servicebus"] categories = ["api-bindings"] edition.workspace = true +publish = false [dependencies] async-lock.workspace = true From 0816de683e333c5f12903c33e6a93068b54a8d12 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Thu, 4 Dec 2025 19:25:39 +0000 Subject: [PATCH 5/7] Instead of checking publish = false, exclude only packages that have "test" as a differentiated part of the name --- eng/scripts/Language-Settings.ps1 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index d2a725df193..45b37bc2530 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -44,12 +44,16 @@ function Get-AllPackageInfoFromRepo ([string] $ServiceDirectory) { $searchPath = Join-Path $searchPath $ServiceDirectory -Resolve } - # when a package is marked `publish = false` in the Cargo.toml, `cargo metadata` returns an empty array for - # `publish`, otherwise it returns null. We only want to include packages where `publish` is null. + # Enumerate packages that do not have "test" as an independent word in the + # name. + # Examples: + # "azure_core" - included + # "azure_core_test" - excluded + # "azure_attestation" - included $packages = Invoke-LoggedCommand "cargo metadata --format-version 1 --no-deps" -GroupOutput | ConvertFrom-Json -AsHashtable | Select-Object -ExpandProperty packages - | Where-Object { $_.manifest_path.StartsWith($searchPath) -and $null -eq $_.publish } + | Where-Object { $_.manifest_path.StartsWith($searchPath) -and "test" -notin ($_.name -split '_') } if (!$packages) { LogError "No publishable packages found in service directory: $ServiceDirectory" From 5b61fd86ee8690468b096f7eb4897e3006d69401 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Thu, 4 Dec 2025 19:26:41 +0000 Subject: [PATCH 6/7] Review feedback: LogWarning instead of LogError (neither will affect control flow, but an empty list of packages might not be an error) --- eng/scripts/Language-Settings.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index 45b37bc2530..330cfc1eba2 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -56,7 +56,7 @@ function Get-AllPackageInfoFromRepo ([string] $ServiceDirectory) { | Where-Object { $_.manifest_path.StartsWith($searchPath) -and "test" -notin ($_.name -split '_') } if (!$packages) { - LogError "No publishable packages found in service directory: $ServiceDirectory" + LogWarning "No publishable packages found in service directory: $ServiceDirectory" return @() } From 9a8b0283742f80b231d315901f82541fbf6e6abb Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Fri, 5 Dec 2025 22:57:17 +0000 Subject: [PATCH 7/7] Support packing crates that are not publishable. Fail if attempting to pack non-publishable crate in release --- eng/scripts/Pack-Crates.ps1 | 22 ++++++++++++++-------- eng/scripts/Test-Semver.ps1 | 8 +++----- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/eng/scripts/Pack-Crates.ps1 b/eng/scripts/Pack-Crates.ps1 index 72323370a9d..9ff98af62bb 100755 --- a/eng/scripts/Pack-Crates.ps1 +++ b/eng/scripts/Pack-Crates.ps1 @@ -57,9 +57,6 @@ function Get-PackagesToBuild() { } function Get-OutputPackageNames($workspacePackages) { - $packablePackages = $workspacePackages | Where-Object -Property publish -NE -Value @() - $packablePackageNames = $packablePackages.name - $names = @() switch ($PsCmdlet.ParameterSetName) { 'Named' { @@ -71,12 +68,12 @@ function Get-OutputPackageNames($workspacePackages) { } default { - return $packablePackageNames + return $workspacePackages.name } } foreach ($name in $names) { - if (-not $packablePackageNames.Contains($name)) { + if (-not $workspacePackages.name.Contains($name)) { Write-Error "Package '$name' is not in the workspace or does not publish" exit 1 } @@ -109,9 +106,18 @@ try { $packageParams += "--no-verify" } - LogGroupStart "cargo publish --locked --dry-run --allow-dirty $($packageParams -join ' ')" - Write-Host "cargo publish --locked --dry-run --allow-dirty $($packageParams -join ' ')" - & cargo publish --locked --dry-run --allow-dirty @packageParams 2>&1 ` + # Some packages are not publishable, in cases where the script is not in a + # release context, run cargo package` instead of `cargo publish --dry-run`. + # The two are equivalent (https://doc.rust-lang.org/cargo/reference/publishing.html) + # though `cargo publish` has additional checks like publishability. + $subCommand = @("package") + if ($Release) { + $subCommand = @("publish", "--dry-run") + } + + LogGroupStart "cargo $($subCommand -join ' ') --locked --allow-dirty $($packageParams -join ' ')" + Write-Host "cargo $($subCommand -join ' ') --locked --allow-dirty $($packageParams -join ' ')" + & cargo @subCommand --locked --allow-dirty @packageParams 2>&1 ` | Tee-Object -Variable packResult ` | ForEach-Object { Write-Host $_ -ForegroundColor Gray } LogGroupEnd diff --git a/eng/scripts/Test-Semver.ps1 b/eng/scripts/Test-Semver.ps1 index 8b66287d3ee..70ac714a9ad 100755 --- a/eng/scripts/Test-Semver.ps1 +++ b/eng/scripts/Test-Semver.ps1 @@ -14,9 +14,6 @@ param( . ([System.IO.Path]::Combine($PSScriptRoot, 'shared', 'Cargo.ps1')) function Get-OutputPackageNames($workspacePackages) { - $packablePackages = $workspacePackages | Where-Object -Property publish -NE -Value @() - $packablePackageNames = $packablePackages.name - $names = @() switch ($PsCmdlet.ParameterSetName) { 'Named' { @@ -28,12 +25,13 @@ function Get-OutputPackageNames($workspacePackages) { } default { - return $packablePackageNames + return $workspacePackages.name + } } foreach ($name in $names) { - if (-not $packablePackageNames.Contains($name)) { + if (-not $workspacePackages.name.Contains($name)) { Write-Error "Package '$name' is not in the workspace or does not publish" exit 1 }