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
26 changes: 26 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET

on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Build
run: dotnet fsi build.fsx -- -- build
- name: Test
run: dotnet fsi build.fsx -- -- test
11 changes: 4 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
language: csharp
mono: latest
dotnet: 2.1.300
dotnet: 7.0.202
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
script:
- export FrameworkPathOverride=$(dirname $(which mono))/../lib/mono/4.5-api/
- dotnet fake run build.fsx -- build test -ll Diag
- dotnet fsi build.fsx -- -- build test -ll Diag
deploy:
- provider: script
script: dotnet fake run build.fsx -- pack push -ll Diag
script: dotnet fsi build.fsx -- -- pack push -ll Diag
skip_cleanup: true
on:
tags: true
condition: "${TRAVIS_TAG:0:1} = v"
condition: "${TRAVIS_TAG:0:1} = v"
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
dotnet fsi build.fsx -- -- build
84 changes: 35 additions & 49 deletions build.fsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
#r "paket:
nuget Xake ~> 1.1 prerelease //"

#if !FAKE
#load ".fake/build.fsx/intellisense.fsx"
#endif
#r "nuget: Xake, 2.0.0"

open Xake
open Xake.Tasks

let frameworks = ["netstandard2.0"; "net46"]
let frameworks = ["netstandard2.0" (*; "net46" *)]
let libtargets =
[ for t in frameworks do
for e in ["dll"; "xml"]
Expand All @@ -33,23 +28,19 @@ let getVersion () = recipe {

let makePackageName = sprintf "Xake.%s.nupkg"

let dotnet arglist = recipe {
do! shell {
let dotnet arglist =
shell {
cmd "dotnet"
args arglist
failonerror
} |> Recipe.Ignore
}
} |> 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 @@ -59,37 +50,34 @@ do xakeScript {

let! where =
getVar("FILTER")
|> Recipe.map (function |Some clause -> ["--filter"; sprintf "Name~\"%s\"" clause] | None -> [])
|> map (function |Some clause -> ["--filter"; $"Name~\"{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
}

libtargets *..> recipe {

let! allFiles
= getFiles <| fileset {
basedir "src/core"
includes "Xake.fsproj"
includes "**/*.fs"
}
let! allFiles = getFiles <| fileset {
basedir "src/core"
includes "Xake.fsproj"
includes "**/*.fs"
}

do! needFiles allFiles
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 @@ -102,28 +90,26 @@ 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"
]
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 ""
]
do! dotnet [
"nuget"; "push"
"out" </> makePackageName version
"--source"; "https://www.nuget.org/api/v2/package"
"--api-key"; nuget_key |> Option.defaultValue ""
]
}
]
}
7 changes: 0 additions & 7 deletions build.fsx.lock

This file was deleted.

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
dotnet fsi build.fsx -- --
3 changes: 2 additions & 1 deletion docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Xake script is just an F# script with some flavors.
The most simple, but structured script looks as follows:

```fsharp
#r @".tools/Xake.Core.dll" // (1)
#r "nuget: Xake, 1.1.4.427-beta" // (1)

open Xake // (2)

Expand Down Expand Up @@ -154,6 +154,7 @@ There're several forms of rules including:

* `rule (<name> => <action>)` - creates a phony rule (the rule that does not create a file)
* `rule (<name> <== [targets])` - creates a phony rule which demands specified targets
* `rule (<name> <<< [targets])` - the same as above, but the targets are requested one by one (non-parallel excution)
* `rule (<file pattern> ..> <action>)` - rule for single file or group of files matching the specified wildcards pattern. The file and an optional matching groups can be accessed via getTargetFile and getRuleMatch methods
* `rule (<condition> ..?> <action>)` - allows to use function instead of file name or wildcards

Expand Down
7 changes: 3 additions & 4 deletions docs/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

* change the first page to a tutorial with script and usage examples

* switch development to mono under windows
* idea: xake script as a task. Override/inherit variables. How to change variable on the fly is the original question. (we have got it out of the box, need more info)
* accept filemasks in 'need' parameters (WHY I added it here?, the use case is very unclear)
* detect changes in build script (internal changes), e.g. new target added that was not in .xake database
* dependencies tracking mode: automatically rebuild when dependency is changed, execute triggers allowing to start/stop the processes which lock/hold artifacts
* in-memory artifact (string or stream). Say in Gulp file is processed in-memory
* can the rules be abstract over artifacts

### Refactorings

Expand All @@ -25,10 +22,12 @@
* `rule "Viewer" -> fun folder -> action {need [folder <\\> "bin" <\\> folder <.> "exe"]...}`
* Filelist is not handy as it requires to cast all the time
* FileInfo is not good for the same reason: poorly composable and does not cover Directory well
* wildcards phony actions

## Done (top is recent)

* wildcards phony actions
* support tasks in line with recipes and asyncs

* rules should accept #seq not just the list
* <<< for running tasks one by one. Current one runs in parallel only.
* complete copyFiles method
Expand Down
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"rollForward": "major",
"version": "7.0.0"
}
}
32 changes: 24 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ Xake is a build utility that uses the full power of the F# programming language.
The simple script looks like:

```fsharp
#r "paket:
nuget Xake ~> 1.1 prerelease
nuget Xake.Dotnet ~> 1.1 prerelease //"
#r "nuget: Xake, 2.0.0"
#r "nuget: Xake.Dotnet, 1.1.4.7-beta"

open Xake
open Xake.Dotnet
Expand All @@ -25,7 +24,9 @@ do xakeScript {

This script compiles helloworld assembly from helloworld.cs file.

To run this script:
## Getting started

Make sure dotnet SDK 7.0+ is installed.

1. Clone the project:

Expand All @@ -36,8 +37,7 @@ To run this script:

```
cd samples
dotnet restore dotnet-fake.csproj
dotnet fake run gettingstarted.fsx
dotnet fsi gettingstarted.fsx
```

## Further reading
Expand All @@ -51,12 +51,28 @@ 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
dotnet fsi build.fsx -- -- build test
```

... or use `build.cmd` (`build.sh`) in the root folder

## Getting started for Mono on Linux/OSX

> This is untested and mono nowadays is poorly explored territory for me.

Make sure mono with F# is installed and root certificates are imported:

```
sudo apt-get install mono-complete
sudo mozroots --import --sync
```

TBD

## Documentation

See [documentation](docs/overview.md) for more details.

## References

* [documentation](https://github.com/xakebuild/Xake/wiki)
Expand Down
6 changes: 3 additions & 3 deletions samples/book/intro.fsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#r "paket:
nuget Xake ~> 1.1 prerelease
nuget Xake.Dotnet ~> 1.1 prerelease //" // (1)
#r "nuget: Xake, 1.1.4.427-beta"
#r "nuget: Xake.Dotnet, 1.1.4.7-beta" (1)


open Xake // (2)
open Xake.Dotnet // (2.1)
Expand Down
3 changes: 1 addition & 2 deletions samples/catch_errors.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#r "paket: nuget Xake ~> 1.1 prerelease //"

#r "nuget: Xake, 2.0.0"
open Xake

do xakeScript {
Expand Down
9 changes: 2 additions & 7 deletions samples/features.fsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#r "paket:
nuget Xake ~> 1.1 prerelease
nuget Xake.Dotnet ~> 1.1 prerelease //"

#if !FAKE
#load ".fake/features.fsx/intellisense.fsx"
#endif
#r "nuget: Xake, 2.0.0"
#r "nuget: Xake.Dotnet, 1.1.4.7-beta"

// This a sample Xake script to show off some features.
//
Expand Down
5 changes: 2 additions & 3 deletions samples/gettingstarted.fsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#r "paket:
nuget Xake ~> 1.1 prerelease
nuget Xake.Dotnet ~> 1.1 prerelease //"
#r "nuget: Xake, 2.0.0"
#r "nuget: Xake.Dotnet, 1.1.4.7-beta"

open Xake
open Xake.Dotnet
Expand Down
2 changes: 1 addition & 1 deletion samples/rmdir.fsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#r "paket: nuget Xake ~> 1.1 prerelease //"
#r "nuget: Xake, 1.1.4.427-beta"

open Xake
open Xake.Tasks
Expand Down
2 changes: 1 addition & 1 deletion src/core/Database.fs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ module Storage =
| FileDep _ -> 1
| EnvVar _ -> 2
| Var _ -> 3
| AlwaysRerun _ -> 4
| AlwaysRerun -> 4
| GetFiles _ -> 5)
[| wrap (ArtifactDep, fun (ArtifactDep f | OtherwiseFail f) -> f) target
wrap (FileDep, fun (FileDep(f, ts) | OtherwiseFail (f, ts)) -> (f, ts)) (pair file date)
Expand Down
Loading