diff --git a/build/makefile.proj b/build/makefile.proj index 9c4ee79..3b6511c 100644 --- a/build/makefile.proj +++ b/build/makefile.proj @@ -5,6 +5,14 @@ netcoreapp1.0 0.2.2 + + + <_BuildPropertiesToRemove>$(_BuildPropertiesToRemove);TargetFramework;TargetFrameworks;LifecycleType;RestoreGraphProjectInput;_InvalidConfigurationWarn;_InvalidConfigurationError @@ -32,11 +40,6 @@ - - - - diff --git a/build/shade/_dotnet-test.shade b/build/shade/_dotnet-test.shade deleted file mode 100644 index 6ddc51d..0000000 --- a/build/shade/_dotnet-test.shade +++ /dev/null @@ -1,45 +0,0 @@ -use import="Environment" - -default NO_PARALLEL_TEST_PROJECTS='${E("NO_PARALLEL_TEST_PROJECTS")}' - -@{/* - -dotnet-test - Run unit tests in your project. - -projectFile='' - Required. Path to the test projectFile to execute - -configuration='' - Optional. The configuration to build in. Defaults to 'Debug'. -*/} - -default configuration = 'Debug' -default IgnoreDotnetTestExitCode = '${E("KOREBUILD_IGNORE_DOTNET_TEST_EXIT_CODE") == "true"}' -default test_options='' -default framework = '' - -@{ - var projectFolder = Path.GetDirectoryName(projectFile); - var projectName = Path.GetFileName(projectFolder); - var testArgs = test_options + " --configuration " + configuration; - - if (!string.IsNullOrEmpty(framework)) - { - testArgs += " --framework " + framework; - } - - try - { - Dotnet("test" + testArgs, projectFolder); - } - catch - { - if (!IgnoreDotnetTestExitCode) - { - // Ignore dotnet-test exit code if KOREBUILD_IGNORE_DOTNET_TEST_EXIT_CODE is set. - throw; - } - } -} - diff --git a/build/shade/_k-standard-goals.shade b/build/shade/_k-standard-goals.shade index ff524e8..00632cd 100644 --- a/build/shade/_k-standard-goals.shade +++ b/build/shade/_k-standard-goals.shade @@ -178,69 +178,11 @@ functions nuget-resilient-publish sourcePackagesDir='${BUILD_DIR}' nugetFeed='${E("NUGET_PUBLISH_FEED")}' if='!string.IsNullOrEmpty(E("NUGET_PUBLISH_FEED"))' -} -#xunit-test target='test' if='Directory.Exists("test")' +#xunit-test target='test' @{ - var projectFiles = Files.Include(TEST_PROJECT_GLOB); - foreach (var projectFile in projectFiles) - { - var dir = Path.GetDirectoryName(projectFile); - if (File.Exists(Path.Combine(dir, ".notest"))) - { - continue; - } - - var options = E("KOREBUILD_DOTNET_TEST_OPTIONS"); - if (IsTeamCity) - { - // TODO put all trx files in same folder. See https://github.com/Microsoft/vstest/issues/243 - // TODO or use TC logger https://github.com/Microsoft/vstest/issues/254 - options += " --logger:trx "; - } - // workaround for https://github.com/Microsoft/vstest/issues/283 - var txt = File.ReadAllText(projectFile); - var multiTfm = Regex.Match(txt, @"\(.+)\<\/TargetFrameworks\>"); - var singleTfm = Regex.Match(txt, @"\(.+)\<\/TargetFramework\>"); - if (multiTfm != null && multiTfm.Success) - { - var frameworks = multiTfm.Groups[1] - .Value - .Split(new string[] {";"}, StringSplitOptions.RemoveEmptyEntries) - .Select(s => s.Trim()) - .ToArray(); - - foreach (var framework in frameworks) - { - if (IsLinux && framework != null && framework.StartsWith("net4")) - { - Log.Info("Skipping tests for TFM " + framework + " on this platform"); - continue; - } - - DotnetTest(projectFile, Configuration, options, framework); - } - // end workaround - } - else if(singleTfm != null && singleTfm.Success) - { - var framework = singleTfm.Groups[1].Value; - if (IsLinux && framework != null && framework.StartsWith("net4")) - { - Log.Info("Skipping tests for TFM " + framework + " on this platform"); - } - else - { - DotnetTest(projectFile, Configuration, options, framework); - } - } - else - { - // default invocation - DotnetTest(projectFile, Configuration, options); - } - } + MSBuild("/t:Test"); } - #make-roslyn-fast ngen-roslyn @@ -404,12 +346,6 @@ macro name="DotnetPack" projectFile='string' dotnetPackOutputDir='string' config macro name="DotnetPublish" projectFile='string' outputFolder='string' framework='string' configuration='string' dotnet-publish -macro name="DotnetTest" projectFile='string' configuration='string' test_options='string' - dotnet-test - -macro name="DotnetTest" projectFile='string' configuration='string' test_options='string' framework='string' - dotnet-test - macro name='Npm' npmCommand='string' npmDir='string' npm diff --git a/build/targets/DefaultItems.targets b/build/targets/DefaultItems.targets new file mode 100644 index 0000000..9eb0901 --- /dev/null +++ b/build/targets/DefaultItems.targets @@ -0,0 +1,24 @@ + + + $(RepositoryRoot)shared/ + + + + + + + + + + + + + + + <_FunctionalTests Include="$(RepositoryRoot)test\*\*FunctionalTest*.csproj" /> + + + + + + \ No newline at end of file diff --git a/build/targets/standard-lifecycle.targets b/build/targets/standard-lifecycle.targets index a1f8769..7d28bc9 100644 --- a/build/targets/standard-lifecycle.targets +++ b/build/targets/standard-lifecycle.targets @@ -1,5 +1,7 @@ + + - + + <_SolutionWasBuilt>false + + <_BuildPropertiesToRemove>$(_BuildPropertiesToRemove);_SolutionWasBuilt + + true + + + + + + + + + + + - + - + + Projects="@(_SolutionItems)" + Properties="Configuration=$(Configuration)" + BuildInParallel="$(BuildInParallel)" + RemoveProperties="$(_BuildPropertiesToRemove)" /> + + + <_SolutionWasBuilt>true + - + + Projects="@(_SolutionItems)" + Properties="Configuration=$(Configuration)" + RemoveProperties="$(_BuildPropertiesToRemove)" /> + + + <_SolutionWasBuilt>true + - - - + + + + + + + + true + + Projects="@(_PackProjectItems)" + Condition="'@(_PackProjectItems)' != ''" + Properties="Configuration=$(Configuration);PackageOutputPath=$(BuildDir);NoBuild=$(PackageNoBuild)" + BuildInParallel="$(BuildInParallel)" + RemoveProperties="$(_BuildPropertiesToRemove);PackageNoBuild" /> - - $(RepositoryRoot)shared/ - - - - - + + + + Text="Producing shared source package for %(_SharedSourceItems.Identity)" + Condition="'@(_SharedSourceItems)' != ''" /> + Properties="PackageOutputPath=$(BuildDir);RepositoryRoot=$(RepositoryRoot);NuspecBasePath=%(_SharedSourceItems.Identity);PackageId=%(FileName)%(Extension)" + Condition="'@(_SharedSourceItems)' != ''" + BuildInParallel="$(BuildInParallel)" /> + + + + + + + trx + false + true + + + + + + + + + + + $(_SolutionWasBuilt) + <_TestContinueOnError Condition="'$(IgnoreFailingTestProjects)' == 'true'">ErrorAndContinue + <_TestContinueOnError Condition="'$(IgnoreFailingTestProjects)' != 'true'">ErrorAndStop + + + + +