Skip to content

Commit

Permalink
Initial implementation of With method generation
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhailshilkov committed May 3, 2016
0 parents commit 4b06174
Show file tree
Hide file tree
Showing 28 changed files with 971 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text

# Don't check these into the repo as LF to work around TeamCity bug
*.xml -text
*.targets -text

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Denote all files that are truly binary and should not be modified.
*.dll binary
*.exe binary
*.png binary
*.ico binary
*.snk binary
*.pdb binary
77 changes: 77 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#################
## Visual Studio
#################

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates
*.pidb

*.ncrunchsolution

# Build results
[Dd]ebug/
[Rr]elease/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
.builds
*.dotCover

## If you have NuGet Package Restore enabled, uncomment this
packages/
ForSample/
NugetBuild/

# Visual Studio profiler
*.psess
*.vsp

# ReSharper is a .NET coding add-in
_ReSharper*

# Others
[Bb]in
[Oo]bj
sql
TestResults
*.Cache
ClientBin
stylecop.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML


############
## Windows
############

# Windows image file caches
Thumbs.db

# Folder config file
Desktop.ini

50 changes: 50 additions & 0 deletions AssemblyToProcess/AssemblyToProcess.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E97E649F-B703-47E3-B18A-0871D3498742}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AssemblyToProcess</RootNamespace>
<AssemblyName>AssemblyToProcess</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="NoMatchingProperty.cs" />
<Compile Include="MultipleConstructors.cs" />
<Compile Include="ConstructorWithSingleArgument.cs" />
<Compile Include="NoConstructor.cs" />
<Compile Include="PropertiesOfSameType.cs" />
<Compile Include="PrimitiveValues.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
19 changes: 19 additions & 0 deletions AssemblyToProcess/ConstructorWithSingleArgument.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AssemblyToProcess
{
public class ConstructorWithSingleArgument
{
public ConstructorWithSingleArgument(int value1)
{
this.Value1 = value1;
}

public int Value1 { get; set; }

public string Value2 { get; set; }
}
}
25 changes: 25 additions & 0 deletions AssemblyToProcess/MultipleConstructors.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AssemblyToProcess
{
public class MultipleConstructors
{
public MultipleConstructors(int value1, string value2)
{
this.Value1 = value1;
this.Value2 = value2;
}

public MultipleConstructors(int value1)
{
this.Value1 = value1;
}

public int Value1 { get; set; }

public string Value2 { get; set; }
}
}
14 changes: 14 additions & 0 deletions AssemblyToProcess/NoConstructor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AssemblyToProcess
{
public class NoConstructor
{
public int Value1 { get; set; }

public string Value2 { get; set; }
}
}
20 changes: 20 additions & 0 deletions AssemblyToProcess/NoMatchingProperty.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AssemblyToProcess
{
public class NoMatchingProperty
{
public NoMatchingProperty(int value1, string value2, long value3)
{
this.Value1 = value1;
this.Value2 = value2;
}

public int Value1 { get; set; }

public string Value2 { get; set; }
}
}
19 changes: 19 additions & 0 deletions AssemblyToProcess/PrimitiveValues.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

namespace AssemblyToProcess
{
public class PrimitiveValues
{
public PrimitiveValues(int value1, string value2, long value3)
{
this.Value1 = value1;
this.Value2 = value2;
this.Value3 = value3;
}

public int Value1 { get; }

public string Value2 { get; }

public long Value3 { get; }
}
}
19 changes: 19 additions & 0 deletions AssemblyToProcess/PropertiesOfSameType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

namespace AssemblyToProcess
{
public class PropertiesOfSameType
{
public PropertiesOfSameType(int value1, int value2, int value3)
{
this.Value1 = value1;
this.Value2 = value2;
this.Value3 = value3;
}

public int Value1 { get; }

public int Value2 { get; }

public int Value3 { get; }
}
}
1 change: 1 addition & 0 deletions Content/ToBeDeleted.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions NuGet/Fody_ToBeDeleted.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

51 changes: 51 additions & 0 deletions NuGet/Nuget.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{63786CE5-D899-43DF-AD4E-C2CA3BAC3FC2}</ProjectGuid>
<NuGetPackageImportStamp>8682f2ae</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<ConfigurationName>Debug</ConfigurationName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<ConfigurationName>Release</ConfigurationName>
</PropertyGroup>
<ItemGroup>
<None Include="WithFodyAddin.Fody.nuspec">
<SubType>Designer</SubType>
</None>
<None Include="install.ps1" />
<None Include="packages.config" />
<None Include="uninstall.ps1" />
</ItemGroup>
<Target Name="Clean">
<RemoveDir Directories="$(SolutionDir)NuGetBuild" />
</Target>
<Target Name="Build" DependsOnTargets="NuGetBuild" />
<Target Name="ReBuild" DependsOnTargets="NuGetBuild" />
<Target Name="NuGetBuild" DependsOnTargets="Clean">
<MakeDir Directories="$(SolutionDir)NuGetBuild" />
<Copy SourceFiles="$(SolutionDir)NuGet\WithFodyAddin.Fody.nuspec" DestinationFolder="$(SolutionDir)NuGetBuild" />
<Copy SourceFiles="$(SolutionDir)WithFodyAddin\bin\$(ConfigurationName)\WithFodyAddin.Fody.dll" DestinationFolder="$(SolutionDir)NuGetBuild" />
<Copy SourceFiles="$(SolutionDir)NuGet\Fody_ToBeDeleted.txt" DestinationFolder="$(SolutionDir)NuGetBuild\Content" />
<Copy SourceFiles="$(ProjectDir)install.ps1" DestinationFolder="$(SolutionDir)NuGetBuild\Tools" />
<Copy SourceFiles="$(ProjectDir)uninstall.ps1" DestinationFolder="$(SolutionDir)NuGetBuild\Tools" />
<PepitaPackage.CreatePackageTask NuGetBuildDirectory="$(SolutionDir)NuGetBuild" MetadataAssembly="$(SolutionDir)WithFodyAddin\bin\$(ConfigurationName)\WithFodyAddin.Fody.dll" />
</Target>
<ItemGroup>
<ProjectReference Include="..\WithFodyAddin\WithFodyAddin.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<Project>{C3578A7B-09A6-4444-9383-0DEAFA4958BD}</Project>
<Name>WithFodyAddin</Name>
</ProjectReference>
</ItemGroup>
<Import Project="..\packages\PepitaPackage.1.21.4\build\PepitaPackage.targets" Condition="Exists('..\packages\PepitaPackage.1.21.4\build\PepitaPackage.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\PepitaPackage.1.21.4\build\PepitaPackage.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\PepitaPackage.1.21.4\build\PepitaPackage.targets'))" />
</Target>
</Project>
22 changes: 22 additions & 0 deletions NuGet/WithFodyAddin.Fody.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.8">
<id>WithFodyAddin.Fody</id>
<version>$version$</version>
<title>WithFodyAddin.Fody</title>
<authors>Mikhail Shilkov</authors>
<owners>Mikhail Shilkov</owners>
<developmentDependency>true</developmentDependency>
<licenseUrl>http://www.opensource.org/licenses/mit-license.php</licenseUrl>
<projectUrl>https://github.com/mikhailshilkov/WithFodyAddin</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<iconUrl>https://raw.github.com/Fody/BasicFodyAddin/master/Icons/package_icon.png</iconUrl>
<description>A Fody addin to add With methods to immutable C# classes, inspired by F# with keyword for records.</description>
<summary />
<language>en-UK</language>
<tags>ILWeaving, Fody, Cecil</tags>
<dependencies>
<dependency id="Fody"/>
</dependencies>
</metadata>
</package>
Loading

0 comments on commit 4b06174

Please sign in to comment.