Skip to content

Commit

Permalink
Merge pull request #267 from novotnyllc/misc-updates
Browse files Browse the repository at this point in the history
Misc updates for building
  • Loading branch information
clairernovotny authored Dec 6, 2024
2 parents 34b2df6 + b3ab32b commit d3af008
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 62 deletions.
65 changes: 65 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,68 @@ csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_indent_labels = no_change
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_primary_constructors = true:suggestion
csharp_prefer_system_threading_lock = true:suggestion
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_space_around_binary_operators = before_and_after

[*.{cs,vb}]
#### Naming styles ####

# Naming rules

dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i

dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

# Symbol specifications

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

# Naming styles

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
end_of_line = crlf
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
7 changes: 6 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<Project>
<PropertyGroup>
<ImplicitUsings>true</ImplicitUsings>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DotNet.ReproducibleBuilds" Version="1.1.1" PrivateAssets="All"/>
<PackageReference Include="DotNet.ReproducibleBuilds" Version="1.2.25" PrivateAssets="All"/>
</ItemGroup>
</Project>
5 changes: 3 additions & 2 deletions Zeroconf.sln
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29322.22
# Visual Studio Version 17
VisualStudioVersion = 17.13.35507.96
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZeroconfTest.NetCore", "ZeroconfTest.NetFx\ZeroconfTest.NetCore.csproj", "{E1424569-4A10-4164-A99B-A3EBC7AFD469}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{48990F96-480D-4AAF-BBC2-FF765251DABE}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
azure-pipelines.yml = azure-pipelines.yml
Directory.Build.props = Directory.Build.props
README.md = README.md
version.json = version.json
EndProjectSection
Expand Down
7 changes: 3 additions & 4 deletions Zeroconf/AsyncLock.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Zeroconf
{
#pragma warning disable CA1001 // Types that own disposable fields should be disposable
class AsyncLock
#pragma warning restore CA1001 // Types that own disposable fields should be disposable
{
readonly SemaphoreSlim m_semaphore;
readonly Task<Releaser> m_releaser;

public AsyncLock()
{
m_semaphore = new SemaphoreSlim(1);
Expand Down
3 changes: 2 additions & 1 deletion Zeroconf/Zeroconf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
<CodeAnalysisRuleSet>Zeroconf.ruleset</CodeAnalysisRuleSet>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<EmbeddedResource Include="Properties\Zeroconf.rd.xml" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.5.104" PrivateAssets="all" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.146" PrivateAssets="all" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
</ItemGroup>

Expand Down
82 changes: 43 additions & 39 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ stages:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true

steps:
- task: UseDotNet@2
displayName: Install .NET 6
inputs:
version: 6.x

- task: UseDotNet@2
displayName: Install .NET 8
inputs:
Expand All @@ -50,43 +45,52 @@ stages:
displayName: Publish build packages
artifact: BuildPackages

- publish: config
displayName: Publish signing config
artifact: config

- stage: CodeSign
condition: and(succeeded('Build'), not(eq(variables['build.reason'], 'PullRequest')))
dependsOn: Build
variables:
- group: Trusted Signing Config
jobs:
- deployment: CodeSign
- job: CodeSign
displayName: Code Signing
pool:
vmImage: windows-latest
environment: Code Sign - CI
variables:
- group: Sign Client Credentials
strategy:
runOnce:
deploy:
steps:
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . SignClient
displayName: Install SignTool tool

- pwsh: |
.\SignClient "Sign" `
--baseDirectory "$(Pipeline.Workspace)\BuildPackages" `
--input "**/*.nupkg" `
--config "$(Pipeline.Workspace)\config\signclient.json" `
--user "$(SignClientUser)" `
--secret "$(SignClientSecret)" `
--name "Zeroconf" `
--description "Zeroconf" `
--descriptionUrl "https://github.com/novotnyllc/Zeroconf"
displayName: Sign packages
- publish: $(Pipeline.Workspace)/BuildPackages
displayName: Publish Signed Packages
artifact: SignedPackages

steps:

- download: current
artifact: BuildPackages

- task: UseDotNet@2
displayName: 'Use .NET SDK 9.x'
inputs:
version: 9.x

# Install the code signing tool
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . --prerelease sign
displayName: Install Sign CLI tool

- task: AzureCLI@2
inputs:
azureSubscription: 'Azure - Claire Novotny LLC'
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
.\sign code trusted-signing `
"**/*.nupkg" `
--base-directory "$(Pipeline.Workspace)\BuildPackages" `
--publisher-name "Claire Novotny LLC" `
--description "Zeroconf" `
--description-url "https://github.com/novotnyllc/Zeroconf" `
--trusted-signing-endpoint "$(TrustedSigningEndpoint)" `
--trusted-signing-account "$(TrustedSigningAccount)" `
--trusted-signing-certificate-profile "$(TrustedSigningCertificateProfile)"
displayName: Sign artifacts

- publish: $(Pipeline.Workspace)/BuildPackages
displayName: Publish Signed Packages
artifact: SignedPackages
13 changes: 0 additions & 13 deletions config/signclient.json

This file was deleted.

4 changes: 2 additions & 2 deletions version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "3.6",
"version": "3.7",
"publicReleaseRefSpec": [
"^refs/heads/main$", // we release out of master
"^refs/heads/main$", // we release out of main
"^refs/heads/rel/v\\d+\\.\\d+" // we also release branches starting with rel/vN.N
],
"nugetPackageVersion":{
Expand Down

0 comments on commit d3af008

Please sign in to comment.