Ios 2017 compatible Xamarin.Forms.Platform.iOS (#9760)

* if def out xcode10

* - setup ios targets

* - fix ios 13 inclusion

* - fix cake

* - fix ArtifactStagingDirectory

* - remove restore

* - name the task

* - fix cast

* - fix cast

* - fix cast

* - fix cast

* Update Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj

* - add 2017 lane for osx validation

* - fix cake

* - 2017 netstandard

* - remove build tasks for 2017 compatibility build

* - more conditions

* - apply swapping to mac target

* - macos nuspec

* - provisioning

* - add macos 2017 build

* - add cert back in

* - type redirector

* - fix platform dll nuspec location
This commit is contained in:
Shane Neuville 2020-03-02 07:50:09 -07:00 коммит произвёл GitHub
Родитель f92dc78131
Коммит 1cb0656489
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
15 изменённых файлов: 226 добавлений и 105 удалений

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

@ -58,7 +58,6 @@
<reference file="Xamarin.Forms.Core.dll" /> <reference file="Xamarin.Forms.Core.dll" />
<reference file="Xamarin.Forms.Platform.dll" /> <reference file="Xamarin.Forms.Platform.dll" />
<reference file="Xamarin.Forms.Xaml.dll" /> <reference file="Xamarin.Forms.Xaml.dll" />
<reference file="Xamarin.Forms.Platform.iOS.dll" />
</group> </group>
<group targetFramework="MonoAndroid10.0"> <group targetFramework="MonoAndroid10.0">
<reference file="Xamarin.Forms.Core.dll" /> <reference file="Xamarin.Forms.Core.dll" />
@ -88,7 +87,6 @@
</group> </group>
<group targetFramework="Xamarin.Mac"> <group targetFramework="Xamarin.Mac">
<reference file="Xamarin.Forms.Core.dll" /> <reference file="Xamarin.Forms.Core.dll" />
<reference file="Xamarin.Forms.Platform.macOS.dll" />
<reference file="Xamarin.Forms.Platform.dll" /> <reference file="Xamarin.Forms.Platform.dll" />
<reference file="Xamarin.Forms.Xaml.dll" /> <reference file="Xamarin.Forms.Xaml.dll" />
</group> </group>
@ -207,9 +205,13 @@
<file src="..\Stubs\Xamarin.Forms.Platform.Android\bin\$Configuration$\MonoAndroid10.0\Xamarin.Forms.Platform.dll" target="lib\MonoAndroid10.0" /> <file src="..\Stubs\Xamarin.Forms.Platform.Android\bin\$Configuration$\MonoAndroid10.0\Xamarin.Forms.Platform.dll" target="lib\MonoAndroid10.0" />
<!--iPhone Unified--> <!--iPhone Unified-->
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\Xamarin.Forms.Platform.iOS.dll" target="lib\Xamarin.iOS10" /> <file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\Xamarin.Forms.Platform.iOS.dll" target="build\XCODE11" />
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\Xamarin.Forms.Platform.iOS.*pdb" target="lib\Xamarin.iOS10" /> <file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\Xamarin.Forms.Platform.iOS.*pdb" target="build\XCODE11" />
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\Xamarin.Forms.Platform.iOS.*mdb" target="lib\Xamarin.iOS10" /> <file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\Xamarin.Forms.Platform.iOS.*mdb" target="build\XCODE11" />
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\2017\Xamarin.Forms.Platform.iOS.dll" target="build\XCODE10" />
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\2017\Xamarin.Forms.Platform.iOS.*pdb" target="build\XCODE10" />
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\2017\Xamarin.Forms.Platform.iOS.*mdb" target="build\XCODE10" />
<file src="..\Xamarin.Forms.Core\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Core.dll" target="lib\Xamarin.iOS10" /> <file src="..\Xamarin.Forms.Core\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Core.dll" target="lib\Xamarin.iOS10" />
<file src="..\Xamarin.Forms.Core\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Core.*pdb" target="lib\Xamarin.iOS10" /> <file src="..\Xamarin.Forms.Core\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Core.*pdb" target="lib\Xamarin.iOS10" />
<file src="..\Xamarin.Forms.Core\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Core.*mdb" target="lib\Xamarin.iOS10" /> <file src="..\Xamarin.Forms.Core\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Core.*mdb" target="lib\Xamarin.iOS10" />
@ -296,8 +298,9 @@
<!--Mac--> <!--Mac-->
<file src="..\Xamarin.Forms.Core\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Core.dll" target="lib\Xamarin.Mac" /> <file src="..\Xamarin.Forms.Core\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Core.dll" target="lib\Xamarin.Mac" />
<file src="..\Xamarin.Forms.Xaml\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Xaml.dll" target="lib\Xamarin.Mac" /> <file src="..\Xamarin.Forms.Xaml\bin\$Configuration$\netstandard2.0\Xamarin.Forms.Xaml.dll" target="lib\Xamarin.Mac" />
<file src="..\Xamarin.Forms.Platform.MacOS\bin\$Configuration$\Xamarin.Forms.Platform.macOS.dll" target="lib\Xamarin.Mac" />
<file src="..\Xamarin.Forms.Platform.MacOS\bin\$Configuration$\Xamarin.Forms.Platform.dll" target="lib\Xamarin.Mac" /> <file src="..\Xamarin.Forms.Platform.MacOS\bin\$Configuration$\Xamarin.Forms.Platform.dll" target="lib\Xamarin.Mac" />
<file src="..\Xamarin.Forms.Platform.MacOS\bin\$Configuration$\Xamarin.Forms.Platform.macOS.dll" target="build\XCODE11" />
<file src="..\Xamarin.Forms.Platform.MacOS\bin\$Configuration$\2017\Xamarin.Forms.Platform.macOS.dll" target="build\XCODE10" />
<!-- iOS Localized String Resource Assemblies --> <!-- iOS Localized String Resource Assemblies -->
<file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\ar\Xamarin.Forms.Platform.iOS.resources.dll" target="lib\Xamarin.iOS10\ar" /> <file src="..\Xamarin.Forms.Platform.iOS\bin\$Configuration$\ar\Xamarin.Forms.Platform.iOS.resources.dll" target="lib\Xamarin.iOS10\ar" />

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

@ -183,7 +183,41 @@
<Error Code="XF005" Condition="$(TargetFrameworkVersionWithoutV) &lt; $(MinTargetFrameworkVersionForForms)" <Error Code="XF005" Condition="$(TargetFrameworkVersionWithoutV) &lt; $(MinTargetFrameworkVersionForForms)"
Text="The %24(TargetFrameworkVersion) for $(ProjectName) ($(TargetFrameworkVersion)) is less than the minimum required %24(TargetFrameworkVersion) for Xamarin.Forms ($(MinTargetFrameworkVersionForForms)). You need to increase the %24(TargetFrameworkVersion) for $(ProjectName)." /> Text="The %24(TargetFrameworkVersion) for $(ProjectName) ($(TargetFrameworkVersion)) is less than the minimum required %24(TargetFrameworkVersion) for Xamarin.Forms ($(MinTargetFrameworkVersionForForms)). You need to increase the %24(TargetFrameworkVersion) for $(ProjectName)." />
</Target> </Target>
<!-- Xamarin iOS targets -->
<PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == 'Xamarin.iOS' OR '$(TargetFrameworkIdentifier)' == 'Xamarin.Mac'">
<CoreCompileDependsOn>
IncludeCorrectXIOSReference;
$(CoreCompileDependsOn);
</CoreCompileDependsOn>
<PrepareForBuildDependsOn>
IncludeCorrectXIOSReference;
$(PrepareForBuildDependsOn);
</PrepareForBuildDependsOn>
</PropertyGroup>
<Target Name="IncludeCorrectXIOSReference" Condition="'$(TargetFrameworkIdentifier)' == 'Xamarin.iOS' OR '$(TargetFrameworkIdentifier)' == 'Xamarin.Mac'">
<PropertyGroup>
<Use2017 Condition="'$(Use2017)' == '' AND '$(MSBuildRuntimeType)' == 'Mono'">$(FrameworkSDKRoot.Contains('/Versions/5'))</Use2017>
<Use2017 Condition="'$(Use2017)' == '' AND '$(MSBuildAssemblyVersion)' &lt; '16.0'">true</Use2017>
<Use2017 Condition="'$(Use2017)' == ''">false</Use2017>
<FrameworkDll Condition="'$(TargetFrameworkIdentifier)' == 'Xamarin.iOS'">Xamarin.Forms.Platform.iOS.dll</FrameworkDll>
<FrameworkDll Condition="'$(TargetFrameworkIdentifier)' == 'Xamarin.Mac'">Xamarin.Forms.Platform.macOS.dll</FrameworkDll>
</PropertyGroup>
<ItemGroup Condition="'$(Use2017)' != 'true'">
<Reference Include="Xamarin.Forms.Platform.iOS">
<HintPath>$(MSBuildThisFileDirectory)\XCODE11\$(FrameworkDll)</HintPath>
</Reference>
</ItemGroup>
<ItemGroup Condition="'$(Use2017)' == 'true'">
<Reference Include="Xamarin.Forms.Platform.iOS">
<HintPath>$(MSBuildThisFileDirectory)\XCODE10\$(FrameworkDll)</HintPath>
</Reference>
</ItemGroup>
</Target>
<!-- UWP Targets--> <!-- UWP Targets-->
<Target Name="WinUICheckTargetPlatformVersion" BeforeTargets="PrepareForBuild" <Target Name="WinUICheckTargetPlatformVersion" BeforeTargets="PrepareForBuild"
Condition="'$(TargetPlatformVersion)' != '' and '$(TargetPlatformMinVersion)' != ''"> Condition="'$(TargetPlatformVersion)' != '' and '$(TargetPlatformMinVersion)' != ''">

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

@ -57,6 +57,9 @@
<Reference Include="Xamarin.iOS" /> <Reference Include="Xamarin.iOS" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup Condition="'$(Use2017)' == 'true'">
<Reference Include="netstandard" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Condition="'$(CI)' == 'true'" Include="Xamarin.Build.TypeRedirector" Version="0.1.2-preview" PrivateAssets="all" /> <PackageReference Condition="'$(CI)' == 'true'" Include="Xamarin.Build.TypeRedirector" Version="0.1.2-preview" PrivateAssets="all" />
</ItemGroup> </ItemGroup>

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

@ -65,6 +65,9 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup Condition="'$(Use2017)' == 'true'">
<Reference Include="netstandard" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Condition="'$(CI)' == 'true'" Include="Xamarin.Build.TypeRedirector" Version="0.1.2-preview" PrivateAssets="all" /> <PackageReference Condition="'$(CI)' == 'true'" Include="Xamarin.Build.TypeRedirector" Version="0.1.2-preview" PrivateAssets="all" />
</ItemGroup> </ItemGroup>

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

@ -94,6 +94,9 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup Condition="'$(Use2017)' == 'true'">
<Reference Include="netstandard" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Condition="'$(CI)' == 'true'" Include="Xamarin.Build.TypeRedirector" Version="0.1.2-preview" PrivateAssets="all" /> <PackageReference Condition="'$(CI)' == 'true'" Include="Xamarin.Build.TypeRedirector" Version="0.1.2-preview" PrivateAssets="all" />
</ItemGroup> </ItemGroup>

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

@ -473,10 +473,13 @@ namespace Xamarin.Forms.Platform.MacOS
(Source as ListViewDataSource)?.OnRowClicked(); (Source as ListViewDataSource)?.OnRowClicked();
} }
#if __XCODE11__
public override bool ValidateProposedFirstResponder(NSResponder responder, NSEvent forEvent) public override bool ValidateProposedFirstResponder(NSResponder responder, NSEvent forEvent)
{ {
return true; return true;
} }
#endif
} }
} }
} }

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

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Condition="'$(EnvironmentBuildPropsImported)' != 'True'" Project="..\Environment.Build.props" />
<PropertyGroup> <PropertyGroup>
<Description>macOS Backend for Xamarin.Forms</Description> <Description>macOS Backend for Xamarin.Forms</Description>
<AssemblyName>Xamarin.Forms.Platform.macOS</AssemblyName> <AssemblyName>Xamarin.Forms.Platform.macOS</AssemblyName>
@ -60,6 +61,13 @@
<XamMacArch> <XamMacArch>
</XamMacArch> </XamMacArch>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Use2017)' == 'true' ">
<DefineConstants>__XCODE10__;$(DefineConstants);</DefineConstants>
<OutputPath>$(OutputPath)\2017</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Use2017)' != 'true' ">
<DefineConstants>__XCODE11__;$(DefineConstants);</DefineConstants>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -270,4 +278,7 @@
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
<Target Name="_VerifyBuildSignature" /> <Target Name="_VerifyBuildSignature" />
<ItemGroup>
<PackageReference Condition="'$(CI)' == 'true'" Include="Xamarin.Build.TypeRedirector" Version="0.1.2-preview" PrivateAssets="all" />
</ItemGroup>
</Project> </Project>

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

@ -18,9 +18,11 @@ namespace Xamarin.Forms.Platform.iOS
{ {
if (Control == null) if (Control == null)
{ {
#if __XCODE11__
if(Forms.IsiOS13OrNewer) if(Forms.IsiOS13OrNewer)
SetNativeControl(new UIActivityIndicatorView(RectangleF.Empty) { ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Medium }); SetNativeControl(new UIActivityIndicatorView(RectangleF.Empty) { ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Medium });
else else
#endif
SetNativeControl(new UIActivityIndicatorView(RectangleF.Empty) { ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray }); SetNativeControl(new UIActivityIndicatorView(RectangleF.Empty) { ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray });
} }

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

@ -619,14 +619,8 @@ namespace Xamarin.Forms.Platform.iOS
{ {
var barBackgroundColor = NavPage.BarBackgroundColor; var barBackgroundColor = NavPage.BarBackgroundColor;
if (!Forms.IsiOS13OrNewer) #if __XCODE11__
{ if (Forms.IsiOS13OrNewer)
// Set navigation bar background color
NavigationBar.BarTintColor = barBackgroundColor == Color.Default
? UINavigationBar.Appearance.BarTintColor
: barBackgroundColor.ToUIColor();
}
else
{ {
var navigationBarAppearance = new UINavigationBarAppearance(); var navigationBarAppearance = new UINavigationBarAppearance();
@ -642,6 +636,14 @@ namespace Xamarin.Forms.Platform.iOS
NavigationBar.StandardAppearance = navigationBarAppearance; NavigationBar.StandardAppearance = navigationBarAppearance;
NavigationBar.ScrollEdgeAppearance = navigationBarAppearance; NavigationBar.ScrollEdgeAppearance = navigationBarAppearance;
} }
else
#endif
{
// Set navigation bar background color
NavigationBar.BarTintColor = barBackgroundColor == Color.Default
? UINavigationBar.Appearance.BarTintColor
: barBackgroundColor.ToUIColor();
}
} }
void UpdateBarTextColor() void UpdateBarTextColor()
@ -669,6 +671,7 @@ namespace Xamarin.Forms.Platform.iOS
}; };
} }
#if __XCODE11__
if (Forms.IsiOS13OrNewer) if (Forms.IsiOS13OrNewer)
{ {
NavigationBar.CompactAppearance.TitleTextAttributes = titleTextAttributes; NavigationBar.CompactAppearance.TitleTextAttributes = titleTextAttributes;
@ -681,6 +684,7 @@ namespace Xamarin.Forms.Platform.iOS
NavigationBar.ScrollEdgeAppearance.LargeTitleTextAttributes = largeTitleTextAttributes; NavigationBar.ScrollEdgeAppearance.LargeTitleTextAttributes = largeTitleTextAttributes;
} }
else else
#endif
{ {
NavigationBar.TitleTextAttributes = titleTextAttributes; NavigationBar.TitleTextAttributes = titleTextAttributes;
@ -701,14 +705,16 @@ namespace Xamarin.Forms.Platform.iOS
if (statusBarColorMode == StatusBarTextColorMode.DoNotAdjust || barTextColor.Luminosity <= 0.5) if (statusBarColorMode == StatusBarTextColorMode.DoNotAdjust || barTextColor.Luminosity <= 0.5)
{ {
#if __XCODE11__
// Use dark text color for status bar // Use dark text color for status bar
if (Forms.IsiOS13OrNewer) if (Forms.IsiOS13OrNewer)
{ {
UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.DarkContent; UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.DarkContent;
} }
else else
#endif
{ {
UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.Default; UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.Default;
} }
} }
else else

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

@ -137,9 +137,11 @@ namespace Xamarin.Forms.Platform.iOS
{ {
UIColor backgroundColor; UIColor backgroundColor;
#if __XCODE11__
if (Forms.IsiOS13OrNewer) if (Forms.IsiOS13OrNewer)
backgroundColor = UIColor.SystemBackgroundColor; backgroundColor = UIColor.SystemBackgroundColor;
else else
#endif
backgroundColor = UIColor.White; backgroundColor = UIColor.White;
if (Element.BackgroundColor != Color.Default) if (Element.BackgroundColor != Color.Default)

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

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Condition="'$(EnvironmentBuildPropsImported)' != 'True'" Project="..\Environment.Build.props" />
<PropertyGroup> <PropertyGroup>
<Description>iOS Backend for Xamarin.Forms</Description> <Description>iOS Backend for Xamarin.Forms</Description>
<AssemblyName>Xamarin.Forms.Platform.iOS</AssemblyName> <AssemblyName>Xamarin.Forms.Platform.iOS</AssemblyName>
@ -17,7 +18,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath> <OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants> <DefineConstants>$(DefineConstants);DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause> <ConsolePause>false</ConsolePause>
@ -33,6 +34,13 @@
<NoWarn> <NoWarn>
</NoWarn> </NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Use2017)' == 'true' ">
<DefineConstants>$(DefineConstants);__XCODE10__</DefineConstants>
<OutputPath>$(OutputPath)\2017</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Use2017)' != 'true' ">
<DefineConstants>$(DefineConstants);__XCODE11__</DefineConstants>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Runtime.Serialization" /> <Reference Include="System.Runtime.Serialization" />
@ -299,7 +307,10 @@
<Name>Xamarin.Forms.Core</Name> <Name>Xamarin.Forms.Core</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(Use2017)' == 'true'">
<Reference Include="netstandard" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Condition="'$(CI)' == 'true'" Include="Xamarin.Build.TypeRedirector" Version="0.1.2-preview" PrivateAssets="all" /> <PackageReference Condition="'$(CI)' == 'true'" Include="Xamarin.Build.TypeRedirector" Version="0.1.2-preview" PrivateAssets="all" />
</ItemGroup> </ItemGroup>
</Project> </Project>

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

@ -65,9 +65,6 @@ jobs:
name: win name: win
displayName: Build Windows Phase displayName: Build Windows Phase
vmImage: $(win2019VmImage) vmImage: $(win2019VmImage)
msbuildExtraArguments: '/nowarn:VSX1000'
buildConfiguration: $(DefaultBuildConfiguration)
buildPlatform: $(DefaultBuildPlatform)
provisionatorPath : 'build/provisioning/provisioning.csx' provisionatorPath : 'build/provisioning/provisioning.csx'
- template: build/steps/build-android.yml - template: build/steps/build-android.yml
@ -111,6 +108,12 @@ jobs:
- sh - sh
- msbuild - msbuild
- Xamarin.iOS - Xamarin.iOS
strategy:
matrix:
BuildForVS2017:
buildForVS2017: 'true'
BuildForVS2019:
buildForVS2017: 'false'
variables: variables:
provisionator.osxPath : 'build/provisioning/provisioning.csx' provisionator.osxPath : 'build/provisioning/provisioning.csx'
provisionator.signPath : 'build/provisioning/provisioning_sign.csx' provisionator.signPath : 'build/provisioning/provisioning_sign.csx'
@ -118,6 +121,7 @@ jobs:
slnPath: $(SolutionFile) slnPath: $(SolutionFile)
iOSCertSecureFileName: 'Xamarin Forms iOS Certificate.p12' iOSCertSecureFileName: 'Xamarin Forms iOS Certificate.p12'
iOSProvisioningSecureFileName: 'Xamarin Forms iOS Provisioning.mobileprovision' iOSProvisioningSecureFileName: 'Xamarin Forms iOS Provisioning.mobileprovision'
buildForVS2017: $(buildForVS2017)
steps: steps:
- template: build/steps/build-osx.yml - template: build/steps/build-osx.yml

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

@ -22,7 +22,7 @@ PowerShell:
#addin "nuget:?package=Cake.Android.Adb&version=3.0.0" #addin "nuget:?package=Cake.Android.Adb&version=3.0.0"
#addin "nuget:?package=Cake.Git&version=0.19.0" #addin "nuget:?package=Cake.Git&version=0.19.0"
#addin "nuget:?package=Cake.Android.SdkManager&version=3.0.2" #addin "nuget:?package=Cake.Android.SdkManager&version=3.0.2"
#addin "nuget:?package=Cake.Boots&version=1.0.0.291" #addin "nuget:?package=Cake.Boots&version=1.0.2.421"
#addin "nuget:?package=Cake.FileHelpers&version=3.2.0" #addin "nuget:?package=Cake.FileHelpers&version=3.2.0"
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
@ -37,38 +37,64 @@ PowerShell:
var target = Argument("target", "Default"); var target = Argument("target", "Default");
var configuration = Argument("configuration", "Debug"); var configuration = Argument("configuration", "Debug");
var packageVersion = Argument("packageVersion", ""); var packageVersion = Argument("packageVersion", "");
var releaseChannelArg = Argument("releaseChannel", "Stable");
releaseChannelArg = EnvironmentVariable("releaseChannel") ?? 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\\" : ""); (IsRunningOnWindows () ? "C:\\Program Files (x86)\\Android\\android-sdk\\" : "");
string monoMajorVersion = "5.18.1"; string[] androidSdkManagerInstalls = new string[0];//new [] { "platforms;android-24", "platforms;android-28"};
string monoPatchVersion = "28";
string monoVersion = $"{monoMajorVersion}.{monoPatchVersion}";
string monoSDK_windows = "";//$"https://download.mono-project.com/archive/{monoMajorVersion}/windows-installer/mono-{monoVersion}-x64-0.msi";
string androidSDK_windows = "";//"https://aka.ms/xamarin-android-commercial-d15-9-windows";
string iOSSDK_windows = "";//"https://download.visualstudio.microsoft.com/download/pr/71f33151-5db4-49cc-ac70-ba835a9f81e2/d256c6c50cd80ec0207783c5c7a4bc2f/xamarin.visualstudio.apple.sdk.4.12.3.83.vsix";
string macSDK_windows = "";
monoMajorVersion = "6.6.0"; Information ("Team Project: {0}", teamProject);
monoPatchVersion = ""; Information ("buildForVS2017: {0}", buildForVS2017);
var releaseChannel = ReleaseChannel.Stable;
if(releaseChannelArg == "Preview")
{
releaseChannel = ReleaseChannel.Preview;
}
Information ("Release Channel: {0}", releaseChannel);
string androidSDK_macos = "";
string monoSDK_macos = "";
string iOSSDK_macos = "";
string macSDK_macos = "";
string monoPatchVersion = "";
string monoMajorVersion = "";
string monoVersion = "";
if(buildForVS2017)
{
// VS2017
monoMajorVersion = "5.18.1";
monoPatchVersion = "";
androidSDK_macos = "https://aka.ms/xamarin-android-commercial-d15-9-macos";
iOSSDK_macos = $"https://bosstoragemirror.blob.core.windows.net/wrench/jenkins/xcode10.2/9c8d8e0a50e68d9abc8cd48fcd47a669e981fcc9/53/package/xamarin.ios-12.4.0.64.pkg";
macSDK_macos = $"https://bosstoragemirror.blob.core.windows.net/wrench/jenkins/xcode10.2/9c8d8e0a50e68d9abc8cd48fcd47a669e981fcc9/53/package/xamarin.mac-5.4.0.64.pkg";
}
if(String.IsNullOrWhiteSpace(monoPatchVersion)) if(String.IsNullOrWhiteSpace(monoPatchVersion))
monoVersion = $"{monoMajorVersion}"; monoVersion = $"{monoMajorVersion}";
else else
monoVersion = $"{monoMajorVersion}.{monoPatchVersion}"; monoVersion = $"{monoMajorVersion}.{monoPatchVersion}";
if(!String.IsNullOrWhiteSpace(monoVersion))
{
monoSDK_macos = $"https://download.mono-project.com/archive/{monoMajorVersion}/macos-10-universal/MonoFramework-MDK-{monoVersion}.macos10.xamarin.universal.pkg";
}
string androidSDK_macos = "https://aka.ms/xamarin-android-commercial-d16-4-macos";
string monoSDK_macos = $"https://download.mono-project.com/archive/{monoMajorVersion}/macos-10-universal/MonoFramework-MDK-{monoVersion}.macos10.xamarin.universal.pkg";
string iOSSDK_macos = $"https://bosstoragemirror.blob.core.windows.net/wrench/jenkins/xcode11.3/5f802ef535488d12886f264b598b9c59ca2f2404/36/package/notarized/xamarin.ios-13.10.0.17.pkg";
string macSDK_macos = $"https://bosstoragemirror.blob.core.windows.net/wrench/jenkins/xcode11.3/5f802ef535488d12886f264b598b9c59ca2f2404/36/package/notarized/xamarin.mac-6.10.0.17.pkg";
string androidSDK = IsRunningOnWindows() ? androidSDK_windows : androidSDK_macos; string androidSDK = IsRunningOnWindows() ? "" : androidSDK_macos;
string monoSDK = IsRunningOnWindows() ? monoSDK_windows : monoSDK_macos; string monoSDK = IsRunningOnWindows() ? "" : monoSDK_macos;
string iosSDK = IsRunningOnWindows() ? iOSSDK_windows : iOSSDK_macos; string iosSDK = IsRunningOnWindows() ? "" : iOSSDK_macos;
string macSDK = IsRunningOnWindows() ? "" : macSDK_macos; string macSDK = IsRunningOnWindows() ? "" : macSDK_macos;
string[] androidSdkManagerInstalls = new string[0];//new [] { "platforms;android-24", "platforms;android-28"};
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// TASKS // TASKS
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
@ -85,9 +111,12 @@ Task("provision-macsdk")
.Description("Install Xamarin.Mac SDK") .Description("Install Xamarin.Mac SDK")
.Does(async () => .Does(async () =>
{ {
if(!IsRunningOnWindows() && !String.IsNullOrWhiteSpace(macSDK)) if(!IsRunningOnWindows())
{ {
await Boots(macSDK); if(!String.IsNullOrWhiteSpace(macSDK))
await Boots(macSDK);
else
await Boots (Product.XamarinMac, releaseChannel);
} }
}); });
@ -95,8 +124,12 @@ Task("provision-iossdk")
.Description("Install Xamarin.iOS SDK") .Description("Install Xamarin.iOS SDK")
.Does(async () => .Does(async () =>
{ {
if(!String.IsNullOrWhiteSpace(iosSDK)) if (!IsRunningOnWindows ()) {
await Boots(iosSDK); if(!String.IsNullOrWhiteSpace(iosSDK))
await Boots(iosSDK);
else
await Boots (Product.XamariniOS, releaseChannel);
}
}); });
Task("provision-androidsdk") Task("provision-androidsdk")
@ -112,49 +145,30 @@ Task("provision-androidsdk")
SkipVersionCheck = true SkipVersionCheck = true
}; };
AcceptLicenses (androidSdkSettings); AcceptLicenses (androidSdkSettings);
AndroidSdkManagerUpdateAll (androidSdkSettings); AndroidSdkManagerUpdateAll (androidSdkSettings);
AcceptLicenses (androidSdkSettings); AcceptLicenses (androidSdkSettings);
AndroidSdkManagerInstall (androidSdkManagerInstalls, androidSdkSettings); AndroidSdkManagerInstall (androidSdkManagerInstalls, androidSdkSettings);
} }
if(!String.IsNullOrWhiteSpace(androidSDK))
await Boots (androidSDK); if (!IsRunningOnWindows ()) {
if(!String.IsNullOrWhiteSpace(androidSDK))
await Boots (androidSDK);
else
await Boots (Product.XamarinAndroid, releaseChannel);
}
}); });
Task("provision-monosdk") Task("provision-monosdk")
.Description("Install Mono SDK") .Description("Install Mono SDK")
.Does(async () => .Does(async () =>
{ {
if(IsRunningOnWindows()) if(!IsRunningOnWindows())
{
if(!String.IsNullOrWhiteSpace(monoSDK))
{
string monoPath = $"{System.IO.Path.GetTempPath()}mono.msi";
if(!String.IsNullOrWhiteSpace(EnvironmentVariable("Build.Repository.LocalPath")))
monoPath = EnvironmentVariable("Build.Repository.LocalPath") + "\\" + "mono.msi";
Information("Mono Path: {0}", monoPath);
Information("Mono Version: {0}", monoSDK);
DownloadFile(monoSDK, monoPath);
StartProcess("msiexec", new ProcessSettings {
Arguments = new ProcessArgumentBuilder()
.Append(@"/i")
.Append(monoPath)
.Append("/qn")
}
);
}
}
else
{ {
if(!String.IsNullOrWhiteSpace(monoSDK)) if(!String.IsNullOrWhiteSpace(monoSDK))
await Boots(monoSDK); await Boots(monoSDK);
else
await Boots (Product.Mono, releaseChannel);
} }
}); });
@ -167,7 +181,8 @@ Task("provision")
Task("NuGetPack") Task("NuGetPack")
.Description("Build and Create Nugets") .Description("Build and Create Nugets")
.IsDependentOn("Build") .IsDependentOn("Restore")
.IsDependentOn("BuildForNuget")
.IsDependentOn("_NuGetPack"); .IsDependentOn("_NuGetPack");
@ -220,18 +235,55 @@ Task("Restore")
} }
}); });
Task("Build") Task("BuildForNuget")
.Description("Builds all necessary projects to create Nuget Packages") .Description("Builds all necessary projects to create Nuget Packages")
.Does(() =>
{
try{
var msbuildSettings = GetMSBuildSettings();
var binaryLogger = new MSBuildBinaryLogSettings {
Enabled = true
};
msbuildSettings.BinaryLogger = binaryLogger;
msbuildSettings.ArgumentCustomization = args => args.Append("/nowarn:VSX1000");
binaryLogger.FileName = $"{artifactStagingDirectory}/win-{configuration}.binlog";
MSBuild("./Xamarin.Forms.sln", msbuildSettings);
binaryLogger.FileName = $"{artifactStagingDirectory}/win-{configuration}-csproj.binlog";
MSBuild("./Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj",
msbuildSettings
.WithTarget("rebuild")
.WithProperty("DisableEmbeddedXbf", "false"));
binaryLogger.FileName = $"{artifactStagingDirectory}/ios-{configuration}-csproj.binlog";
MSBuild("./Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj",
msbuildSettings
.WithTarget("rebuild")
.WithProperty("USE2017", "true"));
binaryLogger.FileName = $"{artifactStagingDirectory}/macos-{configuration}-csproj.binlog";
MSBuild("./Xamarin.Forms.Platform.MacOS/Xamarin.Forms.Platform.MacOS.csproj",
msbuildSettings
.WithTarget("rebuild")
.WithProperty("USE2017", "true"));
}
catch(Exception)
{
if(IsRunningOnWindows())
throw;
}
});
Task("Build")
.Description("Builds all necessary projects to run Control Gallery")
.IsDependentOn("Restore") .IsDependentOn("Restore")
.Does(() => .Does(() =>
{ {
try{ try{
MSBuild("./Xamarin.Forms.sln", GetMSBuildSettings().WithRestore()); MSBuild("./Xamarin.Forms.sln", GetMSBuildSettings().WithRestore());
MSBuild("./Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj",
GetMSBuildSettings()
.WithRestore()
.WithProperty("DisableEmbeddedXbf", "false"));
} }
catch(Exception) catch(Exception)
{ {

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

@ -15,7 +15,7 @@ steps:
inputs: inputs:
targetType: 'filePath' targetType: 'filePath'
filePath: 'build.sh' filePath: 'build.sh'
arguments: --target provision arguments: --target provision --buildForVS2017=$(buildForVS2017)
- task: UseDotNet@2 - task: UseDotNet@2
displayName: 'Install .net core $(DOTNET_VERSION)' displayName: 'Install .net core $(DOTNET_VERSION)'
@ -56,11 +56,12 @@ steps:
inputs: inputs:
solutionFile: $(slnPath) solutionFile: $(slnPath)
configuration: $(buildConfiguration) configuration: $(buildConfiguration)
args: /bl:$(Build.ArtifactStagingDirectory)/ios.binlog args: /bl:$(Build.ArtifactStagingDirectory)/ios-2017_$(buildForVS2017).binlog
- task: CopyFiles@2 - task: CopyFiles@2
displayName: 'Copy test-cloud.exe' displayName: 'Copy test-cloud.exe'
condition: eq(variables['buildForVS2017'], 'false')
inputs: inputs:
Contents: '**/Xamarin.UITest.*/tools/test-cloud.exe' Contents: '**/Xamarin.UITest.*/tools/test-cloud.exe'
TargetFolder: '$(build.artifactstagingdirectory)/testcloud' TargetFolder: '$(build.artifactstagingdirectory)/testcloud'
@ -71,6 +72,7 @@ steps:
- task: CopyFiles@2 - task: CopyFiles@2
displayName: 'Copy iOS Files for UITest' displayName: 'Copy iOS Files for UITest'
condition: eq(variables['buildForVS2017'], 'false')
inputs: inputs:
Contents: | Contents: |
**/$(IpaName) **/$(IpaName)
@ -87,6 +89,7 @@ steps:
- task: CopyFiles@2 - task: CopyFiles@2
displayName: 'Copy Android Files for UITest' displayName: 'Copy Android Files for UITest'
condition: eq(variables['buildForVS2017'], 'false')
inputs: inputs:
Contents: | Contents: |
Xamarin.Forms.Core.Android.UITests/bin/$(BuildConfiguration)/Newtonsoft.Json.* Xamarin.Forms.Core.Android.UITests/bin/$(BuildConfiguration)/Newtonsoft.Json.*

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

@ -9,9 +9,6 @@ parameters:
postBuildSteps: [] # any additional steps to run after the build postBuildSteps: [] # any additional steps to run after the build
slnPath : 'Xamarin.Forms.sln' slnPath : 'Xamarin.Forms.sln'
csprojPath : 'Xamarin.Forms.Platform.UAP\Xamarin.Forms.Platform.UAP.csproj' csprojPath : 'Xamarin.Forms.Platform.UAP\Xamarin.Forms.Platform.UAP.csproj'
buildConfiguration : 'Debug'
releaseBuildConfiguration : 'Release'
buildPlatform : 'any cpu'
msbuildExtraArguments : '' msbuildExtraArguments : ''
artifactsTargetFolder: '$(build.artifactstagingdirectory)' artifactsTargetFolder: '$(build.artifactstagingdirectory)'
artifactsName: 'win_build' artifactsName: 'win_build'
@ -33,15 +30,13 @@ jobs:
strategy: strategy:
matrix: matrix:
debug: debug:
BuildConfiguration: ${{ parameters.buildConfiguration }} BuildConfiguration: 'Debug'
BuildPlatform: ${{ parameters.buildPlatform }}
release: release:
BuildConfiguration: ${{ parameters.releaseBuildConfiguration }} BuildConfiguration: 'Release'
BuildPlatform: ${{ parameters.buildPlatform }}
steps: steps:
- checkout: self - checkout: self
clean: true clean: true
- script: build.cmd -Target provision --verbosity=diagnostic - script: build.cmd -Target provision
displayName: 'Cake Provision' displayName: 'Cake Provision'
condition: eq(variables['provisioningCake'], 'true') condition: eq(variables['provisioningCake'], 'true')
@ -70,23 +65,9 @@ jobs:
inputs: inputs:
restoreSolution: ${{ parameters.slnPath }} restoreSolution: ${{ parameters.slnPath }}
- task: MSBuild@1 - script: build.cmd -Target BuildForNuget -ScriptArgs '-configuration="$(BuildConfiguration)"','-Build_ArtifactStagingDirectory="$(Build.ArtifactStagingDirectory)"'
displayName: 'Build solution ${{ parameters.slnPath }}'
name: winbuild name: winbuild
inputs: displayName: 'Build Projects For Nuget'
solution: ${{ parameters.slnPath }}
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArguments: ${{ parameters.msbuildExtraArguments }} /bl:$(Build.ArtifactStagingDirectory)\win-$(BuildConfiguration).binlog
- task: MSBuild@1
displayName: 'Embed XBF into PRI'
condition: eq(${{ parameters.includeUwp }}, 'true')
name: winbuild_pri_embed
inputs:
solution: ${{ parameters.csprojPath }}
configuration: '$(BuildConfiguration)'
msbuildArguments: ${{ parameters.msbuildExtraArguments }} /t:rebuild /p:DisableEmbeddedXbf=false /bl:$(Build.ArtifactStagingDirectory)\win-$(BuildConfiguration)-csproj.binlog
- task: VSTest@2 - task: VSTest@2
displayName: 'Unit Tests' displayName: 'Unit Tests'