Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Setup Maui.sln with a set of net6 projects (#13433)
Browse files Browse the repository at this point in the history
* net6 projects

* - additional

* - net6 nullable fixes

* - provision sdks

* - net6.0

* - change to 5.0.0

* - update cake provisioning

* - net6 fixes

* - fix up platform heads

* - fix global.json

* - add net6 nuget feeds

* - fix up platform heads and net6 if defs

* - simplify

* - add dotnet core build of maui sln

* - update readme

* - net6 yaml target

* - remove net6 build from nuget

* - simplify provisioning

* - write json file

* - net6 via yaml

* - fix parameters

* - more boots

* - yaml

* - base yaml pipeline off net6-samples

* - yaml yaml yaml

* - mac yaml

* - add binlogs

* - set AndroidRestoreOnBuild to false

* - browser assembly

* - fix artifacts directories

* - fix NET6 artifacts

* - update to preview bits

* Update handlers.yml

* [Build]Deploy android sample app

* - restore from devops config

Co-authored-by: Rui Marinho <[email protected]>
  • Loading branch information
PureWeen and rmarinho authored Feb 10, 2021
1 parent e8fbdbf commit 9fe1b41
Show file tree
Hide file tree
Showing 47 changed files with 415 additions and 1,083 deletions.
30 changes: 25 additions & 5 deletions .nuspec/Xamarin.Forms.MultiTargeting.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS')) != true ">
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS')) != true AND $(TargetFramework.StartsWith('net6.0-ios')) != true ">
<Compile Remove="**\*.iOS.cs" />
<None Include="**\*.iOS.cs" />
<Compile Remove="**\iOS\*.cs" />
Expand All @@ -11,13 +11,13 @@
<Compile Remove="**\Mac\*.cs" />
<None Include="**\Mac\*.cs" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac')) != true And $(TargetFramework.StartsWith('Xamarin.iOS')) != true ">
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac')) != true AND $(TargetFramework.StartsWith('Xamarin.iOS')) != true AND $(TargetFramework.StartsWith('net6.0-ios')) != true ">
<Compile Remove="**\*.MaciOS.cs" />
<None Include="**\*.MaciOS.cs" />
<Compile Remove="**\MaciOS\*.cs" />
<None Include="**\MaciOS\*.cs" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid')) != true ">
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid')) != true AND $(TargetFramework.StartsWith('net6.0-android')) != true ">
<Compile Remove="**\*.Android.cs" />
<None Include="**\*.Android.cs" />
<Compile Remove="**\Android\*.cs" />
Expand All @@ -40,16 +40,36 @@
<None Include="**\Win32\*.cs" />
</ItemGroup>


<!-- Android -->
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6.0-android'))">
<DefineConstants>$(DefineConstants);MONOANDROID</DefineConstants>
</PropertyGroup>

<!-- iOS -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0-ios' ">
<DefineConstants>$(DefineConstants);IOS</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="$(TargetFramework.StartsWith('netcoreapp')) == true ">
<UseWpf>true</UseWpf>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<!-- If this becomes part of the product we will remove these but for now it's useful having them all in one place -->
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid')) == true ">
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid')) == true OR '$(TargetPlatformIdentifier)' == 'android' OR '$(TargetFramework)' == 'net6.0-android'">
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.2.0.4" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.2.1.1" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.6" />
</ItemGroup>
</Project>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net5.0-windows')) == true">
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<DefineConstants>$(DefineConstants);DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;UWP_16299;UWP_18362;UWP_17134</DefineConstants>
<NoWarn>$(NoWarn);NU5104</NoWarn>
</PropertyGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net5.0-windows')) == true">
<PackageReference Include="Microsoft.WinUI" Version="3.0.0-preview3.201113.0" />
</ItemGroup>
</Project>
56 changes: 56 additions & 0 deletions Maui.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30926.220
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Platform.Handlers-net6", "src\Platform.Handlers\src\Xamarin.Platform.Handlers\Xamarin.Platform.Handlers-net6.csproj", "{95BA42B5-B00E-4986-B9B5-517140378452}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample-net6", "src\Platform.Handlers\samples\Sample\Sample-net6.csproj", "{31D405F0-723E-4A6C-A52B-F4CB19A8D845}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Files", "Files", "{449F6071-A74F-4309-8D7B-7038CFD1B17B}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
.nuspec\Xamarin.Forms.MultiTargeting.targets = .nuspec\Xamarin.Forms.MultiTargeting.targets
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Forms.Core-net6", "src\Forms\src\Xamarin.Forms.Core\Xamarin.Forms.Core-net6.csproj", "{AF64451F-E2BD-41C2-B083-F60C26AE2A9F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.Droid-net6", "src\Platform.Handlers\samples\Sample.Droid\Sample.Droid-net6.csproj", "{3AE5B968-1916-4213-97E4-F88F51BCAB23}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.iOS-net6", "src\Platform.Handlers\samples\Sample.iOS\Sample.iOS-net6.csproj", "{B8D80A2B-F636-4E27-BCAA-EA601007B7F4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{95BA42B5-B00E-4986-B9B5-517140378452}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{95BA42B5-B00E-4986-B9B5-517140378452}.Debug|Any CPU.Build.0 = Debug|Any CPU
{95BA42B5-B00E-4986-B9B5-517140378452}.Release|Any CPU.ActiveCfg = Release|Any CPU
{95BA42B5-B00E-4986-B9B5-517140378452}.Release|Any CPU.Build.0 = Release|Any CPU
{31D405F0-723E-4A6C-A52B-F4CB19A8D845}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{31D405F0-723E-4A6C-A52B-F4CB19A8D845}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31D405F0-723E-4A6C-A52B-F4CB19A8D845}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31D405F0-723E-4A6C-A52B-F4CB19A8D845}.Release|Any CPU.Build.0 = Release|Any CPU
{AF64451F-E2BD-41C2-B083-F60C26AE2A9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF64451F-E2BD-41C2-B083-F60C26AE2A9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF64451F-E2BD-41C2-B083-F60C26AE2A9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF64451F-E2BD-41C2-B083-F60C26AE2A9F}.Release|Any CPU.Build.0 = Release|Any CPU
{3AE5B968-1916-4213-97E4-F88F51BCAB23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3AE5B968-1916-4213-97E4-F88F51BCAB23}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3AE5B968-1916-4213-97E4-F88F51BCAB23}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{3AE5B968-1916-4213-97E4-F88F51BCAB23}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3AE5B968-1916-4213-97E4-F88F51BCAB23}.Release|Any CPU.Build.0 = Release|Any CPU
{B8D80A2B-F636-4E27-BCAA-EA601007B7F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B8D80A2B-F636-4E27-BCAA-EA601007B7F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B8D80A2B-F636-4E27-BCAA-EA601007B7F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B8D80A2B-F636-4E27-BCAA-EA601007B7F4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0B8ABEAD-D2B5-4370-A187-62B5ABE4EE50}
EndGlobalSection
EndGlobal
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@
* Evolution of [Xamarin.Forms](https://github.com/xamarin/xamarin.forms)
* Targeting .NET 6, previews end of year

## Maui.sln

### SDKS required
- Install the SDKs listed here https://github.com/xamarin/net6-samples

- And/or run the following

```
dotnet tool install Cake.Tool -g
dotnet cake --target=provision
```

### Running

#### IDE
- If you have Visual Studio 16.9 P4 installed you can open `Maui.sln` and run it from there.

#### Command Line

```
dotnet build src\Platform.Handlers\samples\Sample.Droid\Sample.Droid-net6.csproj -t:Run
dotnet build src\Platform.Handlers\samples\Sample.iOS\Sample.iOS-net6.csproj -t:Run
```

## Current News

[![](Assets/poster-standup.png)](https://www.youtube.com/watch?v=5bK2ICHtMxo)
Expand Down
104 changes: 63 additions & 41 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PowerShell:
#addin "nuget:?package=Cake.Android.Adb&version=3.2.0"
#addin "nuget:?package=Cake.Git&version=0.21.0"
#addin "nuget:?package=Cake.Android.SdkManager&version=3.0.2"
#addin "nuget:?package=Cake.Boots&version=1.0.2.437"
#addin "nuget:?package=Cake.Boots&version=1.0.3.556"
#addin "nuget:?package=Cake.AppleSimulator&version=0.2.0"
#addin "nuget:?package=Cake.FileHelpers&version=3.2.1"

Expand Down Expand Up @@ -388,7 +388,7 @@ Task("provision-netsdk-local")
Information("Downloading: {0} to {1}", cabUrl, cabPath);
DownloadFile(cabUrl, cabPath);
InstallMsi(msiUrl, null, msiName);
InstallMsiOrExe(msiUrl, null, msiName);
}
int i = 0;
Expand Down Expand Up @@ -541,7 +541,7 @@ Task("provision-uitests-uwp")
if(!DirectoryExists(driverPath))
{
try{
InstallMsi(UWP_APP_DRIVER_INSTALL_PATH, installPath);
InstallMsiOrExe(UWP_APP_DRIVER_INSTALL_PATH, installPath);
}
catch(Exception e)
{
Expand All @@ -550,31 +550,77 @@ Task("provision-uitests-uwp")
}
});

void InstallMsi(string msiFile, string installTo, string fileName = "InstallFile.msi")

async Task InstallMsiWithBoots(string msiFile, string installTo = null, string fileName = "InstallFile.msi")
{
bool success = false;

try
{
await Boots(msiFile);
success = true;
}
catch (System.Exception e)
{
Information("Boots failed: {0}", e);
}


if(success)
return;

try
{
InstallMsiOrExe(msiFile, installTo, fileName, !isCIBuild);
success = true;
}
catch (System.Exception e)
{
Information("Our attempt failed: {0}", e);
}
}

void InstallMsiOrExe(string msiFile, string installTo = null, string fileName = "InstallFile.msi", bool interactive = false)
{
if(msiFile.EndsWith(".exe") && fileName == "InstallFile.msi")
fileName = "InstallFile.exe";

string installerPath = $"{System.IO.Path.GetTempPath()}{fileName}";

try
{
Information ("Installing: {0}", msiFile);
DownloadFile(msiFile, installerPath);
Information("File Downloaded To: {0}", installerPath);
int result = -1;

var argumentBuilder =
new ProcessArgumentBuilder()
.Append("/a")
.Append(installerPath)
.Append("/qn");

if(!String.IsNullOrWhiteSpace(installTo))
if(msiFile.EndsWith(".exe"))
{
Information("Installing into: {0}", installTo);
argumentBuilder = argumentBuilder.Append("TARGETDIR=\"" + installTo + "\"");
result = StartProcess(installerPath, new ProcessSettings {
Arguments = new ProcessArgumentBuilder()
.Append(@" /q")
}
);
}
else{
var argumentBuilder =
new ProcessArgumentBuilder()
.Append("/a")
.Append(installerPath);

if(!interactive)
argumentBuilder = argumentBuilder.Append("/qn");

var result = StartProcess("msiexec", new ProcessSettings {
Arguments = argumentBuilder
});
if(!String.IsNullOrWhiteSpace(installTo))
{
Information("Installing into: {0}", installTo);
argumentBuilder = argumentBuilder.Append("TARGETDIR=\"" + installTo + "\"");
}

result = StartProcess("msiexec", new ProcessSettings {
Arguments = argumentBuilder
});
}

if(result != 0)
throw new Exception("Failed to install: " + msiFile);
Expand Down Expand Up @@ -828,30 +874,6 @@ Task("BuildForNuget")
}
});

Task("BuildPages")
.IsDependentOn("BuildTasks")
.Description("Build Xamarin.Forms.Pages")
.Does(() =>
{
try
{
var msbuildSettings = GetMSBuildSettings();
var binaryLogger = new MSBuildBinaryLogSettings {
Enabled = isCIBuild
};
msbuildSettings.BinaryLogger = binaryLogger;
binaryLogger.FileName = $"{artifactStagingDirectory}/win-pages-{configuration}.binlog";
MSBuild("./build/Xamarin.Forms.Pages.sln", msbuildSettings.WithRestore());
}
catch(Exception)
{
if(IsRunningOnWindows())
throw;
}
});

Task("BuildTasks")
.Description($"Build {BUILD_TASKS_PROJ}")
.Does(() =>
Expand Down Expand Up @@ -891,7 +913,7 @@ Task("VSMAC")
{
StartVisualStudio();
});

Task("cg-android")
.Description("Builds Android Control Gallery")
.IsDependentOn("WriteGoogleMapsAPIKey")
Expand Down
1 change: 1 addition & 0 deletions eng/DevopsNuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" protocolVersion="3" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" protocolVersion="3" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<add key="xamarin" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
Expand Down
2 changes: 1 addition & 1 deletion eng/Environment.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<!-- Auto install any missing Android SDKs -->
<PropertyGroup Condition="'$(CI)' == 'true'">
<AndroidRestoreOnBuild Condition="'$(AndroidRestoreOnBuild)' == ''">True</AndroidRestoreOnBuild>
<AndroidRestoreOnBuild Condition="'$(AndroidRestoreOnBuild)' == ''">False</AndroidRestoreOnBuild>
<AcceptAndroidSDKLicenses Condition="'$(AcceptAndroidSDKLicenses)' == ''">True</AcceptAndroidSDKLicenses>
</PropertyGroup>
</Project>
Loading

0 comments on commit 9fe1b41

Please sign in to comment.