diff --git a/BuildTransportPackage.ps1 b/BuildTransportPackage.ps1 index e88a13948..ba9142e46 100644 --- a/BuildTransportPackage.ps1 +++ b/BuildTransportPackage.ps1 @@ -1,11 +1,14 @@ <# -This script is to build the framework transport package that will be used to generate the windows app sdk framework package. +This script is to build the Foundation transport package that will be used to generate the windows app sdk package. This script is called from BuildAll.ps1 from the aggregator repo and should not be called directly. +PackageVersion: NuGet Package Version that will be used in the packing of Foundation Transport Package Platform: Comma delimited string of platforms to run. Configuration: Comma delimited string of configurations to run. -LocalPackagesPath: The path that the generated transport package needs to be saved. +AzureBuildStep: Only used by the pipeline to perform tasks such as signing in between the steps +OutputDirectory: Pack Location of the Nuget Package UpdateVersionDetailsPath: Path to a ps1 or cmd that updates version.details.xml. +Clean: Performs a clean on BuildOutput, Obj, and build\override Note about building in different environments. The feed the nuget.config points to changes depending on the branch. @@ -19,12 +22,37 @@ Param( [string]$Platform = "x64", [string]$Configuration = "Release", [string]$AzureBuildStep = "all", - [string]$OutputDirectory = "", + [string]$OutputDirectory = "BuildOutput", [string]$PGOBuildMode = "Optimize", - [string]$BasePath = "BuildOutput/FullNuget", - [string]$UpdateVersionDetailsPath = $null + [string]$UpdateVersionDetailsPath = $null, + [switch]$Clean = $false ) +$env:Build_SourcesDirectory = (Split-Path $MyInvocation.MyCommand.Path) +$buildOverridePath = "build\override" +$BasePath = "BuildOutput/FullNuget" + +# FUTURE(YML2PS): Update build to no longer place generated files in sources directory +if ($Clean) +{ + $CleanTargets = @( + "BuildOutput", + "obj", + $buildOverridePath + ) + + foreach ($CleanTarget in $CleanTargets) + { + $CleanTargetPath = (Join-Path $env:Build_SourcesDirectory $CleanTarget) + + if (Test-Path ($CleanTargetPath)) { + Remove-Item $CleanTargetPath -recurse + } + } + + Exit +} + # Make sure nuget directory exists. if(-not (test-path ".nuget")) { @@ -47,7 +75,6 @@ $msBuildPath = "$VCToolsInstallDir\MSBuild\Current\Bin\msbuild.exe" write-host "msBuildPath: $msBuildPath" -$buildOverridePath = "build\override" # Generate overrides # Make sure override directory exists. if(-not (test-path "$buildOverridePath")) @@ -57,6 +84,10 @@ if(-not (test-path "$buildOverridePath")) Try { $WindowsAppSDKBuildPipeline = 0 + + .\tools\GenerateDynamicDependencyOverrides.ps1 -Path "$buildOverridePath" + .\tools\GeneratePushNotificationsOverrides.ps1 -Path "$buildOverridePath" + if ($AzureBuildStep -ne "all") { # Some builds have "-branchname" appended, but when this happens the environment variable @@ -74,12 +105,6 @@ Try { # If $AzureBuildStep is not "all", that means we are in the pipeline $WindowsAppSDKBuildPipeline = 1 - - #------------------ - # Build windowsAppRuntime.sln and move output to staging. - #------------------ - .\tools\GenerateDynamicDependencyOverrides.ps1 -Path "$buildOverridePath" - .\tools\GeneratePushNotificationsOverrides.ps1 -Path "$buildOverridePath" } if (($AzureBuildStep -eq "all") -Or (($AzureBuildStep -eq "BuildBinaries") -Or ($AzureBuildStep -eq "BuildMRT"))) { diff --git a/build/AzurePipelinesTemplates/WindowsAppSDK-BuildProject-Steps.yml b/build/AzurePipelinesTemplates/WindowsAppSDK-BuildProject-Steps.yml deleted file mode 100644 index 5a79cf284..000000000 --- a/build/AzurePipelinesTemplates/WindowsAppSDK-BuildProject-Steps.yml +++ /dev/null @@ -1,244 +0,0 @@ -parameters: - solutionPath: '' - nugetConfigPath: '' - buildOutputDir: '$(Build.SourcesDirectory)\BuildOutput' - WindowsAppSDKCleanIntermediateFiles: 'true' - artifactName: 'drop' - channel: 'experimental' - enableLicenseInstall: false - # license installation assets are only accessible in internal builds, but are only - # needed in release-signed stable builds. Only enble this functionality in the private - # pipeline builds. Otherwise, default to an inert placeholder implementation. - runSDLBinaryAnalysis: false - enablePREFast: true - -steps: - - ${{ if eq(parameters.enableLicenseInstall, true) }}: - - task: NuGetToolInstaller@1 - - - task: NuGetAuthenticate@1 - inputs: - nuGetServiceConnections: 'ProjectReunionInternal' - - # Restore transport package dependencies. This is only enbaled in release-signed builds. - - task: PowerShell@2 - name: ConvertVersionDetailsToPackageConfig - displayName: "Convert VersionDetails To PackageConfig" - inputs: - filePath: '$(Build.SourcesDirectory)\build\Scripts\ConvertVersionDetailsToPackageConfig.ps1' - arguments: -versionDetailsPath '$(Build.SourcesDirectory)\eng\Version.Details.xml' -packageConfigPath '$(Build.SourcesDirectory)\build\packages.config' - - - task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2 - displayName: RestoreNuGetPackages - inputs: - restoreSolution: build/packages.config - feedsToUse: config - nugetConfigPath: build/licensing.nuget.config - restoreDirectory: packages - - - template: WindowsAppSDK-PopulateBuildDateAndRevision-Steps.yml - - - script: | - echo parameters.solutionPath = '${{ parameters.solutionPath }}' - echo parameters.nugetConfigPath = '${{ parameters.nugetConfigPath }}' - echo parameters.buildOutputDir = '${{ parameters.buildOutputDir }}' - displayName: 'BuildProject: Display parameters' - - - template: WindowsAppSDK-InstallWindowsSDK-Steps.yml - - - template: WindowsAppSDK-InstallNuget-Steps.yml - - # The environment variable VCToolsInstallDir isn't defined on lab machines, so we need to retrieve it ourselves. - - script: | - "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -Latest -requires Microsoft.Component.MSBuild -property InstallationPath > %TEMP%\vsinstalldir.txt - set /p _VSINSTALLDIR15=<%TEMP%\vsinstalldir.txt - del %TEMP%\vsinstalldir.txt - call "%_VSINSTALLDIR15%\Common7\Tools\VsDevCmd.bat" - echo VCToolsInstallDir = %VCToolsInstallDir% - echo ##vso[task.setvariable variable=VCToolsInstallDir]%VCToolsInstallDir% - displayName: 'Retrieve VC tools directory' - - - task: CmdLine@1 - displayName: 'Display build machine environment variables' - inputs: - filename: 'set' - - - task: NuGetAuthenticate@1 - inputs: - nuGetServiceConnections: 'WindowsES' - - - task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2 - displayName: 'NuGet restore ${{ parameters.solutionPath }}' - inputs: - restoreSolution: ${{ parameters.solutionPath }} - feedsToUse: config - nugetConfigPath: ${{ parameters.nugetConfigPath }} - - - task: powershell@2 - displayName: 'Create test pfx to sign MSIX test packages (DevCheck)' - inputs: - targetType: filePath - filePath: tools\DevCheck.ps1 - arguments: -NoInteractive -Offline -Verbose -CertPassword 'BuildPipeline' -CheckTestPfx -Clean - workingDirectory: '$(Build.SourcesDirectory)' - - - task: powershell@2 - displayName: 'Create AppNotifications overrides' - inputs: - targetType: filePath - filePath: tools\GenerateDynamicDependencyOverrides.ps1 - arguments: -Path $(Build.SourcesDirectory)\build\override - workingDirectory: '$(Build.SourcesDirectory)' - - - task: powershell@2 - displayName: 'Create PushNotifications overrides' - inputs: - targetType: filePath - filePath: tools\GeneratePushNotificationsOverrides.ps1 - arguments: -Path $(Build.SourcesDirectory)\build\override - workingDirectory: '$(Build.SourcesDirectory)' - - - task: powershell@2 - displayName: 'Create DynamicDependencies TerminalVelocity features' - inputs: - targetType: filePath - filePath: tools\TerminalVelocity\Generate-TerminalVelocityFeatures.ps1 - arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-AppNotifications.xml -Channel ${{ parameters.channel }} -Language C++ -Namespace Microsoft.Windows.AppNotifications -Output $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-AppNotifications.h - workingDirectory: '$(Build.SourcesDirectory)' - - - task: powershell@2 - displayName: 'Create DeploymentAPI TerminalVelocity features' - inputs: - targetType: filePath - filePath: tools\TerminalVelocity\Generate-TerminalVelocityFeatures.ps1 - arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-DeploymentAPI.xml -Channel ${{ parameters.channel }} -Language C++ -Namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime -Output $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-DeploymentAPI.h - workingDirectory: '$(Build.SourcesDirectory)' - - - task: powershell@2 - displayName: 'Create DynamicDependencies TerminalVelocity features' - inputs: - targetType: filePath - filePath: tools\TerminalVelocity\Generate-TerminalVelocityFeatures.ps1 - arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-DynamicDependency.xml -Channel ${{ parameters.channel }} -Language C++ -Namespace Microsoft.Windows.ApplicationModel.DynamicDependency -Output $(Build.SourcesDirectory)\dev\common\MddTerminalVelocityFeatures.h - workingDirectory: '$(Build.SourcesDirectory)' - - - task: powershell@2 - displayName: 'Create VersionInfo TerminalVelocity features' - inputs: - targetType: filePath - filePath: tools\TerminalVelocity\Generate-TerminalVelocityFeatures.ps1 - arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-VersionInfo.xml -Channel ${{ parameters.channel }} -Language C++ -Namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime -Output $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-VersionInfo.h - workingDirectory: '$(Build.SourcesDirectory)' - - - task: powershell@2 - displayName: 'Create PushNotifications TerminalVelocity features' - inputs: - targetType: filePath - filePath: tools\TerminalVelocity\Generate-TerminalVelocityFeatures.ps1 - arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-PushNotifications.xml -Channel ${{ parameters.channel }} -Language C++ -Namespace Microsoft.Windows.PushNotifications -Output $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-PushNotifications.h - workingDirectory: '$(Build.SourcesDirectory)' - - - task: powershell@2 - displayName: 'Create EnvironmentManager TerminalVelocity features' - inputs: - targetType: filePath - filePath: tools\TerminalVelocity\Generate-TerminalVelocityFeatures.ps1 - arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-EnvironmentManager.xml -Channel ${{ parameters.channel }} -Language C++ -Namespace Microsoft.Windows.System -Output $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-EnvironmentManager.h - workingDirectory: '$(Build.SourcesDirectory)' - - - task: powershell@2 - name: UpdateTraceloggingConfig - inputs: - targetType: 'inline' - script: | - $srcPath = Get-Childitem -Path 'dev\WindowsAppRuntime_Insights\packages' -File 'MicrosoftTelemetry.h' -Recurse - - if (($srcPath -ne $null)){ - $destinationPaths = Get-Childitem -Path 'packages' -File 'Traceloggingconfig.h' -Recurse - - if (($destinationPaths -ne $null)) { - foreach ($destPath in $destinationPaths) { - Write-Host 'SourcePath:' $srcPath.FullName - Write-Host 'DestinationPath:' $destPath.FullName - Copy-Item -Force $srcPath.FullName $destPath.FullName - } - } - } - - # Copy MSIX license installation header into the correct source location. - - ${{ if eq(parameters.enableLicenseInstall, true) }}: - - task: CopyFiles@2 - displayName: 'Extract license header to source location' - inputs: - SourceFolder: '$(Build.SourcesDirectory)\build\packages\$(AppLicensingInternalPackageName).$(AppLicensingInternalPackageVersion)\src' - Contents: | - *.h - TargetFolder: '$(Build.SourcesDirectory)\dev\Licensing' - flattenFolders: false - overWrite: true - - - task: VSBuild@1 - displayName: 'Build solution ${{ parameters.solutionPath }}' - inputs: - solution: ${{ parameters.solutionPath }} - vsVersion: 16.0 - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' - msbuildArgs: '/restore /p:AppxSymbolPackageEnabled=false /binaryLogger:$(Build.SourcesDirectory)/${{ parameters.solutionPath }}.$(buildPlatform).$(buildConfiguration).binlog /p:WindowsAppSDKVersionBuild=$(builddate_yymm) /p:WindowsAppSDKVersionRevision=$(builddate_dd)$(buildrevision) /p:VCToolsInstallDir="$(VCToolsInstallDir)\" /p:PGOBuildMode=$(PGOBuildMode) /p:WindowsAppSDKBuildPipeline=1 /p:WindowsAppSDKCleanIntermediateFiles=${{ parameters.WindowsAppSDKCleanIntermediateFiles }}' - - - ${{ if eq(parameters.runSDLBinaryAnalysis, 'true') }}: - - template: WindowsAppSDK-BinaryAnalysis-steps.yml - parameters: - outputDirectory: '${{ parameters.buildOutputDir }}' - enablePREFast: ${{ parameters.enablePREFast }} - - - task: powershell@2 - displayName: 'Install test certificate for MSIX test packages (DevCheck)' - inputs: - targetType: filePath - filePath: tools\DevCheck.ps1 - arguments: -NoInteractive -Offline -Verbose -CheckTestCert - workingDirectory: '$(Build.SourcesDirectory)' - - - task: powershell@2 - displayName: 'Setup TAEF Service (DevCheck)' - inputs: - targetType: filePath - filePath: tools\DevCheck.ps1 - arguments: -Offline -Verbose -NoInteractive -CheckTAEFService - workingDirectory: '$(Build.SourcesDirectory)' - -#DISABLED - GitHub runs as a a built-in Administrator (thus Elevated and no split-token) -# TAEF Service can't RunAs:RestrictedUser from this account thus all tests Failed or Blocked -# and Dynamic Dependencies doesn't support Elevation so it's impossible for this test to -# work correctly today. Disabling until we move off GitHub's pipeline for test execution -# - task: CmdLine@2 -# displayName: 'Run AppLifeCycleTest' -# inputs: -# script: 'te.exe CppTest.dll' -# workingDirectory: '$(Build.SourcesDirectory)\BuildOutput\$(buildConfiguration)\$(buildPlatform)\CppTest' -# condition: or(eq(variables.buildPlatform, 'x64'), eq(variables.buildPlatform, 'x86')) - - - task: PublishBuildArtifacts@1 - displayName: 'Publish ${{ parameters.solutionPath }} binlog' - condition: succeededOrFailed() - inputs: - PathtoPublish: $(Build.SourcesDirectory)/${{ parameters.solutionPath }}.$(buildPlatform).$(buildConfiguration).binlog - artifactName: binlogs - -#UNDONE - subsequent PR -# - task: powershell@2 -# displayName: 'Source Index PDBs' -# inputs: -# targetType: filePath -# filePath: build\SourceIndexing\IndexPdbs.ps1 -# arguments: -SearchDir '${{ parameters.buildOutputDir }}\$(buildConfiguration)' -SourceRoot '$(Build.SourcesDirectory)' -recursive -Verbose -CommitId $(Build.SourceVersion) -# errorActionPreference: silentlyContinue - - - task: powershell@2 - displayName: 'Remove test certificate for MSIX test packages (DevCheck)' - inputs: - targetType: filePath - filePath: tools\DevCheck.ps1 - arguments: -NoInteractive -Offline -Verbose -RemoveTestCert -RemoveTestPfx - workingDirectory: '$(Build.SourcesDirectory)' diff --git a/build/AzurePipelinesTemplates/WindowsAppSDK-SetupBuildEnvironment-Steps.yml b/build/AzurePipelinesTemplates/WindowsAppSDK-SetupBuildEnvironment-Steps.yml index c89ad36c7..85e968609 100644 --- a/build/AzurePipelinesTemplates/WindowsAppSDK-SetupBuildEnvironment-Steps.yml +++ b/build/AzurePipelinesTemplates/WindowsAppSDK-SetupBuildEnvironment-Steps.yml @@ -35,7 +35,7 @@ steps: inputs: targetType: filePath filePath: tools\TerminalVelocity\Generate-TerminalVelocityFeatures.ps1 - arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-DynamicDependency.xml -Channel 'experimental' -Language C++ -Namespace Microsoft.Windows.ApplicationModel.DynamicDependency -Output $(Build.SourcesDirectory)\dev\common\MddTerminalVelocityFeatures.h + arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-DynamicDependency.xml -Channel $(channel) -Language C++ -Namespace Microsoft.Windows.ApplicationModel.DynamicDependency -Output $(Build.SourcesDirectory)\dev\common\MddTerminalVelocityFeatures.h workingDirectory: '$(Build.SourcesDirectory)' - task: powershell@2 @@ -43,7 +43,7 @@ steps: inputs: targetType: filePath filePath: tools\TerminalVelocity\Generate-TerminalVelocityFeatures.ps1 - arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-DeploymentAPI.xml -Channel 'experimental' -Language C++ -Namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime -Output $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-DeploymentAPI.h + arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-DeploymentAPI.xml -Channel $(channel) -Language C++ -Namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime -Output $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-DeploymentAPI.h workingDirectory: '$(Build.SourcesDirectory)' - task: powershell@2 @@ -51,7 +51,7 @@ steps: inputs: targetType: filePath filePath: tools\TerminalVelocity\Generate-TerminalVelocityFeatures.ps1 - arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-AppNotifications.xml -Channel 'experimental' -Language C++ -Namespace Microsoft.Windows.AppNotifications -Output $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-AppNotifications.h + arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-AppNotifications.xml -Channel $(channel) -Language C++ -Namespace Microsoft.Windows.AppNotifications -Output $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-AppNotifications.h workingDirectory: '$(Build.SourcesDirectory)' - task: powershell@2 @@ -59,7 +59,7 @@ steps: inputs: targetType: filePath filePath: tools\TerminalVelocity\Generate-TerminalVelocityFeatures.ps1 - arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-PushNotifications.xml -Channel 'experimental' -Language C++ -Namespace Microsoft.Windows.PushNotifications -Output $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-PushNotifications.h + arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-PushNotifications.xml -Channel $(channel) -Language C++ -Namespace Microsoft.Windows.PushNotifications -Output $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-PushNotifications.h workingDirectory: '$(Build.SourcesDirectory)' - task: powershell@2 @@ -67,7 +67,7 @@ steps: inputs: targetType: filePath filePath: tools\TerminalVelocity\Generate-TerminalVelocityFeatures.ps1 - arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-EnvironmentManager.xml -Channel 'experimental' -Language C++ -Namespace Microsoft.Windows.System -Output $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-EnvironmentManager.h + arguments: -Path $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-EnvironmentManager.xml -Channel $(channel) -Language C++ -Namespace Microsoft.Windows.System -Output $(Build.SourcesDirectory)\dev\common\TerminalVelocityFeatures-EnvironmentManager.h workingDirectory: '$(Build.SourcesDirectory)' - task: powershell@2 diff --git a/docs/Coding-Guidelines/TerminalVelocity.md b/docs/Coding-Guidelines/TerminalVelocity.md index 72d2f75d1..8349bb4a4 100644 --- a/docs/Coding-Guidelines/TerminalVelocity.md +++ b/docs/Coding-Guidelines/TerminalVelocity.md @@ -25,7 +25,7 @@ Follow these steps: 1. Create `dev\common\TerminalVelocityFeatures-.xml` 2. Run the TerminalVelocity generator create `dev\common\TerminalVelocityFeatures-.h` -3. Add a task to the build pipeline `build\AzurePipelinesTemplates\WindowsAppSDK-BuildProject-Steps.yml` +3. Add a task to call `Generate-TerminalVelocityFeatures.ps1` to the build pipeline `build\AzurePipelinesTemplates\WindowsAppSDK-SetupBuildEnvironment-Steps.yml` 4. Add TerminalVelocity checks to NOOP your feature 5. Checkin!