SuperIlc fixes to unblock composite build using the shared library (#34430)
authorTomáš Rylek <trylek@microsoft.com>
Mon, 6 Apr 2020 22:33:51 +0000 (00:33 +0200)
committerGitHub <noreply@github.com>
Mon, 6 Apr 2020 22:33:51 +0000 (00:33 +0200)
src/coreclr/src/tools/ReadyToRun.SuperIlc/BuildFolder.cs
src/coreclr/src/tools/ReadyToRun.SuperIlc/BuildFolderSet.cs
src/coreclr/src/tools/ReadyToRun.SuperIlc/CompilerRunner.cs
src/coreclr/src/tools/ReadyToRun.SuperIlc/CpaotRunner.cs

index 1ca1b4a..319b4c9 100644 (file)
@@ -152,7 +152,7 @@ namespace ReadyToRun.SuperIlc
                 return null;
             }
 
-            if (options.Composite)
+            if (options.Composite && !(options.Framework || options.UseFramework))
             {
                 // In composite mode we copy the native runtime to the app folder and pretend that is CORE_ROOT,
                 // otherwise CoreRun picks up the original MSIL versions of framework assemblies from CORE_ROOT
index 4f7157a..cf0dd1d 100644 (file)
@@ -260,7 +260,7 @@ namespace ReadyToRun.SuperIlc
 
                     if (inputFrameworkDlls.Count > 0)
                     {
-                        string outputFileName = runner.GetOutputFileName(_options.CoreRootDirectory.FullName, "framework");
+                        string outputFileName = runner.GetOutputFileName(_options.CoreRootDirectory.FullName, "framework-r2r.dll");
                         ProcessInfo compilationProcess = new ProcessInfo(new CompilationProcessConstructor(runner, outputFileName, inputFrameworkDlls));
                         compilationsToRun.Add(compilationProcess);
                         processes[(int)runner.Index] = compilationProcess;
index 05336b3..bfefd99 100644 (file)
@@ -244,7 +244,7 @@ namespace ReadyToRun.SuperIlc
             }
 
             string coreRootDir;
-            if (_options.Composite)
+            if (_options.Composite && !(_options.Framework || _options.UseFramework))
             {
                 coreRootDir = GetOutputPath(outputRoot);
             }
index 7e5c5c6..4f5c220 100644 (file)
@@ -69,7 +69,7 @@ namespace ReadyToRun.SuperIlc
                 yield return "-O";
             }
 
-            if (_options.LargeBubble || _options.Composite)
+            if (_options.LargeBubble)
             {
                 yield return "--inputbubble";
             }
@@ -84,27 +84,35 @@ namespace ReadyToRun.SuperIlc
                 yield return $"--parallelism={_options.Crossgen2Parallelism}";
             }
 
-            HashSet<string> uniqueFolders = new HashSet<string>(
-                RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
-                ? StringComparer.OrdinalIgnoreCase
-                : StringComparer.Ordinal);
+            string frameworkFolder = "";
+            if (_options.Framework || _options.UseFramework)
+            {
+                frameworkFolder = GetOutputPath(_options.CoreRootDirectory.FullName);
+                foreach (string frameworkRef in ResolveReferences(new string[] { frameworkFolder }, 'r'))
+                {
+                    yield return frameworkRef;
+                }
+            }
+
+            StringComparer pathComparer = (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal);
+            HashSet<string> uniqueFolders = new HashSet<string>(pathComparer);
+
             foreach (string assemblyFileName in assemblyFileNames)
             {
                 uniqueFolders.Add(Path.GetDirectoryName(assemblyFileName));
             }
 
             uniqueFolders.UnionWith(_referenceFolders);
+            uniqueFolders.Remove(frameworkFolder);
 
-            foreach (string reference in ResolveReferences(uniqueFolders))
+            foreach (string reference in ResolveReferences(uniqueFolders, _options.Composite ? 'u' : 'r'))
             {
                 yield return reference;
             }
         }
 
-        private IEnumerable<string> ResolveReferences(IEnumerable<string> folders)
+        private IEnumerable<string> ResolveReferences(IEnumerable<string> folders, char referenceOption)
         {
-            char referenceOption = (_options.Composite ? 'u' : 'r');
-
             foreach (string referenceFolder in folders)
             {
                 foreach (string reference in ComputeManagedAssemblies.GetManagedAssembliesInFolder(referenceFolder))