Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make PublishAot an optional feature because Mono does not support it. #28674

Merged
merged 3 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions eng/SourceBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<PropertyGroup>
<InnerBuildArgs>$(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)\source-build.slnf"</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:UseSharedCompilation=false</InnerBuildArgs>
<InnerBuildArgs Condition="'$(SourceBuildUseMonoRuntime)' == 'true'">$(InnerBuildArgs) /p:NativeAotSupported=false</InnerBuildArgs>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some coreclr-supported platforms do not support NativeAot as well (arm). Does SDK have a platform variable? I couldn't find any thus I had to find another way to set NativeAotSupported when arch is arm. On Alpine, I removed this part of the modification, and moved the check to repos/sdk.proj as $(BuildArchitecture) does not reach eng/SourceBuild.props.

Of course, you can keep this check and source-build can set NativeAotSupported=false when $(BuildArchitecture) == arm.

Thus, in dotnet/installer#14792:

diff --git a/src/SourceBuild/tarball/content/repos/sdk.proj b/src/SourceBuild/tarball/content/repos/sdk.proj
index c18e00dd61..6567b41983 100644
--- a/src/SourceBuild/tarball/content/repos/sdk.proj
+++ b/src/SourceBuild/tarball/content/repos/sdk.proj
@@ -6,6 +6,7 @@
     <BuildCommandArgs>$(BuildCommandArgs) $(FlagParameterPrefix)nodereuse $(ArcadeFalseBoolBuildArg)</BuildCommandArgs>
     <BuildCommandArgs>$(BuildCommandArgs) /p:PackageProjectUrl=https://github.com/dotnet/sdk</BuildCommandArgs>
     <BuildCommandArgs>$(BuildCommandArgs) /p:PublishCompressedFilesPathPrefix=$(SourceBuiltToolsetDir)</BuildCommandArgs>
+    <BuildCommandArgs Condition="'$(SourceBuildUseMonoRuntime)' == 'true' OR '$(BuildArchitecture)' == 'arm'">$(BuildCommandArgs) /p:NativeAotSupported=false</BuildCommandArgs>
 
     <LogVerbosityOptOut>true</LogVerbosityOptOut>
     <BuildCommandArgs>$(BuildCommandArgs) -v $(LogVerbosity)</BuildCommandArgs>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does SDK have a platform variable?

I don't think so. This approach looks fine to me.

</PropertyGroup>
</Target>

Expand Down
2 changes: 1 addition & 1 deletion src/Layout/redist/targets/BundledSdks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<BundledSdk Include="FSharp.NET.Sdk" Version="1.0.4-bundled-0100" />
<BundledSdk Include="Microsoft.Docker.Sdk" Version="1.1.0" />
<BundledSdk Include="Microsoft.NET.ILLink.Tasks" Version="$(MicrosoftNETILLinkTasksPackageVersion)" />
<BundledSdk Include="Microsoft.DotNet.ILCompiler" Version="$(MicrosoftDotNetILCompilerPackageVersion)" />
<BundledSdk Include="Microsoft.DotNet.ILCompiler" Version="$(MicrosoftDotNetILCompilerPackageVersion)" Condition="'$(NativeAotSupported)' != 'false'" />
</ItemGroup>
</Project>
6 changes: 5 additions & 1 deletion src/Tasks/Common/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ You may need to build the project on another operating system or architecture, o
<comment>{StrBegin="NETSDK1182: "}</comment>
</data>
<data name="AotNoValidRuntimePackageError" xml:space="preserve">
<value>NETSDK1183: Unable to optimize assemblies for Ahead of time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</value>
<value>NETSDK1183: Unable to optimize assemblies for ahead-of-time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</value>
<comment>{StrBegin="NETSDK1183: "}</comment>
</data>
<data name="TargetingPackNotRestored_TransitiveDisabled" xml:space="preserve">
Expand Down Expand Up @@ -875,4 +875,8 @@ You may need to build the project on another operating system or architecture, o
<value>NETSDK1192: Targeting .NET 7.0 or higher in Visual Studio 2022 17.3 is not supported.</value>
<comment>{StrBegin="NETSDK1192: "}</comment>
</data>
<data name="AotNotSupported" xml:space="preserve">
<value>NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</value>
<comment>{StrBegin="NETSDK1193: "}</comment>
</data>
</root>
7 changes: 6 additions & 1 deletion src/Tasks/Common/Resources/xlf/Strings.cs.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
<note>{StrBegin="NETSDK1076: "}</note>
</trans-unit>
<trans-unit id="AotNoValidRuntimePackageError">
<source>NETSDK1183: Unable to optimize assemblies for Ahead of time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<source>NETSDK1183: Unable to optimize assemblies for ahead-of-time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<target state="translated">NETSDK1183: Sestavení nelze optimalizovat pro kompilaci s předstihem: nebyl nalezen platný balíček modulu runtime. Buď nastavte vlastnost PublishAot na hodnotu false, nebo při publikování použijte podporovaný identifikátor modulu runtime. Při cílení na .NET 7 nebo vyšší nezapomeňte obnovit balíčky s vlastností PublishAot nastavenou na hodnotu true.</target>
<note>{StrBegin="NETSDK1183: "}</note>
</trans-unit>
<trans-unit id="AotNotSupported">
<source>NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</source>
<target state="new">NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</target>
<note>{StrBegin="NETSDK1193: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="translated">NETSDK1070: Konfigurační soubor aplikace musí obsahovat kořenový element konfigurace.</target>
Expand Down
7 changes: 6 additions & 1 deletion src/Tasks/Common/Resources/xlf/Strings.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
<note>{StrBegin="NETSDK1076: "}</note>
</trans-unit>
<trans-unit id="AotNoValidRuntimePackageError">
<source>NETSDK1183: Unable to optimize assemblies for Ahead of time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<source>NETSDK1183: Unable to optimize assemblies for ahead-of-time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<target state="translated">NETSDK1183: Assemblys können nicht für Ahead-of-time-Kompilierung optimiert werden: Es wurde kein gültiges Runtimepaket gefunden. Legen Sie entweder die PublishAot-Eigenschaft auf FALSE fest, oder verwenden Sie beim Veröffentlichen einen unterstützten Runtimebezeichner. Wenn Sie .NET 7 oder höher verwenden, stellen Sie sicher, dass Sie Pakete wiederherstellen, bei denen die PublishAot-Eigenschaft auf TRUE festgelegt ist.</target>
<note>{StrBegin="NETSDK1183: "}</note>
</trans-unit>
<trans-unit id="AotNotSupported">
<source>NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</source>
<target state="new">NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</target>
<note>{StrBegin="NETSDK1193: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="translated">NETSDK1070: Die Anwendungskonfigurationsdatei muss das Stammkonfigurationselement enthalten.</target>
Expand Down
7 changes: 6 additions & 1 deletion src/Tasks/Common/Resources/xlf/Strings.es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
<note>{StrBegin="NETSDK1076: "}</note>
</trans-unit>
<trans-unit id="AotNoValidRuntimePackageError">
<source>NETSDK1183: Unable to optimize assemblies for Ahead of time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<source>NETSDK1183: Unable to optimize assemblies for ahead-of-time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<target state="translated">NETSDK1183: No se pueden optimizar los ensamblados para la compilación Ahead of time: no se ha encontrado un paquete en tiempo de ejecución válido. Establezca la propiedad PublishAot en false o use un identificador de tiempo de ejecución compatible al publicar. Cuando el destino sea .NET 7 o una versión posterior, asegúrese de restaurar los paquetes con la propiedad PublishAot establecida en true.</target>
<note>{StrBegin="NETSDK1183: "}</note>
</trans-unit>
<trans-unit id="AotNotSupported">
<source>NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</source>
<target state="new">NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</target>
<note>{StrBegin="NETSDK1193: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="translated">NETSDK1070: El archivo de configuración de la aplicación debe tener el elemento de configuración raíz.</target>
Expand Down
7 changes: 6 additions & 1 deletion src/Tasks/Common/Resources/xlf/Strings.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
<note>{StrBegin="NETSDK1076: "}</note>
</trans-unit>
<trans-unit id="AotNoValidRuntimePackageError">
<source>NETSDK1183: Unable to optimize assemblies for Ahead of time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<source>NETSDK1183: Unable to optimize assemblies for ahead-of-time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<target state="translated">NETSDK1183: Impossible d'optimiser les assemblys pour la compilation Ahead of time : un package d'exécution valide n'a pas été trouvé. Définissez la propriété PublishAot sur false ou utilisez un identificateur d'exécution pris en charge lors de la publication. Lorsque vous ciblez .NET 7 ou supérieur, assurez-vous de restaurer les packages avec la propriété PublishAot définie sur true.</target>
<note>{StrBegin="NETSDK1183: "}</note>
</trans-unit>
<trans-unit id="AotNotSupported">
<source>NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</source>
<target state="new">NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</target>
<note>{StrBegin="NETSDK1193: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="translated">NETSDK1070: Le fichier de configuration de l'application doit avoir un élément de configuration racine.</target>
Expand Down
7 changes: 6 additions & 1 deletion src/Tasks/Common/Resources/xlf/Strings.it.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
<note>{StrBegin="NETSDK1076: "}</note>
</trans-unit>
<trans-unit id="AotNoValidRuntimePackageError">
<source>NETSDK1183: Unable to optimize assemblies for Ahead of time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<source>NETSDK1183: Unable to optimize assemblies for ahead-of-time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<target state="translated">NETSDK1183: non è possibile ottimizzare gli assembly per la compilazione Ahead Of Time perché non è stato trovato alcun pacchetto di runtime valido. Impostare la proprietà PublishAot su false oppure usare un identificatore di runtime supportato durante la pubblicazione. Quando si usa .NET 7 o versioni successive, assicurarsi di ripristinare i pacchetti con la proprietà PublishAot impostata su true.</target>
<note>{StrBegin="NETSDK1183: "}</note>
</trans-unit>
<trans-unit id="AotNotSupported">
<source>NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</source>
<target state="new">NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</target>
<note>{StrBegin="NETSDK1193: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="translated">NETSDK1070: il file di configurazione dell'applicazione deve avere un elemento di configurazione radice.</target>
Expand Down
7 changes: 6 additions & 1 deletion src/Tasks/Common/Resources/xlf/Strings.ja.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
<note>{StrBegin="NETSDK1076: "}</note>
</trans-unit>
<trans-unit id="AotNoValidRuntimePackageError">
<source>NETSDK1183: Unable to optimize assemblies for Ahead of time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<source>NETSDK1183: Unable to optimize assemblies for ahead-of-time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<target state="translated">NETSDK1183: Ahead Of Time コンパイル用にアセンブリを最適化できません: 有効なランタイム パッケージが見つかりませんでした。PublishAot プロパティを false に設定するか、公開時に、サポートされているランタイム識別子を使用してください。.NET 7 以降を対象とする場合は、必ず PublishAot プロパティを true に設定してパッケージを復元してください。</target>
<note>{StrBegin="NETSDK1183: "}</note>
</trans-unit>
<trans-unit id="AotNotSupported">
<source>NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</source>
<target state="new">NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</target>
<note>{StrBegin="NETSDK1193: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="translated">NETSDK1070: アプリケーション構成ファイルには、ルート構成要素が必要です。</target>
Expand Down
7 changes: 6 additions & 1 deletion src/Tasks/Common/Resources/xlf/Strings.ko.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
<note>{StrBegin="NETSDK1076: "}</note>
</trans-unit>
<trans-unit id="AotNoValidRuntimePackageError">
<source>NETSDK1183: Unable to optimize assemblies for Ahead of time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<source>NETSDK1183: Unable to optimize assemblies for ahead-of-time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<target state="translated">NETSDK1183: Ahead of Time 컴파일을 위해 어셈블리를 최적화할 수 없습니다. 유효한 런타임 패키지를 찾을 수 없습니다. PublishAot 속성을 false로 설정하거나 게시할 때 지원되는 런타임 식별자를 사용하세요. .NET 7 이상을 대상으로 하는 경우 PublishAot 속성이 true로 설정된 패키지를 복원해야 합니다.</target>
<note>{StrBegin="NETSDK1183: "}</note>
</trans-unit>
<trans-unit id="AotNotSupported">
<source>NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</source>
<target state="new">NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</target>
<note>{StrBegin="NETSDK1193: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="translated">NETSDK1070: 애플리케이션 구성 파일에는 루트 구성 요소가 있어야 합니다.</target>
Expand Down
7 changes: 6 additions & 1 deletion src/Tasks/Common/Resources/xlf/Strings.pl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
<note>{StrBegin="NETSDK1076: "}</note>
</trans-unit>
<trans-unit id="AotNoValidRuntimePackageError">
<source>NETSDK1183: Unable to optimize assemblies for Ahead of time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<source>NETSDK1183: Unable to optimize assemblies for ahead-of-time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.</source>
<target state="translated">NETSDK1183: Nie można zoptymalizować zestawów pod kątem kompilacji z wyprzedzeniem: nie znaleziono prawidłowego pakietu środowiska uruchomieniowego. Ustaw właściwość PublishAot na wartość false lub użyj obsługiwanego identyfikatora środowiska uruchomieniowego podczas publikowania. W przypadku określania wartości docelowej platformy .NET 7 lub nowszej należy przywrócić pakiety z właściwością PublishAot ustawioną na wartość true.</target>
<note>{StrBegin="NETSDK1183: "}</note>
</trans-unit>
<trans-unit id="AotNotSupported">
<source>NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</source>
<target state="new">NETSDK1193: The SDK does not support ahead-of-time compilation. Set the PublishAot property to false.</target>
<note>{StrBegin="NETSDK1193: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="translated">NETSDK1070: Plik konfiguracji aplikacji musi mieć główny element konfiguracji.</target>
Expand Down