Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
457 changes: 457 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

129 changes: 129 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Build and Release

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

env:
configuration: Release
productNamespacePrefix: "Splat"

jobs:
build:
runs-on: windows-latest
outputs:
nbgv: ${{ steps.nbgv.outputs.SemVer2 }}
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0

- name: Install .NET Core
uses: actions/setup-dotnet@v1.8.0
with:
dotnet-version: 3.1.x

- name: Install .NET 5
uses: actions/setup-dotnet@v1.8.0
with:
dotnet-version: 5.0.x

# - name: Update VS2019
# shell: powershell
# run: Start-Process -Wait -PassThru -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList "update --passive --norestart --installpath ""C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"""

- 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

- name: Run Unit Tests and Generate Coverage
uses: glennawatson/coverlet-msbuild@v1
with:
project-files: '**/*Tests*.csproj'
no-build: true
exclude-filter: '[${{env.productNamespacePrefix}}.*.Tests.*]*'
include-filter: '[${{env.productNamespacePrefix}}*]*'
output-format: cobertura
output: '../../artifacts/'
configuration: ${{ env.configuration }}

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

- name: Upload Code Coverage
shell: bash
run: |
echo $PWD
bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -t ${{ env.CODECOV_TOKEN }} -s '$PWD/artifacts' -f '*.xml'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Create NuGet Artifacts
uses: actions/upload-artifact@master
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/checkout@v2.3.4
with:
fetch-depth: 0

- name: Download NuGet Packages
uses: actions/download-artifact@v2.0.9
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/create-release@v1.1.4
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
13 changes: 13 additions & 0 deletions src/.idea/.idea.Splat.DI.SourceGenerator/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/.idea/.idea.Splat.DI.SourceGenerator/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/.idea/.idea.Splat.DI.SourceGenerator/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/.idea/.idea.Splat.DI.SourceGenerator/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/.idea/.idea.Splat.DI.SourceGenerator/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<Project>
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Platform>AnyCPU</Platform>
<IsTestProject>$(MSBuildProjectName.Contains('Tests'))</IsTestProject>
<DebugType>embedded</DebugType>
<Authors>Glenn Watson</Authors>
<Copyright>Copyright (c) 2021 ReactiveUI Association Inc</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/reactivemarbles/ObservableEvents</PackageProjectUrl>
<PackageDescription>Generates source for Splat dependency injection registrations with constructor and property injection.</PackageDescription>
<Owners>glennawatson</Owners>
<PackageTags>system.reactive;splat;dependency injection</PackageTags>
<PackageReleaseNotes>https://github.com/reactivemarbles/Splat.DI.SourceGenerator/releases</PackageReleaseNotes>
<RepositoryUrl>https://github.com/reactivemarbles/Splat.DI.SourceGenerator</RepositoryUrl>
<PackageIconUrl>https://github.com/reactiveui/styleguide/blob/master/logo_splat/logo.png?raw=true</PackageIconUrl>
<RepositoryType>git</RepositoryType>

<!-- Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<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" />
</ItemGroup>

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

<ItemGroup>
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.354" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="3.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
</ItemGroup>
</Project>
30 changes: 30 additions & 0 deletions src/Directory.build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Project>
<PropertyGroup>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
</PropertyGroup>

<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
<DefineConstants>$(DefineConstants);NET_45;XAML</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('uap'))">
<DefineConstants>$(DefineConstants);NETFX_CORE;XAML;WINDOWS_UWP</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS'))">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac'))">
<DefineConstants>$(DefineConstants);MONO;COCOA</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('Xamarin.TVOS'))">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('Xamarin.WatchOS'))">
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('MonoAndroid'))">
<DefineConstants>$(DefineConstants);MONO;ANDROID</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('tizen'))">
<DefineConstants>$(DefineConstants);TIZEN</DefineConstants>
</PropertyGroup>
</Project>
63 changes: 63 additions & 0 deletions src/Splat.DI.SourceGenerator.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Splat.DependencyInjection.SourceGenerator", "Splat.DependencyInjection.SourceGenerator\Splat.DependencyInjection.SourceGenerator.csproj", "{3BD91F34-54B0-4E7C-B933-D16C0A054FE9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Splat.DependencyInjection.SourceGenerator.Tests", "Splat.DependencyInjection.SourceGenerator.Tests\Splat.DependencyInjection.SourceGenerator.Tests.csproj", "{09554D3F-6277-479E-BBA6-3E4806C7ED85}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{43FD3021-45AA-4849-BFD7-46363EE0C6B7}"
ProjectSection(SolutionItems) = preProject
..\.editorconfig = ..\.editorconfig
..\.gitignore = ..\.gitignore
Directory.Build.props = Directory.Build.props
Directory.build.targets = Directory.build.targets
..\LICENSE = ..\LICENSE
..\README.md = ..\README.md
stylecop.json = stylecop.json
..\version.json = ..\version.json
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3BD91F34-54B0-4E7C-B933-D16C0A054FE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3BD91F34-54B0-4E7C-B933-D16C0A054FE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3BD91F34-54B0-4E7C-B933-D16C0A054FE9}.Debug|x64.ActiveCfg = Debug|Any CPU
{3BD91F34-54B0-4E7C-B933-D16C0A054FE9}.Debug|x64.Build.0 = Debug|Any CPU
{3BD91F34-54B0-4E7C-B933-D16C0A054FE9}.Debug|x86.ActiveCfg = Debug|Any CPU
{3BD91F34-54B0-4E7C-B933-D16C0A054FE9}.Debug|x86.Build.0 = Debug|Any CPU
{3BD91F34-54B0-4E7C-B933-D16C0A054FE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3BD91F34-54B0-4E7C-B933-D16C0A054FE9}.Release|Any CPU.Build.0 = Release|Any CPU
{3BD91F34-54B0-4E7C-B933-D16C0A054FE9}.Release|x64.ActiveCfg = Release|Any CPU
{3BD91F34-54B0-4E7C-B933-D16C0A054FE9}.Release|x64.Build.0 = Release|Any CPU
{3BD91F34-54B0-4E7C-B933-D16C0A054FE9}.Release|x86.ActiveCfg = Release|Any CPU
{3BD91F34-54B0-4E7C-B933-D16C0A054FE9}.Release|x86.Build.0 = Release|Any CPU
{09554D3F-6277-479E-BBA6-3E4806C7ED85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{09554D3F-6277-479E-BBA6-3E4806C7ED85}.Debug|Any CPU.Build.0 = Debug|Any CPU
{09554D3F-6277-479E-BBA6-3E4806C7ED85}.Debug|x64.ActiveCfg = Debug|Any CPU
{09554D3F-6277-479E-BBA6-3E4806C7ED85}.Debug|x64.Build.0 = Debug|Any CPU
{09554D3F-6277-479E-BBA6-3E4806C7ED85}.Debug|x86.ActiveCfg = Debug|Any CPU
{09554D3F-6277-479E-BBA6-3E4806C7ED85}.Debug|x86.Build.0 = Debug|Any CPU
{09554D3F-6277-479E-BBA6-3E4806C7ED85}.Release|Any CPU.ActiveCfg = Release|Any CPU
{09554D3F-6277-479E-BBA6-3E4806C7ED85}.Release|Any CPU.Build.0 = Release|Any CPU
{09554D3F-6277-479E-BBA6-3E4806C7ED85}.Release|x64.ActiveCfg = Release|Any CPU
{09554D3F-6277-479E-BBA6-3E4806C7ED85}.Release|x64.Build.0 = Release|Any CPU
{09554D3F-6277-479E-BBA6-3E4806C7ED85}.Release|x86.ActiveCfg = Release|Any CPU
{09554D3F-6277-479E-BBA6-3E4806C7ED85}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C06417F6-753F-4456-9D91-64D547407315}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) 2019-2021 ReactiveUI Association Incorporated. All rights reserved.
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Runtime.CompilerServices;

using VerifyTests;

/// <summary>
/// Initialize for the module.
/// </summary>
public static class ModuleInitializer
{
/// <summary>
/// Initializes the source generators.
/// </summary>
[ModuleInitializer]
public static void Init()
{
VerifySourceGenerators.Enable();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
Diagnostics: [
{
Id: SPLATDI005,
Title: Constructors must not have a circular dependency,
Severity: Error,
WarningLevel: 0,
Location: : (26,36)-(26,44),
MessageFormat: Constructor parameters must not have a circular dependency to another registered resource,
Category: Compiler
},
{
Id: SPLATDI005,
Title: Constructors must not have a circular dependency,
Severity: Error,
WarningLevel: 0,
Location: : (18,36)-(18,44),
MessageFormat: Constructor parameters must not have a circular dependency to another registered resource,
Category: Compiler
}
]
}
Loading