Skip to content

Commit

Permalink
Merge pull request #94 from fsprojects/feature/core2
Browse files Browse the repository at this point in the history
Support NetStandard 2.0
  • Loading branch information
eiriktsarpalis authored Dec 7, 2017
2 parents 06cb007 + 0c28b8b commit 6b761aa
Show file tree
Hide file tree
Showing 36 changed files with 579 additions and 830 deletions.
28 changes: 22 additions & 6 deletions .paket/Paket.Restore.targets
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,24 @@
<NoWarn>$(NoWarn);NU1603</NoWarn>
</PropertyGroup>

<!-- Because ReadAllText is slow on osx/linux, try to find shasum and awk -->
<PropertyGroup>
<PaketRestoreCachedHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreCachedHasher)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum $(PaketRestoreCacheFile) | /usr/bin/awk '{ print $1 }'</PaketRestoreCachedHasher>
<PaketRestoreLockFileHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreLockFileHash)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum $(PaketLockFilePath) | /usr/bin/awk '{ print $1 }'</PaketRestoreLockFileHasher>
</PropertyGroup>

<!-- If shasum and awk exist get the hashes -->
<Exec Condition=" '$(PaketRestoreCachedHasher)' != '' " Command="$(PaketRestoreCachedHasher)" ConsoleToMSBuild='true'>
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreCachedHash" />
</Exec>
<Exec Condition=" '$(PaketRestoreLockFileHasher)' != '' " Command="$(PaketRestoreLockFileHasher)" ConsoleToMSBuild='true'>
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreLockFileHash" />
</Exec>

<PropertyGroup Condition="Exists('$(PaketRestoreCacheFile)') ">
<PaketRestoreCachedHash>$([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))</PaketRestoreCachedHash>
<PaketRestoreLockFileHash>$([System.IO.File]::ReadAllText('$(PaketLockFilePath)'))</PaketRestoreLockFileHash>
<!-- if no hash has been done yet fall back to just reading in the files and comparing them -->
<PaketRestoreCachedHash Condition=" '$(PaketRestoreCachedHash)' == '' ">$([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))</PaketRestoreCachedHash>
<PaketRestoreLockFileHash Condition=" '$(PaketRestoreLockFileHash)' == '' ">$([System.IO.File]::ReadAllText('$(PaketLockFilePath)'))</PaketRestoreLockFileHash>
<PaketRestoreRequired>true</PaketRestoreRequired>
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '$(PaketRestoreCachedHash)' ">false</PaketRestoreRequired>
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '' ">true</PaketRestoreRequired>
Expand Down Expand Up @@ -137,27 +152,28 @@

<Target Name="PaketOverrideNuspec" AfterTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references')" >
<ItemGroup>
<_NuspecFilesNewLocation Include="$(BaseIntermediateOutputPath)$(Configuration)/*.nuspec"/>
<_NuspecFilesNewLocation Include="$(BaseIntermediateOutputPath)$(Configuration)\*.nuspec"/>
</ItemGroup>

<PropertyGroup>
<PaketProjectFile>$(MSBuildProjectDirectory)/$(MSBuildProjectFile)</PaketProjectFile>
<ContinuePackingAfterGeneratingNuspec>true</ContinuePackingAfterGeneratingNuspec>
<UseNewPack>false</UseNewPack>
<UseNewPack Condition=" '$(NuGetToolVersion)' != '4.0.0' ">true</UseNewPack>
<AdjustedNuspecOutputPath>$(BaseIntermediateOutputPath)$(Configuration)/</AdjustedNuspecOutputPath>
<AdjustedNuspecOutputPath>$(BaseIntermediateOutputPath)$(Configuration)</AdjustedNuspecOutputPath>
<AdjustedNuspecOutputPath Condition="@(_NuspecFilesNewLocation) == ''">$(BaseIntermediateOutputPath)</AdjustedNuspecOutputPath>
</PropertyGroup>

<ItemGroup>
<_NuspecFiles Include="$(AdjustedNuspecOutputPath)*.nuspec"/>
<_NuspecFiles Include="$(AdjustedNuspecOutputPath)\*.nuspec"/>
</ItemGroup>

<Exec Command='$(PaketCommand) fix-nuspecs files "@(_NuspecFiles)" project-file "$(PaketProjectFile)" ' Condition="@(_NuspecFiles) != ''" />

<ConvertToAbsolutePath Condition="@(_NuspecFiles) != ''" Paths="@(_NuspecFiles)">
<Output TaskParameter="AbsolutePaths" PropertyName="NuspecFileAbsolutePath" />
</ConvertToAbsolutePath>
</ConvertToAbsolutePath>


<!-- Call Pack -->
<PackTask Condition="$(UseNewPack)"
Expand Down
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
language: csharp

sudo: required
addons:
apt:
packages:
- msbuild

sudo: false # use the new container-based Travis infrastructure
dist: trusty # Ubuntu 14.04
mono: latest
dotnet: 1.0.0-preview2-003121
dotnet: 2.0.0

script:
- dotnet --info
- ./build.sh RunTests.NetCore
- ./build.sh Default
33 changes: 26 additions & 7 deletions Argu.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.27130.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{FB06D972-6D76-4220-AD16-8E5F20DADAA6}"
ProjectSection(SolutionItems) = preProject
.paket\paket.bootstrapper.exe = .paket\paket.bootstrapper.exe
paket.dependencies = paket.dependencies
paket.lock = paket.lock
.paket\Paket.Restore.targets = .paket\Paket.Restore.targets
.paket\paket.targets = .paket\paket.targets
EndProjectSection
EndProject
Expand Down Expand Up @@ -50,37 +51,55 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Argu.Samples.LS", "samples\
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{AF8469CE-9BA8-4EDD-BFFA-FF67EA8FFD86}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Argu.Core", "src\Argu.Core\Argu.Core.fsproj", "{E492695A-2363-4A74-814B-E79745D9C06A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{6FBA8939-A5FA-4476-9F25-B8CEC181EC21}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Argu.Core.Tests", "tests\Argu.Core.Tests\Argu.Core.Tests.fsproj", "{48F82C6A-1BBC-40F0-B9A1-FD05B2EF3341}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{3F10A2DD-E1BA-4A9F-8679-A18144168EFA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Release-NET35|Any CPU = Release-NET35|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{49E38CF1-8B37-4A4F-83CF-EAFE9577BCC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{49E38CF1-8B37-4A4F-83CF-EAFE9577BCC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{49E38CF1-8B37-4A4F-83CF-EAFE9577BCC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{49E38CF1-8B37-4A4F-83CF-EAFE9577BCC6}.Release|Any CPU.Build.0 = Release|Any CPU
{49E38CF1-8B37-4A4F-83CF-EAFE9577BCC6}.Release-NET35|Any CPU.ActiveCfg = Release-NET35|Any CPU
{49E38CF1-8B37-4A4F-83CF-EAFE9577BCC6}.Release-NET35|Any CPU.Build.0 = Release-NET35|Any CPU
{B94D60AD-2083-4E08-B28F-43122BE14819}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B94D60AD-2083-4E08-B28F-43122BE14819}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B94D60AD-2083-4E08-B28F-43122BE14819}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B94D60AD-2083-4E08-B28F-43122BE14819}.Release|Any CPU.Build.0 = Release|Any CPU
{B94D60AD-2083-4E08-B28F-43122BE14819}.Release-NET35|Any CPU.ActiveCfg = Release|Any CPU
{C7615A27-8D3D-466A-9B0B-D6C068B31CB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C7615A27-8D3D-466A-9B0B-D6C068B31CB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C7615A27-8D3D-466A-9B0B-D6C068B31CB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C7615A27-8D3D-466A-9B0B-D6C068B31CB1}.Release|Any CPU.Build.0 = Release|Any CPU
{C7615A27-8D3D-466A-9B0B-D6C068B31CB1}.Release-NET35|Any CPU.ActiveCfg = Release|Any CPU
{E492695A-2363-4A74-814B-E79745D9C06A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E492695A-2363-4A74-814B-E79745D9C06A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E492695A-2363-4A74-814B-E79745D9C06A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E492695A-2363-4A74-814B-E79745D9C06A}.Release|Any CPU.Build.0 = Release|Any CPU
{48F82C6A-1BBC-40F0-B9A1-FD05B2EF3341}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{48F82C6A-1BBC-40F0-B9A1-FD05B2EF3341}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48F82C6A-1BBC-40F0-B9A1-FD05B2EF3341}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48F82C6A-1BBC-40F0-B9A1-FD05B2EF3341}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{49E38CF1-8B37-4A4F-83CF-EAFE9577BCC6} = {6FBA8939-A5FA-4476-9F25-B8CEC181EC21}
{036AEA2A-4F01-4834-A345-B7C6D27754FB} = {31C8F489-6FEC-4DE5-A247-8447D56B5C04}
{745EFEBD-8B8D-4B9B-9743-6AC51D586724} = {31C8F489-6FEC-4DE5-A247-8447D56B5C04}
{33A4833E-3B3D-40FD-8FFE-734E9C510A46} = {31C8F489-6FEC-4DE5-A247-8447D56B5C04}
{B94D60AD-2083-4E08-B28F-43122BE14819} = {3F10A2DD-E1BA-4A9F-8679-A18144168EFA}
{C7615A27-8D3D-466A-9B0B-D6C068B31CB1} = {AF8469CE-9BA8-4EDD-BFFA-FF67EA8FFD86}
{E492695A-2363-4A74-814B-E79745D9C06A} = {6FBA8939-A5FA-4476-9F25-B8CEC181EC21}
{48F82C6A-1BBC-40F0-B9A1-FD05B2EF3341} = {3F10A2DD-E1BA-4A9F-8679-A18144168EFA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {42B6791A-3A2A-4988-967C-14BE8C294990}
EndGlobalSection
EndGlobal
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 4.0.0
* Support NetStandard 2.0
* Add Environment Variable configuration reader.

### 3.6.1
* Fix default character width issue in console apps.

Expand Down
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
os: Visual Studio 2015
os: Visual Studio 2017

build_script:
- cmd: build.cmd NuGet
- cmd: build.cmd Bundle

test: off
artifacts:
- path: bin
name: bin
name: bin
95 changes: 28 additions & 67 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ let gitName = "Argu"
let gitHome = "https://github.com/" + gitOwner
let gitRaw = "https://raw.github.com/" + gitOwner

let testAssemblies = !! "bin/net40/Argu.Tests.dll"
let netCoreSrcFiles = !! "src/*Core*/*.fsproj"
let netCoreTestFiles = !! "tests/*Core*/*.fsproj"

let netcoreSrcFiles = !! "src/**/project.json" |> Seq.toList
let netcoreTestFiles = !! "tests/**/project.json" |> Seq.toList
let testAssemblies = !! "bin/Release/net40/*.Tests.dll"

let isDotnetSDKInstalled = DotNetCli.isInstalled()

//
//// --------------------------------------------------------------------------------------
//// The rest of the code is standard F# build script
//// --------------------------------------------------------------------------------------
Expand Down Expand Up @@ -68,15 +69,7 @@ let configuration = environVarOrDefault "Configuration" "Release"

let isTravisCI = (environVarOrDefault "TRAVIS" "") = "true"

Target "Build.Net35" (fun _ ->
{ BaseDirectory = __SOURCE_DIRECTORY__
Includes = [ project + ".sln" ]
Excludes = [] }
|> MSBuild "" "Build" ["Configuration", "Release-NET35" ]
|> Log "AppBuild-Output: "
)

Target "Build.Net40" (fun _ ->
Target "Build" (fun _ ->
// Build the rest of the project
{ BaseDirectory = __SOURCE_DIRECTORY__
Includes = [ project + ".sln" ]
Expand All @@ -89,26 +82,24 @@ Target "Build.Net40" (fun _ ->
// --------------------------------------------------------------------------------------
// Run the unit tests using test runner & kill test runner when complete

Target "RunTests" (fun _ ->
ActivateFinalTarget "CloseTestRunner"
Target "RunTests" DoNothing

Target "RunTests.Net40" (fun _ ->
testAssemblies
|> xUnit2 (fun p ->
{ p with
Parallel = ParallelMode.Collections
TimeOut = TimeSpan.FromMinutes 20. })
)

FinalTarget "CloseTestRunner" (fun _ ->
ProcessHelper.killProcess "nunit-agent.exe"
)
Target "RunTests.NetCore" (fun _ ->
for proj in netCoreTestFiles do
DotNetCli.Test (fun c -> { c with Project = proj }))

//
//// --------------------------------------------------------------------------------------
//// Build a NuGet package

Target "NuGet" DoNothing

Target "NuGet.Pack" (fun _ ->
Paket.Pack(fun config ->
{ config with
Expand All @@ -117,7 +108,7 @@ Target "NuGet.Pack" (fun _ ->
OutputPath = "bin"
}))

Target "NuGetPush" (fun _ -> Paket.Push (fun p -> { p with WorkingDir = "bin/" }))
Target "NuGet.Push" (fun _ -> Paket.Push (fun p -> { p with WorkingDir = "bin/" }))

// Doc generation

Expand Down Expand Up @@ -146,15 +137,15 @@ open SourceLink

Target "SourceLink" (fun _ ->
let baseUrl = sprintf "%s/%s/{0}/%%var2%%" gitRaw project
[ yield! !! "src/**/*.??proj" ]
[ yield! !! "src/**/Argu.fsproj" ]
|> Seq.iter (fun projFile ->
let proj = VsProj.LoadRelease projFile
SourceLink.Index proj.CompilesNotLinked proj.OutputFilePdb __SOURCE_DIRECTORY__ baseUrl
)
)

// Github Releases

#nowarn "85"
#load "paket-files/build/fsharp/FAKE/modules/Octokit/Octokit.fsx"
open Octokit

Expand Down Expand Up @@ -194,72 +185,42 @@ Target "ReleaseGitHub" (fun _ ->
|> Async.RunSynchronously
)

// .NET Core SDK and .NET Core

let assertExitCodeZero x = if x = 0 then () else failwithf "Command failed with exit code %i" x

Target "SetVersionInProjectJSON" (fun _ ->
for proj in netcoreSrcFiles @ netcoreTestFiles do
DotNetCli.SetVersionInProjectJson release.NugetVersion proj
)

Target "Build.NetCore" (fun _ ->
for proj in netcoreSrcFiles @ netcoreTestFiles do
DotNetCli.Restore (fun c -> { c with Project = proj })

for proj in netcoreSrcFiles @ netcoreTestFiles do
DotNetCli.Build (fun c -> { c with Project = proj })
)

Target "RunTests.NetCore" (fun _ ->
for proj in netcoreTestFiles do
DotNetCli.Test (fun c -> { c with Project = proj })
)

let isDotnetSDKInstalled = DotNetCli.isInstalled()

Target "NuGet.AddNetCore" (fun _ ->
if not isDotnetSDKInstalled then failwith "You need to install .NET core to publish NuGet packages"
for proj in netcoreSrcFiles do
DotNetCli.Pack (fun c -> { c with Project = proj })

let nupkg = sprintf "../../bin/Argu.%s.nupkg" (release.NugetVersion)
let netcoreNupkg = sprintf "bin/Release/Argu.%s.nupkg" (release.NugetVersion)

Shell.Exec("dotnet", sprintf """mergenupkg --source "%s" --other "%s" --framework netstandard1.6 """ nupkg netcoreNupkg, "src/Argu/") |> assertExitCodeZero
)

let assertExitCodeZero x = if x <> 0 then failwithf "Command failed with exit code %i" x

Target "Release" DoNothing
Target "NetCore.Restore" (fun _ ->
for proj in Seq.append netCoreSrcFiles netCoreTestFiles do
DotNetCli.Restore(fun c -> { c with Project = proj }))

// --------------------------------------------------------------------------------------
// Run all targets by default. Invoke 'build <Target>' to override

Target "Prepare" DoNothing
Target "PrepareRelease" DoNothing
Target "Default" DoNothing
Target "Bundle" DoNothing
Target "Release" DoNothing

"Clean"
==> "AssemblyInfo"
==> "SetVersionInProjectJSON"
==> "Prepare"
==> "Build.Net40"
==> "NetCore.Restore"
==> "Build"
==> "RunTests.Net40"
==> "RunTests.NetCore"
==> "RunTests"
==> "Default"

"Default"
==> "PrepareRelease"
=?> ("Build.Net35", not isTravisCI) //mono 4.x doesnt have FSharp.Core 2.3.0.0 installed
=?> ("Build.NetCore", isDotnetSDKInstalled)
=?> ("RunTests.NetCore", isDotnetSDKInstalled)
==> "NuGet.Pack"
==> "NuGet.AddNetCore"
==> "NuGet"
==> "GenerateDocs"
==> "SourceLink"
==> "Bundle"

"Bundle"
==> "ReleaseDocs"
==> "NuGetPush"
==> "ReleaseGitHub"
==> "NuGet.Push"
==> "Release"

RunTargetOrDefault "Default"
2 changes: 1 addition & 1 deletion docs/content/index.fsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(*** hide ***)
// This block of code is omitted in the generated HTML documentation. Use
// it to define helpers that you do not want to show in the documentation.
#I "../../bin/net40"
#I "../../bin/"
#r "Argu.dll"

open System
Expand Down
2 changes: 1 addition & 1 deletion docs/content/tutorial.fsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(*** hide ***)
// This block of code is omitted in the generated HTML documentation. Use
// it to define helpers that you do not want to show in the documentation.
#I "../../bin/net40"
#I "../../bin/"
#r "Argu.dll"

open System
Expand Down
6 changes: 0 additions & 6 deletions global.json

This file was deleted.

Loading

0 comments on commit 6b761aa

Please sign in to comment.