|
6 | 6 | <IntermediateOutputPath>.nuget\</IntermediateOutputPath>
|
7 | 7 | <PackagesPath>$(IntermediateOutputPath)packages</PackagesPath>
|
8 | 8 | <Out Condition=" '$(Out)' == '' ">$(MSBuildThisFileDirectory)out</Out>
|
9 |
| - <!-- |
10 |
| - <SkipReadGitCache Condition=" '$(SkipReadGitCache)' == '' ">true</SkipReadGitCache> |
11 |
| - <SkipWriteGitCache Condition=" '$(SkipWriteGitCache)' == '' ">true</SkipWriteGitCache> |
12 |
| - --> |
13 | 9 | <!-- We always use DeployExtension=false from the build script to ensure a clean build, but
|
14 | 10 | also because if we run integration tests, we do so by installing the resulting VSIX,
|
15 | 11 | which makes for a cleaner test too. -->
|
16 |
| - <CommonBuildProperties>WarningLevel=0;NoWarn=1591;RunCodeAnalysis=false;Configuration=$(Configuration);Out=$(Out);SkipReadGitCache=$(SkipReadGitCache);SkipWriteGitCache=$(SkipWriteGitCache);DeployExtension=false</CommonBuildProperties> |
17 |
| - <DefaultImportance Condition=" '$(DefaultImportance)' == '' ">normal</DefaultImportance> |
| 12 | + <CommonBuildProperties>WarningLevel=0;NoWarn=1591;RunCodeAnalysis=false;Configuration=$(Configuration);Out=$(Out);DeployExtension=false</CommonBuildProperties> |
| 13 | + <DefaultImportance Condition=" '$(DefaultImportance)' == '' ">high</DefaultImportance> |
18 | 14 | </PropertyGroup>
|
19 | 15 |
|
20 | 16 | <!-- Integration-test related stuff -->
|
|
27 | 23 | </PropertyGroup>
|
28 | 24 |
|
29 | 25 | <PropertyGroup Condition=" '$(IntegrationTest)' == 'true' ">
|
| 26 | + <TestVsVersions>$([MSBuild]::ValueOrDefault('$(VisualStudioVersions)', 'All'))</TestVsVersions> |
30 | 27 | <!-- When running integration tests, either use an explicit VisualStudioVersion received or fallback to All -->
|
31 |
| - <CommonBuildProperties>$(CommonBuildProperties);VisualStudioVersions=$([MSBuild]::ValueOrDefault('$(VisualStudioVersions)', 'All'))</CommonBuildProperties> |
| 28 | + <CommonBuildProperties>$(CommonBuildProperties);VisualStudioVersions=$(TestVsVersions)</CommonBuildProperties> |
32 | 29 | </PropertyGroup>
|
33 | 30 |
|
34 | 31 | <ItemGroup>
|
35 | 32 | <Solution Include="src\*.sln"/>
|
36 | 33 | <TestProject Include="src\**\*.Tests.csproj" />
|
37 |
| - <TestProject Include="src\**\*.IntegrationTests.csproj" Condition=" '$(IntegrationTest)' == 'true' " /> |
| 34 | + <IntegrationTestProject Include="src\**\*.IntegrationTests.csproj" /> |
38 | 35 | </ItemGroup>
|
39 | 36 |
|
40 | 37 | <Target Name="All" DependsOnTargets="Build;Test;Package" />
|
|
54 | 51 | <MSBuild Projects="@(Solution)" Properties="$(CommonBuildProperties)" />
|
55 | 52 |
|
56 | 53 | <ItemGroup>
|
57 |
| - <CandidateNuSpec Include="src\**\*.nuspec" /> |
58 |
| - <NuSpec Include="@(CandidateNuSpec)" Condition=" '%(Filename)' != 'Merq' And '%(Filename)' != 'Merq.Installer' " /> |
| 54 | + <NuSpec Include="src\**\*.nuspec" /> |
59 | 55 | </ItemGroup>
|
60 | 56 | </Target>
|
61 | 57 |
|
62 |
| - <Target Name="Package" DependsOnTargets="BuildInstaller;BuildPackages;FindPackages;DeletePackages;PrepareMetaPackage;BuildMetaPackage" /> |
| 58 | + <Target Name="Package" DependsOnTargets="BuildInstaller;BuildPackages;FindPackages;DeletePackages" /> |
63 | 59 |
|
64 | 60 | <Target Name="BuildInstaller">
|
65 | 61 | <!-- Refresh the VSIX with the SystemComponent flag now for redistribution -->
|
|
146 | 142 | <Delete Files="%(NuPackage.FullPath)" Condition=" '$(ExitCode)' == '0' Or '$(ExitCode)' == '18' " />
|
147 | 143 | </Target>
|
148 | 144 |
|
149 |
| - <Target Name="PrepareMetaPackage" DependsOnTargets="DeletePackages"> |
150 |
| - <ItemGroup> |
151 |
| - <EventsPackage Include="@(NuPackage)" Condition=" '%(Id)' == 'Merq.Events' And Exists('%(FullPath)') " /> |
152 |
| - <CommandsPackage Include="@(NuPackage)" Condition=" '%(Id)' == 'Merq.Commands' And Exists('%(FullPath)') " /> |
153 |
| - </ItemGroup> |
154 |
| - <PropertyGroup> |
155 |
| - <EventsVersion>@(EventsPackage -> '%(Version)%(ReleaseLabel)')</EventsVersion> |
156 |
| - <CommandsVersion>@(CommandsPackage -> '%(Version)%(ReleaseLabel)')</CommandsVersion> |
157 |
| - </PropertyGroup> |
158 |
| - </Target> |
159 |
| - |
160 |
| - <Target Name="BuildMetaPackage" DependsOnTargets="PrepareMetaPackage" Condition=" '$(EventsVersion)' != '' Or '$(CommandsVersion)' != '' "> |
161 |
| - <!-- There is at least a new Events or Commands package --> |
162 |
| - <Exec Command="$(Curl) -s -0 https://api.nuget.org/v3/registration1/merq.events/index.json" StandardOutputImportance="low" ConsoleToMSBuild="true"> |
163 |
| - <Output TaskParameter="ConsoleOutput" PropertyName="JsonContent" /> |
164 |
| - </Exec> |
165 |
| - <JsonPeek JsonContent="$(JsonContent)" JPath="items[0].upper"> |
166 |
| - <Output TaskParameter="Result" PropertyName="PublishedEvents" /> |
167 |
| - </JsonPeek> |
168 |
| - |
169 |
| - <Exec Command="$(Curl) -s -0 https://api.nuget.org/v3/registration1/merq.commands/index.json" StandardOutputImportance="low" ConsoleToMSBuild="true"> |
170 |
| - <Output TaskParameter="ConsoleOutput" PropertyName="JsonContent" /> |
171 |
| - </Exec> |
172 |
| - <JsonPeek JsonContent="$(JsonContent)" JPath="items[0].upper"> |
173 |
| - <Output TaskParameter="Result" PropertyName="PublishedCommands" /> |
174 |
| - </JsonPeek> |
175 |
| - |
176 |
| - <XmlPeek XmlInputPath="src\Merq.nuspec" Query="/package/metadata/version/text()"> |
177 |
| - <Output TaskParameter="Result" PropertyName="BaseVersion" /> |
178 |
| - </XmlPeek> |
179 |
| - |
180 |
| - <Exec Command="$(Curl) -s -0 https://api.nuget.org/v3/registration1/merq/index.json" StandardOutputImportance="low" ConsoleToMSBuild="true"> |
181 |
| - <Output TaskParameter="ConsoleOutput" PropertyName="JsonContent" /> |
182 |
| - </Exec> |
183 |
| - <JsonPeek JsonContent="$(JsonContent)" JPath="items[0].upper"> |
184 |
| - <Output TaskParameter="Result" PropertyName="PublishedMeta" /> |
185 |
| - </JsonPeek> |
186 |
| - |
187 |
| - <CalculateMetaVersion BaseVersion="$(BaseVersion)" PublishedVersion="$(PublishedMeta)"> |
188 |
| - <Output TaskParameter="TargetVersion" PropertyName="TargetVersion" /> |
189 |
| - </CalculateMetaVersion> |
190 |
| - |
191 |
| - <PropertyGroup> |
192 |
| - <EventsVersion Condition=" '$(EventsVersion)' == '' ">$(PublishedEvents)</EventsVersion> |
193 |
| - <CommandsVersion Condition=" '$(CommandsVersion)' == '' ">$(PublishedCommands)</CommandsVersion> |
194 |
| - </PropertyGroup> |
195 |
| - |
196 |
| - <Message Text="Determined new meta package version $(TargetVersion) with dependencies: |
197 |
| - Events: $(EventsVersion) (currently published version is $(PublishedEvents)) |
198 |
| - Commands: $(CommandsVersion) (currently published version is $(PublishedCommands))" |
199 |
| - Importance="high" /> |
200 |
| - |
201 |
| - <Exec Command='"$(NuGet)" Pack src\Merq.nuspec -Version $(TargetVersion) -Properties events=$(EventsVersion);commands=$(CommandsVersion) -OutputDirectory $(Out)' /> |
202 |
| - </Target> |
203 |
| - |
204 | 145 | <Import Project="$(PackagesPath)\MSBuilder.CodeTaskAssembly\build\MSBuilder.CodeTaskAssembly.props"
|
205 | 146 | Condition=" Exists('$(PackagesPath)\MSBuilder.CodeTaskAssembly\build\MSBuilder.CodeTaskAssembly.props') " />
|
206 | 147 | <Import Project="$(PackagesPath)\MSBuilder.DumpItems\build\MSBuilder.DumpItems.targets"
|
207 | 148 | Condition=" Exists('$(PackagesPath)\MSBuilder.DumpItems\build\MSBuilder.DumpItems.targets') "/>
|
208 | 149 | <Import Project="$(PackagesPath)\MSBuilder.IsAdministrator\build\MSBuilder.IsAdministrator.targets"
|
209 | 150 | Condition=" Exists('$(PackagesPath)\MSBuilder.IsAdministrator\build\MSBuilder.IsAdministrator.targets') "/>
|
210 |
| - <Import Project="$(PackagesPath)\JsonPoke.MSBuild\build\JsonPoke.MSBuild.Targets" |
211 |
| - Condition=" Exists('$(PackagesPath)\JsonPoke.MSBuild\build\JsonPoke.MSBuild.Targets') "/> |
212 | 151 | <Import Project="$(PackagesPath)\Microsoft.VSSDK.BuildTools\build\Microsoft.VSSDK.BuildTools.targets"
|
213 | 152 | Condition=" Exists('$(PackagesPath)\Microsoft.VSSDK.BuildTools\build\Microsoft.VSSDK.BuildTools.targets') And '$(IntegrationTest)' == 'true' " />
|
214 | 153 | <Import Project="$(PackagesPath)\MSBuilder.VsixInstaller\build\MSBuilder.VsixInstaller.targets"
|
|
229 | 168 | <Target Name="Test" DependsOnTargets="$(TestDependsOn)" />
|
230 | 169 |
|
231 | 170 | <Target Name="PrepareInstall" DependsOnTargets="IsAdministrator">
|
232 |
| - <ItemGroup> |
| 171 | + <ItemGroup Condition=" '$(TestVsVersions)' == 'All' "> |
233 | 172 | <SupportedVersion Include="11.0;12.0;14.0" />
|
| 173 | + </ItemGroup> |
| 174 | + <ItemGroup Condition=" '$(TestVsVersions)' != 'All' "> |
| 175 | + <SupportedVersion Include="11.0" Condition=" $(TestVsVersions.Contains('11.0')) == 'true' " /> |
| 176 | + <SupportedVersion Include="12.0" Condition=" $(TestVsVersions.Contains('12.0')) == 'true' " /> |
| 177 | + <SupportedVersion Include="14.0" Condition=" $(TestVsVersions.Contains('14.0')) == 'true' " /> |
| 178 | + </ItemGroup> |
| 179 | + <ItemGroup> |
234 | 180 | <SupportedVersion>
|
235 |
| - <VsixInstaller>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\%(Identity)', 'InstallDir', null, RegistryView.Registry32))VSIXInstaller.exe</VsixInstaller> |
| 181 | + <DevEnv>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\%(Identity)', 'InstallDir', null, RegistryView.Registry32))devenv.exe</DevEnv> |
236 | 182 | </SupportedVersion>
|
237 | 183 | <InstalledVersion Include="@(SupportedVersion)"
|
238 |
| - Condition=" Exists('%(VsixInstaller)') " /> |
| 184 | + Condition=" Exists('%(DevEnv)') " /> |
239 | 185 | </ItemGroup>
|
240 | 186 |
|
241 | 187 | <Message Importance="$(DefaultImportance)" Text="Found installed Visual Studio versions @(InstalledVersion)." />
|
|
253 | 199 | <EnabledExtension Include="@(_EnabledExtension)" Condition=" '$(IsAdministrator)' == 'False' And '%(InstalledPerMachine)' == 'False' And '%(SystemComponent)' == 'False' " />
|
254 | 200 | </ItemGroup>
|
255 | 201 |
|
| 202 | + <PropertyGroup> |
| 203 | + <PS>%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe</PS> |
| 204 | + </PropertyGroup> |
| 205 | + |
| 206 | + <!-- Existing versions of Xamarin will collide with the provided IAsyncManager export, even from the normal hive --> |
| 207 | + <!-- NOTE: we could check the product version too if needed: Version is available from the Win32_Product structure --> |
| 208 | + <Exec Command=""$(PS)" -NoProfile -Command "& { get-wmiobject Win32_Product | Where-Object Name -eq Xamarin | Select-Object -ExpandProperty IdentifyingNumber }"" |
| 209 | + ConsoleToMSBuild="true"> |
| 210 | + <Output TaskParameter="ConsoleOutput" PropertyName="XamarinProductCode" /> |
| 211 | + </Exec> |
| 212 | + |
| 213 | + <!-- TODO: eventually we will need to do this for the normal hive Merq installation itself instead :( |
| 214 | + although if that comes as a VSIX, it may be simpler to achieve? |
| 215 | + --> |
| 216 | + <Error Condition=" '$(IsAdministrator)' == 'false' And '$(XamarinProductCode)' != '' " |
| 217 | + Text="Existing Xamarin product installation found, but current user is not Administrator and can't uninstall it." /> |
| 218 | + |
| 219 | + <Exec Command='msiexec /x $(XamarinProductCode) /norestart /q | more' |
| 220 | + Condition=" '$(XamarinProductCode)' != '' " /> |
256 | 221 | </Target>
|
257 | 222 |
|
258 | 223 | <Target Name="DisableExtensions">
|
|
297 | 262 | <MSBuild Projects="@(TestProject)" BuildInParallel="false" Targets="GetTargetPath" Properties="$(CommonBuildProperties)">
|
298 | 263 | <Output TaskParameter="TargetOutputs" ItemName="_TestAssembly" />
|
299 | 264 | </MSBuild>
|
| 265 | + <MSBuild Projects="@(IntegrationTestProject)" BuildInParallel="false" Targets="GetTargetPath" Properties="$(CommonBuildProperties)" |
| 266 | + Condition=" '@(IntegrationTestProject)' != '' "> |
| 267 | + <Output TaskParameter="TargetOutputs" ItemName="_IntegrationTestAssembly" /> |
| 268 | + </MSBuild> |
300 | 269 |
|
301 | 270 | <ItemGroup>
|
302 | 271 | <TestAssembly Include="@(_TestAssembly)" Condition=" Exists('%(_TestAssembly.FullPath)') " />
|
| 272 | + <IntegrationTestAssembly Include="@(_IntegrationTestAssembly)" Condition=" Exists('%(_IntegrationTestAssembly.FullPath)') " /> |
303 | 273 | </ItemGroup>
|
304 | 274 |
|
305 | 275 | <MakeDir Directories="$(Out)" Condition="!Exists('$(Out)')" />
|
|
317 | 287 | <Exec Command="$(CoverageConsole) $(CoverageOptions) -target:$(XunitConsole) -targetargs:"@(TestAssembly, ' ') $(XunitOptions)""
|
318 | 288 | ConsoleToMSBuild="true"
|
319 | 289 | ContinueOnError="ErrorAndContinue" />
|
| 290 | + |
| 291 | + <Exec Command="$(XunitConsole) @(IntegrationTestAssembly, ' ') $(XunitOptions.Replace('test', 'integrationtest'))" |
| 292 | + Condition=" '@(IntegrationTestAssembly)' != '' " |
| 293 | + ConsoleToMSBuild="true" |
| 294 | + ContinueOnError="ErrorAndContinue" /> |
320 | 295 | </Target>
|
321 | 296 |
|
322 | 297 | <Target Name="TestMac" DependsOnTargets="PrepareTest" Condition=" '$(OS)' != 'Windows_NT' ">
|
|
0 commit comments