Skip to content
This repository was archived by the owner on May 21, 2018. It is now read-only.

Pull request of my last version #50

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ _ReSharper.T4TS.Example
T4TS.Build/_ReSharper.T4TS.Build
!buid/T4TS.Attributes.dll
packages/
*.user
/T4TS.Example/T4TS.d.ts
*.ts
*.nupkg
Binary file added .nuget/NuGet.exe
Binary file not shown.
40 changes: 16 additions & 24 deletions .nuget/NuGet.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>

<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>

Expand All @@ -11,11 +11,11 @@

<!-- Determines if package restore consent is required to restore packages -->
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>

<!-- Download NuGet.exe if it does not already exist -->
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
</PropertyGroup>

<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
Expand All @@ -28,36 +28,28 @@
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
</PropertyGroup>

<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
</PropertyGroup>

<PropertyGroup>
<PackagesProjectConfig Condition=" '$(OS)' == 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
<PackagesProjectConfig Condition=" '$(OS)' != 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesProjectConfig>
</PropertyGroup>

<PropertyGroup>
<PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
<PackagesConfig Condition="Exists('$(PackagesProjectConfig)')">$(PackagesProjectConfig)</PackagesConfig>
<PackagesConfig>packages.config</PackagesConfig>
</PropertyGroup>

<PropertyGroup>
<!-- NuGet command -->
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>

<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 "$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>

<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>

<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>

<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>

Expand Down Expand Up @@ -93,24 +85,24 @@
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
</Target>

<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)"
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />

<Exec Command="$(RestoreCommand)"
LogStandardErrorAsError="true"
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
</Target>

<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(BuildCommand)"
<Exec Command="$(BuildCommand)"
Condition=" '$(OS)' != 'Windows_NT' " />

<Exec Command="$(BuildCommand)"
LogStandardErrorAsError="true"
Condition=" '$(OS)' == 'Windows_NT' " />
</Target>

<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
Expand Down Expand Up @@ -141,4 +133,4 @@
</Code>
</Task>
</UsingTask>
</Project>
</Project>
2 changes: 2 additions & 0 deletions NuGet_pack.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.nuget\NuGet Update -self
.nuget\NuGet pack T4TS.nuspec -Prop Configuration=Release -IncludeReferencedProjects
4 changes: 4 additions & 0 deletions Nuget-Pack.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$thisDir = (Split-Path $MyInvocation.MyCommand.Path)
Set-Alias nuget "$thisDir/.nuget/Nuget.exe"
nuget update -Self
nuget pack T4TS.nuspec -Prop Configuration=Release -IncludeReferencedProjects
7 changes: 5 additions & 2 deletions T4TS.Attributes/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly: AssemblyTitle("T4TS.Attributes")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
Expand All @@ -17,9 +17,11 @@
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.

[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM

[assembly: Guid("b31f4cfe-d412-4273-9dd4-46672802145d")]

// Version information for an assembly consists of the following four values:
Expand All @@ -32,5 +34,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
8 changes: 2 additions & 6 deletions T4TS.Attributes/T4TS.Attributes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ProjectGuid>{AF50A5E0-791D-47D4-91FE-56A7CE4577EB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>T4TS.Attributes</RootNamespace>
<RootNamespace>T4TS</RootNamespace>
<AssemblyName>T4TS.Attributes</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
Expand All @@ -30,13 +30,9 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TypeScriptEnumAttribute.cs" />
<Compile Include="TypeScriptInterfaceAttribute.cs" />
<Compile Include="TypeScriptMemberAttribute.cs" />
</ItemGroup>
Expand Down
28 changes: 28 additions & 0 deletions T4TS.Attributes/TypeScriptEnumAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;

namespace T4TS
{
/// <summary>
/// Add this attribute to an enum to generate a corresponding TypeScript enum.
/// </summary>
[AttributeUsage(AttributeTargets.Enum, AllowMultiple = false, Inherited = true)]
public class TypeScriptEnumAttribute : Attribute
{
/// <summary>
/// Specifies which module the enum should be placed.
/// The default module will be used if not specified.
/// </summary>
public string Module { get; set; }

/// <summary>
/// The name of the enum.
/// If not specified, the name of the class will be used.
/// </summary>
public string Name { get; set; }

/// <summary>
/// If specified, the enum name will be prefixed with this string.
/// </summary>
public string NamePrefix { get; set; }
}
}
16 changes: 8 additions & 8 deletions T4TS.Attributes/TypeScriptInterfaceAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
namespace T4TS
{
/// <summary>
/// Add this attribute to a class to generate a corresponding TypeScript interface.
/// Add this attribute to a class to generate a corresponding TypeScript interface.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple=false, Inherited=true)]
public class TypeScriptInterfaceAttribute: Attribute
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public class TypeScriptInterfaceAttribute : Attribute
{
/// <summary>
/// Specifies which module the interface should be placed.
/// The default module will be used if not specified.
/// Specifies which module the interface should be placed.
/// The default module will be used if not specified.
/// </summary>
public string Module { get; set; }

/// <summary>
/// The name of the interface.
/// If not specified, the name of the class will be used.
/// The name of the interface.
/// If not specified, the name of the class will be used.
/// </summary>
public string Name { get; set; }

/// <summary>
/// If specified, the interface name will be prefixed with this string.
/// If specified, the interface name will be prefixed with this string.
/// </summary>
public string NamePrefix { get; set; }
}
Expand Down
26 changes: 13 additions & 13 deletions T4TS.Attributes/TypeScriptMemberAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,38 @@
namespace T4TS
{
/// <summary>
/// Add this attribute to a property to customize the generated interface member
/// Add this attribute to a property to customize the generated interface member
/// </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple=false, Inherited=true)]
public class TypeScriptMemberAttribute: Attribute
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class TypeScriptMemberAttribute : Attribute
{
/// <summary>
/// The member name in the interface.
/// If not specified, the property name will be used.
/// The member name in the interface.
/// If not specified, the property name will be used.
/// </summary>
public string Name { get; set; }

/// <summary>
/// Specify if the member should be optional, ie. "name?: type".
/// If not specified, the default value will be used (see settings).
/// Specify if the member should be optional, ie. "name?: type".
/// If not specified, the default value will be used (see settings).
/// </summary>
public bool Optional { get; set; }

/// <summary>
/// Specify which type the interface member will have.
/// If not specified, a suitable type will be determined.
/// Specify which type the interface member will have.
/// If not specified, a suitable type will be determined.
/// </summary>
public string Type { get; set; }

/// <summary>
/// If set to true, the first character of the member name will be lower cased.
/// If not specified, the default value will be used (see settings).
/// If set to true, the first character of the member name will be lower cased.
/// If not specified, the default value will be used (see settings).
/// </summary>
public bool CamelCase { get; set; }

/// <summary>
/// If set to true, this property will be ignored.
/// If set to true, this property will be ignored.
/// </summary>
public bool Ignore { get; set; }
}
}
}
4 changes: 2 additions & 2 deletions T4TS.Build.Builder/Properties/Resources.Designer.cs

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

21 changes: 20 additions & 1 deletion T4TS.Build.Builder/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,26 @@ readonly Dictionary&lt;string, object&gt; SettingsValues = new Dictionary&lt;str

// The default value for DateTime type translation.
// Type: bool?, defaults to false if not specified.
{ "UseNativeDates", null }
{ "UseNativeDates", null },

// List of the project names to process divided with comma to process.
// Type: string, defaults to null if not specified means that the all projects in solution should be processed.
{ "ProjectNamesToProcess", null },
// { "ProjectNamesToProcess", "T4TS.Example_, T4TS.Example.Models" },

// If equals true - classes marked with DataContractAttribute will be processed.
// Type: bool?, defaults to false if not specified.
{ "ProcessDataContracts", null },

// If equals true - - parent classes will be processed even if they weren't marked with TypeScriptInterfaceAttribute or DataContractAttribute.
// Type: bool?, defaults to false if not specified.
{ "ProcessParentClasses", null },

// Additional list of the additional attribute short names which prevents processing of the members.
// Type: string, defaults to null if not specified means that the the properties marked with JsonIgnoreAttribute will be ignored.
{ "MemberIgnoreAttributes", null }
// { "MemberIgnoreAttributes", "JsonIgnoreAttribute, XmlIgnoreAttribute" }

};
#&gt;</value>
<comment>The contents of the generated template settings file T4TS.tt.settings.t4</comment>
Expand Down
Loading