diff --git a/src/coreclr/src/tools/r2rtest/BuildOptions.cs b/src/coreclr/src/tools/r2rtest/BuildOptions.cs index eec3f5bc711f39..152b6ae04352f6 100644 --- a/src/coreclr/src/tools/r2rtest/BuildOptions.cs +++ b/src/coreclr/src/tools/r2rtest/BuildOptions.cs @@ -30,6 +30,7 @@ public class BuildOptions public bool Release { get; set; } public bool LargeBubble { get; set; } public bool Composite { get; set; } + public bool PartialComposite { get; set; } public int Crossgen2Parallelism { get; set; } public int CompilationTimeoutMinutes { get; set; } public int ExecutionTimeoutMinutes { get; set; } diff --git a/src/coreclr/src/tools/r2rtest/CommandLineOptions.cs b/src/coreclr/src/tools/r2rtest/CommandLineOptions.cs index 5f6d3d914d364e..0deebb10d4619a 100644 --- a/src/coreclr/src/tools/r2rtest/CommandLineOptions.cs +++ b/src/coreclr/src/tools/r2rtest/CommandLineOptions.cs @@ -158,6 +158,7 @@ Command CompileSerp() => CoreRootDirectory(), AspNetPath(), Composite(), + PartialComposite(), }, handler: CommandHandler.Create(CompileSerpCommand.CompileSerpAssemblies)); @@ -267,6 +268,9 @@ Option PackageList() => // Option AspNetPath() => new Option(new[] { "--asp-net-path", "-asp" }, "Path to SERP's ASP.NET Core folder", new Argument().ExistingOnly()); + + Option PartialComposite() => + new Option(new[] { "--partial-composite", "-pc" }, "Add references to framework and asp.net instead of unrooted inputs", new Argument()); } } } diff --git a/src/coreclr/src/tools/r2rtest/Commands/CompileSerpCommand.cs b/src/coreclr/src/tools/r2rtest/Commands/CompileSerpCommand.cs index af6b7ba8c918ea..15893256577bc7 100644 --- a/src/coreclr/src/tools/r2rtest/Commands/CompileSerpCommand.cs +++ b/src/coreclr/src/tools/r2rtest/Commands/CompileSerpCommand.cs @@ -110,12 +110,26 @@ public static int CompileSerpAssemblies(BuildOptions options) referenceAssemblies.Add(Path.Combine(options.CoreRootDirectory.FullName, "mscorlib.dll")); referenceAssemblies.Add(Path.Combine(options.CoreRootDirectory.FullName, "netstandard.dll")); + // + // binFiles is now all the assemblies that we want to compile (either individually or as composite) + // referenceAssemblies is all managed assemblies that are referenceable + // + + // Remove all bin files except serp.dll so they're just referenced (eventually we'll be able to compile all these in a single composite) + foreach (string item in new HashSet(File.ReadAllLines(whiteListFilePath))) + { + if (item == "Serp.dll") + continue; + + binFiles.Remove(Path.Combine(binDir, item)); + } + List fileCompilations = new List(); if (options.Composite) { string serpDll = Path.Combine(binDir, "Serp.dll"); var runner = new CpaotRunner(options, referenceAssemblies); - var compilationProcess = new ProcessInfo(new CompilationProcessConstructor(runner, Path.ChangeExtension(serpDll, ".ni.dll"), referenceAssemblies)); + var compilationProcess = new ProcessInfo(new CompilationProcessConstructor(runner, Path.ChangeExtension(serpDll, ".ni.dll"), binFiles)); fileCompilations.Add(compilationProcess); } else diff --git a/src/coreclr/src/tools/r2rtest/CpaotRunner.cs b/src/coreclr/src/tools/r2rtest/CpaotRunner.cs index f1f9090eec82e6..128b0e20ed6cea 100644 --- a/src/coreclr/src/tools/r2rtest/CpaotRunner.cs +++ b/src/coreclr/src/tools/r2rtest/CpaotRunner.cs @@ -137,7 +137,7 @@ protected override IEnumerable BuildCommandLineArguments(IEnumerable