Merge pull request #274 from dotnet/dev

.Net 7 update!
This commit is contained in:
James Clancey 2022-11-09 14:42:47 -09:00 коммит произвёл GitHub
Родитель 4716ad7555 18f045d16b
Коммит b8465e8a9e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
14 изменённых файлов: 140 добавлений и 48 удалений

2
.github/workflows/dev.yml поставляемый
Просмотреть файл

@ -33,7 +33,7 @@ jobs:
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile dotnet-install.ps1
& .\dotnet-install.ps1 -InstallDir "$env:ProgramFiles\dotnet\" -Verbose
& .\dotnet-install.ps1 -InstallDir "$env:ProgramFiles\dotnet\" -Verbose -Channel STS
& dotnet --list-sdks
# - name: Install Visual Studio Preview

2
.github/workflows/main-template.yml поставляемый
Просмотреть файл

@ -29,7 +29,7 @@ jobs:
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile dotnet-install.ps1
& .\dotnet-install.ps1 -InstallDir "$env:ProgramFiles\dotnet\" -Verbose
& .\dotnet-install.ps1 -InstallDir "$env:ProgramFiles\dotnet\" -Verbose -Channel STS
& dotnet --list-sdks
# - name: Install Visual Studio Preview

2
.github/workflows/main.yml поставляемый
Просмотреть файл

@ -33,7 +33,7 @@ jobs:
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile dotnet-install.ps1
& .\dotnet-install.ps1 -InstallDir "$env:ProgramFiles\dotnet\" -Verbose
& .\dotnet-install.ps1 -InstallDir "$env:ProgramFiles\dotnet\" -Verbose -Channel STS
& dotnet --list-sdks
# - name: Install Visual Studio Preview

3
.gitmodules поставляемый
Просмотреть файл

@ -1,3 +1,4 @@
[submodule "External/Maui"]
path = External/Maui
url = https://github.com/Clancey/Maui.git
url = https://github.com/dotnet/maui
branch = net6.0

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

@ -15,23 +15,13 @@
<license type="expression">MIT</license>
<language>C#</language>
<dependencies>
<group targetFramework=".NETStandard2.1">
<dependency id="Microsoft.Maui.Graphics" version="6.0.100-rc.2.470" exclude="Build,Analyzers" />
<dependency id="Microsoft.Extensions.Configuration" version="6.0.0" />
<dependency id="Microsoft.Extensions.Hosting" version="6.0.0" />
<dependency id="Microsoft.Extensions.Hosting.Abstractions" version="6.0.0" />
<dependency id="Microsoft.Extensions.Logging" version="6.0.0" />
<dependency id="Microsoft.Extensions.Logging.Abstractions" version="6.0.0" />
<dependency id="Microsoft.Extensions.DependencyInjection" version="6.0.0" />
<dependency id="Microsoft.Extensions.Configuration" version="6.0.0" />
<group targetFramework="net7.0-android30.0">
</group>
<group targetFramework="net6.0-android30.0">
<group targetFramework="net7.0-ios13.6">
</group>
<group targetFramework="net6.0-ios13.6">
</group>
<group targetFramework="net6.0-maccatalyst13.5">
<group targetFramework="net7.0-maccatalyst13.5">
</group>
<group targetFramework="net6.0-windows10.0.19041">
<group targetFramework="net7.0-windows10.0.19041">
</group>
</dependencies>
</metadata>
@ -44,17 +34,17 @@
<file src="src/Comet/bin/Debug/netstandard2.0/Microsoft.Maui.pdb" target="lib/netstandard2.0/Microsoft.Maui.pdb"/>
<file src="src/Comet/bin/Debug/netstandard2.0/Microsoft.Maui.Essentials.dll" target="lib/netstandard2.0/Microsoft.Maui.Essentials.dll"/>
<file src="src/Comet/bin/Debug/netstandard2.0/Microsoft.Maui.Essentials.pdb" target="lib/netstandard2.0/Microsoft.Maui.Essentials.pdb"/> -->
<file src="src/Comet/bin/Debug/net6.0-ios/Comet.dll" target="lib/net6.0-ios13.6/Comet.dll"/>
<file src="src/Comet/bin/Debug/net6.0-ios/Comet.pdb" target="lib/net6.0-ios13.6/Comet.pdb"/>
<file src="src/Comet/bin/Debug/net6.0/Comet.dll" target="lib/net6.0/Comet.dll"/>
<file src="src/Comet/bin/Debug/net6.0/Comet.pdb" target="lib/net6.0/Comet.pdb"/>
<file src="src/Comet/bin/Debug/net6.0-android/Comet.dll" target="lib/net6.0-android30.0/Comet.dll"/>
<file src="src/Comet/bin/Debug/net6.0-android/Comet.pdb" target="lib/net6.0-android30.0/Comet.pdb"/>
<file src="src/Comet/bin/Debug/net6.0-maccatalyst/Comet.dll" target="lib/net6.0-maccatalyst13.5/Comet.dll"/>
<file src="src/Comet/bin/Debug/net6.0-maccatalyst/Comet.pdb" target="lib/net6.0-maccatalyst13.5/Comet.pdb"/>
<file src="src/Comet/bin/Debug/net6.0-windows10.0.19041/Comet.dll" target="lib/net6.0-windows10.0.19041/Comet.dll"/>
<file src="src/Comet/bin/Debug/net6.0-windows10.0.19041/Comet.pdb" target="lib/net6.0-windows10.0.19041/Comet.pdb"/>
<file src="external/Maui/.nuspec/Microsoft.Maui.Controls.MultiTargeting.targets" target="build/Microsoft.Maui.Controls.MultiTargeting.targets" />
<file src="src/Comet/bin/Debug/net7.0-ios/Comet.dll" target="lib/net7.0-ios13.6/Comet.dll"/>
<file src="src/Comet/bin/Debug/net7.0-ios/Comet.pdb" target="lib/net7.0-ios13.6/Comet.pdb"/>
<file src="src/Comet/bin/Debug/net7.0/Comet.dll" target="lib/net7.0/Comet.dll"/>
<file src="src/Comet/bin/Debug/net7.0/Comet.pdb" target="lib/net7.0/Comet.pdb"/>
<file src="src/Comet/bin/Debug/net7.0-android/Comet.dll" target="lib/net7.0-android30.0/Comet.dll"/>
<file src="src/Comet/bin/Debug/net7.0-android/Comet.pdb" target="lib/net7.0-android30.0/Comet.pdb"/>
<file src="src/Comet/bin/Debug/net7.0-maccatalyst/Comet.dll" target="lib/net7.0-maccatalyst13.5/Comet.dll"/>
<file src="src/Comet/bin/Debug/net7.0-maccatalyst/Comet.pdb" target="lib/net7.0-maccatalyst13.5/Comet.pdb"/>
<file src="src/Comet/bin/Debug/net7.0-windows10.0.19041.0/Comet.dll" target="lib/net7.0-windows10.0.19041.0/Comet.dll"/>
<file src="src/Comet/bin/Debug/net7.0-windows10.0.19041.0/Comet.pdb" target="lib/net7.0-windows10.0.19041.0/Comet.pdb"/>
<!-- <file src="external/Maui/.nuspec/Microsoft.Maui.Controls.MultiTargeting.targets" target="build/Microsoft.Maui.Controls.MultiTargeting.targets" /> -->
<file src="src/Comet.SourceGenerator/bin/Debug/netstandard2.0/Comet.SourceGenerator.dll" target="analyzers/cs/Comet.SourceGenerator.dll"/>
<file src="src/Comet.SourceGenerator/bin/Debug/netstandard2.0/Stubble.Core.dll" target="analyzers/cs/Stubble.Core.dll"/>
</files>

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

@ -1,12 +1,12 @@
<Project>
<!-- Fancy file adding/removing based on .platform -->
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS')) != true AND $(TargetFramework.StartsWith('net6.0-ios')) != true AND $(TargetFramework.StartsWith('net6.0-maccatalyst')) != true ">
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS')) != true AND $(TargetFramework.Contains('-ios')) != true AND $(TargetFramework.Contains('-maccatalyst')) != true ">
<Compile Remove="**\**\*.iOS.cs" />
<None Include="**\**\*.iOS.cs" />
<Compile Remove="**\iOS\**\*.cs" />
<None Include="**\iOS\**\*.cs" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac')) != true AND $(TargetFramework.StartsWith('net6.0-maccatalyst')) != true ">
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac')) != true AND $(TargetFramework.Contains('-maccatalyst')) != true ">
<Compile Remove="**\*.Mac.cs" />
<None Include="**\*.Mac.cs" />
<Compile Remove="**\Mac\**\*.cs" />
@ -14,19 +14,19 @@
<Compile Remove="**\MacCatalyst\**\*.cs" />
<None Include="**\MacCatalyst\**\*.cs" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac')) != true AND $(TargetFramework.StartsWith('Xamarin.iOS')) != true AND $(TargetFramework.StartsWith('net6.0-ios')) != true AND $(TargetFramework.StartsWith('net6.0-maccatalyst')) != true">
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac')) != true AND $(TargetFramework.Contains('Xamarin.iOS')) != true AND $(TargetFramework.Contains('-ios')) != true AND $(TargetFramework.StartsWith('-maccatalyst')) != true">
<Compile Remove="**\*.MaciOS.cs" />
<None Include="**\*.MaciOS.cs" />
<Compile Remove="**\MaciOS\**\*.cs" />
<None Include="**\MaciOS\**\*.cs" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid')) != true AND $(TargetFramework.StartsWith('net6.0-android')) != true ">
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid')) != true AND $(TargetFramework.Contains('-android')) != true ">
<Compile Remove="**\**\*.Android.cs" />
<None Include="**\**\*.Android.cs" />
<Compile Remove="**\Android\**\*.cs" />
<None Include="**\Android\**\*.cs" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard')) != true AND '$(TargetFramework)' != 'net6.0'">
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard')) != true AND '$(TargetFramework)' != 'net6.0' AND '$(TargetFramework)' != 'net7.0'">
<Compile Remove="**\*.Standard.cs" />
<None Include="**\*.Standard.cs" />
<Compile Remove="**\Standard\**\*.cs" />

2
External/Maui поставляемый

@ -1 +1 @@
Subproject commit c121ea3a06bc8139c061379c077cdd7e751886d1
Subproject commit 439853d004681b16a5ff20d0c16903606d1a77ee

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

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(MauiPlatforms)</TargetFrameworks>
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>CometSample</RootNamespace>
<SingleProject>true</SingleProject>

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

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Maui.Graphics;
/*
// Flutter only support if render
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
if (someCondition == true)
Text('The condition is true!'),
],
);
}
}
// Flutter render list
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
if (someCondition == true) ...[
Text('Widget A'),
Text('Widget B'),
Text('Widget C'),
],
],
);
}
}
*/
namespace Comet.Samples.Comparisons
{
public class Section5 : View
{
bool showMore = true;
int[] nums = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
string fillColor = "Red";
[Body]
View body() => new VStack {
new Text("Hello Comet!"),
() => {
if(showMore)
return new Text("If condition is working");
else
return new Text("Else condition is working");
},
nums.Select(i => new Text($"Show rows {i}")),
showMore?new Text("Ternary is working"):null,
() => {
switch(fillColor)
{
case "Red":
return new ShapeView(new Rectangle().Fill(Colors.Red)).Frame(100, 60);
default:
return null;
}
}
};
}
}

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

@ -73,6 +73,7 @@ namespace Comet.Samples
new MenuItem("SwiftUI Tutorial Section 4b", ()=> new Section4b()),
new MenuItem("SwiftUI Tutorial Section 4c", ()=> new Section4c()),
new MenuItem("SwiftUI Tutorial Section 4d", ()=> new Section4c()),
new MenuItem("Compare with Flutter",() => new Section5()),
new MenuItem("DavidSample1",()=> new DavidSample1()),
new MenuItem("DavidSample1a",()=> new DavidSample1a()),
new MenuItem("DavidSample1b",()=> new DavidSample1b()),

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

@ -1,16 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks>
<TargetFrameworks>net7.0;net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<RootNamespace>Comet</RootNamespace>
<AssemblyName>Comet</AssemblyName>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<LangVersion>preview</LangVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Comet.SourceGenerator\Comet.SourceGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false">

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

@ -1,17 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks>
<TargetFrameworks>net7.0;net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<RootNamespace>Comet</RootNamespace>
<AssemblyName>Comet</AssemblyName>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<LangVersion>preview</LangVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>
<ItemGroup>

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

@ -30,6 +30,12 @@ namespace Comet
foreach (var v in ieiv)
Add(v);
}
else if (obj is Func<View> func)
{
var view = func();
if (view != null)
Add(view);
}
else
{
throw new NotSupportedException("The object either needs to be a View, IView, or IEnumerable<IView>/IEnumerable<View>");

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

@ -104,10 +104,27 @@ namespace Comet
void IWindow.DisplayDensityChanged(float displayDensity) => DisplayScale = displayDensity;
float IWindow.RequestDisplayDensity() => ViewHandler?.InvokeWithResult(nameof(IWindow.RequestDisplayDensity), new DisplayDensityRequest()) ?? DisplayScale;
void IWindow.FrameChanged(Rect frame) => this.Frame = frame;
public static IToolbar Toolbar = new Toolbar(true, true);
IToolbar IToolbarElement.Toolbar => this.GetProperty<IToolbar>(nameof(IToolbarElement.Toolbar), false) ?? Toolbar;
FlowDirection IWindow.FlowDirection => this.GetEnvironment<FlowDirection>(nameof(IWindow.FlowDirection));
double IWindow.X => this.Frame.X;
double IWindow.Y => this.Frame.Y;
double IWindow.Width => this.Frame.Width;
double IWindow.MinimumWidth => this.GetEnvironment<double>(nameof(IWindow.MinimumWidth));
double IWindow.MaximumWidth => this.GetEnvironment<double?>(nameof(IWindow.MaximumWidth)) ?? double.MaxValue;
double IWindow.Height => this.Frame.Height;
double IWindow.MinimumHeight => this.GetEnvironment<double>(nameof(IWindow.MinimumHeight));
double IWindow.MaximumHeight => this.GetEnvironment<double?>(nameof(IWindow.MaximumHeight)) ?? double.MaxValue;
}
}