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

use Nerdbank.GitVersioning #100

Merged
merged 17 commits into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from 14 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: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed for Travis CI

- 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
1 change: 1 addition & 0 deletions Compiler/Froto.Compiler.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
<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="Nerdbank.GitVersioning" Version="2.3.136" /> -->
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nerbankbank.GitVersioning is failing F# exe builds with:

C:\projects\froto\Compiler\Program.fs(20,5): error FS0433: A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence. [C:\projects\froto\Compiler\Froto.Compiler.fsproj]

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

</ItemGroup>
</Project>
16 changes: 5 additions & 11 deletions Froto.sln
Original file line number Diff line number Diff line change
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
46 changes: 2 additions & 44 deletions Parser.Test/TestParser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,7 @@ module RegressionTests =

[<Fact>]
let ``proto3 oneof type doesn't parse (#88)`` () =
System.Diagnostics.Debugger.Break()
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, don't need that.

Parse.fromStringWithParser pProto """
syntax = "proto3";

Expand All @@ -1082,47 +1083,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,[])
])
])
])
1 change: 1 addition & 0 deletions Parser/Froto.Parser.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
<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="Nerdbank.GitVersioning" Version="2.3.136" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Parser/Parser.fs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
1 change: 1 addition & 0 deletions Serialization/Froto.Serialization.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.5.2" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-*" PrivateAssets="All" />
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.136" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions TypeProvider/Froto.TypeProvider.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@
<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="Nerdbank.GitVersioning" Version="2.3.136" />
</ItemGroup>
</Project>
28 changes: 8 additions & 20 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
}
}
}