Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 133 lines (106 sloc) 3.296 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
#I @"Tools\Fake"
#r "FakeLib.dll"

open Fake

// properties
let projectName = "Lingua"
let projectSummary = "A .NET-based parser generator. It uses reflection to generate parsers and scanners using code-based scanner and grammar definitions."
let authors = ["R. Todd"; "J. Preiss"]
let homepage = "https://github.com/Slesa/Lingua"
let mail = "joerg.preiss@slesa.de"

let currentVersion =
  if not isLocalBuild then buildVersion else
  "1.0.2"

TraceEnvironmentVariables()


// Directories
let srcDir = @".\src\"
let binDir = @".\bin\"
let buildDir = binDir @@ @"build\"
let testDir = binDir @@ @"test\"
let nugetDir = binDir @@ @"nuget\"
let reportDir = binDir @@ @"report\"
let packagesDir = srcDir @@ @"packages\"


// Tools
let MSpecVersion = GetPackageVersion packagesDir "Machine.Specifications"
let mspecTool = sprintf @"%sMachine.Specifications.%s\tools\mspec-clr4.exe" packagesDir MSpecVersion


// Files
let appReferences =
  !+ @"src\Lingua\Lingua.csproj"
    ++ @"src\LinguaDemo\LinguaDemo.csproj"
        |> Scan

let testReferences =
  !+ @"**\Lingua.Specs\Lingua.Specs.csproj"
    |> Scan


// Targets
Target "Clean" (fun _ ->
  CleanDirs [buildDir; testDir; nugetDir; reportDir ]
)

Target "SetAssemblyInfo" (fun _ ->
  AssemblyInfo
    (fun p ->
    {p with
      CodeLanguage = CSharp;
      Guid = "";
      ComVisible = None;
      CLSCompliant = None;
      AssemblyCompany = "Richard G. Todd";
      AssemblyProduct = "Lingua";
      AssemblyCopyright = "Copyright © 2010";
      AssemblyTrademark = "MS Public License";
      AssemblyVersion = currentVersion;
      OutputFileName = srcDir @@ @"\VersionInfo.cs"})
)

Target "BuildApp" (fun _ ->
  MSBuildRelease buildDir "Build" appReferences
    |> Log "AppBuild-Output: "
)

Target "BuildTest" (fun _ ->
  MSBuildDebug testDir "Build" testReferences
    |> Log "TestBuild-Output: "
)

Target "RunTest" (fun _ ->
  !! (testDir @@ "*.Specs.dll")
    |> MSpec (fun p ->
      {p with
        ToolPath = mspecTool
        HtmlOutputDir = reportDir})
)

Target "Deploy" (fun _ ->
  
  let libDir = nugetDir @@ @"lib\net40"
  CreateDir libDir
  let toolsDir = nugetDir @@ @"tools\"
  CreateDir toolsDir
  let contentDir = nugetDir @@ @"content\"
  CreateDir contentDir
  let nugetExe = @"tools\NuGet\NuGet.exe"

  !! (buildDir @@ "Lingua.dll")
    |> CopyTo libDir
  !+ (buildDir @@ "Lingua.dll")
    ++ (buildDir @@ "LinguaDemo.exe")
    ++ (buildDir @@ "LinguaDemo.exe.config")
      |> Scan
        |> CopyTo toolsDir
  !+ "Copyright.txt"
    ++ "License.txt"
    ++ "Readme.txt"
    |> Scan
      |> CopyTo contentDir

  NuGet (fun p ->
    {p with
      Authors = authors
      Project = projectName
      Description = projectSummary
      OutputPath = nugetDir
      Version = currentVersion
      AccessKey = getBuildParamOrDefault "nugetkey" ""
      Publish = hasBuildParam "nugetkey" }) "Lingua.nuspec"
)

Target "Default" DoNothing


// Dependencies
"Clean"
  ==> "SetAssemblyInfo"
  ==> "BuildApp" <=> "BuildTest"
  ==> "RunTest"
  ==> "Deploy"
  ==> "Default"


// start build
RunParameterTargetOrDefault "target" "Default"

Something went wrong with that request. Please try again.