diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets
index 6f672918b33e0..69b7b1fa452a8 100644
--- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets
+++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets
@@ -5,6 +5,8 @@
DependsOnTargets="$(IlcDynamicBuildPropertyDependencies)">
+
+
@@ -82,6 +84,7 @@
FrameworkAssemblies="@(FrameworkAssemblies)">
+
diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
index 607028701561f..5736aa8bbd054 100644
--- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
+++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
@@ -194,6 +194,7 @@ The .NET Foundation licenses this file to you under the MIT license.
+
@@ -262,7 +263,7 @@ The .NET Foundation licenses this file to you under the MIT license.
diff --git a/src/coreclr/tools/aot/ILCompiler.Build.Tasks/ComputeManagedAssembliesToCompileToNative.cs b/src/coreclr/tools/aot/ILCompiler.Build.Tasks/ComputeManagedAssembliesToCompileToNative.cs
index ee68181bfd62b..60084f4d03d1b 100644
--- a/src/coreclr/tools/aot/ILCompiler.Build.Tasks/ComputeManagedAssembliesToCompileToNative.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Build.Tasks/ComputeManagedAssembliesToCompileToNative.cs
@@ -80,6 +80,13 @@ public ITaskItem[] ManagedAssemblies
set;
}
+ [Output]
+ public ITaskItem[] SatelliteAssemblies
+ {
+ get;
+ set;
+ }
+
[Output]
public ITaskItem[] AssembliesToSkipPublish
{
@@ -91,6 +98,7 @@ public override bool Execute()
{
var list = new List();
var assembliesToSkipPublish = new List();
+ var satelliteAssemblies = new List();
var nativeAotFrameworkAssembliesToUse = new HashSet();
foreach (ITaskItem taskItem in SdkAssemblies)
@@ -164,11 +172,16 @@ public override bool Execute()
string culture = moduleMetadataReader.GetString(moduleMetadataReader.GetAssemblyDefinition().Culture);
assembliesToSkipPublish.Add(taskItem);
+
+ // Split satellite assemblies from normal assemblies
if (culture == "" || culture.Equals("neutral", StringComparison.OrdinalIgnoreCase))
{
- // NativeAOT doesn't consume resource assemblies yet so skip them
list.Add(taskItem);
}
+ else
+ {
+ satelliteAssemblies.Add(taskItem);
+ }
}
}
}
@@ -180,6 +193,7 @@ public override bool Execute()
ManagedAssemblies = list.ToArray();
AssembliesToSkipPublish = assembliesToSkipPublish.ToArray();
+ SatelliteAssemblies = satelliteAssemblies.ToArray();
return true;
}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler.Tests/DependencyGraphTests.cs b/src/coreclr/tools/aot/ILCompiler.Compiler.Tests/DependencyGraphTests.cs
index b05ed634686e8..01cbbc5be8cc9 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler.Tests/DependencyGraphTests.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler.Tests/DependencyGraphTests.cs
@@ -73,7 +73,7 @@ public void TestDependencyGraphInvariants(EcmaMethod method)
new FullyBlockedMetadataBlockingPolicy(), new FullyBlockedManifestResourceBlockingPolicy(),
null, new NoStackTraceEmissionPolicy(), new NoDynamicInvokeThunkGenerationPolicy(),
new ILLink.Shared.TrimAnalysis.FlowAnnotations(Logger.Null, ilProvider, compilerGeneratedState), UsageBasedMetadataGenerationOptions.None,
- default, Logger.Null, Array.Empty>(), Array.Empty(), Array.Empty(), Array.Empty());
+ default, Logger.Null, Array.Empty>(), Array.Empty(), Array.Empty(), Array.Empty(), Array.Empty());
CompilationBuilder builder = new RyuJitCompilationBuilder(context, compilationGroup)
.UseILProvider(ilProvider);
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ModuleMetadataNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ModuleMetadataNode.cs
index cc703cde05751..ef1e8e9ab5b1e 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ModuleMetadataNode.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ModuleMetadataNode.cs
@@ -44,7 +44,14 @@ public override IEnumerable GetStaticDependencies(NodeFacto
dependencies.Add(factory.ReflectedMethod(entrypoint), "Reflectable entrypoint");
}
- CustomAttributeBasedDependencyAlgorithm.AddDependenciesDueToCustomAttributes(ref dependencies, factory, (EcmaAssembly)_module);
+ EcmaAssembly ecmaAssembly = (EcmaAssembly)_module;
+
+ CustomAttributeBasedDependencyAlgorithm.AddDependenciesDueToCustomAttributes(ref dependencies, factory, ecmaAssembly);
+
+ foreach (EcmaModule satelliteModule in ((UsageBasedMetadataManager)factory.MetadataManager).GetSatelliteAssemblies(ecmaAssembly))
+ {
+ dependencies.Add(factory.ModuleMetadata(satelliteModule), "Satellite assembly");
+ }
return dependencies;
}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs
index 84eb949fafac2..c8c49f23116af 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs
@@ -63,6 +63,7 @@ private static (string AttributeName, DiagnosticId Id)[] _requiresAttributeMisma
private readonly HashSet _rootEntireAssembliesModules;
private readonly HashSet _trimmedAssemblies;
+ private readonly List _satelliteAssemblyFiles;
internal FlowAnnotations FlowAnnotations { get; }
@@ -83,7 +84,8 @@ public UsageBasedMetadataManager(
IEnumerable> featureSwitchValues,
IEnumerable rootEntireAssembliesModules,
IEnumerable additionalRootedAssemblies,
- IEnumerable trimmedAssemblies)
+ IEnumerable trimmedAssemblies,
+ IEnumerable satelliteAssemblyFilePaths)
: base(typeSystemContext, blockingPolicy, resourceBlockingPolicy, logFile, stackTracePolicy, invokeThunkGenerationPolicy, options)
{
_compilationModuleGroup = group;
@@ -98,6 +100,20 @@ public UsageBasedMetadataManager(
_rootEntireAssembliesModules = new HashSet(rootEntireAssembliesModules);
_rootEntireAssembliesModules.UnionWith(additionalRootedAssemblies);
_trimmedAssemblies = new HashSet(trimmedAssemblies);
+ _satelliteAssemblyFiles = new List(satelliteAssemblyFilePaths);
+ }
+
+ public IEnumerable GetSatelliteAssemblies(EcmaAssembly module)
+ {
+ string expectedSimpleName = module.GetName().Name + ".resources";
+ foreach (string filePath in _satelliteAssemblyFiles)
+ {
+ string simpleName = Path.GetFileNameWithoutExtension(filePath);
+ if (simpleName == expectedSimpleName)
+ {
+ yield return _typeSystemContext.GetMetadataOnlyModuleFromPath(filePath);
+ }
+ }
}
protected override void Graph_NewMarkedNode(DependencyNodeCore obj)
diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props
index 87abaa5f9ebb7..e1279e470c51d 100644
--- a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props
+++ b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props
@@ -15,7 +15,6 @@
true
false
true
- true
Speed
diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs b/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs
index a417d22aa7c87..f6f81e83d39ba 100644
--- a/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs
+++ b/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs
@@ -28,6 +28,8 @@ internal sealed class ILCompilerRootCommand : RootCommand
new(new[] { "--optimize-time", "--Ot" }, "Enable optimizations, favor code speed");
public Option MibcFilePaths { get; } =
new(new[] { "--mibc", "-m" }, Array.Empty, "Mibc file(s) for profile guided optimization");
+ public Option SatelliteFilePaths { get; } =
+ new(new[] { "--satellite" }, Array.Empty, "Satellite assemblies associated with inputs/references");
public Option EnableDebugInfo { get; } =
new(new[] { "--debug", "-g" }, "Emit debugging information");
public Option UseDwarf5 { get; } =
@@ -173,6 +175,7 @@ public ILCompilerRootCommand(string[] args) : base(".NET Native IL Compiler")
AddOption(OptimizeSpace);
AddOption(OptimizeTime);
AddOption(MibcFilePaths);
+ AddOption(SatelliteFilePaths);
AddOption(EnableDebugInfo);
AddOption(UseDwarf5);
AddOption(NativeLib);
diff --git a/src/coreclr/tools/aot/ILCompiler/Program.cs b/src/coreclr/tools/aot/ILCompiler/Program.cs
index 7fc33c7a1c77f..485539ce14f03 100644
--- a/src/coreclr/tools/aot/ILCompiler/Program.cs
+++ b/src/coreclr/tools/aot/ILCompiler/Program.cs
@@ -391,7 +391,8 @@ public int Run()
featureSwitches,
Get(_command.ConditionallyRootedAssemblies),
rootedAssemblies,
- Get(_command.TrimmedAssemblies));
+ Get(_command.TrimmedAssemblies),
+ Get(_command.SatelliteFilePaths));
InteropStateManager interopStateManager = new InteropStateManager(typeSystemContext.GeneratedAssembly);
InteropStubManager interopStubManager = new UsageBasedInteropStubManager(interopStateManager, pinvokePolicy, logger);
diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerDriver.cs b/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerDriver.cs
index d5fa880badfef..16d2e42c1fe4f 100644
--- a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerDriver.cs
+++ b/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerDriver.cs
@@ -111,7 +111,8 @@ public ILScanResults Trim (ILCompilerOptions options, ILogWriter logWriter)
Array.Empty> (),
Array.Empty (),
options.AdditionalRootAssemblies.ToArray (),
- options.TrimAssemblies.ToArray ());
+ options.TrimAssemblies.ToArray (),
+ Array.Empty ());
PInvokeILEmitterConfiguration pinvokePolicy = new ILCompilerTestPInvokePolicy ();
InteropStateManager interopStateManager = new InteropStateManager (typeSystemContext.GeneratedAssembly);
diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.props b/src/coreclr/tools/aot/crossgen2/crossgen2.props
index 012c9ec3dfc96..765c7847dfd39 100644
--- a/src/coreclr/tools/aot/crossgen2/crossgen2.props
+++ b/src/coreclr/tools/aot/crossgen2/crossgen2.props
@@ -15,7 +15,6 @@
Debug;Release;Checked
true
true
- true
Speed
false
diff --git a/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs b/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs
index 9a0bae5037d04..6bb68cb65b145 100644
--- a/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs
+++ b/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs
@@ -87,7 +87,6 @@ public static IEnumerable