Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed MSBUILD dependencies in the package #338

Closed
wants to merge 2 commits into from
Closed
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
61 changes: 33 additions & 28 deletions build.fsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// --------------------------------------------------------------------------------------
// FAKE build script
// FAKE build script
// --------------------------------------------------------------------------------------

#I "packages/FAKE/tools"
#r "packages/FAKE/tools/FakeLib.dll"
#load "packages/SourceLink.Fake/tools/SourceLink.fsx"
open System
open Fake
open Fake
open Fake.Git
open Fake.ReleaseNotesHelper
open Fake.AssemblyInfoFile
Expand All @@ -22,24 +22,28 @@ let summary = "F# compiler services for creating IDE tools, language extensions
let description = """
The F# compiler services package contains a custom build of the F# compiler that
exposes additional functionality for implementing F# language bindings, additional
tools based on the compiler or refactoring tools. The package also includes F#
tools based on the compiler or refactoring tools. The package also includes F#
interactive service that can be used for embedding F# scripting into your applications."""
let standalone = "This is a standalone version of the package that bundles MSBUILD assemblies."
let tags = "F# fsharp interactive compiler editor"

let gitHome = "https://github.com/fsharp"
let gitName = "FSharp.Compiler.Service"
let gitRaw = environVarOrDefault "gitRaw" "https://raw.githubusercontent.com/fsharp"

let netFrameworks = ["v4.0"; "v4.5"]
let nugetPackages =
[ "FSharp.Compiler.Service", summary, description
"FSharp.Compiler.Service.Standalone", summary + standalone, description + standalone]

// --------------------------------------------------------------------------------------
// The rest of the code is standard F# build script
// The rest of the code is standard F# build script
// --------------------------------------------------------------------------------------

// Read release notes & version info from RELEASE_NOTES.md
let release = LoadReleaseNotes "RELEASE_NOTES.md"
let isAppVeyorBuild = environVar "APPVEYOR" <> null
let nugetVersion =
let nugetVersion =
if isAppVeyorBuild then sprintf "%s-a%s" release.NugetVersion (DateTime.UtcNow.ToString "yyMMddHHmm")
else release.NugetVersion

Expand All @@ -52,7 +56,7 @@ Target "AssemblyInfo" (fun _ ->
let fileName = "src/assemblyinfo/assemblyinfo.shared.fs"
CreateFSharpAssemblyInfo fileName
[ Attribute.Version release.AssemblyVersion
Attribute.FileVersion release.AssemblyVersion]
Attribute.FileVersion release.AssemblyVersion]
)

// --------------------------------------------------------------------------------------
Expand All @@ -71,9 +75,9 @@ Target "CleanDocs" (fun _ ->
// --------------------------------------------------------------------------------------
// Build library & test project

Target "GenerateFSIStrings" (fun _ ->
Target "GenerateFSIStrings" (fun _ ->
// Generate FSIStrings using the FSSrGen tool
execProcess (fun p ->
execProcess (fun p ->
let dir = __SOURCE_DIRECTORY__ @@ "src/fsharp/fsi"
p.Arguments <- "FSIstrings.txt FSIstrings.fs FSIstrings.resx"
p.WorkingDirectory <- dir
Expand All @@ -83,7 +87,7 @@ Target "GenerateFSIStrings" (fun _ ->

Target "Build" (fun _ ->
netFrameworks
|> List.iter (fun framework ->
|> List.iter (fun framework ->
let outputPath = "bin/" + framework
!! (project + ".sln")
|> MSBuild outputPath "Build" ["Configuration","Release"; "TargetFrameworkVersion", framework]
Expand All @@ -95,13 +99,13 @@ Target "SourceLink" (fun _ ->
()
#else
netFrameworks
|> List.iter (fun framework ->
|> List.iter (fun framework ->
let f = !! "src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj" |> Seq.head
use repo = new GitRepo(__SOURCE_DIRECTORY__)
let outputPath = __SOURCE_DIRECTORY__ @@ "bin/" + framework
let proj = VsProj.Load f ["Configuration","Release"; "TargetFrameworkVersion",framework; "OutputPath",outputPath]
logfn "indexing %s" proj.OutputFilePdb
let compiles = proj.Compiles.SetBaseDirectory __SOURCE_DIRECTORY__
let compiles = proj.Compiles.SetBaseDirectory __SOURCE_DIRECTORY__
let gitFiles =
compiles
-- "src/assemblyinfo/assemblyinfo*.fs" // not source indexed
Expand All @@ -111,7 +115,7 @@ Target "SourceLink" (fun _ ->
-- "src/fsharp/FSharp.Compiler.Service/lex.fs"
-- "src/fsharp/FSharp.Compiler.Service/pars.fs"
repo.VerifyChecksums gitFiles
let pdbFiles =
let pdbFiles =
compiles
// generated, not in the fsproj as Compile, not source indexed
++ "src/absil/illex.fsl"
Expand All @@ -131,7 +135,7 @@ Target "SourceLink" (fun _ ->
// Run the unit tests using test runner

Target "RunTests" (fun _ ->
!! (if isAppVeyorBuild then "./bin/v4.5/FSharp.Compiler.Service.Tests.dll"
!! (if isAppVeyorBuild then "./bin/v4.5/FSharp.Compiler.Service.Tests.dll"
else "./bin/**/FSharp.Compiler.Service.Tests.dll")
|> NUnit (fun p ->
{ p with
Expand All @@ -145,19 +149,20 @@ Target "RunTests" (fun _ ->
// Build a NuGet package

Target "NuGet" (fun _ ->
NuGet (fun p ->
{ p with
Authors = authors
Project = project
Summary = summary
Description = description
Version = nugetVersion
ReleaseNotes = release.Notes |> toLines
Tags = tags
OutputPath = "bin"
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetkey" })
("nuget/" + project + ".nuspec")
for package, summary, description in nugetPackages do
NuGet (fun p ->
{ p with
Authors = authors
Project = project
Summary = summary
Description = description
Version = nugetVersion
ReleaseNotes = release.Notes |> toLines
Tags = tags
OutputPath = "bin"
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetkey" })
("nuget/" + package + ".nuspec")
)

// --------------------------------------------------------------------------------------
Expand All @@ -176,7 +181,7 @@ Target "GenerateDocsJa" (fun _ ->

Target "ReleaseDocs" (fun _ ->
let tempDocsDir = "temp/gh-pages"
if not (System.IO.Directory.Exists tempDocsDir) then
if not (System.IO.Directory.Exists tempDocsDir) then
Repository.cloneSingleBranch "" (gitHome + "/" + gitName + ".git") "gh-pages" tempDocsDir

fullclean tempDocsDir
Expand Down Expand Up @@ -206,7 +211,7 @@ Target "All" DoNothing
==> "All"

"All"
==> "PrepareRelease"
==> "PrepareRelease"
==> "SourceLink"
==> "NuGet"
==> "Release"
Expand Down
39 changes: 39 additions & 0 deletions nuget/FSharp.Compiler.Service.Standalone.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>@project@</id>
<version>@build.number@</version>
<authors>@authors@</authors>
<owners>@authors@</owners>
<licenseUrl>https://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/fsharp/FSharp.Compiler.Service</projectUrl>
<iconUrl>https://raw.github.com/fsharp/FSharp.Compiler.Service/master/misc/logo.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>@summary@</summary>
<description>@description@</description>
<releaseNotes>@releaseNotes@</releaseNotes>
<copyright>Copyright 2013</copyright>
<tags>@tags@</tags>
</metadata>
<files>
<!-- .NET 4.0 assemblies -->
<file src="..\bin\v4.0\FSharp.Compiler.Service.dll" target="lib/net40" />
<file src="..\bin\v4.0\FSharp.Compiler.Service.xml" target="lib/net40" />
<file src="..\bin\v4.0\FSharp.Compiler.Service.pdb" target="lib/net40" />
<file src="..\bin\v4.0\Microsoft.Build.dll" target="lib/net40" />
<file src="..\bin\v4.0\Microsoft.Build.Engine.dll" target="lib/net40" />
<file src="..\bin\v4.0\Microsoft.Build.Framework.dll" target="lib/net40" />
<file src="..\bin\v4.0\Microsoft.Build.Tasks.v4.0.dll" target="lib/net40" />
<file src="..\bin\v4.0\Microsoft.Build.Utilities.v4.0.dll" target="lib/net40" />

<!-- .NET 4.5 assemblies -->
<file src="..\bin\v4.5\FSharp.Compiler.Service.dll" target="lib/net45" />
<file src="..\bin\v4.5\FSharp.Compiler.Service.xml" target="lib/net45" />
<file src="..\bin\v4.5\FSharp.Compiler.Service.pdb" target="lib/net45" />
<file src="..\bin\v4.5\Microsoft.Build.dll" target="lib/net45" />
<file src="..\bin\v4.5\Microsoft.Build.Engine.dll" target="lib/net45" />
<file src="..\bin\v4.5\Microsoft.Build.Framework.dll" target="lib/net45" />
<file src="..\bin\v4.5\Microsoft.Build.Tasks.v12.0.dll" target="lib/net45" />
<file src="..\bin\v4.5\Microsoft.Build.Utilities.v12.0.dll" target="lib/net45" />
</files>
</package>
4 changes: 2 additions & 2 deletions nuget/FSharp.Compiler.Service.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
<file src="..\bin\v4.5\FSharp.Compiler.Service.dll" target="lib/net45" />
<file src="..\bin\v4.5\FSharp.Compiler.Service.xml" target="lib/net45" />
<file src="..\bin\v4.5\FSharp.Compiler.Service.pdb" target="lib/net45" />
</files>
</package>
</files>
</package>
59 changes: 40 additions & 19 deletions src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
# Copyright (c) 2002-2011 Microsoft Corporation.
# Copyright (c) 2002-2011 Microsoft Corporation.
#
#
#
#
#
#
#
#
#
# You must not remove this notice, or any other, from this software.
Expand Down Expand Up @@ -592,23 +592,44 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.Build.Framework" Condition=" '$(TargetFrameworkVersion)' == 'v4.0'" />
<Reference Include="Microsoft.Build.Engine" Condition=" '$(TargetFrameworkVersion)' == 'v4.0'" />
<Reference Include="Microsoft.Build" Condition=" '$(TargetFrameworkVersion)' == 'v4.0'" />
<Reference Include="Microsoft.Build.Utilities.v4.0" Condition=" '$(TargetFrameworkVersion)' == 'v4.0'" />
<Reference Include="Microsoft.Build.Tasks.v4.0" Condition=" '$(TargetFrameworkVersion)' == 'v4.0'" />

<Reference Include="Microsoft.Build.Framework, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition=" '$(TargetFrameworkVersion)' == 'v4.5'" >
<SpecificVersion>True</SpecificVersion>
<Reference Include="Microsoft.Build.Framework" Condition=" '$(TargetFrameworkVersion)' == 'v4.0'">
<SpecificVersion>True</SpecificVersion>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Build.Engine" Condition=" '$(TargetFrameworkVersion)' == 'v4.0'">
<SpecificVersion>True</SpecificVersion>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Build" Condition=" '$(TargetFrameworkVersion)' == 'v4.0'">
<SpecificVersion>True</SpecificVersion>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Build.Utilities.v4.0" Condition=" '$(TargetFrameworkVersion)' == 'v4.0'">
<SpecificVersion>True</SpecificVersion>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Build.Tasks.v4.0" Condition=" '$(TargetFrameworkVersion)' == 'v4.0'">
<SpecificVersion>True</SpecificVersion>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Build.Framework, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition=" '$(TargetFrameworkVersion)' == 'v4.5'">
<SpecificVersion>True</SpecificVersion>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Build.Engine, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition=" '$(TargetFrameworkVersion)' == 'v4.5'">
<SpecificVersion>True</SpecificVersion>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition=" '$(TargetFrameworkVersion)' == 'v4.5'">
<SpecificVersion>True</SpecificVersion>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Build.Engine, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition=" '$(TargetFrameworkVersion)' == 'v4.5'" >
<SpecificVersion>True</SpecificVersion>
<Reference Include="Microsoft.Build.Utilities.v12.0" Condition=" '$(TargetFrameworkVersion)' == 'v4.5'">
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition=" '$(TargetFrameworkVersion)' == 'v4.5'" >
<SpecificVersion>True</SpecificVersion>
<Reference Include="Microsoft.Build.Tasks.v12.0" Condition=" '$(TargetFrameworkVersion)' == 'v4.5'">
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Build.Utilities.v12.0" Condition=" '$(TargetFrameworkVersion)' == 'v4.5'" />
<Reference Include="Microsoft.Build.Tasks.v12.0" Condition=" '$(TargetFrameworkVersion)' == 'v4.5'" />
<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Private>False</Private>
</Reference>
Expand Down