Skip to content

Commit

Permalink
Merge main into xcode14.1. (#16327)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne committed Oct 14, 2022
2 parents d910c1b + eec5f62 commit 9a7740b
Show file tree
Hide file tree
Showing 69 changed files with 731 additions and 728 deletions.
2 changes: 2 additions & 0 deletions dotnet/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ Microsoft.$1.Sdk/targets/Microsoft.$1.Sdk.Versions.props: targets/Microsoft.$1.S
endef
$(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call VersionsTemplate,$(platform),$(shell echo $(platform) | tr a-z A-Z),$(DOTNET_$(shell echo $(platform) | tr a-z A-Z)_RUNTIME_IDENTIFIERS))))

version-props: $(foreach platform,$(DOTNET_PLATFORMS),targets/Microsoft.$(platform).Sdk.Versions.props)

define AutoImports
Microsoft.$(1).Sdk/Sdk/AutoImport.props: targets/AutoImport.template.props Makefile
$(Q) rm -f $$@.tmp
Expand Down
6 changes: 2 additions & 4 deletions dotnet/package/common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<_buildPath>$(_RepositoryPath)/_build</_buildPath>
<_packagePath Condition="'$(_packagePath)' == ''">$(_buildPath)\$(PackageId)\</_packagePath>
<NupkgPath Condition=" '$(NupkgPath)' == '' ">$([MSBuild]::NormalizeDirectory ('$(_buildPath)\nupkgs\'))</NupkgPath>
<BarManifestOutputPath Condition=" '$(BarManifestOutputPath)' == '' ">$(NupkgPath)\bar-manifests</BarManifestOutputPath>
<BarManifestOutputPath Condition=" '$(BarManifestOutputPath)' == '' ">$(NupkgPath)\bar-manifests\$(_PlatformName)</BarManifestOutputPath>
<_AssemblyInfix Condition="'$(_PlatformName)' == 'iOS'">iOS</_AssemblyInfix>
<_AssemblyInfix Condition="'$(_PlatformName)' == 'tvOS'">tvOS</_AssemblyInfix>
<_AssemblyInfix Condition="'$(_PlatformName)' == 'watchOS'">watchOS</_AssemblyInfix>
Expand Down Expand Up @@ -115,7 +115,7 @@

<Target Name="GenerateBuildAssetRegistryManifest" >
<ItemGroup>
<BuildArtifacts Include="$(NupkgPath)\*.nupkg" />
<BuildArtifacts Include="$(NupkgPath)\Microsoft*.$(_PlatformName).*.nupkg" />
</ItemGroup>

<Error Condition="'@(BuildArtifacts)' == ''" Text="No packages to create manifest from." />
Expand All @@ -139,8 +139,6 @@
RepoBranch="$(BUILD_SOURCEBRANCH)"
RepoCommit="$(BUILD_SOURCEVERSION)"
PublishingVersion="3" />

<Message Importance="high" Text="##vso[artifact.upload containerfolder=AssetManifests;artifactname=AssetManifests]$(BarManifestOutputPath)/AssetManifest.xml" />
</Target>

<Target Name="PushManifestToBuildAssetRegistry" >
Expand Down
5 changes: 5 additions & 0 deletions dotnet/targets/Xamarin.Shared.Sdk.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@

<!-- Do we need a RuntimeIdentifier? For apps and app extensions we do -->
<_RuntimeIdentifierIsRequired Condition="'$(OutputType)' == 'Exe' Or '$(IsAppExtension)' == 'true'">true</_RuntimeIdentifierIsRequired>

<!-- The logic to compute the default value for GenerateSatelliteAssembliesForCore is wrong when building inside Visual Studio (Windows), so make sure it defaults to the correct value -->
<!-- Ref: https://github.com/xamarin/xamarin-macios/issues/16193 -->
<!-- Ref: https://github.com/dotnet/sdk/issues/28419 -->
<GenerateSatelliteAssembliesForCore Condition="'$(GenerateSatelliteAssembliesForCore)' == ''">true</GenerateSatelliteAssembliesForCore>
</PropertyGroup>

<!-- Set the default RuntimeIdentifier if not already specified. -->
Expand Down
3 changes: 2 additions & 1 deletion msbuild/Xamarin.Shared/Xamarin.Shared.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2050,8 +2050,9 @@ Copyright (C) 2018 Microsoft. All rights reserved.
We only run the CodesignAppBundle target on the outer-most executable project
* Not on app extensions
* Not on watch apps
* Not if explicitly disabled by setting EnableCodeSigning=false
-->
<_CodesignAppBundleCondition Condition="'$(_CodesignAppBundleCondition)' == '' And '$(IsAppExtension)' != 'true' And '$(IsWatchApp)' != 'true' And '$(_CanOutputAppBundle)' == 'true'">true</_CodesignAppBundleCondition>
<_CodesignAppBundleCondition Condition="'$(_CodesignAppBundleCondition)' == '' And '$(IsAppExtension)' != 'true' And '$(IsWatchApp)' != 'true' And '$(_CanOutputAppBundle)' == 'true' And '$(EnableCodeSigning)' != 'false'">true</_CodesignAppBundleCondition>
<_CodesignAppBundleCondition Condition="'$(_CodesignAppBundleCondition)' == ''">false</_CodesignAppBundleCondition>
</PropertyGroup>
</Target>
Expand Down
6 changes: 2 additions & 4 deletions src/ObjCRuntime/NativeAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@
using System;
using System.Diagnostics;

namespace ObjCRuntime
{
namespace ObjCRuntime {
[AttributeUsage (AttributeTargets.Enum)]
public sealed class NativeAttribute : Attribute
{
public sealed class NativeAttribute : Attribute {
public NativeAttribute ()
{
}
Expand Down
71 changes: 27 additions & 44 deletions src/ObjCRuntime/PlatformAvailability2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,16 @@
using System;
using System.Text;

namespace ObjCRuntime
{
namespace ObjCRuntime {
[Flags]
public enum PlatformArchitecture : byte
{
public enum PlatformArchitecture : byte {
None = 0x00,
Arch32 = 0x01,
Arch64 = 0x02,
All = 0xff
}

public enum PlatformName : byte
{
public enum PlatformName : byte {
None,
MacOSX,
iOS,
Expand All @@ -43,8 +40,7 @@ public enum PlatformName : byte
UIKitForMac = MacCatalyst, // temporary
}

public enum AvailabilityKind
{
public enum AvailabilityKind {
Introduced,
Deprecated,
Obsoleted,
Expand All @@ -65,8 +61,7 @@ public enum AvailabilityKind
AttributeTargets.Struct,
AllowMultiple = true
)]
public abstract class AvailabilityBaseAttribute : Attribute
{
public abstract class AvailabilityBaseAttribute : Attribute {
public AvailabilityKind AvailabilityKind { get; private set; }
public PlatformName Platform { get; private set; }
public Version Version { get; private set; }
Expand Down Expand Up @@ -95,7 +90,7 @@ public override string ToString ()
{
var builder = new StringBuilder ();
builder.AppendFormat ("[{0} ({1}.{2}", AvailabilityKind, nameof (PlatformName), Platform);

if (Version != null) {
builder.AppendFormat (", {0},{1}", Version.Major, Version.Minor);
if (Version.Build >= 0)
Expand All @@ -113,8 +108,7 @@ public override string ToString ()
}
}

public class IntroducedAttribute : AvailabilityBaseAttribute
{
public class IntroducedAttribute : AvailabilityBaseAttribute {
public IntroducedAttribute (PlatformName platform,
PlatformArchitecture architecture = PlatformArchitecture.None,
string message = null)
Expand All @@ -141,8 +135,7 @@ public class IntroducedAttribute : AvailabilityBaseAttribute
}
}

public sealed class DeprecatedAttribute : AvailabilityBaseAttribute
{
public sealed class DeprecatedAttribute : AvailabilityBaseAttribute {
public DeprecatedAttribute (PlatformName platform,
PlatformArchitecture architecture = PlatformArchitecture.None,
string message = null)
Expand All @@ -169,8 +162,7 @@ public sealed class DeprecatedAttribute : AvailabilityBaseAttribute
}
}

public sealed class ObsoletedAttribute : AvailabilityBaseAttribute
{
public sealed class ObsoletedAttribute : AvailabilityBaseAttribute {
public ObsoletedAttribute (PlatformName platform,
PlatformArchitecture architecture = PlatformArchitecture.None,
string message = null)
Expand All @@ -197,8 +189,7 @@ public sealed class ObsoletedAttribute : AvailabilityBaseAttribute
}
}

public class UnavailableAttribute : AvailabilityBaseAttribute
{
public class UnavailableAttribute : AvailabilityBaseAttribute {
public UnavailableAttribute (PlatformName platform,
PlatformArchitecture architecture = PlatformArchitecture.All,
string message = null)
Expand All @@ -208,58 +199,55 @@ public class UnavailableAttribute : AvailabilityBaseAttribute
}
}

public sealed class TVAttribute : IntroducedAttribute
{
public sealed class TVAttribute : IntroducedAttribute {
public TVAttribute (byte major, byte minor)
: base (PlatformName.TvOS, (int)major, (int)minor)
: base (PlatformName.TvOS, (int) major, (int) minor)
{
}

[Obsolete ("Use the overload that takes '(major, minor)', since tvOS is always 64-bit.")]
public TVAttribute (byte major, byte minor, bool onlyOn64 = false)
: base (PlatformName.TvOS, (int)major, (int)minor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
: base (PlatformName.TvOS, (int) major, (int) minor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
{
}

public TVAttribute (byte major, byte minor, byte subminor)
: base (PlatformName.TvOS, (int)major, (int)minor, subminor)
: base (PlatformName.TvOS, (int) major, (int) minor, subminor)
{
}

[Obsolete ("Use the overload that takes '(major, minor, subminor)', since tvOS is always 64-bit.")]
public TVAttribute (byte major, byte minor, byte subminor, bool onlyOn64)
: base (PlatformName.TvOS, (int)major, (int)minor, (int)subminor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
: base (PlatformName.TvOS, (int) major, (int) minor, (int) subminor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
{
}
}

public sealed class WatchAttribute : IntroducedAttribute
{

public sealed class WatchAttribute : IntroducedAttribute {
public WatchAttribute (byte major, byte minor)
: base (PlatformName.WatchOS, (int)major, (int)minor)
: base (PlatformName.WatchOS, (int) major, (int) minor)
{
}

[Obsolete ("Use the overload that takes '(major, minor)', since watchOS is never 64-bit.")] // not yet at least
public WatchAttribute (byte major, byte minor, bool onlyOn64 = false)
: base (PlatformName.WatchOS, (int)major, (int)minor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
: base (PlatformName.WatchOS, (int) major, (int) minor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
{
}

public WatchAttribute (byte major, byte minor, byte subminor)
: base (PlatformName.WatchOS, (int)major, (int)minor, subminor)
: base (PlatformName.WatchOS, (int) major, (int) minor, subminor)
{
}

[Obsolete ("Use the overload that takes '(major, minor)', since watchOS is never 64-bit.")] // not yet at least
public WatchAttribute (byte major, byte minor, byte subminor, bool onlyOn64)
: base (PlatformName.WatchOS, (int)major, (int)minor, (int)subminor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
: base (PlatformName.WatchOS, (int) major, (int) minor, (int) subminor, onlyOn64 ? PlatformArchitecture.Arch64 : PlatformArchitecture.All)
{
}
}

public sealed class MacCatalystAttribute : IntroducedAttribute
{
public sealed class MacCatalystAttribute : IntroducedAttribute {
public MacCatalystAttribute (byte major, byte minor)
: base (PlatformName.MacCatalyst, (int) major, (int) minor)
{
Expand All @@ -271,40 +259,35 @@ public MacCatalystAttribute (byte major, byte minor, byte subminor)
}
}

public sealed class NoMacAttribute : UnavailableAttribute
{
public sealed class NoMacAttribute : UnavailableAttribute {
public NoMacAttribute ()
: base (PlatformName.MacOSX)
{
}
}

public sealed class NoiOSAttribute : UnavailableAttribute
{
public sealed class NoiOSAttribute : UnavailableAttribute {
public NoiOSAttribute ()
: base (PlatformName.iOS)
{
}
}

public sealed class NoWatchAttribute : UnavailableAttribute
{
public sealed class NoWatchAttribute : UnavailableAttribute {
public NoWatchAttribute ()
: base (PlatformName.WatchOS)
{
}
}

public sealed class NoTVAttribute : UnavailableAttribute
{
public sealed class NoTVAttribute : UnavailableAttribute {
public NoTVAttribute ()
: base (PlatformName.TvOS)
{
}
}

public sealed class NoMacCatalystAttribute : UnavailableAttribute
{
public sealed class NoMacCatalystAttribute : UnavailableAttribute {
public NoMacCatalystAttribute ()
: base (PlatformName.MacCatalyst)
{
Expand Down
6 changes: 2 additions & 4 deletions src/ObjCRuntime/Registrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@
//

#if MONOMAC
namespace ObjCRuntime
{
namespace ObjCRuntime {
public delegate void AssemblyRegistrationHandler (object sender, AssemblyRegistrationEventArgs args);

public class AssemblyRegistrationEventArgs : EventArgs
{
public class AssemblyRegistrationEventArgs : EventArgs {
public bool Register { get; set; }
public System.Reflection.AssemblyName AssemblyName { get; internal set; }
}
Expand Down
2 changes: 2 additions & 0 deletions tools/autoformat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.T
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Tasks.Windows.csproj"
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj"
dotnet format whitespace "$SRC_DIR/tools/dotnet-linker/dotnet-linker.csproj"
dotnet format whitespace "$SRC_DIR/tools/mmp/mmp.csproj"
dotnet format whitespace "$SRC_DIR/tools/mtouch/mtouch.csproj"
dotnet format whitespace "$SRC_DIR/tests/xtro-sharpie/xtro-sharpie.csproj"
dotnet format whitespace "$SRC_DIR/tests/xtro-sharpie/u2ignore/u2ignore.csproj"
dotnet format whitespace "$SRC_DIR/tests/xtro-sharpie/u2todo/u2todo.csproj"
Expand Down
22 changes: 8 additions & 14 deletions tools/common/BuildTasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@
using System.Threading;
using System.Threading.Tasks;

namespace Xamarin.Bundler
{
namespace Xamarin.Bundler {
// This contains all the tasks that has to be done to create the final output.
// Intermediate tasks do not have to be in this list (as long as they're in another task's dependencies),
// but it doesn't hurt if they're here either.
// This is a directed graph, where the top nodes represent the input, and the leaf nodes the output.
// Each node (BuildTask) will build its dependencies before building itself, so at build time
// we only have to iterate over the leaf nodes to build the whole graph.
public class BuildTasks : List<BuildTask>
{
public class BuildTasks : List<BuildTask> {
SemaphoreSlim semaphore;

public BuildTasks ()
Expand All @@ -44,8 +42,7 @@ void ExecuteBuildTasks (SingleThreadedSynchronizationContext context, List<Excep
for (int i = 0; i < Count; i++)
tasks [i] = this [i].Execute (this);

Task.Factory.StartNew (async () =>
{
Task.Factory.StartNew (async () => {
try {
await Task.WhenAll (tasks);
} catch (Exception e) {
Expand Down Expand Up @@ -86,8 +83,7 @@ public void Dot (Application app, string file)
var all_files = new HashSet<string> ();
var circular_ref_nodes = new HashSet<string> ();

var render_file = new Func<string, string> ((v) =>
{
var render_file = new Func<string, string> ((v) => {
if (Path.GetDirectoryName (v).EndsWith (".framework", StringComparison.Ordinal))
v = Path.GetDirectoryName (v);
var cache = v.IndexOf (app.Cache.Location, StringComparison.Ordinal);
Expand Down Expand Up @@ -157,8 +153,7 @@ public void Dot (Application app, string file)
}
}

public abstract class BuildTask
{
public abstract class BuildTask {
static int counter;
public readonly int ID = counter++;

Expand Down Expand Up @@ -236,7 +231,7 @@ public async Task Execute (BuildTasks build_tasks)
var dep_tasks = new Task [deps.Length];
for (int i = 0; i < deps.Length; i++)
dep_tasks [i] = deps [i].Execute (build_tasks);

Log ("Waiting for dependencies to complete.");
await Task.WhenAll (dep_tasks);
Log ("Done waiting for dependencies.");
Expand All @@ -246,7 +241,7 @@ public async Task Execute (BuildTasks build_tasks)
if (Outputs.Count () > 1) {
Driver.Log (3, "Targets '{0}' are up-to-date.", string.Join ("', '", Outputs.ToArray ()));
} else {
Driver.Log (3, "Target '{0}' is up-to-date.", Outputs.First () );
Driver.Log (3, "Target '{0}' is up-to-date.", Outputs.First ());
}
completed_task.SetResult (false);
} else {
Expand Down Expand Up @@ -330,8 +325,7 @@ protected void WriteLimitedOutput (string first, IEnumerable<string> lines, List
}
}

class SingleThreadedSynchronizationContext : SynchronizationContext
{
class SingleThreadedSynchronizationContext : SynchronizationContext {
readonly BlockingCollection<Tuple<SendOrPostCallback, object>> queue = new BlockingCollection<Tuple<SendOrPostCallback, object>> ();

public override void Post (SendOrPostCallback d, object state)
Expand Down

3 comments on commit 9a7740b

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.