Setup public and provisionator based provisioning of SDKS (#7458)

* general provisioning

* - remove android

* - add android in

* - split up provisioning

* Update build.cake

* - increment versions

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* - fix android

* - version

* - fix varialbes

* - NUGET_VERSION

* - set on parameters

* - fix parameters

* - nuget build step

* - fix powershell

* - merge UI Test fixes in

* - squash

* - cleanup provisionator

* - fix missing names

* - simplify

* - simplify

* - provisionator

* - provisionator

* JavaSDK build path hack

* - turn off default provisioning

* - windows image

* - remove sdk installs from cake

* - sdk manager installs

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* - conditional core

* - conditional core

* - change to conditions

* - make the same

* - add better naming

* - sdks

* - user better links
This commit is contained in:
Shane Neuville 2019-09-27 19:01:00 -06:00 коммит произвёл Rui Marinho
Родитель c09ceeaada
Коммит a9f3953b06
12 изменённых файлов: 287 добавлений и 40 удалений

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

@ -0,0 +1 @@
MONO_GC_PARAMS=bridge-implementation=new

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

@ -379,6 +379,9 @@
<Generator>MSBuild:UpdateGeneratedFiles</Generator>
</TransformFile>
</ItemGroup>
<ItemGroup>
<AndroidEnvironment Include="Environment.txt" />
</ItemGroup>
<ItemGroup>
<ProguardConfiguration Include="..\.nuspec\proguard.cfg">
<Link>proguard.cfg</Link>
@ -392,4 +395,4 @@
</CreateItem>
<Copy SourceFiles="@(MapsKey)" DestinationFiles="Properties\MapsKey.cs" Condition="!Exists('Properties\MapsKey.cs')" />
</Target>
</Project>
</Project>

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

@ -29,7 +29,7 @@ namespace Xamarin.Forms.ControlGallery.Android
var nativeButton = (global::Android.Widget.Button)Control;
nativeButton.SetShadowLayer(0, 0, 0, global::Android.Graphics.Color.Transparent);
nativeButton.Elevation = 0;
Platform.Android.ViewExtensions.SetElevation(nativeButton, 0);
}
}
}

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

@ -35,10 +35,14 @@ namespace Xamarin.Forms.Controls.Issues
// At this point, the counter can be any value, but it's most likely not zero.
// Invoking GC once is enough to clean up all garbage data and set counter to zero
RunningApp.WaitForElement(q => q.Marked("GC"));
RunningApp.Tap(q => q.Marked("GC"));
RunningApp.WaitForElement("GC");
RunningApp.QueryUntilPresent(() =>
{
RunningApp.Tap("GC");
return RunningApp.Query("Counter: 0");
});
RunningApp.WaitForElement(q => q.Marked("Counter: 0"));
}
#endif
}

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

@ -1,6 +1,7 @@
using NUnit.Framework;
using Xamarin.Forms.Controls.Issues;
using Xamarin.Forms.CustomAttributes;
using Xamarin.UITest;
using Xamarin.UITest.Queries;
namespace Xamarin.Forms.Core.UITests
@ -36,7 +37,11 @@ namespace Xamarin.Forms.Core.UITests
bool IsFocused()
{
var focusedText = App.Query(q => q.Marked("FocusStateLabel").All())[0].ReadText();
var focusedText = App.QueryUntilPresent(() =>
{
return App.Query(q => q.Marked("FocusStateLabel").All());
})[0].ReadText();
return System.Convert.ToBoolean(focusedText);
}

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

@ -11,13 +11,13 @@ variables:
value: Xamarin.Forms.sln
- name: BuildVersion
value: $[counter('$(Build.SourceBranchName)_counter', 1)]
- name: MONO_VERSION
value: 5_18_1
- name: XCODE_VERSION
value: 10.2
- name: NUGET_VERSION
value: 5.0.2
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: true
- name: winVmImage
value: Hosted VS2017
resources:
repositories:
- repository: xamarin-templates
@ -56,7 +56,8 @@ jobs:
msbuildExtraArguments: '/nowarn:VSX1000 /p:CreateAllAndroidTargets=true /bl:$(Build.ArtifactStagingDirectory)\win.binlog'
buildConfiguration: $(DefaultBuildConfiguration)
buildPlatform: $(DefaultBuildPlatform)
provisionatorPath : 'build/provisioning/provisioning.csx'
- template: build/steps/build-android.yml
parameters:
name: android_legacy
@ -65,6 +66,7 @@ jobs:
targetFolder: Xamarin.Forms.ControlGallery.Android/legacyRenderers/
androidProjectArguments: '/t:"Rebuild;SignAndroidPackage" /bl:$(Build.ArtifactStagingDirectory)/android-legacy.binlog'
buildConfiguration: $(DefaultBuildConfiguration)
provisionatorPath : 'build/provisioning/provisioning.csx'
- template: build/steps/build-android.yml
parameters:
@ -74,6 +76,7 @@ jobs:
targetFolder: Xamarin.Forms.ControlGallery.Android/preAppCompat
androidProjectArguments: '/t:"Rebuild;SignAndroidPackage" /p:DefineConstants="TRACE DEBUG FORMS_APPLICATION_ACTIVITY APP" /bl:$(Build.ArtifactStagingDirectory)/android-preappcompact.binlog'
buildConfiguration: $(DefaultBuildConfiguration)
provisionatorPath : 'build/provisioning/provisioning.csx'
- template: build/steps/build-android.yml
parameters:
@ -83,6 +86,7 @@ jobs:
targetFolder: Xamarin.Forms.ControlGallery.Android/newRenderers/
androidProjectArguments: '/t:"Rebuild;SignAndroidPackage" /p:DefineConstants="TRACE DEBUG TEST_EXPERIMENTAL_RENDERERS APP" /bl:$(Build.ArtifactStagingDirectory)/android-newrenderers.binlog'
buildConfiguration: $(DefaultBuildConfiguration)
provisionatorPath : 'build/provisioning/provisioning.csx'
- job: osx
displayName: OSX Phase
@ -94,12 +98,10 @@ jobs:
- msbuild
- Xamarin.iOS
variables:
provisioningOSX : $(provisioning)
provisionator.osxPath : 'build/provisioning/provisioning.csx'
provisionator.signPath : 'build/provisioning/provisioning_sign.csx'
buildConfiguration: $(DefaultBuildConfiguration)
slnPath: $(SolutionFile)
nugetVersion: $(NUGET_VERSION)
iOSCertSecureFileName: 'Xamarin Forms iOS Certificate.p12'
iOSProvisioningSecureFileName: 'Xamarin Forms iOS Provisioning.mobileprovision'
steps:
@ -115,7 +117,6 @@ jobs:
variables:
FormsIdAppend: ''
buildConfiguration: $(DefaultBuildConfiguration)
nugetVersion: $(NUGET_VERSION)
nugetPackageVersion : $[ dependencies.win.outputs['debug.winbuild.xamarinformspackageversion'] ]
steps:
- template: build/steps/build-nuget.yml

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

@ -21,6 +21,9 @@ PowerShell:
#addin "nuget:?package=Cake.Xamarin&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.Android.SdkManager&version=3.0.2"
#addin "nuget:?package=Cake.Boots&version=1.0.0.291"
//////////////////////////////////////////////////////////////////////
// TOOLS
//////////////////////////////////////////////////////////////////////
@ -40,6 +43,30 @@ var informationalVersion = gitVersion.InformationalVersion;
var buildVersion = gitVersion.FullBuildMetaData;
var nugetversion = Argument<string>("packageVersion", gitVersion.NuGetVersion);
var ANDROID_HOME = EnvironmentVariable ("ANDROID_HOME") ??
(IsRunningOnWindows () ? "C:\\Program Files (x86)\\Android\\android-sdk\\" : "");
string monoMajorVersion = "5.14.0";
string monoPatchVersion = "177";
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 = "";
string androidSDK_macos = "https://aka.ms/xamarin-android-commercial-d15-9-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/xcode10.2/9c8d8e0a50e68d9abc8cd48fcd47a669e981fcc9/53/package/xamarin.ios-12.4.0.64.pkg";
string macSDK_macos = $"https://bosstoragemirror.blob.core.windows.net/wrench/jenkins/xcode10.2/9c8d8e0a50e68d9abc8cd48fcd47a669e981fcc9/53/package/xamarin.mac-5.4.0.64.pkg";
string androidSDK = IsRunningOnWindows() ? androidSDK_windows : androidSDK_macos;
string monoSDK = IsRunningOnWindows() ? monoSDK_windows : monoSDK_macos;
string iosSDK = IsRunningOnWindows() ? "" : iOSSDK_macos;
string macSDK = IsRunningOnWindows() ? "" : macSDK_macos;
string[] androidSdkManagerInstalls = new string[0]; //new [] { "platforms;android-29"};
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
@ -49,9 +76,79 @@ Task("Clean")
{
CleanDirectories("./**/obj", (fsi)=> !fsi.Path.FullPath.Contains("XFCorePostProcessor") && !fsi.Path.FullPath.StartsWith("tools"));
CleanDirectories("./**/bin", (fsi)=> !fsi.Path.FullPath.Contains("XFCorePostProcessor") && !fsi.Path.FullPath.StartsWith("tools"));
});
Task("provision-macsdk")
.Does(async () =>
{
if(!IsRunningOnWindows() && !String.IsNullOrWhiteSpace(macSDK))
{
await Boots(macSDK);
}
});
Task("provision-iossdk")
.Does(async () =>
{
if(!IsRunningOnWindows())
{
if(!String.IsNullOrWhiteSpace(iosSDK))
await Boots(iosSDK);
}
});
Task("provision-androidsdk")
.Does(async () =>
{
Information ("ANDROID_HOME: {0}", ANDROID_HOME);
if(androidSdkManagerInstalls.Length > 0)
{
var androidSdkSettings = new AndroidSdkManagerToolSettings {
SdkRoot = ANDROID_HOME,
SkipVersionCheck = true
};
try { AcceptLicenses (androidSdkSettings); } catch { }
AndroidSdkManagerInstall (androidSdkManagerInstalls, androidSdkSettings);
}
if(!String.IsNullOrWhiteSpace(androidSDK))
await Boots (androidSDK);
});
Task("provision-monosdk")
.Does(async () =>
{
if(IsRunningOnWindows())
{
if(!String.IsNullOrWhiteSpace(monoSDK))
{
string monoPath = $"{System.IO.Path.GetTempPath()}/mono.msi";
DownloadFile(monoSDK, monoPath);
StartProcess("msiexec", new ProcessSettings {
Arguments = new ProcessArgumentBuilder()
.Append(@"/i")
.Append(monoPath)
.Append("/qn")
}
);
}
}
else
{
if(!String.IsNullOrWhiteSpace(monoSDK))
await Boots(monoSDK);
}
});
Task("provision")
.IsDependentOn("provision-macsdk")
.IsDependentOn("provision-iossdk")
.IsDependentOn("provision-monosdk")
.IsDependentOn("provision-androidsdk");
Task("NuGetPack")
.IsDependentOn("Build")
.IsDependentOn("_NuGetPack");

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

@ -1,8 +1,77 @@
var channel = Env("CHANNEL") ?? "Stable";
string monoMajorVersion = "6.4.0";
string monoPatchVersion = "198";
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://download.visualstudio.microsoft.com/download/pr/1131a8f5-99f5-4326-93b1-f5827b54ecd5/e7bd0f680004131157a22982c389b05f2d3698cc04fab3901ce2d7ded47ad8e0/Xamarin.Android.Sdk-10.0.0.43.vsix";
string iOSSDK_windows = "";
string macSDK_windows = "";
string androidSDK_macos = "https://download.visualstudio.microsoft.com/download/pr/d5a432e4-09f3-4da6-9bdd-1d4fdd87f34c/c4ce0854064ffc16b957f22ccc08f9df/xamarin.android-10.0.0.43.pkg";
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/d16-3/5e8a208b5f44c4885060d95e3c3ad68d6a5e95e8/40/package/xamarin.ios-13.2.0.42.pkg";
string macSDK_macos = $"https://bosstoragemirror.blob.core.windows.net/wrench/jenkins/d16-3/5e8a208b5f44c4885060d95e3c3ad68d6a5e95e8/40/package/xamarin.mac-6.2.0.42.pkg";
if (IsMac)
{
Item (XreItem.Xcode_10_1_0).XcodeSelect ();
Item (XreItem.Xcode_11_1_0_rc).XcodeSelect ();
if(!String.IsNullOrEmpty(monoSDK_macos))
Item ("Mono", monoVersion)
.Source (_ => monoSDK_macos);
if(!String.IsNullOrEmpty(androidSDK_macos))
Item ("Xamarin.Android", "10.0.0.43")
.Source (_ => androidSDK_macos);
if(!String.IsNullOrEmpty(iOSSDK_macos))
Item ("Xamarin.iOS", "13.2.0.42")
.Source (_ => iOSSDK_macos);
if(!String.IsNullOrEmpty(macSDK_macos))
Item ("Xamarin.Mac", "6.2.0.42")
.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);
}
}
Console.WriteLine(channel);
XamarinChannel(channel);
else
{
if(!String.IsNullOrEmpty(androidSDK_windows))
Item ("Xamarin.Android", "10.0.0.43")
.Source (_ => androidSDK_windows);
if(!String.IsNullOrEmpty(iOSSDK_windows))
Item ("Xamarin.iOS", "13.2.0.42")
.Source (_ => iOSSDK_windows);
if(!String.IsNullOrEmpty(macSDK_windows))
Item ("Xamarin.Mac", "6.2.0.42")
.Source (_ => macSDK_windows);
if(!String.IsNullOrEmpty(monoSDK_windows))
Item ("Mono", monoVersion)
.Source (_ => monoSDK_windows);
}
Item(XreItem.Java_OpenJDK_1_8_0_25);
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);
}

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

@ -13,8 +13,9 @@ parameters:
androidProjectPath : 'Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj'
androidProjectArguments : ''
buildConfiguration : 'Debug'
nugetVersion: $(NUGET_VERSION)
apkTargetFolder: '$(build.artifactstagingdirectory)/androidApp'
provisionatorPath: 'build/provisioning/provisioning.csx'
provisionatorExtraArguments: ''
jobs:
- job: ${{ parameters.name }}
@ -25,16 +26,45 @@ jobs:
dependsOn: ${{ parameters.dependsOn }}
steps:
- checkout: self
- task: xamops.azdevex.provisionator-task.provisionator@1
displayName: 'Provisionator'
condition: eq(variables['provisioning'], 'true')
inputs:
provisioning_script: ${{ parameters.provisionatorPath }}
provisioning_extra_args: ${{ parameters.provisionator.extraArguments }}
- task: Bash@3
displayName: 'Cake Provision'
condition: eq(variables['provisioning'], 'false')
inputs:
targetType: 'filePath'
filePath: 'build.sh'
arguments: --target provision
- task: DotNetCoreInstaller@0
displayName: 'Install .net core $(DOTNET_VERSION)'
condition: ne(variables['DOTNET_VERSION'], '')
inputs:
version: $(DOTNET_VERSION)
- script: |
export PATH="$PATH:/Users/vsts/.dotnet/tools"
export DOTNET_ROOT="$(dirname "$(readlink "$(command -v dotnet)")")"
dotnet new globaljson --sdk-version $(DOTNET_VERSION)
displayName: 'Add globaljson file'
condition: ne(variables['DOTNET_VERSION'], '')
- task: NuGetToolInstaller@0
displayName: 'Use NuGet ${{ parameters.nugetVersion }}'
displayName: 'Use NuGet'
condition: ne(variables['NUGET_VERSION'], '')
inputs:
versionSpec: ${{ parameters.nugetVersion }}
versionSpec: $(NUGET_VERSION)
- task: NuGetCommand@2
displayName: 'NuGet restore ${{ parameters.slnPath }}'
inputs:
restoreSolution: ${{ parameters.slnPath }}
restoreSolution: ${{ parameters.slnPath }}
- task: MSBuild@1
displayName: 'Build ${{ parameters.buildTaskPath }}'
@ -69,4 +99,4 @@ jobs:
displayName: 'Publish Artifact: AndroidApps'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: OSXArtifacts
ArtifactName: OSXArtifacts

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

@ -22,9 +22,9 @@ steps:
failOnStandardError: false
- task: NuGetToolInstaller@0
displayName: 'Use NuGet'
displayName: 'Use NuGet: $(NUGET_VERSION)'
inputs:
versionSpec: $(nugetVersion)
versionSpec: $(NUGET_VERSION)
- task: NuGetCommand@2
displayName: 'Make NuGet Package'

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

@ -2,22 +2,38 @@ steps:
- checkout: self
- task: xamops.azdevex.provisionator-task.provisionator@1
displayName: Provisionate Xamarin
condition: eq(variables['provisioningOSX'], 'true')
displayName: 'Provisionator'
condition: eq(variables['provisioning'], 'true')
inputs:
provisioning_script: $(provisionator.osxPath)
provisioning_extra_args: $(provisionator.extraArguments)
- task: Bash@3
displayName: 'Cake Provision'
condition: eq(variables['provisioning'], 'false')
inputs:
targetType: 'filePath'
filePath: 'build.sh'
arguments: --target provision
- task: DotNetCoreInstaller@0
displayName: 'Install .net core $(DOTNET_VERSION)'
condition: ne(variables['DOTNET_VERSION'], '')
inputs:
version: $(DOTNET_VERSION)
- bash: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(MONO_VERSION)
displayName: Switch to the latest Xamarin SDK
- bash: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(XCODE_VERSION).app;sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
displayName: Switch to the latest Xcode
- script: |
export PATH="$PATH:/Users/vsts/.dotnet/tools"
export DOTNET_ROOT="$(dirname "$(readlink "$(command -v dotnet)")")"
dotnet new globaljson --sdk-version $(DOTNET_VERSION)
displayName: 'Add globaljson file'
condition: ne(variables['DOTNET_VERSION'], '')
- task: NuGetToolInstaller@0
displayName: 'Use NuGet'
condition: ne(variables['NUGET_VERSION'], '')
inputs:
versionSpec: $(nugetVersion)
versionSpec: $(NUGET_VERSION)
- task: NuGetCommand@2
displayName: 'NuGet restore'

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

@ -12,7 +12,6 @@ parameters:
releaseBuildConfiguration : 'Release'
buildPlatform : 'any cpu'
msbuildExtraArguments : ''
nugetVersion: $(NUGET_VERSION)
artifactsTargetFolder: '$(build.artifactstagingdirectory)'
artifactsName: 'win_build'
nunitTestAdapterFolder: 'packages/NUnitTestAdapter.AnyVersion/tools/'
@ -34,12 +33,34 @@ jobs:
BuildConfiguration: ${{ parameters.releaseBuildConfiguration }}
BuildPlatform: ${{ parameters.buildPlatform }}
steps:
- script: build.cmd -Target provision
displayName: 'Cake Provision'
condition: eq(variables['provisioning'], 'false')
- task: xamops.azdevex.provisionator-task.provisionator@1
displayName: 'Provisionator'
condition: eq(variables['provisioning'], 'true')
inputs:
provisioning_script: ${{ parameters.provisionatorPath }}
provisioning_extra_args: ${{ parameters.provisionator.extraArguments }}
- task: DotNetCoreInstaller@0
displayName: "Install .net core $(DOTNET_VERSION)"
condition: ne(variables['DOTNET_VERSION'], '')
inputs:
version: $(DOTNET_VERSION)
- script: |
dotnet new globaljson --sdk-version $(DOTNET_VERSION)
displayName: 'Add globaljson file'
condition: ne(variables['DOTNET_VERSION'], '')
- task: NuGetToolInstaller@0
displayName: 'Use NuGet ${{ parameters.nugetVersion }}'
displayName: 'Use NuGet $(NUGET_VERSION)'
condition: ne(variables['NUGET_VERSION'], '')
inputs:
versionSpec: ${{ parameters.nugetVersion }}
versionSpec: $(NUGET_VERSION)
- task: NuGetCommand@2
displayName: 'NuGet restore ${{ parameters.slnPath }}'
inputs: