diff --git a/Microsoft.Toolkit.Win32.UI.XamlApplication.Package/Microsoft.Toolkit.Win32.UI.XamlApplication.Package.csproj b/Microsoft.Toolkit.Win32.UI.XamlApplication.Package/Microsoft.Toolkit.Win32.UI.XamlApplication.Package.csproj index d454092..a00e403 100644 --- a/Microsoft.Toolkit.Win32.UI.XamlApplication.Package/Microsoft.Toolkit.Win32.UI.XamlApplication.Package.csproj +++ b/Microsoft.Toolkit.Win32.UI.XamlApplication.Package/Microsoft.Toolkit.Win32.UI.XamlApplication.Package.csproj @@ -32,12 +32,10 @@ runtimes\win10-x86\native - true @@ -49,12 +47,10 @@ runtimes\win10-x64\native - true @@ -66,12 +62,10 @@ runtimes\win10-arm\native - true @@ -83,12 +77,10 @@ runtimes\win10-arm64\native - true diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0caec37..9a9f074 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,6 +12,7 @@ pool: variables: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release + RepositoryLocalPath : $(Build.Repository.LocalPath) steps: @@ -36,9 +37,6 @@ steps: - script: nbgv cloud displayName: Set Version -- powershell: .\build\Install-WindowsSdkISO.ps1 18362 - displayName: Insider SDK - - task: BatchScript@1 inputs: filename: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\Tools\\VsDevCmd.bat" @@ -46,9 +44,6 @@ steps: modifyEnvironment: true displayName: Setup Environment Variables -#- powershell: .\build\build.ps1 -target=Package -# displayName: Build - - task: NuGetCommand@2 displayName: NuGet restore Native projects inputs: @@ -76,6 +71,9 @@ steps: msbuildArguments: /target:Build restoreNugetPackages: false # Optional +- powershell: "& 'C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x64\\pdbcopy.exe' $env:RepositoryLocalPath\\x64\\Release\\Microsoft.Toolkit.Win32.UI.XamlApplication\\Microsoft.Toolkit.Win32.UI.XamlHost.pdb $env:RepositoryLocalPath\\x64\\Release\\Microsoft.Toolkit.Win32.UI.XamlApplication\\Microsoft.Toolkit.Win32.UI.XamlHost_stripped.pdb -p" + displayName: Strip x64 + - task: MSBuild@1 displayName: Build x86 Restore inputs: @@ -94,6 +92,9 @@ steps: msbuildArguments: /target:Build restoreNugetPackages: false # Optional +- powershell: "& 'C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x64\\pdbcopy.exe' $env:RepositoryLocalPath\\Win32\\Release\\Microsoft.Toolkit.Win32.UI.XamlApplication\\Microsoft.Toolkit.Win32.UI.XamlHost.pdb $env:RepositoryLocalPath\\Win32\\Release\\Microsoft.Toolkit.Win32.UI.XamlApplication\\Microsoft.Toolkit.Win32.UI.XamlHost_stripped.pdb -p" + displayName: Strip x86 + - task: MSBuild@1 displayName: Build ARM Restore inputs: @@ -112,6 +113,9 @@ steps: msbuildArguments: /target:Build restoreNugetPackages: false # Optional +- powershell: "& 'C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x64\\pdbcopy.exe' $env:RepositoryLocalPath\\ARM\\Release\\Microsoft.Toolkit.Win32.UI.XamlApplication\\Microsoft.Toolkit.Win32.UI.XamlHost.pdb $env:RepositoryLocalPath\\ARM\\Release\\Microsoft.Toolkit.Win32.UI.XamlApplication\\Microsoft.Toolkit.Win32.UI.XamlHost_stripped.pdb -p" + displayName: Strip ARM + - task: MSBuild@1 displayName: Build ARM64 Restore inputs: @@ -130,6 +134,9 @@ steps: msbuildArguments: /target:Build restoreNugetPackages: false # Optional +- powershell: "& 'C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x64\\pdbcopy.exe' $env:RepositoryLocalPath\\ARM64\\Release\\Microsoft.Toolkit.Win32.UI.XamlApplication\\Microsoft.Toolkit.Win32.UI.XamlHost.pdb $env:RepositoryLocalPath\\ARM64\\Release\\Microsoft.Toolkit.Win32.UI.XamlApplication\\Microsoft.Toolkit.Win32.UI.XamlHost_stripped.pdb -p" + displayName: Strip ARM64 + - task: MSBuild@1 displayName: Build Pack inputs: diff --git a/build/build.cake b/build/build.cake index a205130..b266302 100644 --- a/build/build.cake +++ b/build/build.cake @@ -41,6 +41,8 @@ string Version = null; var inheritDoc = toolsDir + "/InheritDoc/tools/InheritDoc.exe"; var inheritDocExclude = "Foo.*"; +var pdbcopyPath = Context.Environment.GetSpecialPath(SpecialPath.ProgramFilesX86).Combine(@"Windows Kits\10\Debuggers\x64").CombineWithFilePath("pdbcopy.exe"); + ////////////////////////////////////////////////////////////////////// // METHODS ////////////////////////////////////////////////////////////////////// @@ -91,6 +93,59 @@ void VerifyHeaders(bool Replace) } } +void Build(PlatformTarget platformTarget) +{ + var buildSettings = new MSBuildSettings + { + PlatformTarget = platformTarget, + MaxCpuCount = 1, + } + .SetConfiguration("Release") + .UseToolVersion(MSBuildToolVersion.VS2019) + .WithTarget("Restore"); + + Information($"\nRestore {platformTarget} Step"); + MSBuild(win32Solution, buildSettings); + + // Build once with normal dependency ordering + buildSettings = new MSBuildSettings + { + PlatformTarget = platformTarget, + MaxCpuCount = 1, + } + .SetConfiguration("Release") + .UseToolVersion(MSBuildToolVersion.VS2019) + .WithTarget("Build"); + + Information($"\nBuild {platformTarget} Step"); + MSBuild(win32Solution, buildSettings); + + Information($"\nStripping {platformTarget} PDB"); + + string arch; + switch(platformTarget) + { + case PlatformTarget.x86: + arch = "Win32"; + break; + default: + arch = platformTarget.ToString(); + break; + } + + var args = new ProcessArgumentBuilder() + .AppendQuoted(baseDir + $"/{arch}/Release/Microsoft.Toolkit.Win32.UI.XamlApplication/Microsoft.Toolkit.Win32.UI.XamlHost.pdb") + .AppendQuoted(baseDir + $"/{arch}/Release/Microsoft.Toolkit.Win32.UI.XamlApplication/Microsoft.Toolkit.Win32.UI.XamlHost_stripped.pdb") + .AppendSwitch("-p", ""); + + var result = StartProcess(pdbcopyPath, new ProcessSettings { Arguments = args }); + + if (result != 0) + { + throw new InvalidOperationException($"PDBCopy stripping for '{arch}' failed!"); + } +} + ////////////////////////////////////////////////////////////////////// // DEFAULT TASK ////////////////////////////////////////////////////////////////////// @@ -157,121 +212,10 @@ Task("Build") NuGetRestore(solution, nugetRestoreSettings); } - { - var buildSettings = new MSBuildSettings - { - PlatformTarget = PlatformTarget.x64, - MaxCpuCount = 1, - } - .SetConfiguration("Release") - .UseToolVersion(MSBuildToolVersion.VS2019) - .WithTarget("Restore"); - - Information("\nRestore x64 Step"); - MSBuild(win32Solution, buildSettings); - } - - { - // Build once with normal dependency ordering - var buildSettings = new MSBuildSettings - { - PlatformTarget = PlatformTarget.x64, - MaxCpuCount = 1, - } - .SetConfiguration("Release") - .UseToolVersion(MSBuildToolVersion.VS2019) - .WithTarget("Build"); - - Information("\nBuild x64 Step"); - MSBuild(win32Solution, buildSettings); - } - - { - var buildSettings = new MSBuildSettings - { - PlatformTarget = PlatformTarget.x86, - MaxCpuCount = 1, - } - .SetConfiguration("Release") - .UseToolVersion(MSBuildToolVersion.VS2019) - .WithTarget("Restore"); - - Information("\nRestore x86 Step"); - MSBuild(win32Solution, buildSettings); - } - - { - // Build once with normal dependency ordering - var buildSettings = new MSBuildSettings - { - PlatformTarget = PlatformTarget.x86, - MaxCpuCount = 1, - } - .SetConfiguration("Release") - .UseToolVersion(MSBuildToolVersion.VS2019) - .WithTarget("Build"); - - Information("\nBuild x86 Step"); - MSBuild(win32Solution, buildSettings); - } - - { - var buildSettings = new MSBuildSettings - { - PlatformTarget = PlatformTarget.ARM, - MaxCpuCount = 1, - } - .SetConfiguration("Release") - .UseToolVersion(MSBuildToolVersion.VS2019) - .WithTarget("Restore"); - - Information("\nRestore ARM Step"); - MSBuild(win32Solution, buildSettings); - } - - { - // Build once with normal dependency ordering - var buildSettings = new MSBuildSettings - { - PlatformTarget = PlatformTarget.ARM, - MaxCpuCount = 1, - } - .SetConfiguration("Release") - .UseToolVersion(MSBuildToolVersion.VS2019) - .WithTarget("Build"); - - Information("\nBuild ARM Step"); - MSBuild(win32Solution, buildSettings); - } - - { - var buildSettings = new MSBuildSettings - { - PlatformTarget = PlatformTarget.ARM64, - MaxCpuCount = 1, - } - .SetConfiguration("Release") - .UseToolVersion(MSBuildToolVersion.VS2019) - .WithTarget("Restore"); - - Information("\nRestore ARM64 Step"); - MSBuild(win32Solution, buildSettings); - } - - { - // Build once with normal dependency ordering - var buildSettings = new MSBuildSettings - { - PlatformTarget = PlatformTarget.ARM64, - MaxCpuCount = 1, - } - .SetConfiguration("Release") - .UseToolVersion(MSBuildToolVersion.VS2019) - .WithTarget("Build"); - - Information("\nBuild ARM64 Step"); - MSBuild(win32Solution, buildSettings); - } + Build(PlatformTarget.x64); + Build(PlatformTarget.x86); + Build(PlatformTarget.ARM); + Build(PlatformTarget.ARM64); });