diff --git a/Environment.Build.props b/Environment.Build.props index 041013728..2a495fc2f 100644 --- a/Environment.Build.props +++ b/Environment.Build.props @@ -4,8 +4,8 @@ - - + + false true @@ -19,7 +19,7 @@ LEGACY --> - + <_XamarinFormsVersion>$(BUILD_BUILDNUMBER.Split(`+`)[0]) $(_XamarinFormsVersion) @@ -43,4 +43,10 @@ MonoAndroid90; MonoAndroid90;MonoAndroid10.0; + + + + True + True + diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue8291.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue8291.cs new file mode 100644 index 000000000..4d7087a05 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue8291.cs @@ -0,0 +1,80 @@ +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; +using System.Linq; + + +#if UITEST +using Xamarin.UITest; +using NUnit.Framework; +using Xamarin.Forms.Core.UITests; +#endif + +namespace Xamarin.Forms.Controls.Issues +{ + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Github, 8291, "[Android] Editor - Text selection menu does not appear when selecting text on an editor placed within a ScrollView", + PlatformAffected.Android)] +#if UITEST + [NUnit.Framework.Category(UITestCategories.Editor)] +#endif + public class Issue8291 : TestContentPage + { + protected override void Init() + { + Content = new StackLayout() + { + Children = + { + new Label() + { + Text = "Only Relevant on Android" + }, + new ScrollView() + { + Content = new Editor() + { + Text = "Press and hold this text. Text should become selected and context menu should open", + AutomationId = "PressEditor" + } + }, + new ScrollView() + { + Content = new Entry() + { + Text = "Press and hold this text. Text should become selected and context menu should open", + AutomationId = "PressEntry" + } + } + } + }; + } + +#if UITEST && __ANDROID__ + [Test] + public void ContextMenuShowsUpWhenPressAndHoldTextOnEditorAndEntryField() + { + RunningApp.TouchAndHold("PressEditor"); + TestForPopup(); + RunningApp.Tap("PressEntry"); + RunningApp.TouchAndHold("PressEntry"); + TestForPopup(); + } + + void TestForPopup() + { + var result = RunningApp.QueryUntilPresent(() => + { + return RunningApp.Query("Paste") + .Union(RunningApp.Query("Share")) + .Union(RunningApp.Query("Copy")) + .Union(RunningApp.Query("Cut")) + .Union(RunningApp.Query("Select All")) + .ToArray(); + }); + + Assert.IsNotNull(result); + Assert.IsTrue(result.Length > 0); + } +#endif + } +} diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems index 6f8d01d43..272832228 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems @@ -10,6 +10,7 @@ + @@ -1948,7 +1949,7 @@ - Designer + Designer MSBuild:UpdateDesignTimeXaml @@ -1982,4 +1983,4 @@ MSBuild:UpdateDesignTimeXaml - + \ No newline at end of file diff --git a/Xamarin.Forms.Core.UITests.Shared/Tests/CarouselViewUITests.cs b/Xamarin.Forms.Core.UITests.Shared/Tests/CarouselViewUITests.cs index 12c0e50fe..d74b660bd 100644 --- a/Xamarin.Forms.Core.UITests.Shared/Tests/CarouselViewUITests.cs +++ b/Xamarin.Forms.Core.UITests.Shared/Tests/CarouselViewUITests.cs @@ -21,29 +21,25 @@ namespace Xamarin.Forms.Core.UITests public void CarouselViewRemoveAndUpdateCurrentItem(string subgallery) { VisitSubGallery(subgallery); - var position = App.WaitForElement(x => x.Marked("lblPosition")).First().Text; - Assert.IsTrue(position == "0"); - var currentItem = App.WaitForElement(x => x.Marked("lblCurrentItem")).First().Text; - Assert.IsTrue(currentItem == "0"); - var selected = App.WaitForElement(x => x.Marked("lblSelected")).First().Text; - Assert.IsTrue(selected == "0"); + + CheckPositionValue("lblPosition", "0"); + CheckPositionValue("lblCurrentItem", "0"); + CheckPositionValue("lblSelected", "0"); + var rect = App.Query(c => c.Marked("TheCarouselView")).First().Rect; var centerX = rect.CenterX; var rightX = rect.X - 5; App.DragCoordinates(centerX + 40, rect.CenterY, rightX, rect.CenterY); - var positionAfter = App.WaitForElement(x => x.Marked("lblPosition")).First().Text; - Assert.IsTrue(positionAfter == "1"); - var currentItemAfter = App.WaitForElement(x => x.Marked("lblCurrentItem")).First().Text; - Assert.IsTrue(currentItemAfter == "1"); - var selectedAfter = App.WaitForElement(x => x.Marked("lblSelected")).First().Text; - Assert.IsTrue(selectedAfter == "1"); + + CheckPositionValue("lblPosition", "1"); + CheckPositionValue("lblCurrentItem", "1"); + CheckPositionValue("lblSelected", "1"); + App.Tap(x => x.Marked("btnRemove")); - var positionAfterRemove = App.WaitForElement(x => x.Marked("lblPosition")).First().Text; - Assert.IsTrue(positionAfterRemove == "1"); - var currentItemAfterRemove = App.WaitForElement(x => x.Marked("lblCurrentItem")).First().Text; - Assert.IsTrue(currentItemAfterRemove == "2"); - var selectedAfterRemove = App.WaitForElement(x => x.Marked("lblSelected")).First().Text; - Assert.IsTrue(selectedAfterRemove == "2"); + + CheckPositionValue("lblPosition", "1"); + CheckPositionValue("lblCurrentItem", "2"); + CheckPositionValue("lblSelected", "2"); App.Back(); } @@ -53,17 +49,13 @@ namespace Xamarin.Forms.Core.UITests public void CarouselViewRemoveFirstCurrentItem(string subgallery) { VisitSubGallery(subgallery); - var position = App.WaitForElement(x => x.Marked("lblPosition")).First().Text; - Assert.IsTrue(position == "0"); - var currentItem = App.WaitForElement(x => x.Marked("lblCurrentItem")).First().Text; - Assert.IsTrue(currentItem == "0"); + + CheckPositionValue("lblPosition", "0"); + CheckPositionValue("lblCurrentItem", "0"); App.Tap(x => x.Marked("btnRemove")); - var positionAfterRemove = App.WaitForElement(x => x.Marked("lblPosition")).First().Text; - Assert.IsTrue(positionAfterRemove == "0"); - var currentItemAfterRemove = App.WaitForElement(x => x.Marked("lblCurrentItem")).First().Text; - Assert.IsTrue(currentItemAfterRemove == "1"); - var selectedAfterRemove = App.WaitForElement(x => x.Marked("lblSelected")).First().Text; - Assert.IsTrue(selectedAfterRemove == "1"); + CheckPositionValue("lblPosition", "0"); + CheckPositionValue("lblCurrentItem", "1"); + CheckPositionValue("lblSelected", "1"); App.Back(); } @@ -73,12 +65,11 @@ namespace Xamarin.Forms.Core.UITests public void CarouselViewRemoveLastCurrentItem(string subgallery) { VisitSubGallery(subgallery); - var position = App.WaitForElement(x => x.Marked("lblPosition")).First().Text; - Assert.IsTrue(position == "0"); - var currentItem = App.WaitForElement(x => x.Marked("lblCurrentItem")).First().Text; - Assert.IsTrue(currentItem == "0"); - var selected = App.WaitForElement(x => x.Marked("lblSelected")).First().Text; - Assert.IsTrue(selected == "0"); + + CheckPositionValue("lblPosition", "0"); + CheckPositionValue("lblCurrentItem", "0"); + CheckPositionValue("lblSelected", "0"); + var rect = App.Query(c => c.Marked("TheCarouselView")).First().Rect; var centerX = rect.CenterX; var rightX = rect.X - 5; @@ -86,24 +77,21 @@ namespace Xamarin.Forms.Core.UITests App.DragCoordinates(centerX + 40, rect.CenterY, rightX, rect.CenterY); App.DragCoordinates(centerX + 40, rect.CenterY, rightX, rect.CenterY); App.DragCoordinates(centerX + 40, rect.CenterY, rightX, rect.CenterY); - var positionAfter = App.WaitForElement(x => x.Marked("lblPosition")).First().Text; - Assert.IsTrue(positionAfter == "4"); - var currentItemAfter = App.WaitForElement(x => x.Marked("lblCurrentItem")).First().Text; - Assert.IsTrue(currentItemAfter == "4"); - var selectedAfter = App.WaitForElement(x => x.Marked("lblSelected")).First().Text; - Assert.IsTrue(selectedAfter == "4"); + App.DragCoordinates(centerX + 40, rect.CenterY, rightX, rect.CenterY); + + CheckPositionValue("lblPosition", "4"); + CheckPositionValue("lblCurrentItem", "4"); + CheckPositionValue("lblSelected", "4"); + App.Tap(x => x.Marked("btnRemove")); - var positionAfterRemove = App.WaitForElement(x => x.Marked("lblPosition")).First().Text; - Assert.IsTrue(positionAfterRemove == "3"); - var currentItemAfterRemove = App.WaitForElement(x => x.Marked("lblCurrentItem")).First().Text; - Assert.IsTrue(currentItemAfterRemove == "3"); - var selectedAfterRemove = App.WaitForElement(x => x.Marked("lblSelected")).First().Text; - Assert.IsTrue(selectedAfterRemove == "3"); + + CheckPositionValue("lblPosition", "3"); + CheckPositionValue("lblCurrentItem", "3"); + CheckPositionValue("lblSelected", "3"); App.Back(); } - [TestCase("IndicatorView")] public void CarouselViewFirstLastPosition(string subgallery) { @@ -202,7 +190,6 @@ namespace Xamarin.Forms.Core.UITests void VisitSubGallery(string galleryName, bool enableIndicator = false) { - if (enableIndicator) App.Tap(t => t.Marked("EnableIndicatorView")); @@ -214,5 +201,18 @@ namespace Xamarin.Forms.Core.UITests App.Tap(t => t.Marked(galleryName)); } + + static void CheckPositionValue(string marked, string value) + { + var positionAfter = App.QueryUntilPresent(() => + { + var positionLabel = App.WaitForElement(x => x.Marked(marked)); + if (positionLabel.First().Text == value) + return positionLabel; + return null; + }, delayInMs: 1000); + Assert.IsTrue(positionAfter[0].Text == value); + } + } } \ No newline at end of file diff --git a/Xamarin.Forms.Platform.Android/Renderers/EditorRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/EditorRenderer.cs index d43397be2..723d1bee8 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/EditorRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/EditorRenderer.cs @@ -51,6 +51,18 @@ namespace Xamarin.Forms.Platform.Android _textColorSwitcher = _textColorSwitcher ?? new TextColorSwitcher(EditText.TextColors, Element.UseLegacyColorManagement()); _textColorSwitcher.UpdateTextColor(EditText, Element.TextColor); } + + protected override void OnAttachedToWindow() + { + base.OnAttachedToWindow(); + + if (EditText.IsAlive() && EditText.Enabled) + { + // https://issuetracker.google.com/issues/37095917 + EditText.Enabled = false; + EditText.Enabled = true; + } + } } public abstract class EditorRendererBase : ViewRenderer, ITextWatcher diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 92c8e1171..44ec81297 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -72,7 +72,7 @@ stages: pool: name: $(vs2019VmPool) vmImage: $(vs2019VmImage) - demands: + demands: msbuild strategy: matrix: @@ -93,7 +93,7 @@ stages: pool: name: $(vs2019VmPool) vmImage: $(vs2019VmImage) - demands: + demands: msbuild strategy: matrix: @@ -119,7 +119,7 @@ stages: pool: name: $(vs2019VmPool) vmImage: $(vs2019VmImage) - demands: + demands: msbuild variables: FormsIdAppend: '' @@ -136,7 +136,7 @@ stages: pool: name: $(vs2019VmPool) vmImage: $(vs2019VmImage) - demands: + demands: - Agent.OS -equals Windows_NT - msbuild strategy: @@ -158,7 +158,7 @@ stages: pool: name: $(vs2019VmPool) vmImage: $(vs2019VmImage) - demands: + demands: - Agent.OS -equals Windows_NT - msbuild strategy: @@ -185,7 +185,7 @@ stages: pool: name: $(vs2019VmPool) vmImage: $(vs2019VmImage) - demands: + demands: - Agent.OS -equals Windows_NT - msbuild variables: @@ -243,7 +243,7 @@ stages: - job: osx workspace: clean: all - displayName: OSX Phase + displayName: OSX Phase 2017 pool: name: $(osx2017VmPool) vmImage: 'macOS-10.14' @@ -253,6 +253,7 @@ stages: variables: provisionator.osxPath : 'build/provisioning/provisioning.csx' buildConfiguration: $(DefaultBuildConfiguration) + slnPath: $(SolutionFile) iOSCertSecureFileName: 'Xamarin Forms iOS Certificate.p12' iOSProvisioningSecureFileName: 'Xamarin Forms iOS Provisioning.mobileprovision' buildForVS2017: 'true' @@ -269,7 +270,7 @@ stages: displayName: Sign Phase pool: name: $(signVmImage) - demands: + demands: msbuild steps: - template: build/steps/build-sign.yml diff --git a/build.cake b/build.cake index 366ad92c0..85c989c13 100644 --- a/build.cake +++ b/build.cake @@ -37,18 +37,19 @@ PowerShell: var target = Argument("target", "Default"); var configuration = Argument("configuration", "Debug"); var packageVersion = Argument("packageVersion", ""); -var releaseChannelArg = Argument("releaseChannel", "Stable"); -releaseChannelArg = EnvironmentVariable("releaseChannel") ?? releaseChannelArg; +var releaseChannelArg = Argument("CHANNEL", "Stable"); +releaseChannelArg = EnvironmentVariable("CHANNEL") ?? releaseChannelArg; var teamProject = Argument("TeamProject", ""); bool buildForVS2017 = Convert.ToBoolean(Argument("buildForVS2017", "false")); string artifactStagingDirectory = Argument("Build_ArtifactStagingDirectory", (string)null) ?? EnvironmentVariable("Build.ArtifactStagingDirectory") ?? EnvironmentVariable("Build_ArtifactStagingDirectory") ?? "."; -var ANDROID_HOME = EnvironmentVariable ("ANDROID_HOME") ?? +var ANDROID_HOME = EnvironmentVariable("ANDROID_HOME") ?? (IsRunningOnWindows () ? "C:\\Program Files (x86)\\Android\\android-sdk\\" : ""); -string[] androidSdkManagerInstalls = new string[0];//new [] { "platforms;android-24", "platforms;android-28"}; +string[] androidSdkManagerInstalls = new string[0]; //new [] { "platforms;android-24", "platforms;android-28", "platforms;android-29", "build-tools;29.0.3"}; +Information ("ANDROID_HOME: {0}", ANDROID_HOME); Information ("Team Project: {0}", teamProject); Information ("buildForVS2017: {0}", buildForVS2017); @@ -110,12 +111,35 @@ if(String.IsNullOrWhiteSpace(monoSDK_macos)) monoSDK_macos = $"https://download.mono-project.com/archive/{monoMajorVersion}/macos-10-universal/MonoFramework-MDK-{monoVersion}.macos10.xamarin.universal.pkg"; } } - -string androidSDK = IsRunningOnWindows() ? "" : androidSDK_macos; -string monoSDK = IsRunningOnWindows() ? "" : monoSDK_macos; -string iosSDK = IsRunningOnWindows() ? "" : iOSSDK_macos; -string macSDK = IsRunningOnWindows() ? "" : macSDK_macos; +string androidSDK_windows = ""; +string iOSSDK_windows = ""; +string monoSDK_windows = ""; +string macSDK_windows = ""; + +if(!buildForVS2017) +{ + androidSDK_macos = EnvironmentVariable("ANDROID_SDK_MAC", androidSDK_macos); + iOSSDK_macos = EnvironmentVariable("IOS_SDK_MAC", iOSSDK_macos); + monoSDK_macos = EnvironmentVariable("MONO_SDK_MAC", monoSDK_macos); + macSDK_macos = EnvironmentVariable("MAC_SDK_MAC", macSDK_macos); + + androidSDK_windows = EnvironmentVariable("ANDROID_SDK_WINDOWS", ""); + iOSSDK_windows = EnvironmentVariable("IOS_SDK_WINDOWS", ""); + monoSDK_windows = EnvironmentVariable("MONO_SDK_WINDOWS", ""); + macSDK_windows = EnvironmentVariable("MAC_SDK_WINDOWS", ""); +} + +string androidSDK = IsRunningOnWindows() ? androidSDK_windows : androidSDK_macos; +string monoSDK = IsRunningOnWindows() ? monoSDK_windows : monoSDK_macos; +string iosSDK = IsRunningOnWindows() ? iOSSDK_windows : iOSSDK_macos; +string macSDK = IsRunningOnWindows() ? macSDK_windows : macSDK_macos; + + +Information ("androidSDK: {0}", androidSDK); +Information ("monoSDK: {0}", monoSDK); +Information ("macSDK: {0}", macSDK); +Information ("iosSDK: {0}", iosSDK); ////////////////////////////////////////////////////////////////////// // TASKS @@ -140,6 +164,8 @@ Task("provision-macsdk") else await Boots (Product.XamarinMac, releaseChannel); } + else if(!String.IsNullOrWhiteSpace(macSDK)) + await Boots(macSDK); }); Task("provision-iossdk") @@ -152,6 +178,8 @@ Task("provision-iossdk") else await Boots (Product.XamariniOS, releaseChannel); } + else if(!String.IsNullOrWhiteSpace(iosSDK)) + await Boots(iosSDK); }); Task("provision-androidsdk") @@ -163,10 +191,12 @@ Task("provision-androidsdk") if(androidSdkManagerInstalls.Length > 0) { var androidSdkSettings = new AndroidSdkManagerToolSettings { - SdkRoot = ANDROID_HOME, SkipVersionCheck = true }; + if(!String.IsNullOrWhiteSpace(ANDROID_HOME)) + androidSdkSettings.SdkRoot = ANDROID_HOME; + AcceptLicenses (androidSdkSettings); AndroidSdkManagerUpdateAll (androidSdkSettings); AcceptLicenses (androidSdkSettings); @@ -179,6 +209,8 @@ Task("provision-androidsdk") else await Boots (Product.XamarinAndroid, releaseChannel); } + else if(!String.IsNullOrWhiteSpace(androidSDK)) + await Boots(androidSDK); }); Task("provision-monosdk") @@ -192,6 +224,8 @@ Task("provision-monosdk") else await Boots (Product.Mono, releaseChannel); } + else if(!String.IsNullOrWhiteSpace(monoSDK)) + await Boots(monoSDK); }); Task("provision") diff --git a/build/provisioning/provisioning.csx b/build/provisioning/provisioning.csx index aeb906416..6044ca40c 100644 --- a/build/provisioning/provisioning.csx +++ b/build/provisioning/provisioning.csx @@ -7,73 +7,72 @@ string androidSDK_windows = "";//"https://download.visualstudio.microsoft.com/do string iOSSDK_windows = ""; string macSDK_windows = ""; -string androidSDK_macos = "https://download.visualstudio.microsoft.com/download/pr/8f94ca38-039a-4c9f-a51a-a6cb33c76a8c/aa46188c5f7a2e0c6f2d4bd4dc261604/xamarin.android-10.2.0.100.pkg"; -string monoSDK_macos = $"https://download.visualstudio.microsoft.com/download/pr/8f94ca38-039a-4c9f-a51a-a6cb33c76a8c/3a376d8c817ec4d720ecca2d95ceb4c1/monoframework-mdk-6.8.0.123.macos10.xamarin.universal.pkg"; -string iOSSDK_macos = $"https://download.visualstudio.microsoft.com/download/pr/6e56949e-1beb-4550-abf9-ff404868de82/cf7090bee19401076987a57cd12f11e5/xamarin.ios-13.16.0.11.pkg"; -string macSDK_macos = $"https://download.visualstudio.microsoft.com/download/pr/6e56949e-1beb-4550-abf9-ff404868de82/547895e66c0543faccb25933d8691371/xamarin.mac-6.16.0.11.pkg"; +string androidSDK_macos = "";//"https://download.visualstudio.microsoft.com/download/pr/8f94ca38-039a-4c9f-a51a-a6cb33c76a8c/aa46188c5f7a2e0c6f2d4bd4dc261604/xamarin.android-10.2.0.100.pkg"; +string monoSDK_macos = "";//$"https://download.visualstudio.microsoft.com/download/pr/8f94ca38-039a-4c9f-a51a-a6cb33c76a8c/3a376d8c817ec4d720ecca2d95ceb4c1/monoframework-mdk-6.8.0.123.macos10.xamarin.universal.pkg"; +string iOSSDK_macos = "";//$"https://download.visualstudio.microsoft.com/download/pr/6e56949e-1beb-4550-abf9-ff404868de82/cf7090bee19401076987a57cd12f11e5/xamarin.ios-13.16.0.11.pkg"; +string macSDK_macos = "";//$"https://download.visualstudio.microsoft.com/download/pr/6e56949e-1beb-4550-abf9-ff404868de82/547895e66c0543faccb25933d8691371/xamarin.mac-6.16.0.11.pkg"; + if (IsMac) { - // Item (XreItem.Xcode_11_4_0).XcodeSelect (); + if (!Directory.Exists ("/Library/Frameworks/Mono.framework/Versions/Current/Commands/")) + { + Item ("Mono", "6.8.0.123") + .Source (_ => "https://download.mono-project.com/archive/6.8.0/macos-10-universal/MonoFramework-MDK-6.8.0.123.macos10.xamarin.universal.pkg"); + } + + ForceJavaCleanup(); + Item (XreItem.Java_OpenJDK_1_8_0_25); + + string releaseChannel = Environment.GetEnvironmentVariable ("CHANNEL"); + + if(releaseChannel == "Preview") + { + XamarinChannel("Preview"); + } + else{ + XamarinChannel("Stable"); + } if(!String.IsNullOrEmpty(monoSDK_macos)) Item ("Mono", monoVersion) - .Source (_ => monoSDK_macos); + .Source (_ => monoSDK_macos); if(!String.IsNullOrEmpty(androidSDK_macos)) Item ("Xamarin.Android", "10.2.0.100") - .Source (_ => androidSDK_macos); + .Source (_ => androidSDK_macos); if(!String.IsNullOrEmpty(iOSSDK_macos)) Item ("Xamarin.iOS", "13.16.0.11") - .Source (_ => iOSSDK_macos); + .Source (_ => iOSSDK_macos); if(!String.IsNullOrEmpty(macSDK_macos)) Item ("Xamarin.Mac", "6.16.0.11") - .Source (_ => macSDK_macos); - - ForceJavaCleanup(); - - var dotnetVersion = System.Environment.GetEnvironmentVariable("DOTNET_VERSION"); - if (!string.IsNullOrEmpty(dotnetVersion)) - { - // VSTS installs into a non-default location. Let's hardcode it here because why not. - var vstsBaseInstallPath = Path.Combine (Environment.GetEnvironmentVariable ("HOME"), ".dotnet", "sdk"); - var vstsInstallPath = Path.Combine (vstsBaseInstallPath, dotnetVersion); - var defaultInstallLocation = Path.Combine ("/usr/local/share/dotnet/sdk/", dotnetVersion); - if (Directory.Exists (vstsBaseInstallPath) && !Directory.Exists (vstsInstallPath)) - ln (defaultInstallLocation, vstsInstallPath); - } + .Source (_ => macSDK_macos); } else { if(!String.IsNullOrEmpty(androidSDK_windows)) Item ("Xamarin.Android", "10.0.0.43") - .Source (_ => androidSDK_windows); + .Source (_ => androidSDK_windows); if(!String.IsNullOrEmpty(iOSSDK_windows)) Item ("Xamarin.iOS", "13.2.0.42") - .Source (_ => iOSSDK_windows); + .Source (_ => iOSSDK_windows); if(!String.IsNullOrEmpty(macSDK_windows)) Item ("Xamarin.Mac", "6.2.0.42") - .Source (_ => macSDK_windows); + .Source (_ => macSDK_windows); if(!String.IsNullOrEmpty(monoSDK_windows)) - Item ("Mono", monoVersion) - .Source (_ => monoSDK_windows); + Item ("Mono", monoVersion) + .Source (_ => monoSDK_windows); } -// Item(XreItem.Java_OpenJDK_1_8_0_25); -AndroidSdk ().ApiLevel((AndroidApiLevel)24); -AndroidSdk ().ApiLevel((AndroidApiLevel)28); -AndroidSdk ().ApiLevel((AndroidApiLevel)29); - -void ln (string source, string destination) -{ - Console.WriteLine ($"ln -sf {source} {destination}"); - if (!Config.DryRun) - Exec ("/bin/ln", "-sf", source, destination); -} +AndroidSdk() + .ApiLevel((AndroidApiLevel)24) + .ApiLevel((AndroidApiLevel)28) + .ApiLevel((AndroidApiLevel)29) + .SdkManagerPackage ("build-tools;29.0.3"); diff --git a/build/provisioning/xcode.csx b/build/provisioning/xcode.csx new file mode 100644 index 000000000..0769e2f83 --- /dev/null +++ b/build/provisioning/xcode.csx @@ -0,0 +1,19 @@ +using System; +using System.Linq; + +var desiredXcode = Environment.GetEnvironmentVariable ("REQUIRED_XCODE"); +if (string.IsNullOrEmpty (desiredXcode)) { + Console.WriteLine ("The environment variable 'REQUIRED_XCODE' must be exported and the value must be a valid value from the 'XreItem' enumeration."); + Environment.Exit (1); +} + +XreItem xreItem; + +if(desiredXcode == "Latest") + xreItem = (XreItem)Enum.GetValues(typeof(XreItem)).Cast().Max(); +else + xreItem = (XreItem) Enum.Parse (typeof (XreItem), desiredXcode); + +var item = Item (xreItem); +Console.WriteLine ("InstallPath: {0}", item.Version); +item.XcodeSelect (); \ No newline at end of file diff --git a/build/steps/build-android.yml b/build/steps/build-android.yml index 36abd98a6..fcccf96da 100644 --- a/build/steps/build-android.yml +++ b/build/steps/build-android.yml @@ -52,7 +52,7 @@ jobs: inputs: targetType: 'filePath' filePath: 'build.sh' - arguments: --target provision --TeamProject="$(System.TeamProject)" --releaseChannel=$(releaseChannel) + arguments: --target provision --TeamProject="$(System.TeamProject)" - task: UseDotNet@2 displayName: 'Install .net core $(DOTNET_VERSION)' diff --git a/build/steps/build-osx.yml b/build/steps/build-osx.yml index 1d07ca188..f9f8473d9 100644 --- a/build/steps/build-osx.yml +++ b/build/steps/build-osx.yml @@ -2,12 +2,24 @@ steps: - checkout: self clean: true + - task: xamops.azdevex.provisionator-task.provisionator@1 + displayName: 'Provision Xcode' + condition: and(ne(variables['REQUIRED_XCODE'], ''), eq(variables['buildForVS2017'], 'false')) + inputs: + provisioning_script: 'build/provisioning/xcode.csx' + - task: xamops.azdevex.provisionator-task.provisionator@1 displayName: 'Provisionator' condition: and(eq(variables['provisioning'], 'true'), eq(variables['buildForVS2017'], 'false')) inputs: provisioning_script: $(provisionator.osxPath) - provisioning_extra_args: $(provisionator.extraArguments) + provisioning_extra_args: $(provisionator.extraArguments) --v + + - script: | + echo "##vso[task.prependpath]/Library/Frameworks/Mono.framework/Versions/Current/Commands/" + echo "##vso[task.prependpath]~/Library/Developer/Xamarin/android-sdk-macosx" + displayName: 'Setup SDK Paths' + condition: and(ne(variables['osx2019VmPool'], 'Azure Pipelines'), eq(variables['buildForVS2017'], 'false')) - task: Bash@3 displayName: 'Cake Provision' @@ -15,7 +27,7 @@ steps: inputs: targetType: 'filePath' filePath: 'build.sh' - arguments: --target provision --TeamProject="$(System.TeamProject)" --buildForVS2017=$(buildForVS2017) --releaseChannel=$(releaseChannel) + arguments: --target provision --TeamProject="$(System.TeamProject)" --buildForVS2017=$(buildForVS2017) - task: UseDotNet@2 displayName: 'Install .net core $(DOTNET_VERSION)' @@ -29,7 +41,7 @@ steps: condition: ne(variables['NUGET_VERSION'], '') inputs: versionSpec: $(NUGET_VERSION) - + - task: DownloadBuildArtifacts@0 displayName: 'Download build artifact nuget' condition: eq(variables['System.TeamProject'], 'DevDiv') @@ -128,7 +140,7 @@ steps: Xamarin.Forms.Core.Android.UITests/bin/$(BuildConfiguration)/NUnit3.* Xamarin.Forms.Core.Android.UITests/bin/$(BuildConfiguration)/Plugin.* Xamarin.Forms.Core.Android.UITests/bin/$(BuildConfiguration)/Xamarin.* - + TargetFolder: '$(build.artifactstagingdirectory)/android' CleanTargetFolder: true flattenFolders: true