Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Commit

Permalink
use Nerdbank.GitVersioning (#101)
Browse files Browse the repository at this point in the history
* add Nerdbank.GitVersioning

* temp remove SourceLink

* try switching Froto.Parser.Test from netsoreapp2.0 to 2.1

* use Froto.sln

* latest dotnet 2.2.3

* try 2.2.2

* sdk is 2.2.105

* dist: xenial

* remove Froto.TypeProvider from Froto.sln

* back to netcoreapp2.0

* git fetch --unshallow

* Revert "fix Enum in message body error (#96)"

This reverts commit 40a86c7.

* add version.json

* disable nbgv for exe

* use previous SourceLink
dotnet/sourcelink#236

* PrivateAssets="All"

* upgrade to Nerdbank.GitVersioning" Version="2.3.136

* remove Break()
  • Loading branch information
ctaggart committed Mar 19, 2019
1 parent 40a86c7 commit 70c2685
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 85 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -11,4 +11,6 @@ TestResults/
/paket.exe
/.fake
AssemblyInfo.fs
docs/type-provider/paket.lock
docs/type-provider/paket.lock
.idea/
.vs/
8 changes: 5 additions & 3 deletions .travis.yml
@@ -1,8 +1,10 @@
language: csharp
dist: xenial
mono: none
dotnet: 2.1.3
dotnet: 2.2.105
script:
- dotnet restore Froto.unix.sln
- dotnet build Froto.unix.sln -c Release
- git fetch --unshallow
- dotnet restore Froto.sln
- dotnet build Froto.sln -c Release
- dotnet test Parser.Test/Froto.Parser.Test.fsproj
- dotnet test Serialization.Test/Froto.Serialization.Test.fsproj
3 changes: 2 additions & 1 deletion Compiler/Froto.Compiler.fsproj
Expand Up @@ -26,6 +26,7 @@
<ProjectReference Include="..\Parser\Froto.Parser.fsproj" />
<PackageReference Update="FSharp.Core" Version="4.5.2" />
<PackageReference Include="Argu" Version="4.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-*" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="All" />
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.138" PrivateAssets="All" />
</ItemGroup>
</Project>
16 changes: 5 additions & 11 deletions Froto.sln
Expand Up @@ -38,17 +38,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "protobuf", "protobuf", "{82
test\google\protobuf\descriptor.proto = test\google\protobuf\descriptor.proto
EndProjectSection
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Froto.Parser", "Parser/Froto.Parser.fsproj", "{1C31DA31-BEC5-4E73-9D83-E36D18847439}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Froto.Parser", "Parser\Froto.Parser.fsproj", "{1C31DA31-BEC5-4E73-9D83-E36D18847439}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Froto.Parser.Test", "Parser.Test/Froto.Parser.Test.fsproj", "{18104831-6F33-4F15-AB45-3E8527CC5181}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Froto.Parser.Test", "Parser.Test\Froto.Parser.Test.fsproj", "{18104831-6F33-4F15-AB45-3E8527CC5181}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Froto.Serialization", "Serialization/Froto.Serialization.fsproj", "{C37745D0-275D-4DCE-9DDC-C4663A462EDD}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Froto.Serialization", "Serialization\Froto.Serialization.fsproj", "{C37745D0-275D-4DCE-9DDC-C4663A462EDD}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Froto.Serialization.Test", "Serialization.Test/Froto.Serialization.Test.fsproj", "{AF2D437D-55A1-4F31-86BD-9B9D7E05CAEA}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Froto.Serialization.Test", "Serialization.Test\Froto.Serialization.Test.fsproj", "{AF2D437D-55A1-4F31-86BD-9B9D7E05CAEA}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Froto.Compiler", "Compiler/Froto.Compiler.fsproj", "{F5D8D709-919D-4539-8908-91C540C970B3}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Froto.TypeProvider", "TypeProvider/Froto.TypeProvider.fsproj", "{837AA4FC-E2DD-48A1-A793-50DC4404EE57}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Froto.Compiler", "Compiler\Froto.Compiler.fsproj", "{F5D8D709-919D-4539-8908-91C540C970B3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -76,10 +74,6 @@ Global
{F5D8D709-919D-4539-8908-91C540C970B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F5D8D709-919D-4539-8908-91C540C970B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F5D8D709-919D-4539-8908-91C540C970B3}.Release|Any CPU.Build.0 = Release|Any CPU
{837AA4FC-E2DD-48A1-A793-50DC4404EE57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{837AA4FC-E2DD-48A1-A793-50DC4404EE57}.Debug|Any CPU.Build.0 = Debug|Any CPU
{837AA4FC-E2DD-48A1-A793-50DC4404EE57}.Release|Any CPU.ActiveCfg = Release|Any CPU
{837AA4FC-E2DD-48A1-A793-50DC4404EE57}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
45 changes: 1 addition & 44 deletions Parser.Test/TestParser.fs
Expand Up @@ -1082,47 +1082,4 @@ module RegressionTests =
])

])
])

[<Fact>]
let ``proto3 message with enum type doesn't parse (#93)`` () =
Parse.fromStringWithParser pProto """
syntax = "proto3";
message SearchRequest {
string query = 1;
int32 page_number = 2;
int32 result_per_page = 3;
enum Corpus {
UNIVERSAL = 0;
WEB = 1;
IMAGES = 2;
LOCAL = 3;
NEWS = 4;
PRODUCTS = 5;
VIDEO = 6;
}
Corpus corpus = 4;
}
"""
|> should equal (
[
TSyntax TProto3
TMessage ("SearchRequest",
[
TField ("query",TOptional,TString,1u,[])
TField ("page_number",TOptional,TInt32,2u,[])
TField ("result_per_page",TOptional,TInt32,3u,[])
TMessageEnum("Corpus",
[
TEnumField ("UNIVERSAL",0,[])
TEnumField ("WEB",1,[])
TEnumField ("IMAGES",2,[])
TEnumField ("LOCAL",3,[])
TEnumField ("NEWS",4,[])
TEnumField ("PRODUCTS",5,[])
TEnumField ("VIDEO",6,[])
])
TField ("corpus", TOptional,TIdent "Corpus",4u,[])
])
])
])
3 changes: 2 additions & 1 deletion Parser/Froto.Parser.fsproj
Expand Up @@ -20,6 +20,7 @@
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.5.2" />
<PackageReference Include="FParsec" Version="1.0.3" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-*" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="All" />
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.138" PrivateAssets="All" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Parser/Parser.fs
Expand Up @@ -482,14 +482,14 @@ module Parse =
choice [
(isProto2 >>. pGroup) // must be parsed first to avoid confusion
pOneOf // must be parsed before pField, so 'oneof' isn't considered a type in Proto3
pField
pMessageEnum
pMessageMessage
(isProto2 >>. pMessageExtend)
(isProto2 >>. pExtensions)
pMessageOption
pMap
pReserved
pField
]

/// Parse message option: "option" (ident | "(" fullIdent ")" { "." ident }
Expand Down
2 changes: 1 addition & 1 deletion Serialization.Test/TestSerialization.fs
Expand Up @@ -206,7 +206,7 @@ module RecordSerialization =
]
|> Map.ofList

static member DecodeFixup m =
static member DecodeFixup m: Proto3Message =
{ m with _unknownFields = List.rev m._unknownFields }

static member UnknownFields m =
Expand Down
3 changes: 2 additions & 1 deletion Serialization/Froto.Serialization.fsproj
Expand Up @@ -23,6 +23,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.5.2" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-*" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="All" />
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.138" PrivateAssets="All" />
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion TypeProvider/Froto.TypeProvider.fsproj
Expand Up @@ -46,6 +46,7 @@
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.5.2" />
<Reference Include="System.Runtime.Caching" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-*" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="All" />
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.138" PrivateAssets="All" />
</ItemGroup>
</Project>
28 changes: 8 additions & 20 deletions build.ps1
@@ -1,22 +1,10 @@
$version = '0.7.0' # the version under development, update after a release
$versionSuffix = '-build.0' # manually incremented for local builds

function isVersionTag($tag){
$v = New-Object Version
[Version]::TryParse($tag, [ref]$v)
}

if ($env:appveyor){
$versionSuffix = '-build.' + $env:appveyor_build_number
if ($env:appveyor_repo_tag -eq 'true' -and (isVersionTag($env:appveyor_repo_tag_name))){
$version = $env:appveyor_repo_tag_name
$versionSuffix = ''
}
Update-AppveyorBuild -Version "$version$versionSuffix"
}

dotnet build -c Release Froto.sln /p:Version=$version$versionSuffix
dotnet build -c Release Froto.sln
if ($lastexitcode -ne 0){ exit $lastexitcode }
dotnet test --no-build -c Release Parser.Test\Froto.Parser.Test.fsproj
if ($lastexitcode -ne 0){ exit $lastexitcode }
dotnet test --no-build -c Release Serialization.Test\Froto.Serialization.Test.fsproj
dotnet pack --no-build -c Release Parser\Froto.Parser.fsproj /p:Version=$version$versionSuffix -o $psscriptroot/bin
dotnet pack --no-build -c Release Serialization\Froto.Serialization.fsproj /p:Version=$version$versionSuffix -o $psscriptroot/bin
if ($lastexitcode -ne 0){ exit $lastexitcode }
dotnet pack --no-build -c Release Parser\Froto.Parser.fsproj -o $psscriptroot/bin
if ($lastexitcode -ne 0){ exit $lastexitcode }
dotnet pack --no-build -c Release Serialization\Froto.Serialization.fsproj -o $psscriptroot/bin
if ($lastexitcode -ne 0){ exit $lastexitcode }
17 changes: 17 additions & 0 deletions version.json
@@ -0,0 +1,17 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "0.6",
"nugetPackageVersion": {
"semVer": 2
},
"gitCommitIdShortAutoMinimum": 7,
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/heads/\\d+\\.\\d+$"
],
"cloudBuild": {
"buildNumber": {
"enabled": true
}
}
}

0 comments on commit 70c2685

Please sign in to comment.