Skip to content

Commit

Permalink
Provide consumable nuget packages
Browse files Browse the repository at this point in the history
  • Loading branch information
manne committed Apr 15, 2020
1 parent 32299c3 commit 47ca5c3
Show file tree
Hide file tree
Showing 37 changed files with 223 additions and 139 deletions.
17 changes: 17 additions & 0 deletions src/semantictypes/Attributes/Attributes.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Sdk Name="Microsoft.Build.CentralPackageVersions" />

<PropertyGroup>
<TargetFrameworks>net40;netstandard1.0</TargetFrameworks>
<AssemblyName>Obviously.SemanticTypes.Attributes</AssemblyName>
<PackageId>Obviously.SemanticTypes.Attributes</PackageId>
<RootNamespace>Obviously.SemanticTypes</RootNamespace>
<Description>Defines `SemanticType` attribute. See project site for more details.</Description>
<IsNuGetPackage>true</IsNuGetPackage>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CodeGeneration.Roslyn.Attributes" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using System.Diagnostics;
using CodeGeneration.Roslyn;

namespace Obviously.SemanticTypes.Generator
namespace Obviously.SemanticTypes
{
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
[CodeGenerationAttribute(typeof(SemanticTypeGenerator))]
[CodeGenerationAttribute("Obviously.SemanticTypes.Generator.SemanticTypeGenerator, Obviously.SemanticTypes.Generator")]
[Conditional("CodeGeneration")]
public sealed class SemanticTypeAttribute : Attribute
{
Expand Down
37 changes: 37 additions & 0 deletions src/semantictypes/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Project>
<PropertyGroup Label="Project">
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);NU5105</MSBuildWarningsAsMessages>
</PropertyGroup>

<PropertyGroup>
<IsTestProject Condition="'$(IsTestProject)' == ''">false</IsTestProject>
<IsTestProject Condition="$(MSBuildProjectName.EndsWith('Tests'))">true</IsTestProject>
</PropertyGroup>

<ItemGroup Label="Testing" Condition="'$(IsTestProject)' == 'true'">
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="xunit.core" />
<PackageReference Include="xunit.analyzers" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
15 changes: 15 additions & 0 deletions src/semantictypes/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project>

<PropertyGroup Label="NuGet Packages" Condition="'$(IsNuGetPackage)' == 'true'">
<Version>0.0.1-preview.7</Version>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Authors>Manuel Pfemeter</Authors>
<RepositoryUrl>https://github.com/manne/obviously</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<MinClientVersion>4.3.0</MinClientVersion>
<IsPackable>true</IsPackable>
<Company />
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.AspNetCore.Mvc.Testing;
using Xunit;

#pragma warning disable CA2007 // Consider calling ConfigureAwait on the awaited task
namespace Obviously.SemanticTypes.Generator.Templates.AspNetCore.Tests
{
public sealed class AspNetCoreModelBindingTests : IDisposable
Expand All @@ -23,15 +24,19 @@ public async Task GivenOneStandardApp_WhenInvokingTheAutomaticGuidRoute_ThenTheR
{
using var response = await _httpClient.GetAsync(new Uri("api/modelbinding/automatic/76447AA6-F77F-46AA-A4C6-0E4ABBC5A660", UriKind.Relative));
var content = await response.Content.ReadAsStringAsync();
#pragma warning disable CA1308 // Normalize strings to uppercase
content.Should().Be("\"76447AA6-F77F-46AA-A4C6-0E4ABBC5A660\"".ToLowerInvariant());
#pragma warning restore CA1308 // Normalize strings to uppercase
}

[Fact]
public async Task GivenOneStandardApp_WhenInvokingTheManualGuidRoute_ThenTheResult_ShouldContain_TheGuidAsOneJsonString()
{
using var response = await _httpClient.GetAsync(new Uri("api/modelbinding/manual/76447AA6-F77F-46AA-A4C6-0E4ABBC5A660", UriKind.Relative));
var content = await response.Content.ReadAsStringAsync();
#pragma warning disable CA1308 // Normalize strings to uppercase
content.Should().Be("\"76447AA6-F77F-46AA-A4C6-0E4ABBC5A660\"".ToLowerInvariant());
#pragma warning restore CA1308 // Normalize strings to uppercase
}

public void Dispose()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="Microsoft.Build.CentralPackageVersions" />

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

<IsPackable>false</IsPackable>
<AssemblyName>Obviously.SemanticTypes.Generator.Templates.AspNetCore.Tests</AssemblyName>
<RootNamespace>Obviously.SemanticTypes.Generator.Templates.AspNetCore.Tests</RootNamespace>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="xunit.core" Version="2.4.1" />
<PackageReference Include="xunit.analyzers" Version="0.10.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.2.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
<ProjectReference Include="..\Generator.Templates.AspNetCore\Generator.Templates.AspNetCore.csproj" />
<ProjectReference Include="..\Generator\Generator.csproj" OutputItemType="CodeGenerationRoslynPlugin" PrivateAssets="all" />
<PackageReference Include="CodeGeneration.Roslyn.Tool" Version="0.7.63">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<Sdk Name="Microsoft.Build.CentralPackageVersions" />

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>Obviously.SemanticTypes.Generator.Templates.AspNetCore</AssemblyName>
Expand All @@ -8,12 +10,12 @@
</PropertyGroup>

<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
<ProjectReference Include="..\Generator\Generator.csproj" OutputItemType="CodeGenerationRoslynPlugin" PrivateAssets="all" />
<PackageReference Include="CodeGeneration.Roslyn.Tool" Version="0.7.63">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="CodeGeneration.Roslyn.Tool" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Attributes\Attributes.csproj" />
<ProjectReference Include="..\Generator\Generators.csproj" OutputItemType="CodeGenerationRoslynPlugin" ReferenceOutputAssembly="false" SkipGetTargetFrameworkProperties="true" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Obviously.SemanticTypes.Generator.Templates.AspNetCore.ModelBinding
#pragma warning disable IDE0001
public sealed class ManualGuidSemanticTypeModelBinderProvider : global::Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinderProvider
{
public global::Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder GetBinder(global::Microsoft.AspNetCore.Mvc.ModelBinding.ModelBinderProviderContext context)
public global::Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder? GetBinder(global::Microsoft.AspNetCore.Mvc.ModelBinding.ModelBinderProviderContext context)
{
if (context is null) throw new global::System.ArgumentNullException(nameof(context));
var metadataForType = context.MetadataProvider.GetMetadataForType(typeof(Guid));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Obviously.SemanticTypes.Generator.Templates.AspNetCore.ModelBinding
{
[Route("api/[controller]")]
[Route("api/modelbinding")]
public class ModelBindingController
{
[HttpGet("int/{id}")]
Expand Down
57 changes: 0 additions & 57 deletions src/semantictypes/Generator/Generator.csproj

This file was deleted.

34 changes: 34 additions & 0 deletions src/semantictypes/Generators/Generators.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="CodeGeneration.Roslyn.Plugin.Sdk" />
<Sdk Name="Microsoft.Build.CentralPackageVersions" />

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>Obviously.SemanticTypes.Generator</AssemblyName>
<RootNamespace>Obviously.SemanticTypes.Generator</RootNamespace>
<PackageId>Obviously.SemanticTypes.Generator</PackageId>
<Description>A code generator for semantic types.</Description>
<PackageTags>codegenerator semantic-types</PackageTags>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
</PropertyGroup>

<PropertyGroup>
<IsNuGetPackage>true</IsNuGetPackage>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\..\LICENSE" Pack="true" PackagePath="" />
<Compile Include="../Attributes/*.cs" Link="Attributes/%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup Label="Nested Partial Files">
<Compile Update="SemanticTypeGenerator.*.cs">
<DependentUpon>SemanticTypeGenerator.cs</DependentUpon>
</Compile>
<Compile Update="Modules\AspNetCoreModelBinding.*.cs">
<DependentUpon>Modules\AspNetCoreModelBinding.cs</DependentUpon>
</Compile>
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions src/semantictypes/Meta/Meta.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="CodeGeneration.Roslyn.PluginMetapackage.Sdk" />

<PropertyGroup>
<TargetFramework>netstandard1.0</TargetFramework>
<IsNuGetPackage>true</IsNuGetPackage>
<PackageId>Obviously.SemanticTypes</PackageId>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Attributes\Attributes.csproj" />
<NupkgAdditionalDependency Include="Obviously.SemanticTypes.Generators" IncludeAssets="all" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions src/semantictypes/Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<ItemGroup>
<PackageReference Update="CodeGeneration.Roslyn" Version="0.7.63" />
<PackageReference Update="CodeGeneration.Roslyn.Attributes" Version="0.7.63" />
<PackageReference Update="CodeGeneration.Roslyn.Tool" Version="0.7.63" PrivateAssets="all" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="[3.4.0]" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="[3.4.0]" />
<PackageReference Update="System.Collections.Immutable" Version="1.7.0" />
<PackageReference Update="Microsoft.CodeAnalysis.Analyzers" Version="3.0.0" />
<PackageReference Update="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" />
<PackageReference Update="FluentAssertions" Version="5.10.3" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.3" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Update="xunit.core" Version="2.4.1" />
<PackageReference Update="xunit.analyzers" Version="0.10.0" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Update="coverlet.collector" Version="1.2.1" />
<PackageReference Update="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Update="Namotion.Reflection" Version="1.0.8" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.3" />
</ItemGroup>

</Project>
34 changes: 33 additions & 1 deletion src/semantictypes/SemanticTypes.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
MinimumVisualStudioVersion = 15.0.26124.0
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Generator", "Generator\Generator.csproj", "{D267CE94-C333-4717-B964-A7DCA9304261}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Generators", "Generators\Generators.csproj", "{D267CE94-C333-4717-B964-A7DCA9304261}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StaticTests", "StaticTests\StaticTests.csproj", "{0D2BD227-D92C-4F23-8D05-C862B874A59D}"
ProjectSection(ProjectDependencies) = postProject
Expand All @@ -14,13 +14,21 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
..\..\CHANGELOG.md = ..\..\CHANGELOG.md
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
global.json = global.json
Packages.props = Packages.props
..\..\Readme.md = ..\..\Readme.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Generator.Templates.AspNetCore", "Generator.Templates.AspNetCore\Generator.Templates.AspNetCore.csproj", "{1EAA0057-2B19-42FC-A4BC-D18290063F08}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Generator.Templates.AspNetCore.Tests", "Generator.Templates.AspNetCore.Tests\Generator.Templates.AspNetCore.Tests.csproj", "{BC2A09FA-6D89-485B-987C-4D8661ADCCD5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meta", "Meta\Meta.csproj", "{E0973E9B-C064-4A5E-95E4-B2189C309426}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Attributes", "Attributes\Attributes.csproj", "{9A585685-B62D-4AFB-9055-2AD0F2C68398}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -79,6 +87,30 @@ Global
{BC2A09FA-6D89-485B-987C-4D8661ADCCD5}.Release|x64.Build.0 = Release|Any CPU
{BC2A09FA-6D89-485B-987C-4D8661ADCCD5}.Release|x86.ActiveCfg = Release|Any CPU
{BC2A09FA-6D89-485B-987C-4D8661ADCCD5}.Release|x86.Build.0 = Release|Any CPU
{E0973E9B-C064-4A5E-95E4-B2189C309426}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E0973E9B-C064-4A5E-95E4-B2189C309426}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0973E9B-C064-4A5E-95E4-B2189C309426}.Debug|x64.ActiveCfg = Debug|Any CPU
{E0973E9B-C064-4A5E-95E4-B2189C309426}.Debug|x64.Build.0 = Debug|Any CPU
{E0973E9B-C064-4A5E-95E4-B2189C309426}.Debug|x86.ActiveCfg = Debug|Any CPU
{E0973E9B-C064-4A5E-95E4-B2189C309426}.Debug|x86.Build.0 = Debug|Any CPU
{E0973E9B-C064-4A5E-95E4-B2189C309426}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0973E9B-C064-4A5E-95E4-B2189C309426}.Release|Any CPU.Build.0 = Release|Any CPU
{E0973E9B-C064-4A5E-95E4-B2189C309426}.Release|x64.ActiveCfg = Release|Any CPU
{E0973E9B-C064-4A5E-95E4-B2189C309426}.Release|x64.Build.0 = Release|Any CPU
{E0973E9B-C064-4A5E-95E4-B2189C309426}.Release|x86.ActiveCfg = Release|Any CPU
{E0973E9B-C064-4A5E-95E4-B2189C309426}.Release|x86.Build.0 = Release|Any CPU
{9A585685-B62D-4AFB-9055-2AD0F2C68398}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A585685-B62D-4AFB-9055-2AD0F2C68398}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A585685-B62D-4AFB-9055-2AD0F2C68398}.Debug|x64.ActiveCfg = Debug|Any CPU
{9A585685-B62D-4AFB-9055-2AD0F2C68398}.Debug|x64.Build.0 = Debug|Any CPU
{9A585685-B62D-4AFB-9055-2AD0F2C68398}.Debug|x86.ActiveCfg = Debug|Any CPU
{9A585685-B62D-4AFB-9055-2AD0F2C68398}.Debug|x86.Build.0 = Debug|Any CPU
{9A585685-B62D-4AFB-9055-2AD0F2C68398}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A585685-B62D-4AFB-9055-2AD0F2C68398}.Release|Any CPU.Build.0 = Release|Any CPU
{9A585685-B62D-4AFB-9055-2AD0F2C68398}.Release|x64.ActiveCfg = Release|Any CPU
{9A585685-B62D-4AFB-9055-2AD0F2C68398}.Release|x64.Build.0 = Release|Any CPU
{9A585685-B62D-4AFB-9055-2AD0F2C68398}.Release|x86.ActiveCfg = Release|Any CPU
{9A585685-B62D-4AFB-9055-2AD0F2C68398}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Loading

0 comments on commit 47ca5c3

Please sign in to comment.