| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -415,7 +415,7 @@ public void TestDefaultCSharpAutoBuilder() | |||
| 415 | 415 | actions.RunProcess["cmd.exe /C dotnet --info"] = 0; | |
| 416 | 416 | actions.RunProcess[@"cmd.exe /C dotnet clean C:\Project\test.csproj"] = 0; | |
| 417 | 417 | actions.RunProcess[@"cmd.exe /C dotnet restore C:\Project\test.csproj"] = 0; | |
| 418 | - actions.RunProcess[@"cmd.exe /C C:\odasa\tools\odasa index --auto dotnet build --no-incremental C:\Project\test.csproj"] = 0; | ||
| 418 | + actions.RunProcess[@"cmd.exe /C C:\odasa\tools\odasa index --auto dotnet build --no-incremental /p:UseSharedCompilation=false C:\Project\test.csproj"] = 0; | ||
| 419 | 419 | actions.FileExists["csharp.log"] = true; | |
| 420 | 420 | actions.FileExists[@"C:\Project\test.csproj"] = true; | |
| 421 | 421 | actions.GetEnvironmentVariable["CODEQL_EXTRACTOR_CSHARP_TRAP_DIR"] = ""; | |
@@ -439,9 +439,6 @@ public void TestDefaultCSharpAutoBuilder() | |||
| 439 | 439 | [Fact] | |
| 440 | 440 | public void TestLinuxCSharpAutoBuilder() | |
| 441 | 441 | { | |
| 442 | - actions.RunProcess["dotnet --list-runtimes"] = 0; | ||
| 443 | - actions.RunProcessOut["dotnet --list-runtimes"] = @"Microsoft.AspNetCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] | ||
| 444 | - Microsoft.NETCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]"; | ||
| 445 | 442 | actions.RunProcess["dotnet --info"] = 0; | |
| 446 | 443 | actions.RunProcess[@"dotnet clean C:\Project/test.csproj"] = 0; | |
| 447 | 444 | actions.RunProcess[@"dotnet restore C:\Project/test.csproj"] = 0; | |
@@ -463,7 +460,7 @@ public void TestLinuxCSharpAutoBuilder() | |||
| 463 | 460 | actions.LoadXml[@"C:\Project/test.csproj"] = xml; | |
| 464 | 461 | ||
| 465 | 462 | var autobuilder = CreateAutoBuilder(false); | |
| 466 | - TestAutobuilderScript(autobuilder, 0, 5); | ||
| 463 | + TestAutobuilderScript(autobuilder, 0, 4); | ||
| 467 | 464 | } | |
| 468 | 465 | ||
| 469 | 466 | [Fact] | |
@@ -603,8 +600,6 @@ private void TestAutobuilderScript(Autobuilder autobuilder, int expectedOutput, | |||
| 603 | 600 | [Fact] | |
| 604 | 601 | public void TestLinuxBuildCommand() | |
| 605 | 602 | { | |
| 606 | - actions.RunProcess["dotnet --list-runtimes"] = 1; | ||
| 607 | - actions.RunProcessOut["dotnet --list-runtimes"] = ""; | ||
| 608 | 603 | actions.RunProcess[@"C:\odasa/tools/odasa index --auto ""./build.sh --skip-tests"""] = 0; | |
| 609 | 604 | actions.FileExists["csharp.log"] = true; | |
| 610 | 605 | actions.GetEnvironmentVariable["CODEQL_EXTRACTOR_CSHARP_TRAP_DIR"] = ""; | |
@@ -615,7 +610,7 @@ public void TestLinuxBuildCommand() | |||
| 615 | 610 | SkipVsWhere(); | |
| 616 | 611 | ||
| 617 | 612 | var autobuilder = CreateAutoBuilder(false, buildCommand: "./build.sh --skip-tests"); | |
| 618 | - TestAutobuilderScript(autobuilder, 0, 2); | ||
| 613 | + TestAutobuilderScript(autobuilder, 0, 1); | ||
| 619 | 614 | } | |
| 620 | 615 | ||
| 621 | 616 | [Fact] | |
@@ -626,14 +621,12 @@ public void TestLinuxBuildSh() | |||
| 626 | 621 | actions.GetEnvironmentVariable["CODEQL_EXTRACTOR_CSHARP_TRAP_DIR"] = ""; | |
| 627 | 622 | actions.GetEnvironmentVariable["CODEQL_EXTRACTOR_CSHARP_SOURCE_ARCHIVE_DIR"] = ""; | |
| 628 | 623 | actions.RunProcess[@"/bin/chmod u+x C:\Project/build/build.sh"] = 0; | |
| 629 | - actions.RunProcess["dotnet --list-runtimes"] = 1; | ||
| 630 | - actions.RunProcessOut["dotnet --list-runtimes"] = ""; | ||
| 631 | 624 | actions.RunProcess[@"C:\odasa/tools/odasa index --auto C:\Project/build/build.sh"] = 0; | |
| 632 | 625 | actions.RunProcessWorkingDirectory[@"C:\odasa/tools/odasa index --auto C:\Project/build/build.sh"] = @"C:\Project/build"; | |
| 633 | 626 | actions.FileExists["csharp.log"] = true; | |
| 634 | 627 | ||
| 635 | 628 | var autobuilder = CreateAutoBuilder(false); | |
| 636 | - TestAutobuilderScript(autobuilder, 0, 3); | ||
| 629 | + TestAutobuilderScript(autobuilder, 0, 2); | ||
| 637 | 630 | } | |
| 638 | 631 | ||
| 639 | 632 | [Fact] | |
@@ -645,14 +638,12 @@ public void TestLinuxBuildShCSharpLogMissing() | |||
| 645 | 638 | actions.GetEnvironmentVariable["CODEQL_EXTRACTOR_CSHARP_SOURCE_ARCHIVE_DIR"] = ""; | |
| 646 | 639 | ||
| 647 | 640 | actions.RunProcess[@"/bin/chmod u+x C:\Project/build.sh"] = 0; | |
| 648 | - actions.RunProcess["dotnet --list-runtimes"] = 1; | ||
| 649 | - actions.RunProcessOut["dotnet --list-runtimes"] = ""; | ||
| 650 | 641 | actions.RunProcess[@"C:\odasa/tools/odasa index --auto C:\Project/build.sh"] = 0; | |
| 651 | 642 | actions.RunProcessWorkingDirectory[@"C:\odasa/tools/odasa index --auto C:\Project/build.sh"] = @"C:\Project"; | |
| 652 | 643 | actions.FileExists["csharp.log"] = false; | |
| 653 | 644 | ||
| 654 | 645 | var autobuilder = CreateAutoBuilder(false); | |
| 655 | - TestAutobuilderScript(autobuilder, 1, 3); | ||
| 646 | + TestAutobuilderScript(autobuilder, 1, 2); | ||
| 656 | 647 | } | |
| 657 | 648 | ||
| 658 | 649 | [Fact] | |
@@ -664,14 +655,12 @@ public void TestLinuxBuildShFailed() | |||
| 664 | 655 | actions.GetEnvironmentVariable["CODEQL_EXTRACTOR_CSHARP_SOURCE_ARCHIVE_DIR"] = ""; | |
| 665 | 656 | ||
| 666 | 657 | actions.RunProcess[@"/bin/chmod u+x C:\Project/build.sh"] = 0; | |
| 667 | - actions.RunProcess["dotnet --list-runtimes"] = 1; | ||
| 668 | - actions.RunProcessOut["dotnet --list-runtimes"] = ""; | ||
| 669 | 658 | actions.RunProcess[@"C:\odasa/tools/odasa index --auto C:\Project/build.sh"] = 5; | |
| 670 | 659 | actions.RunProcessWorkingDirectory[@"C:\odasa/tools/odasa index --auto C:\Project/build.sh"] = @"C:\Project"; | |
| 671 | 660 | actions.FileExists["csharp.log"] = true; | |
| 672 | 661 | ||
| 673 | 662 | var autobuilder = CreateAutoBuilder(false); | |
| 674 | - TestAutobuilderScript(autobuilder, 1, 3); | ||
| 663 | + TestAutobuilderScript(autobuilder, 1, 2); | ||
| 675 | 664 | } | |
| 676 | 665 | ||
| 677 | 666 | [Fact] | |
@@ -872,9 +861,6 @@ public void TestSkipNugetBuildless() | |||
| 872 | 861 | [Fact] | |
| 873 | 862 | public void TestSkipNugetDotnet() | |
| 874 | 863 | { | |
| 875 | - actions.RunProcess["dotnet --list-runtimes"] = 0; | ||
| 876 | - actions.RunProcessOut["dotnet --list-runtimes"] = @"Microsoft.AspNetCore.App 2.1.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] | ||
| 877 | - Microsoft.NETCore.App 2.1.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]"; | ||
| 878 | 864 | actions.RunProcess["dotnet --info"] = 0; | |
| 879 | 865 | actions.RunProcess[@"dotnet clean C:\Project/test.csproj"] = 0; | |
| 880 | 866 | actions.RunProcess[@"dotnet restore C:\Project/test.csproj"] = 0; | |
@@ -896,7 +882,7 @@ public void TestSkipNugetDotnet() | |||
| 896 | 882 | actions.LoadXml[@"C:\Project/test.csproj"] = xml; | |
| 897 | 883 | ||
| 898 | 884 | var autobuilder = CreateAutoBuilder(false, dotnetArguments: "--no-restore"); // nugetRestore=false does not work for now. | |
| 899 | - TestAutobuilderScript(autobuilder, 0, 5); | ||
| 885 | + TestAutobuilderScript(autobuilder, 0, 4); | ||
| 900 | 886 | } | |
| 901 | 887 | ||
| 902 | 888 | [Fact] | |
@@ -907,13 +893,10 @@ public void TestDotnetVersionNotInstalled() | |||
| 907 | 893 | actions.RunProcess[@"chmod u+x dotnet-install.sh"] = 0; | |
| 908 | 894 | actions.RunProcess[@"./dotnet-install.sh --channel release --version 2.1.3 --install-dir C:\Project/.dotnet"] = 0; | |
| 909 | 895 | actions.RunProcess[@"rm dotnet-install.sh"] = 0; | |
| 910 | - actions.RunProcess[@"C:\Project/.dotnet/dotnet --list-runtimes"] = 0; | ||
| 911 | - actions.RunProcessOut[@"C:\Project/.dotnet/dotnet --list-runtimes"] = @"Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] | ||
| 912 | - Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]"; | ||
| 913 | 896 | actions.RunProcess[@"C:\Project/.dotnet/dotnet --info"] = 0; | |
| 914 | 897 | actions.RunProcess[@"C:\Project/.dotnet/dotnet clean C:\Project/test.csproj"] = 0; | |
| 915 | 898 | actions.RunProcess[@"C:\Project/.dotnet/dotnet restore C:\Project/test.csproj"] = 0; | |
| 916 | - actions.RunProcess[@"C:\odasa/tools/odasa index --auto C:\Project/.dotnet/dotnet build --no-incremental C:\Project/test.csproj"] = 0; | ||
| 899 | + actions.RunProcess[@"C:\odasa/tools/odasa index --auto C:\Project/.dotnet/dotnet build --no-incremental /p:UseSharedCompilation=false C:\Project/test.csproj"] = 0; | ||
| 917 | 900 | actions.FileExists["csharp.log"] = true; | |
| 918 | 901 | actions.FileExists["test.csproj"] = true; | |
| 919 | 902 | actions.GetEnvironmentVariable["CODEQL_EXTRACTOR_CSHARP_TRAP_DIR"] = ""; | |
@@ -933,7 +916,7 @@ public void TestDotnetVersionNotInstalled() | |||
| 933 | 916 | actions.DownloadFiles.Add(("https://dot.net/v1/dotnet-install.sh", "dotnet-install.sh")); | |
| 934 | 917 | ||
| 935 | 918 | var autobuilder = CreateAutoBuilder(false, dotnetVersion: "2.1.3"); | |
| 936 | - TestAutobuilderScript(autobuilder, 0, 9); | ||
| 919 | + TestAutobuilderScript(autobuilder, 0, 8); | ||
| 937 | 920 | } | |
| 938 | 921 | ||
| 939 | 922 | [Fact] | |
@@ -945,11 +928,6 @@ public void TestDotnetVersionAlreadyInstalled() | |||
| 945 | 928 | actions.RunProcess[@"chmod u+x dotnet-install.sh"] = 0; | |
| 946 | 929 | actions.RunProcess[@"./dotnet-install.sh --channel release --version 2.1.3 --install-dir C:\Project/.dotnet"] = 0; | |
| 947 | 930 | actions.RunProcess[@"rm dotnet-install.sh"] = 0; | |
| 948 | - actions.RunProcess[@"C:\Project/.dotnet/dotnet --list-runtimes"] = 0; | ||
| 949 | - actions.RunProcessOut[@"C:\Project/.dotnet/dotnet --list-runtimes"] = @"Microsoft.AspNetCore.App 2.1.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] | ||
| 950 | - Microsoft.AspNetCore.App 2.1.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] | ||
| 951 | - Microsoft.NETCore.App 2.1.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] | ||
| 952 | - Microsoft.NETCore.App 2.1.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]"; | ||
| 953 | 931 | actions.RunProcess[@"C:\Project/.dotnet/dotnet --info"] = 0; | |
| 954 | 932 | actions.RunProcess[@"C:\Project/.dotnet/dotnet clean C:\Project/test.csproj"] = 0; | |
| 955 | 933 | actions.RunProcess[@"C:\Project/.dotnet/dotnet restore C:\Project/test.csproj"] = 0; | |
@@ -973,7 +951,7 @@ Microsoft.NETCore.App 2.1.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.Ap | |||
| 973 | 951 | actions.DownloadFiles.Add(("https://dot.net/v1/dotnet-install.sh", "dotnet-install.sh")); | |
| 974 | 952 | ||
| 975 | 953 | var autobuilder = CreateAutoBuilder(false, dotnetVersion: "2.1.3"); | |
| 976 | - TestAutobuilderScript(autobuilder, 0, 9); | ||
| 954 | + TestAutobuilderScript(autobuilder, 0, 8); | ||
| 977 | 955 | } | |
| 978 | 956 | ||
| 979 | 957 | private void TestDotnetVersionWindows(Action action, int commandsRun) | |
@@ -984,7 +962,7 @@ private void TestDotnetVersionWindows(Action action, int commandsRun) | |||
| 984 | 962 | actions.RunProcess[@"cmd.exe /C C:\Project\.dotnet\dotnet --info"] = 0; | |
| 985 | 963 | actions.RunProcess[@"cmd.exe /C C:\Project\.dotnet\dotnet clean C:\Project\test.csproj"] = 0; | |
| 986 | 964 | actions.RunProcess[@"cmd.exe /C C:\Project\.dotnet\dotnet restore C:\Project\test.csproj"] = 0; | |
| 987 | - actions.RunProcess[@"cmd.exe /C C:\odasa\tools\odasa index --auto C:\Project\.dotnet\dotnet build --no-incremental C:\Project\test.csproj"] = 0; | ||
| 965 | + actions.RunProcess[@"cmd.exe /C C:\odasa\tools\odasa index --auto C:\Project\.dotnet\dotnet build --no-incremental /p:UseSharedCompilation=false C:\Project\test.csproj"] = 0; | ||
| 988 | 966 | actions.FileExists["csharp.log"] = true; | |
| 989 | 967 | actions.FileExists[@"C:\Project\test.csproj"] = true; | |
| 990 | 968 | actions.GetEnvironmentVariable["CODEQL_EXTRACTOR_CSHARP_TRAP_DIR"] = ""; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,7 @@ public BuildScript Analyse(Autobuilder builder, bool auto) | |||
| 36 | 36 | builder.Log(Severity.Info, "Attempting to build using .NET Core"); | |
| 37 | 37 | } | |
| 38 | 38 | ||
| 39 | - return WithDotNet(builder, (dotNetPath, environment, compatibleClr) => | ||
| 39 | + return WithDotNet(builder, (dotNetPath, environment) => | ||
| 40 | 40 | { | |
| 41 | 41 | var ret = GetInfoCommand(builder.Actions, dotNetPath, environment); | |
| 42 | 42 | foreach (var projectOrSolution in builder.ProjectsOrSolutionsToBuild) | |
@@ -49,15 +49,15 @@ public BuildScript Analyse(Autobuilder builder, bool auto) | |||
| 49 | 49 | restoreCommand.QuoteArgument(projectOrSolution.FullPath); | |
| 50 | 50 | var restore = restoreCommand.Script; | |
| 51 | 51 | ||
| 52 | - var build = GetBuildScript(builder, dotNetPath, environment, compatibleClr, projectOrSolution.FullPath); | ||
| 52 | + var build = GetBuildScript(builder, dotNetPath, environment, projectOrSolution.FullPath); | ||
| 53 | 53 | ||
| 54 | 54 | ret &= BuildScript.Try(clean) & BuildScript.Try(restore) & build; | |
| 55 | 55 | } | |
| 56 | 56 | return ret; | |
| 57 | 57 | }); | |
| 58 | 58 | } | |
| 59 | 59 | ||
| 60 | - private static BuildScript WithDotNet(Autobuilder builder, Func<string?, IDictionary<string, string>?, bool, BuildScript> f) | ||
| 60 | + private static BuildScript WithDotNet(Autobuilder builder, Func<string?, IDictionary<string, string>?, BuildScript> f) | ||
| 61 | 61 | { | |
| 62 | 62 | var installDir = builder.Actions.PathCombine(builder.Options.RootDirectory, ".dotnet"); | |
| 63 | 63 | var installScript = DownloadDotNet(builder, installDir); | |
@@ -81,35 +81,10 @@ private static BuildScript WithDotNet(Autobuilder builder, Func<string?, IDictio | |||
| 81 | 81 | env = null; | |
| 82 | 82 | } | |
| 83 | 83 | ||
| 84 | - // The CLR tracer is always compatible on Windows | ||
| 85 | - if (builder.Actions.IsWindows()) | ||
| 86 | - return f(installDir, env, true); | ||
| 87 | - | ||
| 88 | - // The CLR tracer is only compatible on .NET Core >= 3 on Linux and macOS (see | ||
| 89 | - // https://github.com/dotnet/coreclr/issues/19622) | ||
| 90 | - return BuildScript.Bind(GetInstalledRuntimesScript(builder.Actions, installDir, env), (runtimes, runtimesRet) => | ||
| 91 | - { | ||
| 92 | - var compatibleClr = false; | ||
| 93 | - if (runtimesRet == 0) | ||
| 94 | - { | ||
| 95 | - var minimumVersion = new Version(3, 0); | ||
| 96 | - var regex = new Regex(@"Microsoft\.NETCore\.App (\d\.\d\.\d)"); | ||
| 97 | - compatibleClr = runtimes | ||
| 98 | - .Select(runtime => regex.Match(runtime)) | ||
| 99 | - .Where(m => m.Success) | ||
| 100 | - .Select(m => m.Groups[1].Value) | ||
| 101 | - .Any(m => Version.TryParse(m, out var v) && v >= minimumVersion); | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - if (!compatibleClr) | ||
| 105 | - { | ||
| 106 | - if (env is null) | ||
| 107 | - env = new Dictionary<string, string>(); | ||
| 108 | - env.Add("UseSharedCompilation", "false"); | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - return f(installDir, env, compatibleClr); | ||
| 112 | - }); | ||
| 84 | + if (env is null) | ||
| 85 | + env = new Dictionary<string, string>(); | ||
| 86 | + env.Add("UseSharedCompilation", "false"); | ||
| 87 | + return f(installDir, env); | ||
| 113 | 88 | }); | |
| 114 | 89 | } | |
| 115 | 90 | ||
@@ -122,7 +97,7 @@ private static BuildScript WithDotNet(Autobuilder builder, Func<string?, IDictio | |||
| 122 | 97 | /// are needed). | |
| 123 | 98 | /// </summary> | |
| 124 | 99 | public static BuildScript WithDotNet(Autobuilder builder, Func<IDictionary<string, string>?, BuildScript> f) | |
| 125 | - => WithDotNet(builder, (_1, env, _2) => f(env)); | ||
| 100 | + => WithDotNet(builder, (_1, env) => f(env)); | ||
| 126 | 101 | ||
| 127 | 102 | /// <summary> | |
| 128 | 103 | /// Returns a script for downloading relevant versions of the | |
@@ -259,14 +234,6 @@ private static CommandBuilder GetRestoreCommand(IBuildActions actions, string? d | |||
| 259 | 234 | return restore; | |
| 260 | 235 | } | |
| 261 | 236 | ||
| 262 | - private static BuildScript GetInstalledRuntimesScript(IBuildActions actions, string? dotNetPath, IDictionary<string, string>? environment) | ||
| 263 | - { | ||
| 264 | - var listSdks = new CommandBuilder(actions, environment: environment, silent: true). | ||
| 265 | - RunCommand(DotNetCommand(actions, dotNetPath)). | ||
| 266 | - Argument("--list-runtimes"); | ||
| 267 | - return listSdks.Script; | ||
| 268 | - } | ||
| 269 | - | ||
| 270 | 237 | /// <summary> | |
| 271 | 238 | /// Gets the `dotnet build` script. | |
| 272 | 239 | /// | |
@@ -276,17 +243,14 @@ private static BuildScript GetInstalledRuntimesScript(IBuildActions actions, str | |||
| 276 | 243 | /// hence the need for CLR tracing), by adding a | |
| 277 | 244 | /// `/p:UseSharedCompilation=false` argument. | |
| 278 | 245 | /// </summary> | |
| 279 | - private static BuildScript GetBuildScript(Autobuilder builder, string? dotNetPath, IDictionary<string, string>? environment, bool compatibleClr, string projOrSln) | ||
| 246 | + private static BuildScript GetBuildScript(Autobuilder builder, string? dotNetPath, IDictionary<string, string>? environment, string projOrSln) | ||
| 280 | 247 | { | |
| 281 | 248 | var build = new CommandBuilder(builder.Actions, null, environment); | |
| 282 | 249 | var script = builder.MaybeIndex(build, DotNetCommand(builder.Actions, dotNetPath)). | |
| 283 | 250 | Argument("build"). | |
| 284 | 251 | Argument("--no-incremental"); | |
| 285 | 252 | ||
| 286 | - return compatibleClr ? | ||
| 287 | - script.Argument(builder.Options.DotNetArguments). | ||
| 288 | - QuoteArgument(projOrSln). | ||
| 289 | - Script : | ||
| 253 | + return | ||
| 290 | 254 | script.Argument("/p:UseSharedCompilation=false"). | |
| 291 | 255 | Argument(builder.Options.DotNetArguments). | |
| 292 | 256 | QuoteArgument(projOrSln). | |
| Back | FazBrowse Home | New Git URL |
0 commit comments