Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch build system and structure according to community best practises #30

Closed
wants to merge 5 commits into from
Closed
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: 2 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
image: Visual Studio 2017
build_script:
- ps: .\src\build.ps1
- cmd: build.cmd

534 changes: 267 additions & 267 deletions src/.paket/Paket.Restore.targets → .paket/Paket.Restore.targets

Large diffs are not rendered by default.

Binary file renamed src/.paket/paket.exe → .paket/paket.exe
Binary file not shown.
72 changes: 72 additions & 0 deletions .paket/paket.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">true</RestorePackages>
<PaketToolsPath>$(MSBuildThisFileDirectory)</PaketToolsPath>
<PaketRootPath>$(MSBuildThisFileDirectory)..\</PaketRootPath>
<PaketLockFilePath>$(PaketRootPath)paket.lock</PaketLockFilePath>
<PaketRestoreCacheFile>$(PaketRootPath)paket-files\paket.restore.cached</PaketRestoreCacheFile>
<MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
<MonoPath Condition="'$(MonoPath)' == ''">mono</MonoPath>
</PropertyGroup>

<PropertyGroup>
<!-- Paket command -->
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket.exe')">$(PaketRootPath)paket.exe</PaketExePath>
<PaketExePath Condition=" '$(PaketExePath)' == '' ">$(PaketToolsPath)paket.exe</PaketExePath>
<PaketCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketExePath)"</PaketCommand>
<PaketCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
</PropertyGroup>

<Choose> <!-- MyProject.fsproj.paket.references has the highest precedence -->
<When Condition="Exists('$(MSBuildProjectFullPath).paket.references')">
<PropertyGroup>
<PaketReferences>$(MSBuildProjectFullPath).paket.references</PaketReferences>
</PropertyGroup>
</When> <!-- MyProject.paket.references -->
<When Condition="Exists('$(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references')">
<PropertyGroup>
<PaketReferences>$(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references</PaketReferences>
</PropertyGroup>
</When> <!-- paket.references -->
<When Condition="Exists('$(MSBuildProjectDirectory)\paket.references')">
<PropertyGroup>
<PaketReferences>$(MSBuildProjectDirectory)\paket.references</PaketReferences>
</PropertyGroup>
</When> <!-- Set to empty if a reference file isn't found matching one of the 3 format options -->
<Otherwise>
<PropertyGroup>
<PaketReferences></PaketReferences>
</PropertyGroup>
</Otherwise>
</Choose>

<PropertyGroup>
<!-- Commands -->
<RestoreCommand>$(PaketCommand) restore --references-file "$(PaketReferences)"</RestoreCommand>
<!-- We need to ensure packages are restored prior to assembly resolve -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">RestorePackages; $(BuildDependsOn);</BuildDependsOn>
</PropertyGroup>
<Target Name="RestorePackages">
<PropertyGroup>
<PaketRestoreRequired>true</PaketRestoreRequired>
</PropertyGroup>

<PropertyGroup Condition="Exists('$(PaketRestoreCacheFile)') ">
<PaketRestoreCachedHash>$([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))</PaketRestoreCachedHash>
<PaketRestoreLockFileHash>$([System.IO.File]::ReadAllText('$(PaketLockFilePath)'))</PaketRestoreLockFileHash>
<PaketRestoreRequired>true</PaketRestoreRequired>
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '$(PaketRestoreCachedHash)' ">false</PaketRestoreRequired>
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '' ">true</PaketRestoreRequired>
</PropertyGroup>

<Exec Command="$(RestoreCommand)"
IgnoreStandardErrorWarningFormat="true"
WorkingDirectory="$(PaketRootPath)"
ContinueOnError="false"
Condition=" '$(PaketRestoreRequired)' == 'true' AND Exists('$(PaketReferences)') AND '$(PaketReferences)' != '' "
/>
</Target>
</Project>
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ mono:
before_install:
- sudo apt-get install libunwind8
script:
- ./src/build.sh --use-mono
- ./build.sh
File renamed without changes.
4 changes: 0 additions & 4 deletions src/build.cmd → build.cmd
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
@echo off
cls

pushd "%~dp0"

.paket\paket.exe restore
if errorlevel 1 (
exit /b %errorlevel%
)

packages\build\FAKE\tools\FAKE.exe build.fsx %*

popd
47 changes: 47 additions & 0 deletions build.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
(* -- 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

let mutable dotnetCliPath = "dotnet"
let dotnetCliVersion = "2.1.3"

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

Target.Create "Clean" <| fun _ ->
!!"**/bin"++"**/obj" |> CleanDirs

Target.Create "InstallDotNet" <| fun _ ->
dotnetCliPath <- DotNetCli.InstallDotNetSDK dotnetCliVersion

Target.Create "Build" <| fun _ ->
runDotNet "build"

Target.Create "Test" <| fun _ ->
!!"**/*Tests.fsproj"
|> Seq.iter ( sprintf "run --project %s --no-build" >> runDotNet )

"Clean"
==> "InstallDotNet"
==> "Build"
==> "Test"

Target.RunOrDefault "Test"

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

set -eu

cd "$(dirname "$0")"

PAKET_EXE=.paket/paket.exe
FAKE_EXE=packages/build/FAKE/tools/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 [ "$OS" != "Windows_NT" ]
then
mono "$@"
else
"$@"
fi
}

run $PAKET_EXE restore
run $FAKE_EXE "$@" $FSIARGS $FSIARGS2 build.fsx
71 changes: 71 additions & 0 deletions mechanic.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@

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}") = "src", "src", "{022D9082-F4FA-4F44-8FCD-F3F5F65BAAFB}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "mechanic", "src\mechanic\mechanic.fsproj", "{89360E0B-2F0C-4268-B8A4-BFDE19F53F4C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{EF288DE2-6F5D-4B21-B296-A9EF83CABE15}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "mechanicTests", "test\mechanicTests\mechanicTests.fsproj", "{41EA33A4-0A6B-4DBE-ADA3-B39C4189D573}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "mech", "src\mech\mech.fsproj", "{0A697B19-9D15-4680-AB97-4F26C1C2E4B4}"
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
{89360E0B-2F0C-4268-B8A4-BFDE19F53F4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{89360E0B-2F0C-4268-B8A4-BFDE19F53F4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{89360E0B-2F0C-4268-B8A4-BFDE19F53F4C}.Debug|x64.ActiveCfg = Debug|x64
{89360E0B-2F0C-4268-B8A4-BFDE19F53F4C}.Debug|x64.Build.0 = Debug|x64
{89360E0B-2F0C-4268-B8A4-BFDE19F53F4C}.Debug|x86.ActiveCfg = Debug|x86
{89360E0B-2F0C-4268-B8A4-BFDE19F53F4C}.Debug|x86.Build.0 = Debug|x86
{89360E0B-2F0C-4268-B8A4-BFDE19F53F4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{89360E0B-2F0C-4268-B8A4-BFDE19F53F4C}.Release|Any CPU.Build.0 = Release|Any CPU
{89360E0B-2F0C-4268-B8A4-BFDE19F53F4C}.Release|x64.ActiveCfg = Release|x64
{89360E0B-2F0C-4268-B8A4-BFDE19F53F4C}.Release|x64.Build.0 = Release|x64
{89360E0B-2F0C-4268-B8A4-BFDE19F53F4C}.Release|x86.ActiveCfg = Release|x86
{89360E0B-2F0C-4268-B8A4-BFDE19F53F4C}.Release|x86.Build.0 = Release|x86
{41EA33A4-0A6B-4DBE-ADA3-B39C4189D573}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41EA33A4-0A6B-4DBE-ADA3-B39C4189D573}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41EA33A4-0A6B-4DBE-ADA3-B39C4189D573}.Debug|x64.ActiveCfg = Debug|x64
{41EA33A4-0A6B-4DBE-ADA3-B39C4189D573}.Debug|x64.Build.0 = Debug|x64
{41EA33A4-0A6B-4DBE-ADA3-B39C4189D573}.Debug|x86.ActiveCfg = Debug|x86
{41EA33A4-0A6B-4DBE-ADA3-B39C4189D573}.Debug|x86.Build.0 = Debug|x86
{41EA33A4-0A6B-4DBE-ADA3-B39C4189D573}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41EA33A4-0A6B-4DBE-ADA3-B39C4189D573}.Release|Any CPU.Build.0 = Release|Any CPU
{41EA33A4-0A6B-4DBE-ADA3-B39C4189D573}.Release|x64.ActiveCfg = Release|x64
{41EA33A4-0A6B-4DBE-ADA3-B39C4189D573}.Release|x64.Build.0 = Release|x64
{41EA33A4-0A6B-4DBE-ADA3-B39C4189D573}.Release|x86.ActiveCfg = Release|x86
{41EA33A4-0A6B-4DBE-ADA3-B39C4189D573}.Release|x86.Build.0 = Release|x86
{0A697B19-9D15-4680-AB97-4F26C1C2E4B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A697B19-9D15-4680-AB97-4F26C1C2E4B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A697B19-9D15-4680-AB97-4F26C1C2E4B4}.Debug|x64.ActiveCfg = Debug|x64
{0A697B19-9D15-4680-AB97-4F26C1C2E4B4}.Debug|x64.Build.0 = Debug|x64
{0A697B19-9D15-4680-AB97-4F26C1C2E4B4}.Debug|x86.ActiveCfg = Debug|x86
{0A697B19-9D15-4680-AB97-4F26C1C2E4B4}.Debug|x86.Build.0 = Debug|x86
{0A697B19-9D15-4680-AB97-4F26C1C2E4B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A697B19-9D15-4680-AB97-4F26C1C2E4B4}.Release|Any CPU.Build.0 = Release|Any CPU
{0A697B19-9D15-4680-AB97-4F26C1C2E4B4}.Release|x64.ActiveCfg = Release|x64
{0A697B19-9D15-4680-AB97-4F26C1C2E4B4}.Release|x64.Build.0 = Release|x64
{0A697B19-9D15-4680-AB97-4F26C1C2E4B4}.Release|x86.ActiveCfg = Release|x86
{0A697B19-9D15-4680-AB97-4F26C1C2E4B4}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{89360E0B-2F0C-4268-B8A4-BFDE19F53F4C} = {022D9082-F4FA-4F44-8FCD-F3F5F65BAAFB}
{41EA33A4-0A6B-4DBE-ADA3-B39C4189D573} = {EF288DE2-6F5D-4B21-B296-A9EF83CABE15}
{0A697B19-9D15-4680-AB97-4F26C1C2E4B4} = {022D9082-F4FA-4F44-8FCD-F3F5F65BAAFB}
EndGlobalSection
EndGlobal
14 changes: 14 additions & 0 deletions paket.dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
source https://www.nuget.org/api/v2
framework: netcoreapp2.0

nuget Fsharp.Core
nuget Expecto
nuget Argu
nuget Unquote

nuget FSharp.Compiler.Service

group Build
source https://api.nuget.org/v3/index.json
# storage:none
nuget FAKE prerelease
Loading