Skip to content

Commit

Permalink
feature: Add additional overloads for Parameter (#21)
Browse files Browse the repository at this point in the history
* feature: Add additional overloads for Parameter

* Add logo correct path
  • Loading branch information
glennawatson authored Sep 25, 2021
1 parent e4ef590 commit 0d85e64
Show file tree
Hide file tree
Showing 9 changed files with 279 additions and 114 deletions.
72 changes: 72 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,39 @@ root = true
insert_final_newline = true
indent_style = space
indent_size = 4
dotnet_diagnostic.CA1027.severity=error
dotnet_diagnostic.CA1062.severity=error
dotnet_diagnostic.CA1064.severity=error
dotnet_diagnostic.CA1066.severity=error
dotnet_diagnostic.CA1067.severity=error
dotnet_diagnostic.CA1068.severity=error
dotnet_diagnostic.CA1069.severity=warning
dotnet_diagnostic.CA2013.severity=error
dotnet_diagnostic.CA1802.severity=error
dotnet_diagnostic.CA1813.severity=error
dotnet_diagnostic.CA1814.severity=error
dotnet_diagnostic.CA1815.severity=error
dotnet_diagnostic.CA1822.severity=error
dotnet_diagnostic.CA1827.severity=error
dotnet_diagnostic.CA1828.severity=error
dotnet_diagnostic.CA1826.severity=error
dotnet_diagnostic.CA1829.severity=error
dotnet_diagnostic.CA1830.severity=error
dotnet_diagnostic.CA1831.severity=error
dotnet_diagnostic.CA1832.severity=error
dotnet_diagnostic.CA1833.severity=error
dotnet_diagnostic.CA1834.severity=error
dotnet_diagnostic.CA1835.severity=error
dotnet_diagnostic.CA1836.severity=error
dotnet_diagnostic.CA1837.severity=error
dotnet_diagnostic.CA1838.severity=error
dotnet_diagnostic.CA2015.severity=error
dotnet_diagnostic.CA2012.severity=error
dotnet_diagnostic.CA2011.severity=error
dotnet_diagnostic.CA2009.severity=error
dotnet_diagnostic.CA2008.severity=error
dotnet_diagnostic.CA2007.severity=warning
dotnet_diagnostic.CA2000.severity=suggestion

[project.json]
indent_size = 2
Expand Down Expand Up @@ -426,6 +459,45 @@ dotnet_diagnostic.SA1651.severity = error
dotnet_diagnostic.SX1101.severity = error
dotnet_diagnostic.SX1309.severity = error
dotnet_diagnostic.SX1623.severity = none
dotnet_diagnostic.RCS1102.severity=error
dotnet_diagnostic.RCS1166.severity=error
dotnet_diagnostic.RCS1078i.severity=error
dotnet_diagnostic.RCS1248.severity=error
dotnet_diagnostic.RCS1080.severity=error
dotnet_diagnostic.RCS1077.severity=error
dotnet_diagnostic.CA1825.severity=error
dotnet_diagnostic.CA1812.severity=error
dotnet_diagnostic.CA1805.severity=error
dotnet_diagnostic.RCS1197.severity=error
dotnet_diagnostic.RCS1198.severity=error
dotnet_diagnostic.RCS1231.severity=error
dotnet_diagnostic.RCS1235.severity=error
dotnet_diagnostic.RCS1242.severity=error
dotnet_diagnostic.CA2016.severity=warning
dotnet_diagnostic.CA2014.severity=error
dotnet_diagnostic.RCS1010.severity=error
dotnet_diagnostic.RCS1006.severity=error
dotnet_diagnostic.RCS1005.severity=error
dotnet_diagnostic.RCS1020.severity=error
dotnet_diagnostic.RCS1049.severity=warning
dotnet_diagnostic.RCS1058.severity=warning
dotnet_diagnostic.RCS1068.severity=warning
dotnet_diagnostic.RCS1073.severity=warning
dotnet_diagnostic.RCS1084.severity=error
dotnet_diagnostic.RCS1085.severity=error
dotnet_diagnostic.RCS1105.severity=error
dotnet_diagnostic.RCS1112.severity=error
dotnet_diagnostic.RCS1128.severity=error
dotnet_diagnostic.RCS1143.severity=error
dotnet_diagnostic.RCS1171.severity=error
dotnet_diagnostic.RCS1173.severity=error
dotnet_diagnostic.RCS1176.severity=error
dotnet_diagnostic.RCS1177.severity=error
dotnet_diagnostic.RCS1179.severity=error
dotnet_diagnostic.RCS1180.severity=warning
dotnet_diagnostic.RCS1190.severity=error
dotnet_diagnostic.RCS1195.severity=error
dotnet_diagnostic.RCS1214.severity=error

# C++ Files
[*.{cpp,h,in}]
Expand Down
59 changes: 5 additions & 54 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Build and Release
name: Build

on:
push:
branches: [ main ]
pull_request:
types: [opened, synchronize, reopened, closed]
branches: [ main ]

env:
Expand All @@ -13,22 +12,23 @@ env:

jobs:
build:
runs-on: windows-latest
runs-on: windows-2022
outputs:
nbgv: ${{ steps.nbgv.outputs.SemVer2 }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
lfs: true

- name: Install .NET Core
uses: actions/[email protected].1
uses: actions/[email protected].0
with:
dotnet-version: 3.1.x

- name: Install .NET 5
uses: actions/[email protected].1
uses: actions/[email protected].0
with:
dotnet-version: 5.0.x

Expand Down Expand Up @@ -78,52 +78,3 @@ jobs:
with:
name: nuget
path: '**/*.nupkg'

release:
runs-on: windows-latest
needs: build
if: contains(github.event.pull_request.labels.*.name, 'release') && github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Download NuGet Packages
uses: actions/[email protected]
with:
name: nuget

- uses: nuget/setup-nuget@v1
name: Setup NuGet

# Decode the base 64 encoded pfx and save the Signing_Certificate
- name: Sign NuGet packages
shell: pwsh
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.SIGNING_CERTIFICATE }}")
[IO.File]::WriteAllBytes("GitHubActionsWorkflow.pfx", $pfx_cert_byte)
$secure_password = ConvertTo-SecureString ${{ secrets.SIGN_CERTIFICATE_PASSWORD }} –asplaintext –force
Import-PfxCertificate -FilePath GitHubActionsWorkflow.pfx -Password $secure_password -CertStoreLocation Cert:\CurrentUser\My
nuget sign -Timestamper http://timestamp.digicert.com -CertificateFingerprint ${{ secrets.SIGN_CERTIFICATE_HASH }} **/*.nupkg
- name: Changelog
uses: glennawatson/ChangeLog@v1
id: changelog

- name: Create Release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ needs.build.outputs.nbgv }}
release_name: ${{ needs.build.outputs.nbgv }}
body: |
${{ steps.changelog.outputs.commitLog }}
- name: NuGet Push
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
SOURCE_URL: https://api.nuget.org/v3/index.json
run: |
dotnet nuget push -s ${{ env.SOURCE_URL }} -k ${{ env.NUGET_AUTH_TOKEN }} **/*.nupkg
77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Build and Release

on:
push:
branches: [ main ]

jobs:
build:
runs-on: windows-2022
environment:
name: release
outputs:
nbgv: ${{ steps.nbgv.outputs.SemVer2 }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
lfs: true

- name: Install .NET Core
uses: actions/[email protected]
with:
dotnet-version: 3.1.x

- name: Install .NET 5
uses: actions/[email protected]
with:
dotnet-version: 5.0.x

- name: NBGV
id: nbgv
uses: dotnet/nbgv@master
with:
setAllVars: true

- name: NuGet Restore
run: dotnet restore
working-directory: src

- name: Build
run: dotnet build --configuration=${{ env.configuration }} --verbosity=minimal --no-restore
working-directory: src

- uses: nuget/setup-nuget@v1
name: Setup NuGet

# Decode the base 64 encoded pfx and save the Signing_Certificate
- name: Sign NuGet packages
shell: pwsh
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.SIGNING_CERTIFICATE }}")
[IO.File]::WriteAllBytes("GitHubActionsWorkflow.pfx", $pfx_cert_byte)
$secure_password = ConvertTo-SecureString ${{ secrets.SIGN_CERTIFICATE_PASSWORD }} –asplaintext –force
Import-PfxCertificate -FilePath GitHubActionsWorkflow.pfx -Password $secure_password -CertStoreLocation Cert:\CurrentUser\My
nuget sign -Timestamper http://timestamp.digicert.com -CertificateFingerprint ${{ secrets.SIGN_CERTIFICATE_HASH }} **/*.nupkg
- name: Changelog
uses: glennawatson/ChangeLog@v1
id: changelog

- name: Create Release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ needs.build.outputs.nbgv }}
release_name: ${{ needs.build.outputs.nbgv }}
body: |
${{ steps.changelog.outputs.commitLog }}
- name: NuGet Push
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
SOURCE_URL: https://api.nuget.org/v3/index.json
run: |
dotnet nuget push -s ${{ env.SOURCE_URL }} -k ${{ env.NUGET_AUTH_TOKEN }} **/*.nupkg
Binary file added images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 4 additions & 8 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,21 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<PackageIcon>logo.png</PackageIcon>
<SolutionDir Condition="'$(SolutionDir)' == ''">$(MSBuildThisFileDirectory)</SolutionDir>
</PropertyGroup>

<ItemGroup Condition="$(IsTestProject)">
</ItemGroup>

<ItemGroup Condition="'$(IsTestProject)' != 'true'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

<PropertyGroup>
<SolutionDir Condition="'$(SolutionDir)' == ''">$(MSBuildThisFileDirectory)</SolutionDir>
</PropertyGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\LICENSE" Pack="true" PackagePath="LICENSE" />
<None Include="$(MSBuildThisFileDirectory)..\images\logo.png" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.4.231" PrivateAssets="all" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.4.240" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 7 additions & 2 deletions src/ReactiveMarbles.RoslynHelpers/RoslynCommonHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,23 @@ public static class RoslynCommonHelpers
/// <returns>The event's obsolete information if there is any.</returns>
public static AttributeListSyntax[] GenerateObsoleteAttributeList(ISymbol eventDetails)
{
if (eventDetails is null)
{
throw new ArgumentNullException(nameof(eventDetails));
}

var obsoleteAttribute = eventDetails.GetAttributes()
.FirstOrDefault(attr => attr.AttributeClass?.GetArityDisplayName().Equals("System.ObsoleteAttribute", StringComparison.InvariantCulture) ?? false);

if (obsoleteAttribute == null)
if (obsoleteAttribute is null)
{
return Array.Empty<AttributeListSyntax>();
}

var message = obsoleteAttribute.ConstructorArguments.FirstOrDefault().Value?.ToString();
var isError = bool.Parse(obsoleteAttribute.ConstructorArguments.ElementAtOrDefault(1).Value?.ToString() ?? bool.FalseString) ? SyntaxKind.TrueLiteralExpression : SyntaxKind.FalseLiteralExpression;

if (message != null && !string.IsNullOrWhiteSpace(message))
if (message is not null && !string.IsNullOrWhiteSpace(message))
{
var attribute = Attribute(
"global::System.ObsoleteAttribute",
Expand Down
Loading

0 comments on commit 0d85e64

Please sign in to comment.