Skip to content

Commit

Permalink
Merge pull request #82 from eiriktsarpalis/multi-target
Browse files Browse the repository at this point in the history
Fix multi-target packaging issues
  • Loading branch information
eulerfx committed Feb 27, 2018
2 parents 3b5cabc + f6b4d17 commit aa589cf
Show file tree
Hide file tree
Showing 12 changed files with 1,299 additions and 1,640 deletions.
19 changes: 16 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

# Xamarin Studio / monodevelop user-specific
*.userprefs
*.dll.mdb
*.exe.mdb

# Build results

Expand All @@ -18,9 +20,6 @@ build/
[Bb]in/
[Oo]bj/

# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
!packages/*/build/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
Expand Down Expand Up @@ -62,6 +61,9 @@ ipch/
*.vsp
*.vspx

# Other Visual Studio data
.vs/

# Guidance Automation Toolkit
*.gpState

Expand Down Expand Up @@ -108,6 +110,9 @@ csx
# Windows Store app package directory
AppPackages/

# VSCode
.vscode/

# Others
sql/
*.Cache
Expand Down Expand Up @@ -180,6 +185,14 @@ release.sh
localpackages/
paket-files
*.orig
.paket/paket.exe
docs/content/license.md
docs/content/release-notes.md
.fake
docs/tools/FSharp.Formatting.svclog

# xunit
xunit*.html

# exclude artifacts folder
artifacts/
Binary file removed .paket/paket.exe
Binary file not shown.
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ matrix:
include:
- os: linux # Ubuntu 14.04
dist: trusty
sudo: required
sudo: false
mono: latest
dotnet: 2.0.0
- os: osx # OSX 10.12
osx_image: xcode9.1
dotnet: 2.0.0
dist: trusty
sudo: required
mono: latest
sudo: false

script:
- dotnet --info
- ./build.sh All

branches:
except:
- gh-pages
- gh-pages
9 changes: 7 additions & 2 deletions FSharp.Control.AsyncSeq.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{63297B
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{BF60BC93-E09B-4E5F-9D85-95A519479D54}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
.travis.yml = .travis.yml
appveyor.yml = appveyor.yml
build.cmd = build.cmd
build.fsx = build.fsx
build.sh = build.sh
LICENSE.txt = LICENSE.txt
README.md = README.md
RELEASE_NOTES.md = RELEASE_NOTES.md
Expand Down Expand Up @@ -38,11 +43,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{83F16175
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{86625A13-D7E2-4EAD-B13A-4F37BD89DE2A}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Control.AsyncSeq", "src\FSharp.Control.AsyncSeq\FSharp.Control.AsyncSeq.fsproj", "{DBDF64C3-BE92-4272-8737-5001C469D9AA}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Control.AsyncSeq", "src\FSharp.Control.AsyncSeq\FSharp.Control.AsyncSeq.fsproj", "{DBDF64C3-BE92-4272-8737-5001C469D9AA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{561B2DD4-BBFB-4E0D-BF73-C10A3E42507C}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Control.AsyncSeq.Tests", "tests\FSharp.Control.AsyncSeq.Tests\FSharp.Control.AsyncSeq.Tests.fsproj", "{F2404B35-0DAD-483D-9406-7C763CDDC029}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Control.AsyncSeq.Tests", "tests\FSharp.Control.AsyncSeq.Tests\FSharp.Control.AsyncSeq.Tests.fsproj", "{F2404B35-0DAD-483D-9406-7C763CDDC029}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
7 changes: 6 additions & 1 deletion build.cmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
@echo off
cls

.paket\paket.bootstrapper.exe
if errorlevel 1 (
exit /b %errorlevel%
)

.paket\paket.exe restore
if errorlevel 1 (
exit /b %errorlevel%
Expand All @@ -10,4 +15,4 @@ IF NOT EXIST build.fsx (
.paket\paket.exe update
packages\build\FAKE\tools\FAKE.exe init.fsx
)
packages\build\FAKE\tools\FAKE.exe build.fsx %*
packages\build\FAKE\tools\FAKE.exe build.fsx %*
29 changes: 11 additions & 18 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,17 @@ Target "CleanDocs" (fun _ ->
CleanDirs ["docs/output"]
)

Target "Restore" (fun _ ->
DotNetCli.Restore id
)

// --------------------------------------------------------------------------------------
// Build library & test project

Target "Build" (fun _ ->
DotNetCli.Build (fun p ->
{ p with Project = solutionFile })
)
!! solutionFile
|> MSBuild null "Rebuild" [("Configuration", "Release")]
|> ignore)

// --------------------------------------------------------------------------------------
// Run the unit tests using test runner
Expand All @@ -77,23 +81,11 @@ Target "RunTests" (fun _ ->
// Build a NuGet package

Target "NuGet" (fun _ ->

//Paket.Pack (fun p ->
// { p with
// OutputPath = buildDir
// Version = release.NugetVersion
// ReleaseNotes = (toLines release.Notes) })

DotNetCli.Pack (fun p ->
Paket.Pack (fun p ->
{ p with
Project = project
OutputPath = buildDir
AdditionalArgs =
[ "--no-build"
sprintf "/p:Version=%s" release.NugetVersion
//"/p:ReleaseNotes=" + (toLines release.Notes)
]
})
Version = release.NugetVersion
ReleaseNotes = (toLines release.Notes) })
)

Target "PublishNuget" (fun _ ->
Expand Down Expand Up @@ -248,6 +240,7 @@ Target "BuildPackage" DoNothing
Target "All" DoNothing

"Clean"
==> "Restore"
==> "Build"
==> "RunTests"
=?> ("GenerateReferenceDocs",isLocalBuild && not isMono)
Expand Down
93 changes: 71 additions & 22 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,76 @@
#!/bin/bash
export FrameworkPathOverride=$(dirname $(which mono))/../lib/mono/4.5/
#!/usr/bin/env bash

if test "$OS" = "Windows_NT"
set -eu

cd `dirname $0`

PAKET_BOOTSTRAPPER_EXE=.paket/paket.bootstrapper.exe
PAKET_EXE=.paket/paket.exe
FAKE_EXE=packages/build/FAKE/tools/FAKE.exe

FSIARGS=""
FSIARGS2=""
OS=${OS:-"unknown"}
if [ "$OS" != "Windows_NT" ]
then
# use .Net
.paket/paket.exe restore
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
fi

[ ! -e build.fsx ] && .paket/paket.exe update
[ ! -e build.fsx ] && packages/build/FAKE/tools/FAKE.exe init.fsx
packages/build/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
else
# use mono
mono .paket/paket.exe restore
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
# Can't use FSIARGS="--fsiargs -d:MONO" in zsh, so split it up
# (Can't use arrays since dash can't handle them)
FSIARGS="--fsiargs"
FSIARGS2="-d:MONO"
fi

run() {
if [ "$OS" != "Windows_NT" ]
then
mono "$@"
else
"$@"
fi
}

[ ! -e build.fsx ] && mono .paket/paket.exe update
[ ! -e build.fsx ] && mono packages/build/FAKE/tools/FAKE.exe init.fsx
mono packages/build/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
yesno() {
# NOTE: Defaults to NO
read -p "$1 [y/N] " ynresult
case "$ynresult" in
[yY]*) true ;;
*) false ;;
esac
}

set +e
run $PAKET_BOOTSTRAPPER_EXE
bootstrapper_exitcode=$?
set -e

if [ "$OS" != "Windows_NT" ] &&
[ $bootstrapper_exitcode -ne 0 ] &&
[ $(certmgr -list -c Trust | grep X.509 | wc -l) -le 1 ] &&
[ $(certmgr -list -c -m Trust | grep X.509 | wc -l) -le 1 ]
then
echo "Your Mono installation has no trusted SSL root certificates set up."
echo "This may result in the Paket bootstrapper failing to download Paket"
echo "because Github's SSL certificate can't be verified. One way to fix"
echo "this issue would be to download the list of SSL root certificates"
echo "from the Mozilla project by running the following command:"
echo ""
echo " mozroots --import --sync"
echo ""
echo "This will import over 100 SSL root certificates into your Mono"
echo "certificate repository."
echo ""
if yesno "Run 'mozroots --import --sync' now?"
then
mozroots --import --sync
else
echo "Attempting to continue without running mozroots. This might fail."
fi
# Re-run bootstrapper whether or not the user ran mozroots, because maybe
# they fixed the problem in a separate terminal window.
run $PAKET_BOOTSTRAPPER_EXE
fi

run $PAKET_EXE restore

[ ! -e build.fsx ] && run $PAKET_EXE update
[ ! -e build.fsx ] && run $FAKE_EXE init.fsx
run $FAKE_EXE "$@" $FSIARGS $FSIARGS2 build.fsx
10 changes: 9 additions & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
source https://api.nuget.org/v3/index.json
framework: netstandard2.0
redirects: on
storage: none

nuget FSharp.Core
nuget FSharp.Core >= 4.3.2 lowest_matching: true

group Legacy
source https://api.nuget.org/v3/index.json
framework: net452
storage: none

nuget FSharp.Core >= 3.1.2 lowest_matching: true

group Build
source https://api.nuget.org/v3/index.json
Expand Down
Loading

0 comments on commit aa589cf

Please sign in to comment.