Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
image: Visual Studio 2017
build_script:
- ps: .\src\build.ps1
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bin
obj
packages
paket-files
.vscode
.fake
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: csharp
mono:
- latest
script:
- .\src\build.sh --use-mono
267 changes: 267 additions & 0 deletions src/.paket/Paket.Restore.targets

Large diffs are not rendered by default.

Binary file added src/.paket/paket.exe
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FSharp.Project.FileOrderer\FSharp.Project.FileOrderer.fsproj" />
</ItemGroup>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
6 changes: 6 additions & 0 deletions src/FSharp.Project.FileOrderer.Runner/Program.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
open FSharp.Project.FileOrderer

[<EntryPoint>]
let main argv =
Say.hello "World from F#" |> printfn "%s"
0
1 change: 1 addition & 0 deletions src/FSharp.Project.FileOrderer.Runner/paket.references
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FSharp.Core
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<Compile Include="Tests.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FSharp.Project.FileOrderer\FSharp.Project.FileOrderer.fsproj" />
</ItemGroup>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
1 change: 1 addition & 0 deletions src/FSharp.Project.FileOrderer.Tests/Program.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module Program = let [<EntryPoint>] main _ = 0
11 changes: 11 additions & 0 deletions src/FSharp.Project.FileOrderer.Tests/Tests.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Tests

open FsCheck.Xunit
open Swensen.Unquote
open FSharp.Project.FileOrderer

[<Property>]
let ``Say says hello to whomever we greet`` greetee =
let greeting = Say.hello greetee
let expected = "Hello " + greetee
greeting =! expected
5 changes: 5 additions & 0 deletions src/FSharp.Project.FileOrderer.Tests/paket.references
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FsCheck.Xunit
Microsoft.NET.Test.Sdk
Unquote
xunit
xunit.runner.visualstudio
67 changes: 67 additions & 0 deletions src/FSharp.Project.FileOrderer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{6EA61FE8-490C-40B9-A66F-FFA28DECFB52}"
ProjectSection(SolutionItems) = preProject
paket.dependencies = paket.dependencies
EndProjectSection
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Project.FileOrderer.Runner", "FSharp.Project.FileOrderer.Runner\FSharp.Project.FileOrderer.Runner.fsproj", "{C323DED7-B70E-4A40-8E52-F3BE4E868D3C}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Project.FileOrderer", "FSharp.Project.FileOrderer\FSharp.Project.FileOrderer.fsproj", "{9621C527-1CC1-41CC-A8FC-0447AEDE4B8C}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Project.FileOrderer.Tests", "FSharp.Project.FileOrderer.Tests\FSharp.Project.FileOrderer.Tests.fsproj", "{E1B1B3E7-B2C8-4E70-BCB9-F56FAA24EA93}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C323DED7-B70E-4A40-8E52-F3BE4E868D3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C323DED7-B70E-4A40-8E52-F3BE4E868D3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C323DED7-B70E-4A40-8E52-F3BE4E868D3C}.Debug|x64.ActiveCfg = Debug|x64
{C323DED7-B70E-4A40-8E52-F3BE4E868D3C}.Debug|x64.Build.0 = Debug|x64
{C323DED7-B70E-4A40-8E52-F3BE4E868D3C}.Debug|x86.ActiveCfg = Debug|x86
{C323DED7-B70E-4A40-8E52-F3BE4E868D3C}.Debug|x86.Build.0 = Debug|x86
{C323DED7-B70E-4A40-8E52-F3BE4E868D3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C323DED7-B70E-4A40-8E52-F3BE4E868D3C}.Release|Any CPU.Build.0 = Release|Any CPU
{C323DED7-B70E-4A40-8E52-F3BE4E868D3C}.Release|x64.ActiveCfg = Release|x64
{C323DED7-B70E-4A40-8E52-F3BE4E868D3C}.Release|x64.Build.0 = Release|x64
{C323DED7-B70E-4A40-8E52-F3BE4E868D3C}.Release|x86.ActiveCfg = Release|x86
{C323DED7-B70E-4A40-8E52-F3BE4E868D3C}.Release|x86.Build.0 = Release|x86
{9621C527-1CC1-41CC-A8FC-0447AEDE4B8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9621C527-1CC1-41CC-A8FC-0447AEDE4B8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9621C527-1CC1-41CC-A8FC-0447AEDE4B8C}.Debug|x64.ActiveCfg = Debug|x64
{9621C527-1CC1-41CC-A8FC-0447AEDE4B8C}.Debug|x64.Build.0 = Debug|x64
{9621C527-1CC1-41CC-A8FC-0447AEDE4B8C}.Debug|x86.ActiveCfg = Debug|x86
{9621C527-1CC1-41CC-A8FC-0447AEDE4B8C}.Debug|x86.Build.0 = Debug|x86
{9621C527-1CC1-41CC-A8FC-0447AEDE4B8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9621C527-1CC1-41CC-A8FC-0447AEDE4B8C}.Release|Any CPU.Build.0 = Release|Any CPU
{9621C527-1CC1-41CC-A8FC-0447AEDE4B8C}.Release|x64.ActiveCfg = Release|x64
{9621C527-1CC1-41CC-A8FC-0447AEDE4B8C}.Release|x64.Build.0 = Release|x64
{9621C527-1CC1-41CC-A8FC-0447AEDE4B8C}.Release|x86.ActiveCfg = Release|x86
{9621C527-1CC1-41CC-A8FC-0447AEDE4B8C}.Release|x86.Build.0 = Release|x86
{E1B1B3E7-B2C8-4E70-BCB9-F56FAA24EA93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1B1B3E7-B2C8-4E70-BCB9-F56FAA24EA93}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1B1B3E7-B2C8-4E70-BCB9-F56FAA24EA93}.Debug|x64.ActiveCfg = Debug|x64
{E1B1B3E7-B2C8-4E70-BCB9-F56FAA24EA93}.Debug|x64.Build.0 = Debug|x64
{E1B1B3E7-B2C8-4E70-BCB9-F56FAA24EA93}.Debug|x86.ActiveCfg = Debug|x86
{E1B1B3E7-B2C8-4E70-BCB9-F56FAA24EA93}.Debug|x86.Build.0 = Debug|x86
{E1B1B3E7-B2C8-4E70-BCB9-F56FAA24EA93}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1B1B3E7-B2C8-4E70-BCB9-F56FAA24EA93}.Release|Any CPU.Build.0 = Release|Any CPU
{E1B1B3E7-B2C8-4E70-BCB9-F56FAA24EA93}.Release|x64.ActiveCfg = Release|x64
{E1B1B3E7-B2C8-4E70-BCB9-F56FAA24EA93}.Release|x64.Build.0 = Release|x64
{E1B1B3E7-B2C8-4E70-BCB9-F56FAA24EA93}.Release|x86.ActiveCfg = Release|x86
{E1B1B3E7-B2C8-4E70-BCB9-F56FAA24EA93}.Release|x86.Build.0 = Release|x86
EndGlobalSection
EndGlobal
11 changes: 11 additions & 0 deletions src/FSharp.Project.FileOrderer/FSharp.Project.FileOrderer.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageVersion>0.0.0</PackageVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="Library.fs" />
</ItemGroup>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
5 changes: 5 additions & 0 deletions src/FSharp.Project.FileOrderer/Library.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace FSharp.Project.FileOrderer

module Say =
let hello name =
sprintf "Hello %s" name
1 change: 1 addition & 0 deletions src/FSharp.Project.FileOrderer/paket.references
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FSharp.Core
3 changes: 3 additions & 0 deletions src/GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
assembly-versioning-scheme: None
mode: ContinuousDelivery
next-version: 0.1.0
87 changes: 87 additions & 0 deletions src/build.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
(* -- Fake Dependencies paket-inline
source https://api.nuget.org/v3/index.json

nuget Fake.Core.Target prerelease
nuget FSharp.Core prerelease
-- Fake Dependencies -- *)

#r @"packages/build/FAKE/tools/FakeLib.dll"
open System
open System.Diagnostics

open Fake
open Fake.Core
open Fake.Core.TargetOperators
open Fake.Core.Globbing.Operators

// Helpers and settings that figure themselves out

let projectsPattern = "**/*.fsproj"
let testProjectsPattern = "**/*Tests.fsproj"
let projects = !!projectsPattern
let srcProjects = !!projectsPattern -- testProjectsPattern
let testProjects = !!testProjectsPattern

let dotnetCliVersion = DotNetCli.getVersion()
let mutable dotnetCliPath = "dotnet"
let installDotNet _ = dotnetCliPath <- DotNetCli.InstallDotNetSDK dotnetCliVersion

let gitVersionPath = !!"packages/**/GitVersion.exe" |> Seq.head
let version =
let gitVersion = Fake.GitVersionHelper.GitVersion (fun ps -> { ps with ToolPath = gitVersionPath })
if Fake.EnvironmentHelper.getEnvironmentVarAsBool "APPVEYOR"
then
let version = { gitVersion with BuildMetaData = Fake.AppVeyor.AppVeyorEnvironment.BuildNumber }
Fake.AppVeyor.UpdateBuildVersion version.InformationalVersion
version
elif Fake.EnvironmentHelper.getEnvironmentVarAsBool "TRAVIS"
then
let version = { gitVersion with BuildMetaData = Fake.EnvironmentHelper.environVar "TRAVIS_JOB_NUMBER" }
version
else
{ gitVersion with BuildMetaData = "local" }

let runDotNet args =
let proc (info : ProcessStartInfo) =
info.FileName <- dotnetCliPath
info.WorkingDirectory <- "."
info.Arguments <- args

let result = ProcessHelper.ExecProcess proc TimeSpan.MaxValue
if result <> 0 then failwithf "dotnet %s failed" args

// Build target implementations

let clean _ = !!"**/bin"++"**/obj" |> CleanDirs

let pokeVersion oldVersion newVersion project =
if Fake.Core.Xml.Read false project "" "" "/Project/PropertyGroup/PackageVersion" |> Seq.exists ((=) oldVersion)
then Fake.Core.Xml.PokeInnerText project "Project/PropertyGroup/PackageVersion" newVersion


let setVersion _ =
srcProjects |> Seq.iter (pokeVersion "0.0.0" version.NuGetVersion)
Target.ActivateFinal "ResetVersion"

let resetVersion _ = srcProjects |> Seq.iter (pokeVersion version.NuGetVersion "0.0.0")

let build _ = runDotNet "build"

let test _ = testProjects |> Seq.map (sprintf "test \"%s\" --no-build") |> Seq.iter runDotNet

// Build target definitions

Target.Create "Clean" clean
Target.Create "InstallDotNetCore" installDotNet
Target.Create "Build" build
Target.Create "Test" test
Target.Create "SetVersion" setVersion
Target.CreateFinal "ResetVersion" resetVersion

"Clean"
==> "InstallDotNetCore"
==> "SetVersion"
==> "Build"
==> "Test"

Target.RunOrDefault "Test"
16 changes: 16 additions & 0 deletions src/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$ErrorActionPreference = "Stop"
Copy link
Member

Choose a reason for hiding this comment

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

Would it be possible to use build.cmd instead? Or additionally? I have couple of machines where Powershell is disabled for some reason.

Copy link
Author

Choose a reason for hiding this comment

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

Sure, no problem.


Push-Location $(Split-Path -Parent $MyInvocation.MyCommand.Definition)

function Find-Exe() {
param([string]$name, [string]$root)
return Get-ChildItem -Recurse -Include "$name" "$root" | Select-Object -First 1 -ExpandProperty FullName
}

$PAKET_EXE = Find-Exe -name 'paket.exe' -root '.paket'
& "$PAKET_EXE" restore

$FAKE_EXE = Find-Exe -name 'FAKE.exe' -root 'packages\build'
& "$FAKE_EXE" build.fsx $args

Pop-Location
65 changes: 65 additions & 0 deletions src/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env bash

set -eu

cd "$(dirname $0)"

USE_MONO=false
SHOW_HELP=false
while test $# -gt 0; do
case "$1" in
-m|--use-mono)
USE_MONO=true
shift
;;
--)
shift
break
;;
-h|--help)
SHOW_HELP=true
break
;;
*)
echo "unknown option $1"
SHOW_HELP=true
break
;;
esac
done

if [ "$SHOW_HELP" = true ]; then
echo "usage: ./build.sh [-m|--use-mono] [--] [<fake options>]"
echo ""
echo " -m|--use-mono Invoke paket and fake using mono (requires that mono is installed)"
echo " -- All options after this are passed on to Fake."
echo " -h|--help Show help and exit"
echo ""
echo "For example, to run the Test target under mono: ./build.sh --use-mono -- Test"
exit 1
fi

PAKET_EXE='.paket/paket.exe'
FAKE_EXE="`find packages/build -iname fake.exe`"

FSIARGS=""
FSIARGS2=""
OS=${OS:-"unknown"}
if [ "$OS" != "Windows_NT" ]
then
# Can't use FSIARGS="--fsiargs -d:MONO" in zsh, so split it up
# (Can't use arrays since dash can't handle them)
FSIARGS="--fsiargs"
FSIARGS2="-d:MONO"
fi

run() {
if [ "$USE_MONO" == true ]; then
mono "$@"
else
"$@"
fi
}

run $PAKET_EXE restore
run $FAKE_EXE "$@" $FSIARGS $FSIARGS2 build.fsx
12 changes: 12 additions & 0 deletions src/paket.dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
source https://api.nuget.org/v3/index.json

nuget FsCheck.Xunit
nuget Microsoft.NET.Test.Sdk
nuget Unquote
nuget xunit
nuget xunit.runner.visualstudio

group Build
source https://api.nuget.org/v3/index.json
nuget FAKE prerelease
nuget GitVersion.CommandLine
Loading