diff options
author | Bret Johnson <bret.johnson@microsoft.com> | 2022-08-12 20:37:11 +0300 |
---|---|---|
committer | Bret Johnson <bret.johnson@microsoft.com> | 2022-08-12 20:37:11 +0300 |
commit | ccda5cf07810c3ef472a7320daf31d2d35432bd6 (patch) | |
tree | d6d75dc0ab5574013ae876a524ebc0c6575bc943 | |
parent | 54b3ce9a5b9d604d5a7bd546957826ba6d4f3de1 (diff) | |
parent | 6436bb348141ced2838514aa3f5c5515468df017 (diff) |
Merge branch 'main' into dev/bretjohn/fix-search-width
-rw-r--r-- | .build/automation/stages/validate.yml | 18 | ||||
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/DrawingExtensions.cs | 2 | ||||
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/HistoryLayer.cs | 18 | ||||
-rw-r--r-- | Xamarin.PropertyEditing.Mac/HostResourceProvider.cs | 10 | ||||
-rw-r--r-- | bot-provisioning/dependencies.csx | 6 | ||||
-rw-r--r-- | global.json | 2 |
6 files changed, 37 insertions, 19 deletions
diff --git a/.build/automation/stages/validate.yml b/.build/automation/stages/validate.yml index d59b470..5e55b70 100644 --- a/.build/automation/stages/validate.yml +++ b/.build/automation/stages/validate.yml @@ -42,7 +42,7 @@ stages: - job: 'MacOS' pool: - vmImage: 'macOS-latest' + vmImage: 'macos-12' steps: - checkout: self @@ -58,19 +58,19 @@ stages: provisioning_script: $(System.DefaultWorkingDirectory)/bot-provisioning/dependencies.csx provisioning_extra_args: -vv DEVDIV_PKGS_NUGET_TOKEN=$(DevDiv.NuGet.Token) SECTOOLS_PKGS_NUGET_TOKEN=$(SecTools.NuGet.Token) - - task: MSBuild@1 + - task: DotNetCoreCLI@2 displayName: Build inputs: - solution: build.proj - msbuildVersion: "15.0" - msbuildArguments: '/restore /p:Release=true /t:Build' + projects: build.proj + command: build + arguments: '/restore /p:Release=true /t:Build' - - task: MSBuild@1 + - task: DotNetCoreCLI@2 displayName: 'Run Tests' inputs: - solution: build.proj - msbuildVersion: "15.0" - msbuildArguments: '/p:Release=true /t:Test' + projects: build.proj + command: build + arguments: '/p:Release=true /t:Test' - task: PublishTestResults@2 displayName: 'Publish Test Results' diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/DrawingExtensions.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/DrawingExtensions.cs index cf87d01..430a4f0 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/DrawingExtensions.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/DrawingExtensions.cs @@ -20,7 +20,7 @@ namespace Xamarin.PropertyEditing.Mac Color0 = c0, Color1 = c1, Width = (float)Math.Min (frame.Height / 2f, 10), - Center = new CIVector (new nfloat[] { 0, 0 }), + InputCenter = default, }) { using (var context = new CIContext (null)) { return context.CreateCGImage (board.OutputImage, new CGRect (0, 0, frame.Width, frame.Height)); diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/HistoryLayer.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/HistoryLayer.cs index 9f90d61..d4ec241 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/HistoryLayer.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/HistoryLayer.cs @@ -3,6 +3,7 @@ using AppKit; using CoreAnimation; using CoreGraphics; using ObjCRuntime; +using Xamarin.PropertyEditing.Drawing; namespace Xamarin.PropertyEditing.Mac { @@ -77,9 +78,20 @@ namespace Xamarin.PropertyEditing.Mac public override void UpdateFromModel (EditorInteraction interaction) { LayoutIfNeeded (); - current.BackgroundColor = interaction.Color.ToCGColor (); - previous.BackgroundColor = interaction.ViewModel.InitialColor.ToCGColor (); - last.BackgroundColor = interaction.LastColor.ToCGColor (); + SetCALayerBackgroundColor (current, interaction.Color); + //there are some scenarios where viewmodel could be null + if (interaction.ViewModel != null) + SetCALayerBackgroundColor (previous, interaction.ViewModel.InitialColor); + SetCALayerBackgroundColor (last, interaction.LastColor); + } + + static void SetCALayerBackgroundColor(CALayer layer, CommonColor color) + { + // We need to use GC.KeepAlive to ensure that the CGColor doesn't get garbage collected (and thus the + // native object Released) before the BackgroundColor assignment is complete + CGColor cgColor = color.ToCGColor (); + layer.BackgroundColor = cgColor; + GC.KeepAlive (cgColor); } public override void UpdateFromLocation (EditorInteraction interaction, CGPoint location) diff --git a/Xamarin.PropertyEditing.Mac/HostResourceProvider.cs b/Xamarin.PropertyEditing.Mac/HostResourceProvider.cs index 42720a8..7beea59 100644 --- a/Xamarin.PropertyEditing.Mac/HostResourceProvider.cs +++ b/Xamarin.PropertyEditing.Mac/HostResourceProvider.cs @@ -17,8 +17,14 @@ namespace Xamarin.PropertyEditing.Mac public HostResourceProvider () { - var containingDir = Path.GetDirectoryName (typeof (HostResourceProvider).Assembly.Location); - var bundlePath = Path.Combine (containingDir, "PropertyEditingResource.bundle"); + var bundlePath = NSBundle.MainBundle.PathForResource ("PropertyEditingResource", "bundle"); + if (!Directory.Exists (bundlePath)) + { + //if the bundle resource directory is not in place we fallback into the assembly location + var containingDir = Path.GetDirectoryName (typeof (HostResourceProvider).Assembly.Location); + bundlePath = Path.Combine (containingDir, "PropertyEditingResource.bundle"); + } + this.resourceBundle = new NSBundle (bundlePath); } diff --git a/bot-provisioning/dependencies.csx b/bot-provisioning/dependencies.csx index 0dd5668..78df6d7 100644 --- a/bot-provisioning/dependencies.csx +++ b/bot-provisioning/dependencies.csx @@ -5,9 +5,9 @@ using static Xamarin.Provisioning.ProvisioningScript; if (IsMac) { DotNetCoreSdk ("../global.json", installDirectory: Env("DOTNET_ROOT")) .WithWorkload( - workload: new DotNetWorkload("microsoft.net.sdk.macos", "12.1.301-preview.13.10"), + workload: new DotNetWorkload("microsoft.net.sdk.macos", "12.3.300-rc.3.83"), dependencies: new [] { - new DotNetWorkload("microsoft.net.workload.mono.toolchain", "6.0.2-mauipre.1.22102.15"), + new DotNetWorkload("microsoft.net.workload.mono.toolchain", "6.0.5"), }, // nugetConfigFilePath: "../NuGet.Config"); // TODO: Make this work and remove `sources` below sources: new [] { @@ -15,7 +15,7 @@ if (IsMac) { "https://api.nuget.org/v3/index.json", }); - Xcode ("13.2.1").XcodeSelect (); + Xcode ("13.3.1").XcodeSelect (); } else if (IsWindows) { DotNetCoreSdk ("../global.json"); diff --git a/global.json b/global.json index a2ce2ee..e96609f 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "6.0.200" + "version": "6.0.300" } } |