Skip to content

Commit

Permalink
Merge pull request #212 from max-ieremenko/release/1.8.3
Browse files Browse the repository at this point in the history
release 1.8.3
  • Loading branch information
max-ieremenko committed May 18, 2024
2 parents 954391c + 1ebbc5c commit 4ec72ce
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Because of the dependency on net462, the build runs on Windows.
- install dependencies

[net8.0 sdk](https://dotnet.microsoft.com/download/dotnet/8.0),
[InvokeBuild](https://www.powershellgallery.com/packages/InvokeBuild/5.10.5),
[ThirdPartyLibraries](https://www.powershellgallery.com/packages/ThirdPartyLibraries/3.4.0),
[ZipAsFolder](https://www.powershellgallery.com/packages/ZipAsFolder/0.0.1)
[InvokeBuild](https://www.powershellgallery.com/packages/InvokeBuild/5.11.1),
[ThirdPartyLibraries](https://www.powershellgallery.com/packages/ThirdPartyLibraries/3.5.1),
[ZipAsFolder](https://www.powershellgallery.com/packages/ZipAsFolder/1.0.0)

``` powershell
PS> ./Build/install-dependencies.ps1
Expand Down
2 changes: 1 addition & 1 deletion Build/install-dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $ErrorActionPreference = "Stop"
if (-not $List -or (".net" -in $List)) {
$script = Join-Path $PSScriptRoot "scripts/Install-DotNet.ps1"

& $script "6.0.418"
& $script "6.0.422"
& $script "7.0.405"

$version = (Get-Content -Raw (Join-Path $PSScriptRoot "../Sources/global.json") | ConvertFrom-Json).sdk.version
Expand Down
6 changes: 3 additions & 3 deletions Build/invoke-ci-build.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Requires -Version "7.0"
#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.10.5" }
#Requires -Modules @{ ModuleName="ThirdPartyLibraries"; ModuleVersion="3.5.0" }
#Requires -Modules @{ ModuleName="ZipAsFolder"; ModuleVersion="0.0.1" }
#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.11.1" }
#Requires -Modules @{ ModuleName="ThirdPartyLibraries"; ModuleVersion="3.5.1" }
#Requires -Modules @{ ModuleName="ZipAsFolder"; ModuleVersion="1.0.0" }

[CmdletBinding()]
param (
Expand Down
4 changes: 4 additions & 0 deletions Build/invoke-sdk-test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ foreach ($configuration in $configurations) {
$example.BuildParallelizable = $distinctPath.Add($path)
$example.Solution = Join-Path $path $example.Solution

if (-not $example["BuildMode"]) {
$example.BuildMode = "Rebuild"
}

if ($example.Tests -isnot [object[]]) {
throw "Tests must be array of objects: $configuration"
}
Expand Down
1 change: 1 addition & 0 deletions Build/tasks/sdk-test-tasks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ task BuildParallel {
File = "task-build.ps1"
Path = $example.Solution
Configuration = $example.Configuration
Mode = $example.BuildMode
}
}
}
Expand Down
18 changes: 15 additions & 3 deletions Build/tasks/task-build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ param(
[Parameter()]
[ValidateSet("Release", "Debug")]
[string]
$Configuration = "Release"
$Configuration = "Release",

[Parameter()]
[ValidateSet("Rebuild", "Publish")]
[string]
$Mode = "Rebuild"
)

task Default DotnetRestore, DotnetBuild
task Default DotnetRestore, DotnetBuild, DotnetPublish

task DotnetRestore {
exec { dotnet restore $Path }
}

task DotnetBuild {
task DotnetBuild -If ($Mode -eq "Rebuild") {
exec {
dotnet build $Path `
-t:Rebuild `
Expand All @@ -26,3 +31,10 @@ task DotnetBuild {
-p:EmbedUntrackedSources=true
}
}

task DotnetPublish -If ($Mode -eq "Publish") {
exec {
dotnet publish $Path `
--configuration $Configuration
}
}
5 changes: 3 additions & 2 deletions Examples/BlazorApp/test-configuration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
Solution = "BlazorApp.sln"
Configuration = "Release"
Platform = "Linux"
BuildMode = "Publish"

Tests = @(
, @(
@{
App = "Server/bin/Release/net8.0/BlazorApp.Server.dll"
App = "Server/bin/Release/net8.0/publish/BlazorApp.Server.dll"
Port = 5000
}
@{ App = "Invoke-WebRequest http://localhost:5000/IWeatherForecastService/GetForecasts -Method Post -ContentType application/grpc-web-text" }
@{ App = "ConsoleClient/bin/Release/net8.0/ConsoleApp.Client.dll" }
@{ App = "ConsoleClient/bin/Release/net8.0/publish/ConsoleApp.Client.dll" }
)
)
}
5 changes: 3 additions & 2 deletions Examples/SimpleChat/test-configuration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
Solution = "SimpleChat.sln"
Configuration = "Release"
Platform = "Linux"
BuildMode = "Publish"

Tests = @(
, @(
@{
App = "SimpleChat.Server/bin/Release/net8.0/SimpleChat.Server.dll"
App = "SimpleChat.Server/bin/Release/net8.0/publish/SimpleChat.Server.dll"
Port = 8080
}
@{ App = "SimpleChat.Client.Tester/bin/Release/net8.0/SimpleChat.Client.Tester.dll" }
@{ App = "SimpleChat.Client.Tester/bin/Release/net8.0/publish/SimpleChat.Client.Tester.dll" }
)
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// <copyright>
// Copyright 2024 Max Ieremenko
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>

namespace System.Diagnostics.CodeAnalysis;

[Flags]
internal enum DynamicallyAccessedMemberTypes
{
None = 0,
PublicParameterlessConstructor = 1,
PublicConstructors = 3,
NonPublicConstructors = 4,
PublicMethods = 8,
NonPublicMethods = 16, // 0x00000010
PublicFields = 32, // 0x00000020
NonPublicFields = 64, // 0x00000040
PublicNestedTypes = 128, // 0x00000080
NonPublicNestedTypes = 256, // 0x00000100
PublicProperties = 512, // 0x00000200
NonPublicProperties = 1024, // 0x00000400
PublicEvents = 2048, // 0x00000800
NonPublicEvents = 4096, // 0x00001000
Interfaces = 8192, // 0x00002000
All = -1, // 0xFFFFFFFF
}

// https://github.com/dotnet/runtime/issues/36656
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
internal sealed class DynamicDependencyAttribute : Attribute
{
public DynamicDependencyAttribute(string memberSignature)
{
MemberSignature = memberSignature;
}

public DynamicDependencyAttribute(string memberSignature, Type type)
{
MemberSignature = memberSignature;
Type = type;
}

public DynamicDependencyAttribute(string memberSignature, string typeName, string assemblyName)
{
MemberSignature = memberSignature;
TypeName = typeName;
AssemblyName = assemblyName;
}

public DynamicDependencyAttribute(DynamicallyAccessedMemberTypes memberTypes, Type type)
{
MemberTypes = memberTypes;
Type = type;
}

public DynamicDependencyAttribute(DynamicallyAccessedMemberTypes memberTypes, string typeName, string assemblyName)
{
MemberTypes = memberTypes;
TypeName = typeName;
AssemblyName = assemblyName;
}

public string? MemberSignature { get; }

public DynamicallyAccessedMemberTypes MemberTypes { get; }

public Type? Type { get; }

public string? TypeName { get; }

public string? AssemblyName { get; }

public string? Condition { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -45,6 +46,7 @@ public EmitContractBuilder(ContractDescription description)
return Expression.Lambda<Func<IMarshallerFactory, object>>(factory, marshaller).Compile();
}

[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(Method<,>))]
public TypeInfo Build(ModuleBuilder moduleBuilder, string? className = default)
{
var typeBuilder = moduleBuilder.DefineType(
Expand Down
2 changes: 1 addition & 1 deletion Sources/Versions.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<ServiceModelGrpcVersion>1.8.2</ServiceModelGrpcVersion>
<ServiceModelGrpcVersion>1.8.3</ServiceModelGrpcVersion>
</PropertyGroup>
</Project>

0 comments on commit 4ec72ce

Please sign in to comment.