[msbuild] Warn when we detect that the app developer is trying to link with a static library when using Hot Restart. Fixes #17640. (#18940)

Warn when we detect that the app developer is trying to link with a static
library when using Hot Restart, because we don't support linking with static
libraries in that case.

Also change the resource generation for Xamarin.iOS.Tasks.Windows project to
generate the code-behind for the resources during the build (as opposed to by
the IDE - which won't happen unless using an IDE, while the build will always
happen).

Fixes https://github.com/xamarin/xamarin-macios/issues/17640.
This commit is contained in:
Rolf Bjarne Kvinge 2023-09-07 13:53:45 +02:00 коммит произвёл GitHub
Родитель 1c8c4fb6d0
Коммит 08ad43a003
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 54 добавлений и 21 удалений

Просмотреть файл

@ -1,7 +1,6 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -10,35 +9,46 @@
namespace Xamarin.iOS.Tasks.Windows.Properties {
using System;
using System.Reflection;
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// This class was generated by MSBuild using the GenerateResource task.
/// To add or remove a member, edit your .resx file then rerun MSBuild.
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Build.Tasks.StronglyTypedResourceBuilder", "15.1.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static System.Resources.ResourceManager resourceMan;
private static global::System.Resources.ResourceManager resourceMan;
private static System.Globalization.CultureInfo resourceCulture;
private static global::System.Globalization.CultureInfo resourceCulture;
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static System.Resources.ResourceManager ResourceManager {
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.Equals(null, resourceMan)) {
System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Xamarin.iOS.Tasks.Windows.Properties.Resources", typeof(Resources).Assembly);
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Xamarin.iOS.Tasks.Windows.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static System.Globalization.CultureInfo Culture {
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
@ -47,16 +57,31 @@ namespace Xamarin.iOS.Tasks.Windows.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Could not find the password for the selected Signing Identity, please create a new Certificate from Tools -&gt; Options -&gt; Apple Accounts -&gt; View Team Details..
/// </summary>
internal static string Codesign_MissingPasswordFile {
get {
return ResourceManager.GetString("Codesign_MissingPasswordFile", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Info.plist file does not exist under {0}, please rebuild your project.
/// </summary>
internal static string CompileAppManifest_MissinInfoPList {
get {
return ResourceManager.GetString("CompileAppManifest_MissinInfoPList", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Linking with a static library is not supported when using Hot Restart..
/// </summary>
internal static string HotRestartStaticLibraryNotSupported {
get {
return ResourceManager.GetString("HotRestartStaticLibraryNotSupported", resourceCulture);
}
}
}
}

Просмотреть файл

@ -19,4 +19,7 @@
<value>Info.plist file does not exist under {0}, please rebuild your project</value>
<comment>0: path</comment>
</data>
<data name="HotRestartStaticLibraryNotSupported" xml:space="preserve">
<value>Linking with a static library is not supported when using Hot Restart.</value>
</data>
</root>

Просмотреть файл

@ -6,6 +6,7 @@ using System.Linq;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Xamarin.iOS.Tasks.Windows.Properties;
using Xamarin.MacDev.Tasks;
#nullable enable
@ -139,11 +140,13 @@ namespace Xamarin.iOS.HotRestart.Tasks {
case PublishFolderType.Unknown: // Don't copy unknown stuff anywhere
case PublishFolderType.AppleBindingResourcePackage: // These aren't copied to the bundle
case PublishFolderType.CompressedAppleBindingResourcePackage: // These aren't copied to the bundle
case PublishFolderType.StaticLibrary: // These aren't copied to the bundle
case PublishFolderType.CompressedAppleFramework: // Shouldn't really happen? Should be uncompresed by the time we get here.
case PublishFolderType.CompressedPlugIns: // Shouldn't really happen? Should be uncompresed by the time we get here.
Log.LogMessage (MessageImportance.Low, $" Skipped {item.ItemSpec} because PublishFolderType={publishFolderType} items aren't copied to the app bundle.");
continue;
case PublishFolderType.StaticLibrary: // These aren't copied to the bundle
Log.LogWarning (null, null, null, item.ItemSpec, 0, 0, 0, 0, Resources.HotRestartStaticLibraryNotSupported);
continue;
default:
Log.LogMessage (MessageImportance.Low, $" Skipped {item.ItemSpec} because of unknown PublishFolderType={publishFolderType}.");
continue;

Просмотреть файл

@ -50,16 +50,18 @@
<Folder Include="Tasks\" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Properties\Resources.Designer.cs" />
<EmbeddedResource Update="Properties\Resources.resx">
<Type>Resx</Type>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<StronglyTypedFileName>Properties/Resources.Designer.cs</StronglyTypedFileName>
<StronglyTypedLanguage>CSharp</StronglyTypedLanguage>
<StronglyTypedNamespace>Xamarin.iOS.Tasks.Windows.Properties</StronglyTypedNamespace>
<StronglyTypedClassName>Resources</StronglyTypedClassName>
<GenerateResource>true</GenerateResource>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildThisFileDirectory)..\ILMerge.targets" />