Skip to content

Commit

Permalink
Add experimental depending only mscorlib assembly (Unity3D.Micro). Re…
Browse files Browse the repository at this point in the history
…lated to Issue #72.
  • Loading branch information
yfakariya committed May 23, 2015
1 parent 5cba15e commit 495add6
Show file tree
Hide file tree
Showing 29 changed files with 1,201 additions and 32 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ Release 0.6.0 Beta2 - 2015/05/24

NEW FEATURE
* New utility method of SerializationContext to switch back the behavior to previous version's one.
* Add corlib only build (MsgPack.Unity3D.Micro). This build only depends mscorlib. This feature is experimental. Related to Issue #72.

IMPROVEMENTS
* Add many workarounds for AOT issues of Mono on iOS (in particular, Unity).
Expand Down
33 changes: 33 additions & 0 deletions MsgPack.compats.sln
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NUnitLiteRunner", "..\..\Yu
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite-3.5", "..\..\Yusuke\Documents\git\msgpack-cli\test\NUnitLite\src\framework\nunitlite-3.5.csproj", "{43B24DC5-16D6-45EF-93F1-B021B785A892}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MsgPack.Unity3D.Micro", "src\MsgPack.Unity3D.Micro\MsgPack.Unity3D.Micro.csproj", "{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CodeAnalysis|Any CPU = CodeAnalysis|Any CPU
Expand Down Expand Up @@ -299,6 +301,36 @@ Global
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Release|ARM.ActiveCfg = Release|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Release|x64.ActiveCfg = Release|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Release|x86.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.CodeAnalysis|Any CPU.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.CodeAnalysis|Any CPU.Build.0 = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.CodeAnalysis|ARM.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.CodeAnalysis|x64.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.CodeAnalysis|x86.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.CoreProfile|Any CPU.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.CoreProfile|Any CPU.Build.0 = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.CoreProfile|ARM.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.CoreProfile|x64.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.CoreProfile|x86.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.Debug|ARM.ActiveCfg = Debug|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.Debug|x64.ActiveCfg = Debug|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.Debug|x86.ActiveCfg = Debug|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.Instrument|Any CPU.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.Instrument|Any CPU.Build.0 = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.Instrument|ARM.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.Instrument|x64.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.Instrument|x86.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.PerformanceTest|Any CPU.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.PerformanceTest|Any CPU.Build.0 = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.PerformanceTest|ARM.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.PerformanceTest|x64.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.PerformanceTest|x86.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.Release|Any CPU.Build.0 = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.Release|ARM.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.Release|x64.ActiveCfg = Release|Any CPU
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -315,5 +347,6 @@ Global
{767C2A1C-53F8-4048-BE02-CB4393B1CEB6} = {87A17015-9338-431E-B338-57BDA03984C1}
{12047296-B817-4C1A-B01B-5E619F72E407} = {767C2A1C-53F8-4048-BE02-CB4393B1CEB6}
{43B24DC5-16D6-45EF-93F1-B021B785A892} = {767C2A1C-53F8-4048-BE02-CB4393B1CEB6}
{B752BA0A-72A8-4EE8-AF44-D4F5A55A6121} = {936467D2-1DD3-4243-BBB4-FCCB2CA1E3AC}
EndGlobalSection
EndGlobal
11 changes: 11 additions & 0 deletions Sync.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@
<Exclude Path="Validation.cs" />
</Project>

<Project Name="MsgPack.Unity3D.Micro" Base="MsgPack.Unity3D">
<Preserve Path="Properties\AssemblyInfo.cs" />
<Preserve Path="MicroCorLibHelper*.tt" />
<Preserve Path="MicroCorLibHelper*.cs" />
<Exclude Path="Serialization\AotHelper*.tt" />
<Exclude Path="Serialization\DefaultSerializers\System_Collections_Generic_Queue_1MessagePackSerializer`1.cs" />
<Exclude Path="Serialization\DefaultSerializers\System_Collections_Generic_Stack_1MessagePackSerializer`1.cs" />
<Exclude Path="Serialization\DefaultSerializers\System_Collections_Specialized_NameValueCollectionMessagePackSerializer.cs" />
<Exclude Path="Serialization\DefaultSerializers\System_UriMessagePackSerializer.cs" />
</Project>

<Project Name="MsgPack.WinRT.Portable" Base="MsgPack">
<Preserve Path="Properties\AssemblyInfo.cs" />
<Exclude File="*.tt" />
Expand Down
86 changes: 86 additions & 0 deletions src/MsgPack.Unity3D.Micro/MicroCorLibHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2015 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion -- License Terms --

using System;
using System.Collections.Generic;

namespace MsgPack
{
#if CORLIB_ONLY
internal sealed class BooleanStack
{
private readonly List<Boolean> _list;

public int Count { get { return this._list.Count; } }

public BooleanStack( int initialCapacity )
{
this._list = new List<Boolean>( initialCapacity );
}

public void Push( Boolean value )
{
this._list.Add( value );
}

public Boolean Peek()
{
return this._list[ this._list.Count - 1 ];
}

public Boolean Pop()
{
var result = this.Peek();
this._list.RemoveAt( this._list.Count - 1 );
return result;
}
}

internal sealed class Int64Stack
{
private readonly List<Int64> _list;

public int Count { get { return this._list.Count; } }

public Int64Stack( int initialCapacity )
{
this._list = new List<Int64>( initialCapacity );
}

public void Push( Int64 value )
{
this._list.Add( value );
}

public Int64 Peek()
{
return this._list[ this._list.Count - 1 ];
}

public Int64 Pop()
{
var result = this.Peek();
this._list.RemoveAt( this._list.Count - 1 );
return result;
}
}

#endif // CORLIB_ONLY
}
70 changes: 70 additions & 0 deletions src/MsgPack.Unity3D.Micro/MicroCorLibHelper.tt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ output extension=".cs" #>
#region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2015 FUJIWARA, Yusuke
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion -- License Terms --

using System;
using System.Collections.Generic;

namespace MsgPack
{
#if CORLIB_ONLY
<#
foreach ( var itemType in new[] { typeof( bool ), typeof( long ) } )
{
#>
internal sealed class <#= itemType.Name #>Stack
{
private readonly List<<#= itemType.Name #>> _list;

public int Count { get { return this._list.Count; } }

public <#= itemType.Name #>Stack( int initialCapacity )
{
this._list = new List<<#= itemType.Name #>>( initialCapacity );
}

public void Push( <#= itemType.Name #> value )
{
this._list.Add( value );
}

public <#= itemType.Name #> Peek()
{
return this._list[ this._list.Count - 1 ];
}

public <#= itemType.Name #> Pop()
{
var result = this.Peek();
this._list.RemoveAt( this._list.Count - 1 );
return result;
}
}

<#
}
#>
#endif // CORLIB_ONLY
}
Loading

0 comments on commit 495add6

Please sign in to comment.