Skip to content

Support to Build and test a specific cmdlet project through msbuild property of "scope" #977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 39 additions & 30 deletions AzurePowershell.Test.targets
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,7 @@
<TestTimeout Condition=" '$(TestTimeout)' == '' ">100000000</TestTimeout>
</PropertyGroup>

<ItemGroup>
<XUnitTests Include=".\src\ResourceManager\AzureBackup\Commands.AzureBackup.Test\bin\Debug\Microsoft.Azure.Commands.AzureBackup.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\SiteRecovery\Commands.SiteRecovery.Test\bin\Debug\Microsoft.Azure.Commands.SiteRecovery.Test.dll"/>
<XUnitTests Include=".\src\ServiceManagement\Common\Commands.Common.Test\bin\Debug\Microsoft.WindowsAzure.Commands.Common.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\Sql\Commands.Sql.Test\bin\Debug\Microsoft.Azure.Commands.Sql.Test.dll"/>
<XUnitTests Include=".\src\ServiceManagement\Services\Commands.Test\bin\Debug\Microsoft.WindowsAzure.Commands.Test.dll"/>
<XUnitTests Include=".\src\ServiceManagement\StorSimple\Commands.StorSimple.Test\bin\Debug\Microsoft.WindowsAzure.Commands.StorSimple.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\Resources\Commands.Resources.Test\bin\Debug\Microsoft.Azure.Commands.Resources.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\Compute\Commands.Compute.Test\bin\Debug\Microsoft.Azure.Commands.Compute.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\Network\Commands.Network.Test\bin\Debug\Microsoft.Azure.Commands.Network.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\DataFactories\Commands.DataFactories.Test\bin\Debug\Microsoft.Azure.Commands.DataFactories.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\Dns\Commands.Dns.Test\bin\Debug\Microsoft.Azure.Commands.Dns.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\StreamAnalytics\Commands.StreamAnalytics.Test\bin\Debug\Microsoft.Azure.Commands.StreamAnalytics.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\OperationalInsights\Commands.OperationalInsights.Test\bin\Debug\Microsoft.Azure.Commands.OperationalInsights.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\AzureBatch\Commands.Batch.Test\bin\Debug\Microsoft.Azure.Commands.Batch.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\Websites\Commands.Websites.Test\bin\Debug\Microsoft.Azure.Commands.Websites.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\KeyVault\Commands.KeyVault.Test\bin\Debug\Microsoft.Azure.Commands.KeyVault.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\UsageAggregates\Commands.UsageAggregates.Test\bin\Debug\Microsoft.Azure.Commands.UsageAggregates.Test.dll"/>
<XUnitTests Include=".\src\ServiceManagement\ManagedCache\Commands.ManagedCache.Test\bin\Debug\Microsoft.Azure.Commands.ManagedCache.Test.dll"/>
<XUnitTests Include=".\src\ServiceManagement\RemoteApp\Commands.RemoteApp.Test\bin\Debug\Microsoft.Azure.Commands.RemoteApp.Tests.dll"/>
<XUnitTests Include=".\src\ServiceManagement\Common\Commands.ScenarioTest\bin\Debug\Microsoft.WindowsAzure.Commands.ScenarioTest.dll"/>
<XUnitTests Include=".\src\ServiceManagement\RecoveryServices\Commands.RecoveryServices.Test\bin\Debug\Microsoft.Azure.Commands.RecoveryServices.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\TrafficManager\Commands.TrafficManager2.Test\bin\Debug\Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.dll"/>
<XUnitTests Include=".\src\ServiceManagement\Network\Commands.Network.Test\bin\Debug\Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\ApiManagement\Commands.ApiManagement.Test\bin\Debug\Microsoft.Azure.Commands.ApiManagement.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\Profile\Commands.Profile.Test\bin\Debug\Microsoft.Azure.Commands.Profile.Test.dll"/>
</ItemGroup>


<Target Name="InvokeMSTest">
<!--Remove existing test result; otherwise mstest will error-->
<Delete Files="$(_testResult)"/>
Expand All @@ -79,11 +52,48 @@
</Target>

<Target Name="InvokeXUnit">
<ItemGroup>
<AsmXUnitTests Include=".\src\ServiceManagement\Common\Commands.Common.Test\bin\Debug\Microsoft.WindowsAzure.Commands.Common.Test.dll"/>
<AsmXUnitTests Include=".\src\ServiceManagement\Services\Commands.Test\bin\Debug\Microsoft.WindowsAzure.Commands.Test.dll"/>
<AsmXUnitTests Include=".\src\ServiceManagement\StorSimple\Commands.StorSimple.Test\bin\Debug\Microsoft.WindowsAzure.Commands.StorSimple.Test.dll"/>
<AsmXUnitTests Include=".\src\ServiceManagement\ManagedCache\Commands.ManagedCache.Test\bin\Debug\Microsoft.Azure.Commands.ManagedCache.Test.dll"/>
<AsmXUnitTests Include=".\src\ServiceManagement\RemoteApp\Commands.RemoteApp.Test\bin\Debug\Microsoft.Azure.Commands.RemoteApp.Tests.dll"/>
<AsmXUnitTests Include=".\src\ServiceManagement\Common\Commands.ScenarioTest\bin\Debug\Microsoft.WindowsAzure.Commands.ScenarioTest.dll"/>
<AsmXUnitTests Include=".\src\ServiceManagement\RecoveryServices\Commands.RecoveryServices.Test\bin\Debug\Microsoft.Azure.Commands.RecoveryServices.Test.dll"/>
<AsmXUnitTests Include=".\src\ServiceManagement\Network\Commands.Network.Test\bin\Debug\Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Test.dll"/>
</ItemGroup>
<ItemGroup Condition=" '$(scope)' == '' ">
<XUnitTests Include=".\src\ResourceManager\SiteRecovery\Commands.SiteRecovery.Test\bin\Debug\Microsoft.Azure.Commands.SiteRecovery.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\Sql\Commands.Sql.Test\bin\Debug\Microsoft.Azure.Commands.Sql.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\Resources\Commands.Resources.Test\bin\Debug\Microsoft.Azure.Commands.Resources.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\Compute\Commands.Compute.Test\bin\Debug\Microsoft.Azure.Commands.Compute.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\Network\Commands.Network.Test\bin\Debug\Microsoft.Azure.Commands.Network.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\DataFactories\Commands.DataFactories.Test\bin\Debug\Microsoft.Azure.Commands.DataFactories.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\Dns\Commands.Dns.Test\bin\Debug\Microsoft.Azure.Commands.Dns.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\StreamAnalytics\Commands.StreamAnalytics.Test\bin\Debug\Microsoft.Azure.Commands.StreamAnalytics.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\OperationalInsights\Commands.OperationalInsights.Test\bin\Debug\Microsoft.Azure.Commands.OperationalInsights.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\AzureBatch\Commands.Batch.Test\bin\Debug\Microsoft.Azure.Commands.Batch.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\Websites\Commands.Websites.Test\bin\Debug\Microsoft.Azure.Commands.Websites.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\KeyVault\Commands.KeyVault.Test\bin\Debug\Microsoft.Azure.Commands.KeyVault.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\UsageAggregates\Commands.UsageAggregates.Test\bin\Debug\Microsoft.Azure.Commands.UsageAggregates.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\TrafficManager\Commands.TrafficManager2.Test\bin\Debug\Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.dll"/>
<XUnitTests Include=".\src\ResourceManager\ApiManagement\Commands.ApiManagement.Test\bin\Debug\Microsoft.Azure.Commands.ApiManagement.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\Profile\Commands.Profile.Test\bin\Debug\Microsoft.Azure.Commands.Profile.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\AzureBackup\Commands.AzureBackup.Test\bin\Debug\Microsoft.Azure.Commands.AzureBackup.Test.dll"/>
<XUnitTests Include="@(AsmXUnitTests)"/>
</ItemGroup>
<ItemGroup Condition=" '$(scope)' == 'ServiceManagement' ">
<XUnitTests Include="@(AsmXUnitTests)"/>
</ItemGroup>
<ItemGroup Condition=" '$(scope)' !='' and '$(scope)' != 'ServiceManagement' ">
<XUnitTests Include="$(MSBuildProjectDirectory)\src\ResourceManager\$(scope)\*\bin\Debug\*.Test.dll"/>
</ItemGroup>

<Message Importance="high" Text="Running XUnit tests" />
<MakeDir Directories="$(TestOutputDirectory)" ContinueOnError="false" />
<Exec
Command="$(MSBuildProjectDirectory)\packages\xunit.runner.console.2.0.0\tools\xunit.console.x86.exe &quot;%(XUnitTests.Identity)&quot; -parallel none -maxthreads 0 -trait &quot;AcceptanceType=CheckIn&quot; -html &quot;$(TestOutputDirectory)\%(XUnitTests.Filename).html&quot;"
Timeout="$(TestTimeout)" ContinueOnError="false"/>
Timeout="$(TestTimeout)" ContinueOnError="false" Condition=" @(XUnitTests) != '' "/>
<OnError ExecuteTargets="TimeoutErrorHandler"/>
</Target>

Expand All @@ -101,7 +111,6 @@
</Target>

<Target Name="BeforeRunTests">
<Message Importance="high" Text="You are required to have installed a version of Visual Studio with support for MSTest (and MSTest on your path)." />
<MakeDir Directories="$(TestOutputDirectory)" ContinueOnError="false" />
</Target>

Expand Down
51 changes: 23 additions & 28 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<NuGetPublishingSource Condition=" '$(NuGetPublishingSource)' != '' ">http://psget/PSGallery/api/v2/</NuGetPublishingSource>
</PropertyGroup>
<ItemGroup>
<AzureResourceManagerSln Include=".\src\ResourceManager.sln" />
<AzureServiceManagementSln Include=".\src\ServiceManagement.sln" />
<CmdletSolutionsToBuild Include=".\src\ResourceManager.sln;.\src\ServiceManagement.sln" Condition=" '$(Scope)' == '' "/>
<CmdletSolutionsToBuild Include=".\src\$(Scope).sln" Condition=" '$(Scope)' != '' "/>
<SetupSln Include=".\setup\azurepowershell.sln" />
<SetupPowershellGetSln Include=".\setup-powershellget\powershellget.sln" />
</ItemGroup>
Expand All @@ -64,28 +64,19 @@

<!-- Clean the build in all configurations -->
<Target Name="Clean">
<!-- Clean the solutions -->
<Message Importance="high" Text="Cleaning Cmdlets..." ContinueOnError="false" />
<MSBuild
Projects="@(AzureResourceManagerSln)"
Targets="Clean"
Properties="Configuration=$(Configuration);Platform=Any CPU"
ContinueOnError="false" />
<MSBuild
Projects="@(AzureServiceManagementSln)"
Targets="Clean"
Properties="Configuration=$(Configuration);Platform=Any CPU"
ContinueOnError="false" />
<MSBuild
Projects="@(SetupSln)"
Projects="@(CmdletSolutionsToBuild)"
Targets="Clean"
Properties="Configuration=$(Configuration);Platform=Any CPU"
ContinueOnError="false" />

<MSBuild
Projects="@(SetupPowershellGetSln)"
Targets="Clean"
Properties="Configuration=$(Configuration);Platform=Any CPU"
ContinueOnError="false" />
ContinueOnError="false"
Condition=" '$(Scope)' == '' "/>

<!-- Delete the publish files -->
<Message Importance="high" Text="Cleaning publish files..." ContinueOnError="false" />
Expand Down Expand Up @@ -140,8 +131,12 @@
<Exec Command="$(NuGetCommand) sources add -Name LocalFeed -Source &quot;$(MSBuildProjectDirectory)\tools\LocalFeed&quot; $(NuGetRestoreConfigSwitch)"/>

<!-- Restore packages -->
<Exec Command="$(NuGetCommand) restore $(MSBuildProjectDirectory)\src\ResourceManager.sln $(NuGetRestoreConfigSwitch)" ContinueOnError="false" />
<Exec Command="$(NuGetCommand) restore $(MSBuildProjectDirectory)\src\ServiceManagement.sln $(NuGetRestoreConfigSwitch)" ContinueOnError="false" />
<Exec Command="$(NuGetCommand) restore $(MSBuildProjectDirectory)\src\ResourceManager.sln $(NuGetRestoreConfigSwitch)" ContinueOnError="false"
Condition="$(Scope) == ''" />
<Exec Command="$(NuGetCommand) restore $(MSBuildProjectDirectory)\src\ServiceManagement.sln $(NuGetRestoreConfigSwitch)" ContinueOnError="false"
Condition="$(Scope) == ''" />
<Exec Command="$(NuGetCommand) restore $(MSBuildProjectDirectory)\src\$(Scope).sln $(NuGetRestoreConfigSwitch)" ContinueOnError="false"
Condition="$(Scope) != ''" />

<!--Restore the xunit runner needed to run unit tests-->
<Exec Command="$(NuGetCommand) restore $(MSBuildProjectDirectory)\packages.config -PackagesDirectory $(MSBuildProjectDirectory)\packages" />
Expand All @@ -153,15 +148,11 @@
<Target Name="Build" DependsOnTargets="RestoreNugetPackages;BuildMsBuildTask">
<Message Importance="high" Text="Building Cmdlets..." />
<MSBuild
Projects="@(AzureResourceManagerSln)"
Projects="@(CmdletSolutionsToBuild)"
Targets="Build"
Properties="Configuration=$(Configuration);Platform=Any CPU"
BuildInParallel="$(BuildInParallel)" ContinueOnError="false" />
<MSBuild
Projects="@(AzureServiceManagementSln)"
Targets="Build"
Properties="Configuration=$(Configuration);Platform=Any CPU"
BuildInParallel="$(BuildInParallel)" ContinueOnError="false" />
BuildInParallel="$(BuildInParallel)"
ContinueOnError="false" />

<CallTarget Targets="CodeSignBinaries" Condition=" '$(CodeSign)' == 'true' " />

Expand All @@ -170,14 +161,18 @@
Projects="@(SetupPowershellGetSln)"
Targets="Build"
Properties="Configuration=$(Configuration);Platform=Any CPU"
ContinueOnError="false" />
ContinueOnError="false"
Condition=" '$(Scope)' == '' "/>

<MSBuild
Projects="@(SetupSln)"
Targets="Build"
Properties="Configuration=$(Configuration);Platform=Any CPU"
ContinueOnError="false" />
ContinueOnError="false"
Condition=" '$(Scope)' == '' "/>

<CallTarget Targets="CodeSignInstaller" Condition=" '$(CodeSign)' == 'true' " />
<CallTarget Targets="CodeSignInstaller"
Condition=" '$(CodeSign)' == 'true' and '$(Scope)' == ''" />
</Target>

<!-- Do everything possible -->
Expand Down Expand Up @@ -305,7 +300,7 @@
<Import Project="$(MSBuildThisFileDirectory)AzurePowershell.test.targets"/>

<!-- Run checkin tests for each pull request -->
<Target Name="Test" DependsOnTargets="Build;BeforeRunTests">
<Target Name="Test" DependsOnTargets="BeforeRunTests">
<Message Importance="high" Text="Running check in tests..." />
<CallTarget Targets="InvokeXUnit"/>
</Target>
Expand Down
Loading