Skip to content

Commit

Permalink
Use MinVer; Roll to 2019
Browse files Browse the repository at this point in the history
  • Loading branch information
bartelink committed Jan 22, 2019
1 parent 530ab34 commit 6e5bee4
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 16 deletions.
3 changes: 1 addition & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<Project ToolsVersion="15.0">
<PropertyGroup>
<VersionPrefix>0.2.1</VersionPrefix>
<Authors>@jet @amjjd @eiriktsarpalis and contributors</Authors>
<Company>Jet.com</Company>
<Description>Simple version-tolerant Newtonsoft.Json Converters for F# types</Description>
<PackageProjectUrl>https://github.com/jet/Jet.JsonNet.Converters</PackageProjectUrl>
<PackageTags>fsharp unionconverter JsonPickler json converters</PackageTags>
<PackageLicenseUrl>https://github.com/jet/Jet.JsonNet.Converters/blob/master/LICENSE</PackageLicenseUrl>
<Copyright>Copyright © 2016-8</Copyright>
<Copyright>Copyright © 2016-9</Copyright>

<!-- SourceLink related properties https://github.com/dotnet/SourceLink#using-sourcelink -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand Down
16 changes: 16 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project ToolsVersion="15.0">
<Target Name="ComputePackageVersion" AfterTargets="MinVer" Condition=" '$(BUILD_PR)' != '' AND '$(BUILD_PR)' != '%24(SYSTEM.PULLREQUEST.PULLREQUESTNUMBER)' ">
<PropertyGroup>
<PackageVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch)-pr.$(BUILD_PR)</PackageVersion>
<PackageVersion Condition="'$(MinVerPreRelease)' != ''">$(PackageVersion).$(MinVerPreRelease)</PackageVersion>
<PackageVersion Condition="'$(MinVerBuildMetadata)' != ''">$(PackageVersion)+$(MinVerBuildMetadata)</PackageVersion>
<Version>$(PackageVersion)</Version>
</PropertyGroup>
</Target>
<Target Name="ComputeFileVersion" AfterTargets="MinVer">
<PropertyGroup>
<BUILD_ID Condition="'$(BUILD_ID)' == ''">0</BUILD_ID>
<FileVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).$(BUILD_ID)</FileVersion>
</PropertyGroup>
</Target>
</Project>
1 change: 1 addition & 0 deletions Jet.JsonNet.Converters.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".project", ".project", "{1D
build.proj = build.proj
build.ps1 = build.ps1
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
global.json = global.json
LICENSE = LICENSE
README.md = README.md
Expand Down
18 changes: 6 additions & 12 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: $(Rev:r)
trigger:
- master
- refs/tags/*
jobs:
- job: Windows
pool:
Expand All @@ -11,20 +14,11 @@ jobs:
testResultsFormat: 'VSTest'
testResultsFiles: 'tests/**/*.trx'
condition: succeededOrFailed()
- powershell: |
$buildId = $env:BUILD_BUILDNUMBER.PadLeft(7, '0');
$versionSuffixPR = "ci-$buildId-pr$($env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)";
$branchName = "$env:BUILD_SOURCEBRANCHNAME".Replace("_","");
$versionSuffixBRANCH = "$branchName-$buildId";
$isTag = "$env:BUILD_SOURCEBRANCH".StartsWith('refs/tags/');
$isPR = "$env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER" -ne ""
$versionSuffix = if ($isTag) { "" } else { if ($isPR) { $versionSuffixPR } else { $versionSuffixBRANCH } };
Write-Host "##vso[task.setvariable variable=VersionSuffix]$versionSuffix";
displayName: compute VersionSuffix
- script: dotnet pack build.proj
displayName: dotnet pack
displayName: dotnet pack build.proj
env:
VersionSuffix: '$(VersionSuffix)'
BUILD_PR: $(SYSTEM.PULLREQUEST.PULLREQUESTNUMBER)
BUILD_ID: $(BUILD.BUILDNUMBER)
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'bin'
Expand Down
5 changes: 4 additions & 1 deletion build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
<Cfg>--configuration Release</Cfg>

<ThisDirAbsolute>$([System.IO.Path]::GetFullPath("$(MSBuildThisFileDirectory)"))</ThisDirAbsolute>
<PackOptions>-o $(ThisDirAbsolute)bin --version-suffix "$(VersionSuffix)"</PackOptions>

<PrOption Condition =" '$(BUILD_PR)' != '%24(SYSTEM.PULLREQUEST.PULLREQUESTNUMBER)' ">/p:BUILD_PR=$(BUILD_PR) </PrOption>
<PackOptions>/p:BUILD_ID=$(BUILD_ID) $(PrOption) -o $(ThisDirAbsolute)bin</PackOptions>

<TestOptions>--logger:trx</TestOptions>
</PropertyGroup>

Expand Down
4 changes: 3 additions & 1 deletion src/Jet.JsonNet.Converters/Jet.JsonNet.Converters.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="All" />
<PackageReference Include="MinVer" Version="1.0.0-beta.2" PrivateAssets="All" />

<PackageReference Include="FSharp.Core" Version="3.1.2.5" Condition=" '$(TargetFramework)' != 'netstandard2.0' " />
<PackageReference Include="FSharp.Core" Version="4.3.4" Condition=" '$(TargetFramework)' == 'netstandard2.0' " />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
</ItemGroup>

</Project>
</Project>

0 comments on commit 6e5bee4

Please sign in to comment.