Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Олег Заимкин "FAKE/XAKE - малая автоматизация н...

Олег Заимкин "FAKE/XAKE - малая автоматизация на F#"

Краткий обзор сценариев сборки XAKE, DSL на F# для описания артефактов, зависимостей и правил создания артефактов.
Бесплатно получаем параллелизм, инкрементальные сборки и прогноз времени завершения.

DotNetRu

August 29, 2019
Tweet

More Decks by DotNetRu

Other Decks in Programming

Transcript

  1. ActiveReports 1. .NET 1.0 ... .NET 4.6 ... Netcore 2.

    over 20 модулей 3. CI/CLI/Nant 2
  2. Paket менеджер модулей для .NET #r "paket: nuget Fake.Core.Target nuget

    Fake.BuildServer.TeamCity //" Target.create "Clean" (fun _ -> ... ) 4
  3. Модули DotNet Cli AssemblyInfoFile Fsc Fsi FxCop MSBuild ILMerge Testing

    - NUnit, MSpec, XUnit2, Expecto Testing - VSTest, SpecFlow, OpenCover, DotCover NuGet Mage Paket XML Transforms ... 5
  4. make le CC=gcc CFLAGS=-I. hellomake: hellomake.c hellofunc.c $(CC) -o hellomake

    hellomake.c hellofunc.c $(CFLAGS) цели зависимости команды 7
  5. Xake #r "paket: nuget Xake ~> 1.1 prerelease nuget Xake.Dotnet

    ~> 1.1 prerelease //" open Xake; open Xake.Dotnet do xakeScript { rules [ "hello.exe" ..> csc {src !!"hello.cs"++"AssemblyInfo.cs" "AssemblyInfo.cs" ..> recipe { let! envVersion = getVar "VERSION" let v = Option.defaultValue "1.0.0" envVersion do! writeText <| sprintf "[assembly: System.Reflection.AssemblyVersion (\"%s\")]" v } ] } 8
  6. Рецепты let downloadFile name = recipe { let! fileData =

    WebClient.DownloadStringAsync name return fileData.Length } recipe { let! result = downloadFile "main.cpp" do! need ["version.h"] do! shellx "cpp main.cpp" "" ... } 9
  7. Зависимости do! need ["src/AssemblyInfo.cs"] let! src = getFiles(!! "src/**/*.cs") let!

    cscPath = getEnvVar("CSCPATH") let! ver = getVar("version") do! alwaysRerun() 14
  8. Globbing // define a fileset (!! operator) and add two

    more files let refs = !! "bin/FSharp.Core.dll" + "bin/nunit.framework.dll" + "bin/Xake.Core.dll" // using builder let sourceFiles = fileset { basedir "src" includes "**/*.cs" includes "../versioninfo.cs" } 17
  9. Подстановки "bin/(releaseType:*)/application.exe"` ..> recipe { let! typ = getRuleMatch "releaseType"

    // typ will contain "release" for // artifact "bin/release/application.exe" ... } 19