Skip to content

Commit

Permalink
Switch to FAKE+Paket (#758)
Browse files Browse the repository at this point in the history
* Switch build system to fake+paket

* [build] Push onto a branch ("ci" by default)

* [build] Document env variables used by build

* [build] Only consider merged tags

* Fake: Fix Update task dependency

* Fix F# 3 vs 4 references

* Remove unused WebSharper.proj

* build from sln, use FCT, update packages

* fixes for build

* whole solution compiling

* fix Proxies.fsproj and packaging

* Remove DebugTests configuration and fix related properties

* use package versions same as master, opt-out of referencing transitive dependencies

* more fixing of project files and updating sln

* rc1

* add CommitPublish build target

* add value of ExtraPath to Path in build

* keep output packages in build folder, publish from there

* Fix licenseUrl and projectUrl in nuget templates

* Fix packaged FSharp.Core version

* add setlocal, use GitToolPath env var

* 4.0-rc
  • Loading branch information
Jand42 committed Sep 5, 2017
1 parent 568edc5 commit 060d63a
Show file tree
Hide file tree
Showing 175 changed files with 3,898 additions and 3,220 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Expand Up @@ -10,9 +10,13 @@ IntelliFactory.WebSharper.JQuery/*.js
**/Content/WebSharper/
/build/
/packages/
/paket-files/
/tools/packages/
/tests/Web/downloads/
/msbuild/AssemblyInfo.extra.fs
/msbuild/AssemblyInfo.fs
/.hg
/.vs
/msbuild.log
/.fake
/.paket/paket.exe
/.vscode/
Binary file added .paket/paket.bootstrapper.exe
Binary file not shown.
43 changes: 43 additions & 0 deletions .paket/paket.targets
@@ -0,0 +1,43 @@
<?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>
<!-- Download Paket.exe if it does not already exist -->
<DownloadPaket Condition=" '$(DownloadPaket)' == '' ">true</DownloadPaket>
<PaketToolsPath>$(MSBuildThisFileDirectory)</PaketToolsPath>
<PaketRootPath>$(MSBuildThisFileDirectory)..\</PaketRootPath>
<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>
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
<PaketCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketExePath)"</PaketCommand>
<PaketCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT' AND Exists('$(PaketBootStrapperExePath)')">"$(PaketBootStrapperExePath)" $(PaketBootStrapperCommandArgs)</PaketBootStrapperCommand>
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' AND Exists('$(PaketBootStrapperExePath)')">$(MonoPath) --runtime=v4.0.30319 $(PaketBootStrapperExePath) $(PaketBootStrapperCommandArgs)</PaketBootStrapperCommand>
<!-- Commands -->
<PaketReferences Condition="!Exists('$(MSBuildProjectFullPath).paket.references')">$(MSBuildProjectDirectory)\paket.references</PaketReferences>
<PaketReferences Condition="!Exists('$(PaketReferences)')">$(MSBuildStartupDirectory)\paket.references</PaketReferences>
<PaketReferences Condition="Exists('$(MSBuildProjectFullPath).paket.references')">$(MSBuildProjectFullPath).paket.references</PaketReferences>
<RestoreCommand>$(PaketCommand) restore --references-files "$(PaketReferences)"</RestoreCommand>
<DownloadPaketCommand>$(PaketBootStrapperCommand)</DownloadPaketCommand>
<!-- We need to ensure packages are restored prior to assembly resolve -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">RestorePackages; $(BuildDependsOn);</BuildDependsOn>
</PropertyGroup>
<Target Name="CheckPrerequisites">
<!-- Raise an error if we're unable to locate paket.exe -->
<Error Condition="'$(DownloadPaket)' != 'true' AND !Exists('$(PaketExePath)')" Text="Unable to locate '$(PaketExePath)'" />
<MsBuild Targets="DownloadPaket" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadPaket=$(DownloadPaket)" />
</Target>
<Target Name="DownloadPaket">
<Exec Command="$(DownloadPaketCommand)" IgnoreStandardErrorWarningFormat="true"
Condition=" '$(DownloadPaket)' == 'true' AND '$(DownloadPaketCommand)' != '' AND !Exists('$(PaketExePath)')" />
</Target>
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(PaketRootPath)" Condition="Exists('$(PaketReferences)')" ContinueOnError="true" />
</Target>
</Project>
312 changes: 146 additions & 166 deletions WebSharper.Compiler.sln

Large diffs are not rendered by default.

740 changes: 328 additions & 412 deletions WebSharper.sln

Large diffs are not rendered by default.

27 changes: 12 additions & 15 deletions build.cmd
@@ -1,20 +1,17 @@
@ECHO OFF
@echo off
setlocal
set PATH=%GitToolPath%;%PATH%

if "%VisualStudioVersion%"=="" (
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\" (
set VisualStudioVersion=15.0
) else (
set VisualStudioVersion=14.0
)
)
cls

set PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin;%WINDIR%\Microsoft.NET\Framework\v4.0.30319;%PATH%
set PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin;%PATH%
set PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin;%PATH%
set PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin;%PATH%
.paket\paket.bootstrapper.exe
if errorlevel 1 (
exit /b %errorlevel%
)

tools\nuget\nuget install FSharp.Core -version 3.0.2 -o packages
.paket\paket.exe restore --touch-affected-refs
if errorlevel 1 (
exit /b %errorlevel%
)

echo Building with Visual Studio %VisualStudioVersion% tools
MSBuild.exe msbuild\WebSharper.proj /verbosity:minimal /p:VisualStudioVersion=%VisualStudioVersion% /p:Arguments="%*" /fileLogger /flp:PerformanceSummary /m
packages\FAKE\tools\FAKE.exe build.fsx %*
68 changes: 68 additions & 0 deletions build.fsx
@@ -0,0 +1,68 @@
#load "tools/WebSharper.Fake.fsx"
#r "packages/AjaxMin/lib/net40/AjaxMin.dll"

open System.IO
open Fake
open WebSharper.Fake

let version = "4.0"
let pre = Some "rc"

let baseVersion =
version + match pre with None -> "" | Some x -> "-" + x
|> Paket.SemVer.Parse

let targets = MakeTargets {
WSTargets.Default (ComputeVersion (Some baseVersion)) with
SolutionFile = "WebSharper.sln"
}

let NeedsBuilding input output =
let i = FileInfo(input)
let o = FileInfo(output)
not o.Exists || o.LastWriteTimeUtc < i.LastWriteTimeUtc

let Minify () =
let minify (path: string) =
let min = Microsoft.Ajax.Utilities.Minifier()
let out = Path.ChangeExtension(path, ".min.js")
if NeedsBuilding path out then
let raw = File.ReadAllText(path)
let mjs = min.MinifyJavaScript(raw)
File.WriteAllText(Path.ChangeExtension(path, ".min.js"), mjs)
stdout.WriteLine("Written {0}", out)
minify "src/compiler/WebSharper.Core.JavaScript/Runtime.js"
minify "src/stdlib/WebSharper.Main/Json.js"
minify "src/stdlib/WebSharper.Main/AnimFrame.js"

let SetVersion () =
let v = targets.ComputedVersion
["msbuild/AssemblyInfo.fs"]
|> List.map (fun f -> File.Copy(f + ".in", f, true); f)
|> processTemplates [
"{version}", sprintf "%i.%i.%i.%s" v.Major v.Minor v.Patch v.Build
"{assemblyversion}", sprintf "%i.%i.0.0" v.Major v.Minor
]

Target "Prepare" <| fun () ->
Minify()
SetVersion()
targets.AddPrebuild "Prepare"

Target "Build" DoNothing
targets.BuildDebug ==> "Build"

Target "CI-Release" DoNothing
targets.Publish ==> "CI-Release"

Target "Run" <| fun () ->
shellExec {
defaultParams with
Program = @"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe"
CommandLine = "/r WebSharper.sln"
}
|> ignore

"Build" ==> "Run"

RunTargetOrDefault "Build"
35 changes: 32 additions & 3 deletions build.sh
@@ -1,4 +1,33 @@
#! /bin/sh
#!/bin/bash
if test "$OS" = "Windows_NT"
then
# use .Net

rm -rf build
xbuild msbuild/WebSharper.proj "/verbosity:minimal" "/p:MonoPrefix=mono" "/p:Arguments=$*" "/flp:PerformanceSummary"
.paket/paket.bootstrapper.exe
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
fi

.paket/paket.exe restore --touch-affected-refs
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
fi

packages/FAKE/tools/FAKE.exe $@ --fsiargs build.fsx
else
# use mono
mono .paket/paket.bootstrapper.exe
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
fi

mono .paket/paket.exe restore --touch-affected-refs
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
fi
mono packages/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
fi
6 changes: 0 additions & 6 deletions buildrun.cmd

This file was deleted.

27 changes: 0 additions & 27 deletions msbuild/AssemblyInfo.fs

This file was deleted.

Expand Up @@ -24,4 +24,5 @@ open System
open System.Reflection

[<assembly: AssemblyFileVersion("{version}")>]
[<assembly: AssemblyVersion("{assemblyversion}")>]
do ()
36 changes: 4 additions & 32 deletions msbuild/FSharp.targets
Expand Up @@ -23,8 +23,6 @@

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetFSharpCoreVersion Condition=" '$(FSharp40)' == 'True' ">4.4.1.0</TargetFSharpCoreVersion>
<TargetFSharpCoreVersion Condition=" '$(FSharp40)' != 'True' ">4.3.0.0</TargetFSharpCoreVersion>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v4.0</TargetFrameworkVersion>
<KeyOriginatorFile Condition=" '$(INTELLIFACTORY)' != '' And $(Signed) != 'False' ">$(INTELLIFACTORY)/keys/IntelliFactory.snk</KeyOriginatorFile>
<KeyOriginatorFile Condition=" '$(INTELLIFACTORY)' == '' And $(Signed) != 'False' ">$(MSBuildThisFileDirectory)/../tools/WebSharper.snk</KeyOriginatorFile>
Expand All @@ -37,22 +35,9 @@
<OutputPath Condition=" '$(OutputPath)' == '' And '$(FSharpTool)' == 'True' ">$(Root)\build\$(Configuration)\FSharp</OutputPath>
<OutputPath Condition=" '$(OutputPath)' == '' And '$(Tests)' == 'True' ">$(Root)\build\$(Configuration)\Tests</OutputPath>
<OutputPath Condition=" '$(OutputPath)' == '' ">$(Root)\build\$(Configuration)\</OutputPath>
<PrivateFSharpCore Condition=" '$(PrivateFSharpCore)' == '' ">False</PrivateFSharpCore>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="FSharp.Core, Version=4.3.0.0" Condition=" '$(FSharp40)' != 'True' ">
<HintPath>$(MSBuildThisFileDirectory)\..\packages\FSharp.Core.3.0.2\lib\net40\FSharp.Core.dll</HintPath>
<Private>$(PrivateFSharpCore)</Private>
</Reference>
<Reference Include="FSharp.Core, Version=4.4.1.0" Condition=" '$(FSharp40)' == 'True' ">
<HintPath>$(MSBuildThisFileDirectory)\..\packages\FSharp.Core.4.1.17\lib\net45\FSharp.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.ValueTuple" Condition=" '$(FSharp40)' == 'True' ">
<HintPath>$(MSBuildThisFileDirectory)\..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -80,32 +65,19 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(FSharp40)' == 'True' ">
<DefineConstants>$(DefineConstants);FSHARP40</DefineConstants>
<TargetFrameworkVersion Condition=" $(TargetFrameworkVersion) == '' ">v4.5</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkVersion Condition=" $(TargetFrameworkVersion) == '' ">v4.5</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<Target Name="IncludeVersionFile" BeforeTargets="CoreCompile">
<ItemGroup>
<C Include="@(Compile)" />
<Compile Remove="@(C)" />
<Compile Include="$(MSBuildThisFileDirectory)/AssemblyInfo.fs" />
<Compile Include="$(MSBuildThisFileDirectory)/AssemblyInfo.extra.fs" Condition="Exists('$(MSBuildThisFileDirectory)/AssemblyInfo.extra.fs')" />
<Compile Include="$(MSBuildThisFileDirectory)/AssemblyInfo.fs" Condition="Exists('$(MSBuildThisFileDirectory)/AssemblyInfo.fs')" />
<Compile Include="@(C)" />
</ItemGroup>
</Target>
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
</PropertyGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '11.0'">
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</Otherwise>
</Choose>
<Import Project="$(FSharpTargetsPath)" />
<Import Project="$(MSBuildThisFileDirectory)/../packages/FSharp.Compiler.Tools/tools/Microsoft.FSharp.Targets" />
</Project>
39 changes: 0 additions & 39 deletions msbuild/Mono.Cecil.targets

This file was deleted.

13 changes: 0 additions & 13 deletions msbuild/Temp.proj

This file was deleted.

0 comments on commit 060d63a

Please sign in to comment.