Commit d9a6207
[build] Fix
When inspecting `Microsoft.Android.Sdk.Windows.*.nupkg`, every file
that lives directly under `tools/` (e.g. `r8.jar`, `aapt2.exe`,
`bundletool.jar`, `Xamarin.Android.Build.Tasks.dll`, all the targets
files, etc.) is packed with a malformed entry path containing a
double slash:
tools//r8.jar
tools//aapt2.exe
tools//bundletool.jar
...
83 of the 281 entries in the package are affected.
The cause is in `build-tools/create-packs/Microsoft.Android.Sdk.proj`:
```xml
<AndroidSdkBuildTools Include="@(MSBuildItemsWin)"
TargetPath="tools\$([System.IO.Path]::GetDirectoryName('%(MSBuildItemsWin.RelativePath)'))" ... />
```
For an item whose `RelativePath` is just a filename like `r8.jar`,
`Path.GetDirectoryName('r8.jar')` returns `""`, so `TargetPath`
becomes `tools\` (trailing slash). The `SharedFramework.Sdk`
packaging logic then appends `/r8.jar`, producing `tools//r8.jar`.
Items with a real subdirectory (e.g. `cs\Foo.resources.dll`,
`bcl\Foo.dll`) are unaffected, because the directory name suppresses
the trailing-slash issue.
Switch to `Path.Combine`, which collapses an empty second argument
cleanly:
| Input `RelativePath` | Old result | New result |
| -------------------------- | ------------- | ------------- |
| `r8.jar` | `tools\` ❌ | `tools` ✅ |
| `cs\Foo.resources.dll` | `tools\cs` ✅ | `tools\cs` ✅ |
| `bcl\Foo.dll` | `tools\bcl` ✅| `tools\bcl` ✅|
This bug has been latent since `dc089720b [build] Use
SharedFramework.Sdk to create workload packs (#10000)`.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>tools//<file> paths in Microsoft.Android.Sdk pack (#11689)1 parent ad5cf59 commit d9a6207
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
0 commit comments