Skip to content
Open
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ _UpgradeReport*
packages
.nuget
.paket
.ionide

# Ignore Visual Studio files
*.pdb
Expand All @@ -32,6 +33,8 @@ TestResult.*
.xake*
.fake
.vs/
.vscode/
.ionide/
samples/**/*.exe
samples/**/*.dll
samples/**/*.fsx.lock
Expand Down
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
language: csharp
mono: latest
dotnet: 2.1.300
mono: none
dotnet: 3.0
env: VER=$(if [[ "${TRAVIS_TAG:0:1}" == "v" ]]; then echo ${TRAVIS_TAG:1}.${TRAVIS_BUILD_NUMBER}; else echo 1.0.0.${TRAVIS_BUILD_NUMBER}; fi;)
install:
- dotnet restore build.proj
- chmod +x ./fake.sh
script:
- export FrameworkPathOverride=$(dirname $(which mono))/../lib/mono/4.5-api/
- dotnet fake run build.fsx -- build test -ll Diag
- dotnet build src/core /p:Version=$VER -c Release /p:DocumentationFile=Xake.xml
- dotnet test src/tests -c Release -p:ParallelizeTestCollections=false
deploy:
- provider: script
script: dotnet fake run build.fsx -- pack push -ll Diag
script: ./fake.sh run build.fsx -- pack push -ll Diag
skip_cleanup: true
on:
tags: true
Expand Down
5 changes: 0 additions & 5 deletions .vscode/settings.json

This file was deleted.

3 changes: 1 addition & 2 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
@echo off
dotnet restore build.proj
dotnet fake run build.fsx -- build
fake run build.fsx -- build
83 changes: 35 additions & 48 deletions build.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#r "paket:
nuget Xake ~> 1.1 prerelease //"
nuget Xake ~> 1.1.4 prerelease //"

#if !FAKE
#load ".fake/build.fsx/intellisense.fsx"
Expand All @@ -8,26 +8,23 @@
open Xake
open Xake.Tasks

let frameworks = ["netstandard2.0"; "net46"]
let frameworks = ["netstandard2.0"]
let libtargets =
[ for t in frameworks do
for e in ["dll"; "xml"]
-> sprintf "out/%s/Xake.%s" t e
]
for e in ["dll"; "xml"] -> sprintf "out/%s/Xake.%s" t e ]

let getVersion () = recipe {
let! verVar = getVar("VER")
let! verEnv = getEnv("VER")
let! verVar = getVar "VER"
let! verEnv = getEnv "VER"
let ver = verVar |> Option.defaultValue (verEnv |> Option.defaultValue "0.0.1")

let! verSuffix =
getVar("SUFFIX")
|> Recipe.map (
getVar "SUFFIX"
|> map (
function
| None -> "-beta"
| Some "" -> "" // this is release!
| Some s -> "-" + s
)
| Some s -> "-" + s )
return ver + verSuffix
}

Expand All @@ -37,19 +34,15 @@ let dotnet arglist = recipe {
do! shell {
cmd "dotnet"
args arglist
failonerror
} |> Recipe.Ignore
failonerror } |> Ignore
}

do xakeScript {
filelog "build.log" Verbosity.Diag
// consolelog Verbosity.Normal

rules [
"main" => recipe {
do! need ["build"]
do! need ["test"]
}
"main" <<< ["build"; "test"]

"build" <== libtargets
"clean" => rm {dir "out"}
Expand All @@ -58,13 +51,13 @@ do xakeScript {
do! alwaysRerun()

let! where =
getVar("FILTER")
|> Recipe.map (function |Some clause -> ["--filter"; sprintf "Name~\"%s\"" clause] | None -> [])
getVar "FILTER"
|> map (function |Some clause -> ["--filter"; sprintf "Name~\"%s\"" clause] | None -> [])

// in case of travis only run tests for standard runtime, eventually will add more
let! limitFwk = getEnv("TRAVIS") |> Recipe.map (function | Some _ -> ["-f:netcoreapp2.0"] | _ -> [])
let! limitFwk = getEnv "TRAVIS" |> map (function | Some _ -> ["-f:netcoreapp2.0"] | _ -> [])

do! dotnet <| ["test"; "src/tests"; "-c"; "Release"] @ where @ limitFwk
do! dotnet <| ["test"; "src/tests"; "-c"; "Release"; "-p:ParallelizeTestCollections=false"] @ where @ limitFwk
}

libtargets *..> recipe {
Expand All @@ -80,16 +73,14 @@ do xakeScript {
let! version = getVersion()

for framework in frameworks do
do! dotnet
[
"build"
"src/core"
"/p:Version=" + version
"--configuration"; "Release"
"--framework"; framework
"--output"; "../../out/" + framework
"/p:DocumentationFile=Xake.xml"
]
do! dotnet [
"build"
"src/core"
"/p:Version=" + version
"--configuration"; "Release"
"--framework"; framework
"--output"; "../../out/" + framework
"/p:DocumentationFile=Xake.xml" ]
}
]

Expand All @@ -101,29 +92,25 @@ do xakeScript {
}

"out/Xake.(ver:*).nupkg" ..> recipe {
let! ver = getRuleMatch("ver")
do! dotnet
[
"pack"; "src/core"
"-c"; "Release"
"/p:Version=" + ver
"--output"; "../../out/"
"/p:DocumentationFile=Xake.xml"
]
let! ver = getRuleMatch "ver"
do! dotnet [
"pack"; "src/core"
"-c"; "Release"
"/p:Version=" + ver
"--output"; "../../out/"
"/p:DocumentationFile=Xake.xml" ]
}

// push need pack to be explicitly called in advance
"push" => recipe {
let! version = getVersion()

let! nuget_key = getEnv("NUGET_KEY")
do! dotnet
[
"nuget"; "push"
"out" </> makePackageName version
"--source"; "https://www.nuget.org/api/v2/package"
"--api-key"; nuget_key |> Option.defaultValue ""
]
let! nuget_key = getEnv "NUGET_KEY"
do! dotnet [
"nuget"; "push"
"out" </> makePackageName version
"--source"; "https://www.nuget.org/api/v2/package"
"--api-key"; nuget_key |> Option.defaultValue "" ]
}
]
}
4 changes: 2 additions & 2 deletions build.fsx.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ STORAGE: NONE
RESTRICTION: == netstandard2.0
NUGET
remote: https://api.nuget.org/v3/index.json
FSharp.Core (4.3.4)
Xake (1.1.0.413-alpha)
FSharp.Core (4.7)
Xake (1.1.4.427-beta)
FSharp.Core (>= 4.3.4)
10 changes: 0 additions & 10 deletions build.proj

This file was deleted.

3 changes: 1 addition & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#!/bin/bash
dotnet restore build.proj
dotnet fake run build.fsx -- build
fake run build.fsx -- build
9 changes: 9 additions & 0 deletions docs/cheatsheet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Operators ##

### `<<<` - depends on targets (run sequentially)

> `"main" <<< ["restore"; "build-debug"; "unit-test"]`

### `<==` - depends on targets that are allowed to run in parallel
> `"main" <<< ["build-debug"; "build-release"]`

7 changes: 7 additions & 0 deletions fake.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SET TOOL_PATH=.fake

IF NOT EXIST "%TOOL_PATH%\fake.exe" (
dotnet tool install fake-cli --tool-path ./%TOOL_PATH%
)

"%TOOL_PATH%/fake.exe" %*
27 changes: 27 additions & 0 deletions fake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

set -eu
set -o pipefail

# liberated from https://stackoverflow.com/a/18443300/433393
realpath() {
OURPWD=$PWD
cd "$(dirname "$1")"
LINK=$(readlink "$(basename "$1")")
while [ "$LINK" ]; do
cd "$(dirname "$LINK")"
LINK=$(readlink "$(basename "$1")")
done
REALPATH="$PWD/$(basename "$1")"
cd "$OURPWD"
echo "$REALPATH"
}

TOOL_PATH=$(realpath .fake)
FAKE="$TOOL_PATH"/fake

if ! [ -e "$FAKE" ]
then
dotnet tool install fake-cli --tool-path "$TOOL_PATH"
fi
"$FAKE" "$@"
11 changes: 5 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Xake is a build utility that uses the full power of the F# programming language. Xake is inspired by [shake](https://github.com/ndmitchell/shake) build tool.

[![Build Status](https://travis-ci.org/xakebuild/Xake.svg?branch=dev)](https://travis-ci.org/xakebuild/Xake)
[![Build Status](https://travis-ci.org/Fakebuild/Xake.svg?branch=dev)](https://travis-ci.org/xakebuild/Xake)

## Sample script

Expand Down Expand Up @@ -29,12 +29,13 @@ To run this script:

1. Clone the project:

```
```bash
git clone http://github.com/xakebuild/xake
```

1. Run the "Hello world" build sctipt:

```
```bash
cd samples
dotnet restore dotnet-fake.csproj
dotnet fake run gettingstarted.fsx
Expand All @@ -51,8 +52,7 @@ To run this script:
Once you cloned the repository you are ready to compile and test the binaries:

```
dotnet restore build.proj
dotnet fake run build.fsx -- build test
fake run build.fsx -- build test
```

... or use `build.cmd` (`build.sh`) in the root folder
Expand All @@ -68,4 +68,3 @@ dotnet fake run build.fsx -- build test

Xake requires 'pkg-config' to locate mono runtime. Pkg-config utility is deployed with mono, but it's not included in
$PATH. The options available are described on [monobjc mailing list](http://www.mail-archive.com/[email protected]/msg00235.html)

29 changes: 12 additions & 17 deletions samples/features.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,19 @@ do xakeScript {
// this is shorter way to express the same. See also `<==` and '<<<' operators.
"main" => need ["tracetest"; "temp/a.exe"]

// .NET build rules
// build .net executable using full .net framework (or mono under unix)

// define a "phony rule", which has goal to produce a file
"clean" => rm {file "temp/a*"}
// "phony" rule that produces no file but just removes the files
// `rm` recipe (Xake.Tasks namespace) allow to remove files and folders
"clean" => recipe {
do! rm {file "paket-files/*.*"}
do! rm {dir "out"}
do! rm {files (fileset {
includes "samplefile*"
}); verbose
}
}

// rule to build an a.exe executable by using c# compiler
// .NET build rules
// build .net executable from C# sources using full .net framework (or mono under unix)
// notice there's no "out" parameter: csc recipe will use the target file as an output
"temp/a.exe" ..> csc {src (!!"temp/a.cs" + "temp/AssemblyInfo.cs")}

Expand Down Expand Up @@ -107,17 +113,6 @@ do xakeScript {
return ()
}

// "phony" rule that produces no file but just removes the files
// `rm` recipe (Xake.Tasks namespace) allow to remove files and folders
"clean" => recipe {
do! rm {file "paket-files/*.*"}
do! rm {dir "out"}
do! rm {files (fileset {
includes "samplefile*"
}); verbose
}
}

"libs" => recipe {
// this command will copy all dlls to `lib` (flat files)
do! cp {file "packages/mylib/net46/*.dll"; todir "lib"}
Expand Down
Loading