Skip to content

Commit

Permalink
Merge pull request #3713 from fsprojects/fullsdk
Browse files Browse the repository at this point in the history
Remove FSharp.Compiler.Tools and move to SDK based projects
  • Loading branch information
forki authored Nov 22, 2019
2 parents 6afaf9b + a5dbc6c commit f0f0795
Show file tree
Hide file tree
Showing 47 changed files with 439 additions and 12,212 deletions.
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-mergenupkg": {
"version": "3.0.0",
"commands": [
"dotnet-mergenupkg"
]
}
}
}
85 changes: 0 additions & 85 deletions Paket.preview3.sln

This file was deleted.

5 changes: 5 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ image: Visual Studio 2017
init:
- git config --global core.autocrlf input

install:
- ps: Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile "${env:TEMP}\dotnet-install.ps1"
- ps: $sdkVersionFromGlobalJson = (Get-Content -Raw -Path 'global.json' | Out-String | ConvertFrom-Json).sdk.version
- ps: '& "${env:TEMP}\dotnet-install.ps1" -Version $sdkVersionFromGlobalJson'

build_script:
- cmd: build.cmd BuildPackage

Expand Down
81 changes: 42 additions & 39 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ let tags = "nuget, bundler, F#"
let solutionFile = "Paket.sln"

// Pattern specifying assemblies to be tested using NUnit
let testAssemblies = "tests/**/bin/Release/*Tests*.dll"
let integrationTestAssemblies = "integrationtests/Paket.IntegrationTests/bin/Release/*Tests*.dll"
let testAssemblies = "tests/**/bin/Release/net461/*Tests*.dll"
let integrationTestAssemblies = "integrationtests/Paket.IntegrationTests/bin/Release/net461/*Tests*.dll"

// Git configuration (used for publishing documentation in gh-pages branch)
// The profile where the project is posted
Expand All @@ -69,6 +69,7 @@ let mutable dotnetExePath = "dotnet"
// --------------------------------------------------------------------------------------

let buildDir = "bin"
let buildDirNet461 = "bin/net461"
let buildDirNetCore = "bin_netcore"
let tempDir = "temp"
let buildMergedDir = buildDir @@ "merged"
Expand All @@ -91,6 +92,15 @@ let stable =
| _ -> release


let runDotnet workingDir args =
let result =
ExecProcess (fun info ->
info.FileName <- dotnetExePath
info.WorkingDirectory <- workingDir
info.Arguments <- args) TimeSpan.MaxValue
if result <> 0 then
failwithf "dotnet %s failed" args

let testSuiteFilterFlakyTests = getEnvironmentVarAsBoolOrDefault "PAKET_TESTSUITE_FLAKYTESTS" false

let genFSAssemblyInfo (projectPath: string) =
Expand Down Expand Up @@ -122,8 +132,8 @@ let genCSAssemblyInfo (projectPath: string) =

// Generate assembly info files with the right version & up-to-date information
Target "AssemblyInfo" (fun _ ->
let fsProjs = !! "src/**/*.fsproj" |> Seq.filter (fun s -> not <| s.Contains("preview"))
let csProjs = !! "src/**/*.csproj" |> Seq.filter (fun s -> not <| s.Contains("preview"))
let fsProjs = !! "src/**/*.fsproj"
let csProjs = !! "src/**/*.csproj"
fsProjs |> Seq.iter genFSAssemblyInfo
csProjs |> Seq.iter genCSAssemblyInfo
)
Expand All @@ -140,6 +150,7 @@ Target "Clean" (fun _ ->
!! "src/**/bin"
++ "tests/**/bin"
++ buildDir
++ buildDirNet461
++ buildDirNetCore
++ tempDir
|> CleanDirs
Expand All @@ -157,20 +168,18 @@ Target "CleanDocs" (fun _ ->

Target "Build" (fun _ ->
if isMono then
!! solutionFile
|> MSBuildReleaseExt "" [
"VisualStudioVersion", "14.0"
"ToolsVersion" , "14.0"
] "Rebuild"
|> ignore
DotNetCli.Build (fun c ->
{ c with
Project = solutionFile
ToolPath = dotnetExePath
})
else
!! solutionFile
|> MSBuildReleaseExt "" [
"VisualStudioVersion", "14.0"
"ToolsVersion" , "14.0"
"SourceLinkCreate" , "true"
] "Rebuild"
|> ignore
DotNetCli.Build (fun c ->
{ c with
Project = solutionFile
ToolPath = dotnetExePath
AdditionalArgs = [ "/p:SourceLinkCreate=true" ]
})
)

let assertExitCodeZero x =
Expand All @@ -185,33 +194,26 @@ let runCmdIn workDir exe =
/// Execute a dotnet cli command
let dotnet workDir = runCmdIn workDir "dotnet"

Target "DotnetRestoreTools" (fun _ ->
DotNetCli.Restore (fun c ->
{ c with
Project = currentDirectory </> "tools" </> "tools.fsproj"
ToolPath = dotnetExePath
})
)

Target "DotnetRestore" (fun _ ->

//WORKAROUND dotnet restore with paket doesnt restore the PackageReference of SourceLink
// ref https://github.com/fsprojects/Paket/issues/2930
Paket.Restore (fun p ->
{ p with
Group = "NetCoreTools" })

runDotnet "." "tool restore"

DotNetCli.Restore (fun c ->
{ c with
Project = "Paket.preview3.sln"
Project = "Paket.sln"
ToolPath = dotnetExePath
})
)

Target "DotnetBuild" (fun _ ->
DotNetCli.Build (fun c ->
{ c with
Project = "Paket.preview3.sln"
Project = "Paket.sln"
ToolPath = dotnetExePath
AdditionalArgs = [ "/p:SourceLinkCreate=true" ]
})
Expand All @@ -221,9 +223,10 @@ Target "DotnetBuild" (fun _ ->
Target "DotnetPublish" (fun _ ->
DotNetCli.Publish (fun c ->
{ c with
Project = "src/Paket.preview3"
Project = "src/Paket"
ToolPath = dotnetExePath
Output = FullName (currentDirectory </> buildDirNetCore)
AdditionalArgs = [ "-f netcoreapp2.1" ]
})
)
"Clean" ==> "DotnetBuild" ?=> "DotnetPublish"
Expand All @@ -233,19 +236,19 @@ Target "DotnetPackage" (fun _ ->
CleanDir outPath
DotNetCli.Pack (fun c ->
{ c with
Project = "src/Paket.Core.preview3/Paket.Core.fsproj"
Project = "src/Paket.Core/Paket.Core.fsproj"
ToolPath = dotnetExePath
AdditionalArgs = [(sprintf "-o \"%s\"" outPath); (sprintf "/p:Version=%s" release.NugetVersion)]
})
DotNetCli.Pack (fun c ->
{ c with
Project = "src/Paket.preview3/Paket.fsproj"
Project = "src/Paket/Paket.fsproj"
ToolPath = dotnetExePath
AdditionalArgs = [(sprintf "-o \"%s\"" outPath); (sprintf "/p:Version=%s" release.NugetVersion)]
})
DotNetCli.Pack (fun c ->
{ c with
Project = "src/Paket.Bootstrapper.preview3/Paket.Bootstrapper.csproj"
Project = "src/Paket.Bootstrapper/Paket.Bootstrapper.csproj"
ToolPath = dotnetExePath
AdditionalArgs = [(sprintf "-o \"%s\"" outPath); (sprintf "/p:Version=%s" release.NugetVersion)]
})
Expand All @@ -256,7 +259,7 @@ Target "DotnetTest" (fun _ ->

DotNetCli.Test (fun c ->
{ c with
Project = "tests/Paket.Tests.preview3/Paket.Tests.fsproj"
Project = "tests/Paket.Tests/Paket.Tests.fsproj"
AdditionalArgs =
[ "--filter"; (if testSuiteFilterFlakyTests then "TestCategory=Flaky" else "TestCategory!=Flaky")
sprintf "--logger:trx;LogFileName=%s" ("tests_result/netcore/Paket.Tests/TestResult.trx" |> Path.GetFullPath)
Expand All @@ -272,14 +275,16 @@ Target "RunIntegrationTestsNetCore" (fun _ ->
System.Environment.SetEnvironmentVariable("PAKET_DISABLE_RUNTIME_RESOLUTION", "true")
DotNetCli.Test (fun c ->
{ c with
Project = "integrationtests/Paket.IntegrationTests.preview3/Paket.IntegrationTests.fsproj"
Project = "integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj"
ToolPath = dotnetExePath
AdditionalArgs =
[ "--filter"; (if testSuiteFilterFlakyTests then "TestCategory=Flaky" else "TestCategory!=Flaky")
"--framework=netcoreapp2.0"
sprintf "--logger:trx;LogFileName=%s" ("tests_result/netcore/Paket.IntegrationTests/TestResult.trx" |> Path.GetFullPath) ]
TimeOut = TimeSpan.FromMinutes 60.
})
)

"Clean" ==> "DotnetPublish" ==> "RunIntegrationTestsNetCore"

// --------------------------------------------------------------------------------------
Expand Down Expand Up @@ -342,13 +347,13 @@ Target "MergePaketTool" (fun _ ->

let toPack =
mergeLibs
|> List.map (fun l -> buildDir @@ l)
|> List.map (fun l -> buildDirNet461 @@ l)
|> separated " "

let result =
ExecProcess (fun info ->
info.FileName <- currentDirectory </> "packages" </> "build" </> "ILRepack" </> "tools" </> "ILRepack.exe"
info.Arguments <- sprintf "/lib:%s /ver:%s /out:%s %s" buildDir release.AssemblyVersion paketFile toPack
info.Arguments <- sprintf "/lib:%s /ver:%s /out:%s %s" buildDirNet461 release.AssemblyVersion paketFile toPack
) (TimeSpan.FromMinutes 5.)

if result <> 0 then failwithf "Error during ILRepack execution."
Expand All @@ -367,6 +372,7 @@ Target "RunIntegrationTests" (fun _ ->
Where = if testSuiteFilterFlakyTests then "cat==Flaky" else "cat!=Flaky"
TimeOut = TimeSpan.FromMinutes 40. })
)

"Clean" ==> "Build" ==> "RunIntegrationTests"


Expand Down Expand Up @@ -730,7 +736,4 @@ Target "All" DoNothing
"EnsurePackageSigned"
==> "Release"

"DotnetRestoreTools"
==> "MergeDotnetCoreIntoNuget"

RunTargetOrDefault "All"
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ then
if [ $exit_code -ne 0 ]; then
exit $exit_code
fi
MSBuild=`pwd -W`/packages/build/RoslynTools.MSBuild/tools/msbuild/MSBuild.exe packages/build/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
MSBuild=`pwd -W`/packages/build/RoslynTools.MSBuild/tools/msbuild/MSBuild.exe packages/build/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
else
mono .paket/paket.exe restore
exit_code=$?
if [ $exit_code -ne 0 ]; then
if [ $exit_code -ne 0 ]; then
certificate_count=$(certmgr -list -c Trust | grep X.509 | wc -l)
if [ $certificate_count -le 1 ]; then
echo "Couldn't download Paket. This might be because your Mono installation"
Expand All @@ -28,6 +28,6 @@ else
fi
# Note: the bundled MSBuild crashes hard on linux, so we still rely on the system-installed version
#export MSBuild=packages/build/RoslynTools.MSBuild/tools/msbuild/MSBuild.exe
mono packages/build/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
mono packages/build/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
fi

4 changes: 2 additions & 2 deletions docs/tools/generate.fsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// Getting help docs from Paket.exe
#r "../../bin/Argu.dll"
#r "../../bin/Paket.exe"
#r "../../bin/net461/Argu.dll"
#r "../../bin/net461/Paket.exe"
open System.IO


Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "2.1.500"
"version": "3.0.100"
}
}
13 changes: 13 additions & 0 deletions integrationtests/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project>
<!-- MSBuild only includes the first Directory.Build.props, so we need to manually include the root one -->
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />
<PropertyGroup>
<DebugType>portable</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
Loading

0 comments on commit f0f0795

Please sign in to comment.