Skip to content

Commit 8d3989f

Browse files
authored
Add uap tfm (protobuf-net#411)
* failed attempt to add uap targets * fix broken global.json; start configuring uap1.0 TFM * show current state * UAP tweaks; ref protobuf-net#409 * package 2.3.14-alpha1
1 parent 4b23962 commit 8d3989f

File tree

9 files changed

+30
-13
lines changed

9 files changed

+30
-13
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ To understand how protobuf-net relates to protobuf [see here](https://mgravell.g
1212
## Supported Runtimes
1313
- .NET Framework 2.0+
1414
- .NET Standard 1.0+ (note that 1.0 is very restricted, and suits iOS etc; use the highest .NET Standard that works for your platform)
15+
- UAP 10.0(+?)
1516

1617
It is possible to build for more specific TFMs, but *right now* I've simplified the build to those. If you need help
1718
with a custom build: let me know.
@@ -113,7 +114,8 @@ There is no special significance in the 7 above; it is an integer key, just like
113114

114115
### .proto file
115116

116-
As an alternative to writing your classes and decorating them, You can generate your types from a .proto schema using [`protogen`](https://protogen.marcgravell.com/).
117+
As an alternative to writing your classes and decorating them, You can generate your types from a .proto schema using [`protogen`](https://protogen.marcgravell.com/);
118+
the `protogen` tool is available as a zip from that location, or [as a "global tool"](https://www.nuget.org/packages/protobuf-net.Protogen) (multi-platform).
117119

118120
### Alternative to attributes
119121

docs/releasenotes.md

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ Alternatively, use Visual Studio 2017 ([community edition is free](https://www.v
2828

2929
- fix #406 - relative and wildcard paths (`*.proto` etc) failed on `netcoreapp2.1`, impacting the "global tool"
3030

31+
## protobuf-net v2.3.14-alpha1
32+
33+
- attempt to add UAP TFM
34+
3135
## protobuf-net v2.3.13
3236

3337
- **IMPORTANT** fix #403 - key cache was incorrect in some cases involving multi-level inheritance; update from 2.3.8 or above is highly recommended

global.json

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
"sdk": {
33
"version": "2.1.300"
4+
},
5+
"msbuild-sdks": {
6+
"MSBuild.Sdk.Extras": "1.5.4",
7+
"__MSBuild.Sdk.Extras": "1.6.20-preview"
48
}
59
}

src/Directory.build.props

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project>
22
<PropertyGroup>
3-
<VersionPrefix>2.3.13</VersionPrefix>
3+
<VersionPrefix>2.3.14</VersionPrefix>
44
<ProtoGenVersion>1.0.9</ProtoGenVersion>
5-
<VersionSuffix></VersionSuffix>
5+
<VersionSuffix>alpha1</VersionSuffix>
66
<RootNamespace>ProtoBuf</RootNamespace>
77
<Authors>Marc Gravell</Authors>
88
<OutputType>Library</OutputType>

src/LongDataTests/LongDataTests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp1.1</TargetFramework>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
55
<GenerateDocumentationFile>false</GenerateDocumentationFile>
66
<Configurations>Debug;Release;VS</Configurations>
77
</PropertyGroup>

src/protobuf-net.sln

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{0A6E81
1515
ProjectSection(SolutionItems) = preProject
1616
Tools\bcl.proto = Tools\bcl.proto
1717
Directory.build.props = Directory.build.props
18-
global.json = global.json
18+
..\global.json = ..\global.json
1919
..\docs\index.md = ..\docs\index.md
2020
Tools\protogen.proto = Tools\protogen.proto
2121
..\README.md = ..\README.md
@@ -33,7 +33,7 @@ Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "VBTest", "VBTest\VBTest.vbp
3333
EndProject
3434
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpTest", "CSharpTest\CSharpTest.csproj", "{3C7D830B-7A76-43FD-8FFB-95E9E4231653}"
3535
EndProject
36-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "protobuf-net.Protogen", "protobuf-net.Protogen\protobuf-net.Protogen.csproj", "{D80F8D08-66B1-46C2-B882-7A0CE45B6C2D}"
36+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "protobuf-net.Protogen", "protobuf-net.Protogen\protobuf-net.Protogen.csproj", "{D80F8D08-66B1-46C2-B882-7A0CE45B6C2D}"
3737
EndProject
3838
Global
3939
GlobalSection(SolutionConfigurationPlatforms) = preSolution

src/protobuf-net/Meta/MetaType.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1894,8 +1894,8 @@ internal void WriteSchema(System.Text.StringBuilder builder, int indent, ref Run
18941894
if(field.IsStatic && field.IsLiteral)
18951895
{
18961896
object enumVal;
1897-
#if WINRT || PORTABLE || CF || FX11 || NETSTANDARD1_3 || NETSTANDARD1_4 || PROFILE259
1898-
enumVal = Convert.ChangeType(field.GetValue(null), Enum.GetUnderlyingType(field.FieldType), System.Globalization.CultureInfo.InvariantCulture);
1897+
#if WINRT || PORTABLE || CF || FX11 || NETSTANDARD1_3 || NETSTANDARD1_4 || PROFILE259 || UAP
1898+
enumVal = Convert.ChangeType(field.GetValue(null), Enum.GetUnderlyingType(field.FieldType), System.Globalization.CultureInfo.InvariantCulture);
18991899
#else
19001900
enumVal = field.GetRawConstantValue();
19011901
#endif

src/protobuf-net/Serializers/TypeSerializer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ object CreateInstance(ProtoReader source, bool includeLocalCallback)
318318

319319
#else
320320
obj = Activator.CreateInstance(constructType
321-
#if !(CF || SILVERLIGHT || WINRT || PORTABLE || NETSTANDARD1_3 || NETSTANDARD1_4)
321+
#if !(CF || SILVERLIGHT || WINRT || PORTABLE || NETSTANDARD1_3 || NETSTANDARD1_4 || UAP)
322322
, nonPublic: true
323323
#endif
324324
);

src/protobuf-net/protobuf-net.csproj

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="MSBuild.Sdk.Extras">
22
<PropertyGroup>
33
<AssemblyName>protobuf-net</AssemblyName>
44
<Title>protobuf-net</Title>
55
<Description>Provides simple access to fast and efficient "Protocol Buffers" serialization from .NET applications</Description>
6-
<TargetFrameworks>net20;net35;net40;netstandard1.0;netstandard1.3;netstandard2.0</TargetFrameworks>
6+
<TargetFrameworks>net20;net35;net40;netstandard1.0;netstandard1.3;netstandard2.0;uap10.0</TargetFrameworks>
77
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
88
<DefineConstants>EMIT_ASSEMBLY_INFO</DefineConstants>
99
<!-- new build tools spit these out -->
@@ -24,6 +24,12 @@
2424
<PropertyGroup Condition="'$(TargetFramework)' == 'net20'">
2525
<FeatureServiceModel>false</FeatureServiceModel>
2626
</PropertyGroup>
27+
<PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0'">
28+
<FeatureServiceModel>false</FeatureServiceModel>
29+
<FeatureCompiler>false</FeatureCompiler>
30+
<PlatformBinaryFormatter>false</PlatformBinaryFormatter>
31+
<DefineConstants>$(DefineConstants);COREFX;UAP</DefineConstants>
32+
</PropertyGroup>
2733
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.0'">
2834
<DefineConstants>$(DefineConstants);PROFILE259;FEAT_SAFE</DefineConstants>
2935
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -65,10 +71,11 @@
6571
<Reference Include="System.Configuration" />
6672
<Reference Include="System.Runtime.Serialization" />
6773
</ItemGroup>
68-
<ItemGroup Condition="'$(ImportLibs)' == 'core'">
69-
<!-- could make this more granular to respect the options, but no need yet -->
74+
<ItemGroup Condition="'$(ImportLibs)' == 'core' and '$(FeatureCompiler)' == 'true'">
7075
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
7176
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
77+
</ItemGroup>
78+
<ItemGroup Condition="'$(ImportLibs)' == 'core'">
7279
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.4.0" />
7380
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
7481
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />

0 commit comments

Comments
 (0)