1
+ <#
2
+ This script is to build the framework transport package that will be used to generate the windows app sdk framework package.
3
+ This script is called from BuildAll.ps1 from the aggregator repo and should not be called directly.
4
+
5
+ Platform: Comma delimited string of platforms to run.
6
+ Configuration: Comma delimited string of configurations to run.
7
+ LocalPackagesPath: The path that the generated transport package needs to be saved.
8
+ UpdateVersionDetailsPath: Path to a ps1 or cmd that updates version.details.xml.
9
+
10
+ Note about building in different environments.
11
+ The feed the nuget.config points to changes depending on the branch.
12
+ Develop branch points to the internal feed.
13
+ Main branch points to the external feed.
14
+
15
+ #>
16
+
17
+ Param (
18
+ [string ]$Platform ,
19
+ [string ]$Configuration ,
20
+ [string ]$LocalPackagesPath = $null ,
21
+ [string ]$UpdateVersionDetailsPath = $null
22
+ )
23
+
24
+ $MRTSourcesDirectory = " dev\MRTCore"
25
+ $MRTBinariesDirectory = " BuildOutput"
26
+ $nuSpecsPath = " build\NuSpecs"
27
+ $fullNugetPath = " build\fullnuget"
28
+ $buildOverridePath = " build\override"
29
+ $windowsAppSdkBinariesPath = " build\windowsappsdk_binaries"
30
+
31
+ $builddate_yymm = Get-Date - Format " yyMM"
32
+ $builddate_dd = Get-Date - Format " dd"
33
+ $revision = Get-Date - Format " HHMM"
34
+
35
+ $VCToolsInstallDir = . " ${env: ProgramFiles(x86)} \Microsoft Visual Studio\Installer\vswhere.exe" - Latest - requires Microsoft.Component.MSBuild - property InstallationPath
36
+ write-host " VCToolsInstallDir: $VCToolsInstallDir "
37
+
38
+ # do all the directory making before any building.
39
+ if (-not (test-path " .nuget" ))
40
+ {
41
+ new-item - path " .nuget" - itemtype directory
42
+ }
43
+
44
+ if (-not (test-path " .nuget\nuget.exe" ))
45
+ {
46
+ Invoke-WebRequest https:// dist.nuget.org/ win- x86- commandline/ latest/ nuget.exe - OutFile .nuget\nuget.exe
47
+ }
48
+
49
+ if (-not (test-path " $buildOverridePath " ))
50
+ {
51
+ new-item - path " $buildOverridePath " - itemtype " directory"
52
+ }
53
+
54
+ if (-not (test-path " $windowsAppSdkBinariesPath " ))
55
+ {
56
+ new-item - path " $windowsAppSdkBinariesPath " - itemtype " directory"
57
+ }
58
+
59
+ if (-not (test-path " $fullNugetPath " ))
60
+ {
61
+ new-item - path " $fullNugetPath " - itemtype " directory"
62
+ }
63
+
64
+ if (-not (test-path " $fullNugetPath \build\native" ))
65
+ {
66
+ new-item - path " $fullNugetPath \build\native" - itemtype " directory"
67
+ }
68
+
69
+ if (-not (test-path " $fullNugetPath \mrt_raw" ))
70
+ {
71
+ new-item - path " $fullNugetPath \mrt_raw" - itemtype " directory"
72
+ }
73
+
74
+ if (-not (test-path " $fullNugetPath \mrt_raw\lib" ))
75
+ {
76
+ new-item - path " $fullNugetPath \mrt_raw\lib" - itemtype " directory"
77
+ }
78
+
79
+ # Restore any nuget packages.
80
+ & .\build\Scripts\ConvertVersionDetailsToPackageConfig.ps1 - versionDetailsPath " eng\Version.Details.xml" - packageConfigPath " build\packages.config"
81
+
82
+ & .\.nuget\nuget.exe restore " build\packages.config" - PackagesDirectory packages - ConfigFile " build\licensing.nuget.config"
83
+ & .\.nuget\nuget.exe restore WindowsAppRuntime.sln - configfile nuget.config
84
+ & .\.nuget\nuget.exe restore " dev\Bootstrap\CS\Microsoft.WindowsAppRuntime.Bootstrap.Net\Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj" - configfile nuget.config
85
+ & .\.nuget\nuget.exe restore " dev\WindowsAppRuntime_Insights\packages.config" - ConfigFile " dev\WindowsAppRuntime_Insights\nuget.config" - PackagesDirectory " dev\WindowsAppRuntime_Insights\packages"
86
+ & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\core\src\packages.config" - ConfigFile nuget.config - PackagesDirectory " $MRTSourcesDirectory \mrt\packages"
87
+ & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\Microsoft.Windows.ApplicationModel.Resources\src\packages.config" - ConfigFile nuget.config - PackagesDirectory " $MRTSourcesDirectory \mrt\packages"
88
+ & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\mrm\mrmex\packages.config" - ConfigFile nuget.config - PackagesDirectory " $MRTSourcesDirectory \mrt\packages"
89
+ & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\mrm\mrmmin\packages.config" - ConfigFile nuget.config - PackagesDirectory " $MRTSourcesDirectory \mrt\packages"
90
+ & .\.nuget\nuget.exe restore " $MRTSourcesDirectory \mrt\mrm\unittests\packages.config" - ConfigFile nuget.config - PackagesDirectory " $MRTSourcesDirectory \mrt\packages"
91
+
92
+ # init MRT
93
+ foreach ($platformToRun in $platform.Split (" ," ))
94
+ {
95
+ & $MRTSourcesDirectory \build\init.cmd / envonly $platformToRun \fre
96
+ }
97
+
98
+ # Build windows app runtime and mrt
99
+ foreach ($configurationToRun in $configuration.Split (" ," ))
100
+ {
101
+ foreach ($platformToRun in $platform.Split (" ," ))
102
+ {
103
+ msbuild / restore / m WindowsAppRuntime.sln / p:Configuration= $configurationToRun , Platform= $platformToRun
104
+ msbuild / restore / m " $MRTSourcesDirectory \mrt\MrtCore.sln" / p:Configuration= $configurationToRun , Platform= $platformToRun
105
+ }
106
+ }
107
+
108
+ # Copy over platform files
109
+ foreach ($platformToRun in $platform.Split (" ," ))
110
+ {
111
+ copy-item - path " $MRTBinariesDirectory \Release\$platformToRun \mrm\mrm.dll" - destination " $fullNugetPath \mrt_raw\lib\$platformToRun " - force
112
+ copy-item - path " $MRTBinariesDirectory \Release\$platformToRun \mrm\mrm.lib" - destination " $fullNugetPath \mrt_raw\lib\$platformToRun " - force
113
+ copy-item - path " $MRTBinariesDirectory \Release\$platformToRun \mrm\mrm.pdb" - destination " $fullNugetPath \mrt_raw\lib\$platformToRun " - force
114
+ copy-item - path " $MRTBinariesDirectory \Release\$platformToRun \Microsoft.Windows.ApplicationModel.Resources\Microsoft.Windows.ApplicationModel.Resources.dll" - destination " $fullNugetPath \mrt_raw\lib\$platformToRun " - force
115
+ copy-item - path " $MRTBinariesDirectory \Release\$platformToRun \Microsoft.Windows.ApplicationModel.Resources\Microsoft.Windows.ApplicationModel.Resources.pdb" - destination " $fullNugetPath \mrt_raw\lib\$platformToRun " - force
116
+
117
+ if ($ploatformToRun -eq " x86" )
118
+ {
119
+ copy-item - path " $MRTBinariesDirectory \Release\$platformToRun \Microsoft.Windows.ApplicationModel.Resources.Projection\Microsoft.Windows.ApplicationModel.Resources.Projection.dll" - destination " $fullNugetPath \mrt_raw\lib\anycpu\net5.0" - force
120
+ copy-item - path " $MRTBinariesDirectory \Release\$platformToRun \Microsoft.Windows.ApplicationModel.Resources.Projection\Microsoft.Windows.ApplicationModel.Resources.Projection.pdb" - destination " $fullNugetPath \mrt_raw\lib\anycpu\net5.0" - force
121
+ copy-item - path " $MRTBinariesDirectory \Release\$platformToRun \Microsoft.Windows.ApplicationModel.Resources\Microsoft.Windows.ApplicationModel.Resources.winmd" - destination " $fullNugetPath \mrt_raw\lib\anycpu" - force
122
+ }
123
+ }
124
+
125
+ # build AnyCPU
126
+ msbuild / restore / m " dev\Bootstrap\CS\Microsoft.WindowsAppRuntime.Bootstrap.Net\Microsoft.WindowsAppRuntime.Bootstrap.Net.csproj" / p:Configuration= release, Platform= anycpu
127
+
128
+ # If AnyCPU generates another dll it needs to be added here.
129
+ copy-item - path " buildoutput\release\anycpu\Microsoft.WindowsAppRuntime.Bootstrap.Net\Microsoft.WindowsAppRuntime.Bootstrap.Net.dll" - destination " $fullNugetPath \lib\net5.0-windows10.0.17763.0"
130
+
131
+ # Generate overrides
132
+ .\tools\GenerateDynamicDependencyOverrides.ps1 - Path " $buildOverridePath "
133
+ .\tools\GeneratePushNotificationsOverrides.ps1 - Path " $buildOverridePath "
134
+
135
+ # Copy more files.
136
+ foreach ($configurationToRun in $configuration.Split (" ," ))
137
+ {
138
+ foreach ($platformToRun in $platform.Split (" ," ))
139
+ {
140
+ .\build\CopyFilesToStagingDir.ps1 - BuildOutputDir ' BuildOutput' - OverrideDir " $buildOverridePath " - PublishDir " $windowsAppSdkBinariesPath " - NugetDir " $fullNugetPath " - Platform $PlatformToRun - Configuration $ConfigurationToRun
141
+ }
142
+ }
143
+
144
+ Copy-Item - Path " $nuSpecsPath \WindowsAppSDK-Nuget-Native.targets" - Destination " $fullNugetPath \build\native"
145
+ Copy-Item - Path " $nuSpecsPath \WindowsAppSDK-Nuget-Native.props" - Destination " $fullNugetPath \build\native"
146
+ Copy-Item - Path " $nuSpecsPath \WindowsAppSDK-Nuget-Native.C.props" - Destination " $fullNugetPath \build\native"
147
+ Copy-Item - Path " $nuSpecsPath \WindowsAppSDK-Nuget-Native.WinRt.props" - Destination " $fullNugetPath \build\native"
148
+ Copy-Item - Path " $nuSpecsPath \Microsoft.WindowsAppSDK.Foundation.targets" - Destination " $fullNugetPath \build"
149
+ Copy-Item - Path " $nuSpecsPath \Microsoft.WindowsAppSDK.Foundation.props" - Destination " $fullNugetPath \build"
150
+ Copy-Item - Path " $nuSpecsPath \Microsoft.WindowsAppSDK.Bootstrap.CS.targets" - Destination " $fullNugetPath \build"
151
+ Copy-Item - Path " $nuSpecsPath \WindowsAppSDK-Nuget-Native.Bootstrap.targets" - Destination " $fullNugetPath \build\native"
152
+ Copy-Item - Path " $nuSpecsPath \Microsoft.WindowsAppSDK.BootstrapCommon.targets" - Destination " $fullNugetPath \build"
153
+ Copy-Item - Path " $nuSpecsPath \Microsoft.WindowsAppSDK.DeploymentManager.CS.targets" - Destination " $fullNugetPath \build"
154
+ Copy-Item - Path " $nuSpecsPath \WindowsAppSDK-Nuget-Native.DeploymentManager.targets" - Destination " $fullNugetPath \build\native"
155
+ Copy-Item - Path " $nuSpecsPath \Microsoft.WindowsAppSDK.DeploymentManagerCommon.targets" - Destination " $fullNugetPath \build"
156
+ Copy-Item - Path " $nuSpecsPath \Microsoft.WindowsAppSDK.UndockedRegFreeWinRT.CS.targets" - Destination " $fullNugetPath \build"
157
+ Copy-Item - Path " $nuSpecsPath \WindowsAppSDK-Nuget-Native.UndockedRegFreeWinRT.targets" - Destination " $fullNugetPath \build"
158
+ Copy-Item - Path " $nuSpecsPath \Microsoft.WindowsAppSDK.UndockedRegFreeWinRTCommon.targets" - Destination " $fullNugetPath \build"
159
+ Copy-Item - Path " $nuSpecsPath \AppxManifest.xml" - Destination " $fullNugetPath "
160
+ Copy-Item - Path " LICENSE" - Destination " $fullNugetPath " - force
161
+
162
+ # for some reason xslt.load changes the working directory to C:\windows\system32.
163
+ # store the current working directory here.
164
+ $workingDirectory = get-location
165
+ $manifestPath = " $fullNugetPath \manifests"
166
+
167
+ # Make Microsoft.WindowsAppSDK.Foundation.manifest.
168
+ $newitem = New-Item - ItemType Directory - Force - Path $manifestPath
169
+ $xslt = New-Object System.Xml.Xsl.XslCompiledTransform
170
+ $xslt.Load (" $workingDirectory \build\TransformAppxManifest.xslt" )
171
+ $xslt.Transform (" $workingDirectory \$fullNugetPath \AppxManifest.xml" , " $workingDirectory \$manifestPath \Microsoft.WindowsAppSdk.Foundation.manifest" )
172
+
173
+ # any version will do here.
174
+ $packageVersion = ' 1.1.1.1'
175
+
176
+ # Add the version to the nuspec.
177
+ [xml ]$publicNuspec = Get-Content - Path " .\build\NuSpecs\Microsoft.WindowsAppSDK.Foundation.nuspec"
178
+ $publicNuspec.package.metadata.version = $packageVersion
179
+ Set-Content - Value $publicNuspec.OuterXml " .\build\NuSpecs\Microsoft.WindowsAppSDK.Foundation.nuspec"
180
+
181
+ # Make the foundation transport package.
182
+ nuget pack " .\build\NuSpecs\Microsoft.WindowsAppSDK.Foundation.nuspec" - BasePath $fullNugetPath - OutputDirectory $LocalPackagesPath
183
+
184
+ # Update the details in eng/version.details.xml
185
+ $packageName = " Microsoft.WindowsAppSDK.Foundation.TransportPackage"
186
+ & " $UpdateVersionDetailsPath " - dependencyName $packageName - dependencyVersion $packageVersion
0 commit comments