Skip to content

Commit

Permalink
Add only standard mode
Browse files Browse the repository at this point in the history
When IsStandard is True, the project will only target to .NET 2.0, .NET Standard and the earlier LTS .NET Core App. The Nuget ID will change to AdvancedSharpAdbClient.Standard.
  • Loading branch information
wherewhere committed Nov 15, 2023
1 parent 5962ab0 commit d3d3ac7
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 18 deletions.
20 changes: 18 additions & 2 deletions AdvancedSharpAdbClient.Tests/AdvancedSharpAdbClient.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,25 @@
<PropertyGroup>
<LangVersion>latest</LangVersion>
<NoWarn>CS1591</NoWarn>
<TargetFramework Condition="'$(IsWindows)' != 'True'">net8.0</TargetFramework>
<TargetFramework Condition="'$(IsWindows)' == 'True'">net8.0-windows10.0.17763.0</TargetFramework>
</PropertyGroup>

<Choose>
<When Condition="'$(IsStandard)' == 'True'">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</When>
<When Condition="'$(IsWindows)' == 'True'">
<PropertyGroup>
<TargetFramework Condition="'$(IsWindows)' == 'True'">net8.0-windows10.0.17763.0</TargetFramework>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</Otherwise>
</Choose>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="6.0.0" PrivateAssets="all">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void ThrowIfLessThanTest()
[Fact]
public static void ThrowIfNegativeTest()
{
Assert.Equal(-1, Assert.Throws<ArgumentOutOfRangeException>(() => ExceptionExtensions.ThrowIfNegative(-1)).ActualValue);
Assert.Equal(-1d, Assert.Throws<ArgumentOutOfRangeException>(() => ExceptionExtensions.ThrowIfNegative(-1d)).ActualValue);

ExceptionExtensions.ThrowIfNegative(0);
ExceptionExtensions.ThrowIfNegative(1);
Expand Down
38 changes: 24 additions & 14 deletions AdvancedSharpAdbClient/AdvancedSharpAdbClient.csproj
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<FullTargets>False</FullTargets>
<FullTargets>True</FullTargets>
<ImportAsync>True</ImportAsync>
<NoWarn>$(NoWarn);CS1685;CA2254</NoWarn>
<Nullable>Enable</Nullable>
<WarningsAsErrors />
</PropertyGroup>

<PropertyGroup Condition="'$(FullTargets)' == 'True'">
<NoWarn>$(NoWarn);NU1603;NU1605;NU1902;NU1903</NoWarn>
<TargetFrameworks>net6.0;net8.0;netcoreapp2.1;netcoreapp3.1;netstandard1.3;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks Condition="'$(IsWindows)' == 'True'">$(TargetFrameworks);net2.0-client;net3.5-client;net4.0-client;net4.5.2;net4.6.2;net4.8.1;net6.0-windows10.0.17763.0;net8.0-windows10.0.17763.0</TargetFrameworks>
<TargetFrameworks Condition="'$(GITHUB_ACTIONS)' != 'True' and '$(IsWindows)' == 'True'">$(TargetFrameworks);netcore5.0;uap10.0;uap10.0.15138.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="'$(FullTargets)' != 'True'">
<TargetFrameworks>net8.0;netcoreapp3.1;netstandard1.3;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks Condition="'$(IsWindows)' == 'True'">$(TargetFrameworks);net2.0-client;net3.5-client;net4.5.2;net4.8.1;net8.0-windows10.0.17763.0</TargetFrameworks>
</PropertyGroup>
<Choose>
<When Condition="'$(IsStandard)' == 'True'">
<PropertyGroup>
<PackageId>$(AssemblyName).Standard</PackageId>
<TargetFrameworks>netstandard1.3;netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
<TargetFrameworks Condition="'$(IsWindows)' == 'True'">$(TargetFrameworks);net2.0-client</TargetFrameworks>
</PropertyGroup>
</When>
<When Condition="'$(FullTargets)' == 'True'">
<PropertyGroup>
<NoWarn>$(NoWarn);NU1603;NU1605;NU1902;NU1903</NoWarn>
<TargetFrameworks>net6.0;net8.0;netcoreapp2.1;netcoreapp3.1;netstandard1.3;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks Condition="'$(IsWindows)' == 'True'">$(TargetFrameworks);net2.0-client;net3.5-client;net4.0-client;net4.5.2;net4.6.2;net4.8.1;net6.0-windows10.0.17763.0;net8.0-windows10.0.17763.0</TargetFrameworks>
<TargetFrameworks Condition="'$(GITHUB_ACTIONS)' != 'True' and '$(IsWindows)' == 'True'">$(TargetFrameworks);netcore5.0;uap10.0;uap10.0.15138.0</TargetFrameworks>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<TargetFrameworks>net8.0;netcoreapp3.1;netstandard1.3;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks Condition="'$(IsWindows)' == 'True'">$(TargetFrameworks);net2.0-client;net3.5-client;net4.5.2;net4.8.1;net8.0-windows10.0.17763.0</TargetFrameworks>
</PropertyGroup>
</Otherwise>
</Choose>

<PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0'">
<TargetPlatformMinVersion>10.0</TargetPlatformMinVersion>
Expand Down
2 changes: 1 addition & 1 deletion AdvancedSharpAdbClient/DeviceMonitor.Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected virtual async Task DisposeAsyncCore()
}

/// <inheritdoc/>
#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
#if NETCOREAPP3_0_OR_GREATER || NETSTANDARD2_1_OR_GREATER
public async ValueTask DisposeAsync()
#else
public async Task DisposeAsync()
Expand Down
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<PropertyGroup>
<FullTargets Condition="'$(FullTargets)' == ''">False</FullTargets>
<ImportAsync Condition="'$(ImportAsync)' == ''">False</ImportAsync>
<IsStandard Condition="'$(IsStandard)' == ''">False</IsStandard>
<IsWindows Condition="'$(IsWindows)' == ''">False</IsWindows>
<IsWindows Condition="$([MSBuild]::IsOSPlatform('Windows')) == 'True' OR '$(Platform)' == 'Windows NT'">True</IsWindows>
<IsTestProject Condition="'$(IsTestProject)' == ''">$(MSBuildProjectName.Contains('.Test'))</IsTestProject>
Expand Down

0 comments on commit d3d3ac7

Please sign in to comment.