diff --git a/FSharp.sln b/FSharp.sln index 0d41f990d73..9a3f8f5e6ff 100644 --- a/FSharp.sln +++ b/FSharp.sln @@ -31,7 +31,7 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Tests.FSharpSuite", EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.UnitTests", "tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj", "{A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Core.UnitTests", "tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj", "{88E2D422-6852-46E3-A740-83E391DC7973}" +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Core.UnitTests", "tests\FSharp.Core.UnitTests\FSharp.Core.Unittests.fsproj", "{88E2D422-6852-46E3-A740-83E391DC7973}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Compiler", "Compiler", "{3881429D-A97A-49EB-B7AE-A82BA5FE9C77}" EndProject diff --git a/Makefile b/Makefile index d955b9e7580..b392dfe356f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ include $(topsrcdir)mono/config.make -.PHONY: restore +.PHONY: restore build restore: MONO_ENV_OPTIONS=$(monoopts) mono .nuget/NuGet.exe restore packages.config -PackagesDirectory packages -ConfigFile .nuget/NuGet.Config @@ -27,7 +27,7 @@ build: MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=$(Configuration) /p:TargetDotnetProfile=net40 src/fsharp/FSharp.Compiler.Server.Shared/FSharp.Compiler.Server.Shared.fsproj MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=$(Configuration) /p:TargetDotnetProfile=net40 src/fsharp/fsi/Fsi.fsproj MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=$(Configuration) /p:TargetDotnetProfile=net40 src/fsharp/fsiAnyCpu/FsiAnyCPU.fsproj - MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=$(Configuration) /p:TargetDotnetProfile=net40 tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj + MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=$(Configuration) /p:TargetDotnetProfile=net40 tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj mkdir -p $(Configuration)/fsharp30/net40/bin mkdir -p $(Configuration)/fsharp31/net40/bin mkdir -p $(Configuration)/fsharp40/net40/bin diff --git a/before_install.sh b/before_install.sh index d1498a55e64..10f623a6b0d 100755 --- a/before_install.sh +++ b/before_install.sh @@ -32,7 +32,7 @@ fi # We need to run the command twice -- on some systems (e.g. macOS) the certs are installed in the user store, # and on other systems (e.g., Ubuntu) they're installed to the machine store. certmgr only shows what's in # the selected store, which is why we need to check both. -if [ "$(certmgr -list -c Trust | grep -c -F "X.509")" -le 1 ] && [ "$(certmgr -list -c -m Trust | grep -c -F "X.509")" -le 1 ]; then +if [ $OS = 'Linux' ] && [ "$(certmgr -list -c Trust | grep -c -F "X.509")" -le 1 ] && [ "$(certmgr -list -c -m Trust | grep -c -F "X.509")" -le 1 ]; then echo "No SSL certificates installed so unable to restore NuGet packages." >&2; echo "Run 'mozroots --sync --import' to install certificates to Mono's certificate store." >&2; exit 1 diff --git a/build-everything.proj b/build-everything.proj index f236cde62cb..0d0cdea76c2 100644 --- a/build-everything.proj +++ b/build-everything.proj @@ -54,12 +54,12 @@ - + - + diff --git a/build.sh b/build.sh index 2d15c1a934e..7c4c450c838 100755 --- a/build.sh +++ b/build.sh @@ -24,12 +24,11 @@ Build and run a subset of test suites Usage: -build.sh ^ +build.sh ^ ^ - ^ ^ ^ - ^ + ^ ^ ^ @@ -41,15 +40,11 @@ Other examples: build.sh net40 (build compiler for .NET Framework) build.sh coreclr (build compiler for .NET Core) - build.sh vs (build Visual Studio IDE Tools) build.sh all (build everything) build.sh test (build and test default targets) build.sh net40 test (build and test net40) build.sh coreclr test (build and test net40) - build.sh vs test (build and test net40) build.sh all test (build and test net40) - build.sh nobuild test include Conformance (run only tests marked with Conformance category) - build.sh nobuild test include Expensive (run only tests marked with Expensive category) " @@ -84,8 +79,6 @@ export BUILD_PHASE=1 export BUILD_NET40_FSHARP_CORE=0 export BUILD_NET40=0 export BUILD_CORECLR=0 -export BUILD_PORTABLE=0 -export BUILD_VS=0 export BUILD_CONFIG=release export BUILD_CONFIG_LOWERCASE=release export BUILD_DIAG= @@ -94,11 +87,8 @@ export BUILD_PUBLICSIGN=0 export TEST_NET40_COMPILERUNIT_SUITE=0 export TEST_NET40_COREUNIT_SUITE=0 export TEST_NET40_FSHARP_SUITE=0 -export TEST_NET40_FSHARPQA_SUITE=0 export TEST_CORECLR_COREUNIT_SUITE=0 export TEST_CORECLR_FSHARP_SUITE=0 -export TEST_PORTABLE_COREUNIT_SUITE=0 -export TEST_VS_IDEUNIT_SUITE=0 export INCLUDE_TEST_SPEC_NUNIT= export INCLUDE_TEST_TAGS= @@ -123,19 +113,6 @@ do export BUILD_PROTO_WITH_CORECLR_LKG=1 export BUILD_CORECLR=1 ;; - "pcls") - _autoselect=0 - export BUILD_PORTABLE=1 - ;; - "vs") - _autoselect=0 - export BUILD_NET40=1 - export BUILD_NET40_FSHARP_CORE=1 - export BUILD_VS=1 - ;; - "vstest") - export TEST_VS_IDEUNIT_SUITE=1 - ;; "nobuild") export BUILD_PHASE=0 ;; @@ -151,88 +128,11 @@ do export BUILD_NET40=1 export BUILD_NET40_FSHARP_CORE=1 export BUILD_CORECLR=1 - export BUILD_PORTABLE=1 - export BUILD_VS=1 - export BUILD_SETUP=$FSC_BUILD_SETUP - export CI=1 - ;; - "microbuild") - _autoselect=0 - export BUILD_PROTO=1 - export BUILD_NET40=1 - export BUILD_NET40_FSHARP_CORE=1 - export BUILD_PROTO_WITH_CORECLR_LKG=1 - export BUILD_CORECLR=1 - export BUILD_PORTABLE=1 export BUILD_VS=1 export BUILD_SETUP=$FSC_BUILD_SETUP - - export TEST_NET40_COMPILERUNIT_SUITE=1 - export TEST_NET40_COREUNIT_SUITE=1 - export TEST_NET40_FSHARP_SUITE=1 - export TEST_NET40_FSHARPQA_SUITE=1 - export TEST_CORECLR_COREUNIT_SUITE=0 - export TEST_CORECLR_FSHARP_SUITE=0 - export TEST_PORTABLE_COREUNIT_SUITE=1 - export TEST_VS_IDEUNIT_SUITE=1 - export CI=1 - ;; - - # These divide 'ci' into multiple chunks which can be done in parallel - "ci_part1") - _autoselect=0 - - # what we do - export BUILD_PROTO=1 - export BUILD_NET40=1 - export BUILD_NET40_FSHARP_CORE=1 - export BUILD_PORTABLE=1 - export BUILD_VS=1 - export BUILD_SETUP=$FSC_BUILD_SETUP - export TEST_NET40_COMPILERUNIT_SUITE=1 - export TEST_NET40_FSHARPQA_SUITE=1 - export TEST_VS_IDEUNIT_SUITE=1 - export CI=1 - ;; - "ci_part2") - _autoselect=0 - - # what we do - export BUILD_PROTO_WITH_CORECLR_LKG=1 - export BUILD_PROTO=1 - export BUILD_NET40=1 - export BUILD_NET40_FSHARP_CORE=1 - export BUILD_PORTABLE=1 - - export TEST_NET40_COREUNIT_SUITE=1 - export TEST_NET40_FSHARP_SUITE=1 - export TEST_PORTABLE_COREUNIT_SUITE=1 - export CI=1 - ;; - "ci_part3") - _autoselect=0 - - # what we do - export BUILD_PROTO_WITH_CORECLR_LKG=1 - export BUILD_PROTO=1 - export BUILD_NET40=1 - export BUILD_NET40_FSHARP_CORE=1 - export BUILD_CORECLR=1 - - export TEST_CORECLR_FSHARP_SUITE=1 - export TEST_CORECLR_COREUNIT_SUITE=1 export CI=1 ;; - # TEMP: The Jenkins builds currently call this script with the 'ci' target, - # but that doesn't exist even in build.cmd. It wasn't doing anything - # before anyway, so accept 'ci' but ignore it for now because the test - # suites don't build correctly on Linux/macOS yet anyway. - "ci") - # TODO: Do everything from ci_part1-3 here. - printf "The 'ci' target is currently ignored, until the test suite builds can be fixed for Linux/macOS.\n" - ;; - "proto") export BUILD_PROTO=1 ;; @@ -254,12 +154,6 @@ do "no-test") no_test=1 ;; - "include") - failwith "The 'include' option is not (yet) supported by this script." - #export /a counter=!counter!+1 - #if '$INCLUDE_TEST_SPEC_NUNIT' == '' ( export INCLUDE_TEST_SPEC_NUNIT=cat == $ARG2 ) else (set INCLUDE_TEST_SPEC_NUNIT=cat == $ARG2 or $INCLUDE_TEST_SPEC_NUNIT ) - #if '$INCLUDE_TEST_TAGS' == '' ( export INCLUDE_TEST_TAGS=$ARG2 ) else (set INCLUDE_TEST_TAGS=$ARG2;$INCLUDE_TEST_TAGS ) - ;; "test-all") _autoselect=0 export BUILD_PROTO=1 @@ -267,23 +161,12 @@ do export BUILD_NET40=1 export BUILD_NET40_FSHARP_CORE=1 export BUILD_CORECLR=1 - export BUILD_PORTABLE=1 - export BUILD_VS=1 export BUILD_SETUP=$FSC_BUILD_SETUP export TEST_NET40_COMPILERUNIT_SUITE=1 export TEST_NET40_COREUNIT_SUITE=1 export TEST_NET40_FSHARP_SUITE=1 - export TEST_NET40_FSHARPQA_SUITE=1 - export TEST_PORTABLE_COREUNIT_SUITE=1 export TEST_CORECLR_COREUNIT_SUITE=1 - export TEST_VS_IDEUNIT_SUITE=1 - ;; - "test-net40-fsharpqa") - export BUILD_NET40=1 - export BUILD_NET40_FSHARP_CORE=1 - export BUILD_PORTABLE=1 - export TEST_NET40_FSHARPQA_SUITE=1 ;; "test-compiler-unit") export BUILD_NET40=1 @@ -299,14 +182,9 @@ do export BUILD_CORECLR=1 export TEST_CORECLR_COREUNIT_SUITE=1 ;; - "test-pcl-coreunit") - export BUILD_PORTABLE=1 - export TEST_PORTABLE_COREUNIT_SUITE=1 - ;; "test-net40-fsharp") export BUILD_NET40=1 export BUILD_NET40_FSHARP_CORE=1 - export BUILD_PORTABLE=1 export TEST_NET40_FSHARP_SUITE=1 ;; "test-coreclr-fsharp") @@ -329,50 +207,43 @@ do esac done -if [ $_buildexit -eq 1 ]; then +if [ "$_buildexit" = "1" ]; then exit $_buildexitvalue fi # Apply defaults, if necessary. -if [ $_autoselect -eq 1 ]; then +if [ "$_autoselect" = "1" ]; then export BUILD_NET40=1 export BUILD_NET40_FSHARP_CORE=1 fi -if [ $_autoselect_tests -eq 1 ]; then - if [ $BUILD_NET40 -eq 1 ]; then +if [ "$_autoselect_tests" = "1" ]; then + if [ "$BUILD_NET40" = "1" ]; then export TEST_NET40_COMPILERUNIT_SUITE=1 - export TEST_NET40_COREUNIT_SUITE=1 - export TEST_NET40_FSHARP_SUITE=1 - export TEST_NET40_FSHARPQA_SUITE=1 + + # This requires a build of FSharp.Core.dll? + # export TEST_NET40_COREUNIT_SUITE=1 + + # This requires a lot more work to get running on OSX/Linux + # export TEST_NET40_FSHARP_SUITE=1 fi - if [ $BUILD_CORECLR -eq 1 ]; then + if [ "$BUILD_CORECLR" = "1" ]; then export BUILD_NET40=1 export BUILD_NET40_FSHARP_CORE=1 export TEST_CORECLR_FSHARP_SUITE=1 export TEST_CORECLR_COREUNIT_SUITE=1 fi - if [ $BUILD_PORTABLE -eq 1 ]; then - export TEST_PORTABLE_COREUNIT_SUITE=1 - fi - - if [ $BUILD_VS -eq 1 ]; then - export TEST_VS_IDEUNIT_SUITE=1 - fi fi # If the `PB_SKIPTESTS` variable is set to 'true' then no tests should be built or run, even if explicitly specified -if [ $PB_SKIPTESTS -eq "true" ]; then +if [ "$PB_SKIPTESTS" = "true" ]; then export TEST_NET40_COMPILERUNIT_SUITE=0 export TEST_NET40_COREUNIT_SUITE=0 export TEST_NET40_FSHARP_SUITE=0 - export TEST_NET40_FSHARPQA_SUITE=0 export TEST_CORECLR_COREUNIT_SUITE=0 export TEST_CORECLR_FSHARP_SUITE=0 - export TEST_PORTABLE_COREUNIT_SUITE=0 - export TEST_VS_IDEUNIT_SUITE=0 fi # @@ -386,8 +257,6 @@ printf "BUILD_PROTO_WITH_CORECLR_LKG=%s\n" "$BUILD_PROTO_WITH_CORECLR_LKG" printf "BUILD_NET40=%s\n" "$BUILD_NET40" printf "BUILD_NET40_FSHARP_CORE=%s\n" "$BUILD_NET40_FSHARP_CORE" printf "BUILD_CORECLR=%s\n" "$BUILD_CORECLR" -printf "BUILD_PORTABLE=%s\n" "$BUILD_PORTABLE" -printf "BUILD_VS=%s\n" "$BUILD_VS" printf "BUILD_SETUP=%s\n" "$BUILD_SETUP" printf "BUILD_CONFIG=%s\n" "$BUILD_CONFIG" printf "BUILD_PUBLICSIGN=%s\n" "$BUILD_PUBLICSIGN" @@ -398,21 +267,12 @@ printf "\n" printf "TEST_NET40_COMPILERUNIT_SUITE=%s\n" "$TEST_NET40_COMPILERUNIT_SUITE" printf "TEST_NET40_COREUNIT_SUITE=%s\n" "$TEST_NET40_COREUNIT_SUITE" printf "TEST_NET40_FSHARP_SUITE=%s\n" "$TEST_NET40_FSHARP_SUITE" -printf "TEST_NET40_FSHARPQA_SUITE=%s\n" "$TEST_NET40_FSHARPQA_SUITE" printf "TEST_CORECLR_COREUNIT_SUITE=%s\n" "$TEST_CORECLR_COREUNIT_SUITE" printf "TEST_CORECLR_FSHARP_SUITE=%s\n" "$TEST_CORECLR_FSHARP_SUITE" -printf "TEST_PORTABLE_COREUNIT_SUITE=%s\n" "$TEST_PORTABLE_COREUNIT_SUITE" -printf "TEST_VS_IDEUNIT_SUITE=%s\n" "$TEST_VS_IDEUNIT_SUITE" printf "INCLUDE_TEST_SPEC_NUNIT=%s\n" "$INCLUDE_TEST_SPEC_NUNIT" printf "INCLUDE_TEST_TAGS=%s\n" "$INCLUDE_TEST_TAGS" printf "\n" -# TODO: Print out environment variables? -printf "Environment\n" -printf "\n" -printf "(TODO)\n" -printf "\n" -printf "\n" build_status "Done with arguments, starting preparation" @@ -422,7 +282,7 @@ msbuildflags="" # Perform any necessary setup and system configuration prior to running builds. ./before_install.sh rc=$?; -if [ $rc -ne 0 ]; then +if [ "$rc" != "0" ]; then printf "before_install script failed.\n" exit $rc fi @@ -458,23 +318,10 @@ if [ "${RestorePackages:-true}" = 'true' ]; then failwith "Nuget restore failed" fi - if [ "$BUILD_VS" = '1' ]; then - eval "$_nugetexe restore vsintegration/packages.config $_nugetoptions" - if [ $? -ne 0 ]; then - failwith "Nuget restore failed" - fi - fi - - if [ "$BUILD_SETUP" = '1' ]; then - eval "$_nugetexe restore setup/packages.config $_nugetoptions" - if [ $? -ne 0 ]; then - failwith "Nuget restore failed" - fi - fi fi # If building for CoreCLR, restore the Tools directory. -if [ "$BUILD_PROTO_WITH_CORECLR_LKG" = '1' ]; then +if [ "$BUILD_PROTO_WITH_CORECLR_LKG" = "1" ]; then # Restore the Tools directory ./init-tools.sh rc=$?; @@ -497,10 +344,10 @@ _dotnetexe=dotnet _architecture=win7-x64 # Build Proto -if [ "$BUILD_PROTO" = '1' ]; then +if [ "$BUILD_PROTO" = "1" ]; then rm -rfd Proto - if [ "$BUILD_PROTO_WITH_CORECLR_LKG" = '1' ]; then + if [ "$BUILD_PROTO_WITH_CORECLR_LKG" = "1" ]; then { pushd ./lkg/fsc && eval "$_dotnetexe restore" && popd; } || failwith "dotnet restore failed" { pushd ./lkg/fsi && eval "$_dotnetexe restore" && popd; } || failwith "dotnet restore failed" @@ -512,58 +359,26 @@ if [ "$BUILD_PROTO" = '1' ]; then # { printeval "$_ngenexe install Proto/net40/bin/fsc-proto.exe /nologo"; } || failwith "NGen of proto failed" else # Build proto-compiler and libs - { printeval "$_msbuildexe $msbuildflags src/fsharp-proto-build.proj /p:UseMonoPackaging=true /p:Configuration=Proto /p:DisableLocalization=true"; } || failwith "compiler proto build failed" + { printeval "$_msbuildexe $msbuildflags src/fsharp-proto-build.proj /p:Configuration=Proto /p:DisableLocalization=true"; } || failwith "compiler proto build failed" fi fi build_status "Done with proto, starting build" -if [ "$BUILD_PHASE" = '1' ]; then - cmd="$_msbuildexe $msbuildflags build-everything.proj /p:UseMonoPackaging=true /p:Configuration=$BUILD_CONFIG $BUILD_DIAG /p:BUILD_PUBLICSIGN=$BUILD_PUBLICSIGN" +if [ "$BUILD_PHASE" = "1" ]; then + cmd="$_msbuildexe $msbuildflags build-everything.proj /p:Configuration=$BUILD_CONFIG $BUILD_DIAG /p:BUILD_PUBLICSIGN=$BUILD_PUBLICSIGN" { printeval "$cmd"; } || failwith "'$cmd' failed" fi -build_status "Main part of build finished, completing parts of build needed for Mono setup" - -if [ "$BUILD_NET40" = '1' ]; then - { printeval "./autogen.sh --prefix=/usr"; } || failwith "./autogen.sh failed" - - { printeval "make"; } || failwith "make failed" -fi - -build_status "Done with build, starting update/prepare" - -if [ "$BUILD_NET40" = '1' ]; then - - { printeval "sudo make install"; } || failwith "sudo make install failed" - -# WINDOWS: -# src/update.sh $BUILD_CONFIG -# rc=$?; -# if [ $rc -ne 0 ]; then -# printf "src/update script failed.\n" -# exit $rc -# fi -fi - -NUNITPATH="packages/NUnit.Console.3.0.0/tools/" -printf "set NUNITPATH=%s\n" "$NUNITPATH" -if [ ! -d "$NUNITPATH" ]; then - failwith "Could not find $NUNITPATH" -fi - -{ printeval "cp -R $NUNITPATH ${_scriptdir}tests/fsharpqa/testenv/bin/nunit"; } || failwith "unable to copy nunit binaries to fsharpqa" -{ printeval "cp -R ${_scriptdir}tests/fsharpqa/testenv/src/nunit ${_scriptdir}tests/fsharpqa/testenv/bin/nunit"; } || failwith "unable to copy nunit binaries to fsharpqa" - -# TODO: Define location of ildasm/monodis and sn - -if [ "$TEST_NET40_COMPILERUNIT_SUITE" = '0' ] && [ "$TEST_PORTABLE_COREUNIT_SUITE" = '0' ] && [ "$TEST_CORECLR_COREUNIT_SUITE" = '0' ] && [ "$TEST_VS_IDEUNIT_SUITE" = '0' ] && [ "$TEST_NET40_FSHARP_SUITE" = '0' ] && [ "$TEST_NET40_FSHARPQA_SUITE" = '0' ]; then +if [ "$TEST_NET40_COMPILERUNIT_SUITE" != "1" ] && [ "$TEST_CORECLR_COREUNIT_SUITE" != "1" ] && [ "$TEST_NET40_FSHARP_SUITE" != "1" ]; then # Successful build; not running tests so exit now. exit 0 fi -if [ $no_test -eq 1 ]; then +NUNITPATH="packages/NUnit.Console.3.0.0/tools/" + +if [ "$no_test" = "1" ]; then # Successful build; not running tests so exit now. exit 0 fi @@ -580,15 +395,7 @@ fi printf "WHERE_ARG_NUNIT=%s\n" "$WHERE_ARG_NUNIT" -export NUNITPATH="tests/fsharpqa/testenv/bin/nunit/" export NUNIT3_CONSOLE="${NUNITPATH}nunit3-console.exe" -export link_exe="${_scriptdir}packages/VisualCppTools.14.0.24519-Pre/lib/native/bin/link.exe" -if [ ! -f "$link_exe" ]; then - failwith "failed to find '$link_exe' use nuget to restore the VisualCppTools package" -fi - -#if /I not '$single_threaded' == 'true' (set PARALLEL_ARG=-procs:$NUMBER_OF_PROCESSORS) else set PARALLEL_ARG=-procs:0 - export FSCBINPATH="${_scriptdir}$BUILD_CONFIG/net40/bin" export RESULTSDIR="${_scriptdir}tests/TestResults" if [ ! -d "$RESULTSDIR" ]; then @@ -597,19 +404,18 @@ fi printf "FSCBINPATH=%s\n" "$FSCBINPATH" printf "RESULTSDIR=%s\n" "$RESULTSDIR" -printf "link_exe=%s\n" "$link_exe" printf "NUNIT3_CONSOLE=%s\n" "$NUNIT3_CONSOLE" printf "NUNITPATH=%s\n" "$NUNITPATH" # ---------------- net40-fsharp ----------------------- -if [ "$TEST_NET40_FSHARP_SUITE" = '1' ]; then +if [ "$TEST_NET40_FSHARP_SUITE" = "1" ]; then OUTPUTARG="" ERRORARG="" OUTPUTFILE="" ERRORFILE="" XMLFILE="$RESULTSDIR/test-net40-fsharp-results.xml" - if [ "$CI" = '1' ]; then + if [ "$CI" = "1" ]; then OUTPUTFILE="$RESULTSDIR/test-net40-fsharp-output.log" OUTPUTARG="--output:\"$OUTPUTFILE\"" ERRORFILE="$RESULTSDIR/test-net40-fsharp-errors.log" @@ -630,14 +436,14 @@ fi # ---------------- net40-compilerunit ----------------------- -if [ "$TEST_NET40_COMPILERUNIT_SUITE" = '1' ]; then +if [ "$TEST_NET40_COMPILERUNIT_SUITE" = "1" ]; then OUTPUTARG="" ERRORARG="" OUTPUTFILE="" ERRORFILE="$RESULTSDIR/test-net40-compilerunit-errors.log" XMLFILE="$RESULTSDIR/test-net40-compilerunit-results.xml" - if [ "$CI" = '1' ]; then + if [ "$CI" = "1" ]; then OUTPUTFILE="$RESULTSDIR/test-net40-compilerunit-output.log" ERRORARG="--err:\"$ERRORFILE\"" OUTPUTARG="--output:\"$OUTPUTFILE\"" @@ -661,14 +467,14 @@ fi # ---------------- net40-coreunit ----------------------- -if [ "$TEST_NET40_COREUNIT_SUITE" = '1' ]; then +if [ "$TEST_NET40_COREUNIT_SUITE" = "1" ]; then OUTPUTARG="" ERRORARG="" OUTPUTFILE="" ERRORFILE="" XMLFILE="$RESULTSDIR/test-net40-coreunit-results.xml" - if [ "$CI" = '1' ]; then + if [ "$CI" = "1" ]; then ERRORFILE="$RESULTSDIR/test-net40-coreunit-errors.log" OUTPUTFILE="$RESULTSDIR/test-net40-coreunit-output.log" ERRORARG="--err:\"$ERRORFILE\"" @@ -691,42 +497,10 @@ if [ "$TEST_NET40_COREUNIT_SUITE" = '1' ]; then fi fi -# ---------------- portable-coreunit ----------------------- - -if [ "$TEST_PORTABLE_COREUNIT_SUITE" = '1' ]; then - - OUTPUTARG="" - ERRORARG="" - OUTPUTFILE="" - ERRORFILE="" - XMLFILE="$RESULTSDIR/test-portable-coreunit-results.xml" - - if [ "$CI" = '1' ]; then - OUTPUTFILE="$RESULTSDIR/test-portable-coreunit-output.log" - ERRORFILE="$RESULTSDIR/test-portable-coreunit-errors.log" - ERRORARG="--err:\"$ERRORFILE\"" - OUTPUTARG="--output:\"$OUTPUTFILE\"" - fi - - if ! printeval "mono $NUNIT3_CONSOLE /framework:V4.0 /result=\"$XMLFILE;format=nunit3\" $OUTPUTARG $ERRORARG /work=\"$FSCBINPATH\" \"$FSCBINPATH/../../portable7/bin/FSharp.Core.UnitTests.dll\" \"$FSCBINPATH/../../portable47/bin/FSharp.Core.UnitTests.dll\" \"$FSCBINPATH/../../portable78/bin/FSharp.Core.UnitTests.dll\" \"$FSCBINPATH/../../portable259/bin/FSharp.Core.UnitTests.dll\" $WHERE_ARG_NUNIT"; then - if [ -f "$OUTPUTFILE" ]; then - echo ----------------------------------------------------------------- - cat "$OUTPUTFILE" - fi - if [ -f "$ERRORFILE" ]; then - echo ----------------------------------------------------------------- - cat "$ERRORFILE" - fi - echo ----------------------------------------------------------------- - echo Error: Running tests portable-coreunit failed, see logs above -- FAILED - echo ----------------------------------------------------------------- - exit 1 - fi -fi # ---------------- coreclr-coreunit ----------------------- -if [ "$TEST_CORECLR_COREUNIT_SUITE" = '1' ]; then +if [ "$TEST_CORECLR_COREUNIT_SUITE" = "1" ]; then XMLFILE="$RESULTSDIR/test-coreclr-coreunit-results.xml" OUTPUTFILE="$RESULTSDIR/test-coreclr-coreunit-output.log" @@ -742,7 +516,7 @@ fi # ---------------- coreclr-fsharp ----------------------- -if [ "$TEST_CORECLR_FSHARP_SUITE" = '1' ]; then +if [ "$TEST_CORECLR_FSHARP_SUITE" = "1" ]; then export single_threaded=true export permutations=FSC_CORECLR @@ -760,43 +534,3 @@ if [ "$TEST_CORECLR_FSHARP_SUITE" = '1' ]; then fi fi -# ---------------- net40-fsharpqa ----------------------- - -OSARCH="${PROCESSOR_ARCHITECTURE:-x64}" - -# Set this to 1 in order to use an external compiler host process -# This only has an effect when running the FSHARPQA tests, but can -# greatly speed up execution since fsc.exe does not need to be spawned thousands of times -HOSTED_COMPILER=1 - -if [ "$TEST_NET40_FSHARPQA_SUITE" = '1' ]; then - - export FSC="$FSCBINPATH/fsc.exe" - export FSCOREDLLPATH="$FSCBINPATH/FSharp.Core.dll" - export PATH="$FSCBINPATH;$PATH" - - if ! command -v perl > /dev/null; then - failwith "perl is not in the PATH, it is required for the net40-fsharpqa test suite" - fi - - OUTPUTFILE=test-net40-fsharpqa-results.log - ERRORFILE=test-net40-fsharpqa-errors.log - FAILENV=test-net40-fsharpqa-errors - - { pushd "${_scriptdir}tests/fsharpqa/source" && \ - printeval "perl tests/fsharpqa/testenv/bin/runall.pl -resultsroot $RESULTSDIR -results $OUTPUTFILE -log $ERRORFILE -fail $FAILENV -cleanup:no $TTAGS_ARG_RUNALL $PARALLEL_ARG" && \ - popd; } || { - if [ -f "$RESULTSDIR/$OUTPUTFILE" ]; then - echo ----------------------------------------------------------------- - cat "$RESULTSDIR/$OUTPUTFILE" - fi - if [ -f "$RESULTSDIR/$ERRORFILE" ]; then - echo ----------------------------------------------------------------- - cat "$RESULTSDIR/$ERRORFILE" - fi - echo ----------------------------------------------------------------- - echo Error: Running tests net40-fsharpqa failed, see logs above -- FAILED - echo ----------------------------------------------------------------- - exit 1 - } -fi diff --git a/build/targets/GitHash.props b/build/targets/GitHash.props index 817240dbcab..e03e736e512 100644 --- a/build/targets/GitHash.props +++ b/build/targets/GitHash.props @@ -5,7 +5,7 @@ Copied from RepoToolset. Might be slightly modified to adjust for the current F# build system specifics if necessary. --> - + diff --git a/scripts/dotnet-install.sh b/scripts/dotnet-install.sh old mode 100644 new mode 100755 diff --git a/src/FSharpSource.Profiles.targets b/src/FSharpSource.Profiles.targets index 274cbf5108d..8bcc8aa5f24 100644 --- a/src/FSharpSource.Profiles.targets +++ b/src/FSharpSource.Profiles.targets @@ -3,6 +3,7 @@ + $(DefineConstants);CROSS_PLATFORM_COMPILER $(DefineConstants);ENABLE_MONO_SUPPORT $(DefineConstants);BE_SECURITY_TRANSPARENT $(DefineConstants);FX_LCIDFROMCODEPAGE diff --git a/src/FSharpSource.Settings.targets b/src/FSharpSource.Settings.targets index 35086a642f7..ee3810db644 100644 --- a/src/FSharpSource.Settings.targets +++ b/src/FSharpSource.Settings.targets @@ -98,19 +98,27 @@ $(FSharpSourcesRoot)\..\packages\NUnit.$(NUnitVersion)\lib\net45 $(FSharpSourcesRoot)\..\packages\NUnit.ConsoleRunner\$(NUnitVersion)\tools\ + true + + true true 0.2.0-beta-000076 + + + false + true true $(FSharpSourcesRoot)\fsharp\msft.pubkey true true - + + true false true @@ -130,6 +138,7 @@ full + portable false prompt @@ -142,6 +151,7 @@ pdbonly + portable true false @@ -153,6 +163,7 @@ full + portable true DEBUG;NO_STRONG_NAMES;$(DefineConstants) @@ -196,6 +207,11 @@ $(FSharpSourcesRoot)\..\packages\FSharp.Compiler.Tools.4.1.27\tools + + + + 14.0.0.0 + diff --git a/src/FSharpSource.targets b/src/FSharpSource.targets index c3f6de55051..206259ae082 100644 --- a/src/FSharpSource.targets +++ b/src/FSharpSource.targets @@ -8,74 +8,43 @@ - - - - false - true - - - - - - - - - true - false - fs - - - - - - - true - true - fs - - - - - - - - true - $(FSharpSourcesRoot)\fsharp\msft.pubkey - true - true - fs - - - - - - - - NO_STRONG_NAMES;$(DefineConstants) - fs - - - + + fs + - - $(OtherFlags) --version:"$(MicroBuildAssemblyVersion)" + + + + true + false + false + NO_STRONG_NAMES;$(DefineConstants) - - $(IntermediateOutputPath)source_link.json + + + $(FSharpSourcesRoot)\fsharp\test.snk + false + STRONG_NAME_FSHARP_COMPILER_WITH_TEST_KEY;$(DefineConstants) - - NO_STRONG_NAMES;$(DefineConstants) + + + $(FSCoreVersion) + $(OtherFlags) --version:"$(MicroBuildAssemblyVersion)" + + + + $(IntermediateOutputPath)source_link.json + MSBUILD_AT_LEAST_14;$(DefineConstants) + - false @@ -126,7 +95,8 @@ fsharp30\$(TargetDotnetProfile) fsharp31\$(TargetDotnetProfile) fsharp40\$(TargetDotnetProfile) - obj\$(TargetFrameworkOutputDirectory)\ + $(TargetDotnetProfile) + obj\$(Configuration)\$(TargetFrameworkOutputDirectory)\ @@ -380,9 +350,14 @@ - + + <_PublicKey>002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293 + + + <_PublicKey>002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee + <_InternalsVisibleToAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute"> <_Parameter1 Condition="'%(InternalsVisibleTo.Key)' != ''">%(InternalsVisibleTo.Identity), PublicKey=%(InternalsVisibleTo.Key) diff --git a/src/buildfromsource/FSharp.Build/FSharp.Build.fsproj b/src/buildfromsource/FSharp.Build/FSharp.Build.fsproj index 4fe08c815b5..f49ecb73381 100644 --- a/src/buildfromsource/FSharp.Build/FSharp.Build.fsproj +++ b/src/buildfromsource/FSharp.Build/FSharp.Build.fsproj @@ -17,7 +17,6 @@ FSBuild.resx - diff --git a/src/buildfromsource/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj b/src/buildfromsource/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj index 7cea584c57f..406efaf8a03 100644 --- a/src/buildfromsource/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj +++ b/src/buildfromsource/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj @@ -18,7 +18,6 @@ FSInteractiveSettings.resx - diff --git a/src/buildfromsource/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/buildfromsource/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index ef26074ad54..655cfa81140 100644 --- a/src/buildfromsource/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/buildfromsource/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -608,9 +608,6 @@ InteractiveSession\fsi.fs - - Misc/InternalsVisibleTo.fs - Misc/MSBuildReferenceResolver.fs diff --git a/src/buildfromsource/Fsc/Fsc.fsproj b/src/buildfromsource/Fsc/Fsc.fsproj index 5ee390de338..58b44242fd4 100644 --- a/src/buildfromsource/Fsc/Fsc.fsproj +++ b/src/buildfromsource/Fsc/Fsc.fsproj @@ -15,7 +15,6 @@ - Resources/AssemblyInfo.fs diff --git a/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj b/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj index 8aba433807d..8ab9e33c93f 100644 --- a/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj +++ b/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj @@ -72,7 +72,7 @@ - + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Framework.dll @@ -90,5 +90,19 @@ FSharp.Core + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Framework.14.3.0\lib\net45\Microsoft.Build.Framework.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.14.3.0\lib\net45\Microsoft.Build.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Utilities.Core.14.3.0\lib\net45\Microsoft.Build.Utilities.Core.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Tasks.Core.14.3.0\lib\net45\Microsoft.Build.Tasks.Core.dll + + diff --git a/src/fsharp/FSharp.Build/FSharp.Build.fsproj b/src/fsharp/FSharp.Build/FSharp.Build.fsproj index e432279f749..a24d03a6ac3 100644 --- a/src/fsharp/FSharp.Build/FSharp.Build.fsproj +++ b/src/fsharp/FSharp.Build/FSharp.Build.fsproj @@ -53,13 +53,13 @@ - + - + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Framework.dll @@ -73,6 +73,20 @@ $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Tasks.Core.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Framework.14.3.0\lib\net45\Microsoft.Build.Framework.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.14.3.0\lib\net45\Microsoft.Build.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Utilities.Core.14.3.0\lib\net45\Microsoft.Build.Utilities.Core.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Tasks.Core.14.3.0\lib\net45\Microsoft.Build.Tasks.Core.dll + + {DED3BBD7-53F4-428A-8C9F-27968E768605} diff --git a/src/fsharp/FSharp.Compiler.Interactive.Settings/InternalsVisibleTo.fs b/src/fsharp/FSharp.Compiler.Interactive.Settings/InternalsVisibleTo.fs deleted file mode 100644 index 3071a74b616..00000000000 --- a/src/fsharp/FSharp.Compiler.Interactive.Settings/InternalsVisibleTo.fs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Microsoft.FSharp -open System.Reflection -[] -[] -[] - -do() - diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index e871d61d4c7..0d135f2ee15 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -642,17 +642,17 @@ FSIstrings.txt - InteractiveSession\fsi.fsi + InteractiveSession/fsi.fsi - InteractiveSession\fsi.fs + InteractiveSession/fsi.fs - + Misc/MSBuildReferenceResolver.fs - + Misc/LegacyHostedCompilerForTesting.fs @@ -684,6 +684,8 @@ ..\..\..\packages\System.ValueTuple.4.3.1\lib\netstandard1.0\System.ValueTuple.dll true + + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Framework.dll diff --git a/src/fsharp/FSharp.Core/FSharp.Core.fsproj b/src/fsharp/FSharp.Core/FSharp.Core.fsproj index f24ede9f1b2..32c5f015302 100644 --- a/src/fsharp/FSharp.Core/FSharp.Core.fsproj +++ b/src/fsharp/FSharp.Core/FSharp.Core.fsproj @@ -34,7 +34,7 @@ PreserveNewest - + false diff --git a/src/fsharp/Fsc-proto/Fsc-proto.fsproj b/src/fsharp/Fsc-proto/Fsc-proto.fsproj index fd3d209e512..8c49f5fcf6a 100644 --- a/src/fsharp/Fsc-proto/Fsc-proto.fsproj +++ b/src/fsharp/Fsc-proto/Fsc-proto.fsproj @@ -438,7 +438,10 @@ fsc.fs - + + Service/SimulatedMSBuildReferenceResolver.fs + + MSBuildReferenceResolver.fs @@ -473,7 +476,7 @@ FSharp.Core - + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Framework.dll diff --git a/src/fsharp/fscmain.fs b/src/fsharp/fscmain.fs index 9405af123bb..344656d6b52 100644 --- a/src/fsharp/fscmain.fs +++ b/src/fsharp/fscmain.fs @@ -48,7 +48,14 @@ module Driver = failwithf "%s" <| FSComp.SR.elSysEnvExitDidntExit() } - mainCompile (ctok, argv, MSBuildReferenceResolver.Resolver, (*bannerAlreadyPrinted*)false, (*openBinariesInMemory*)false, (*defaultCopyFSharpCore*)true, quitProcessExiter, ConsoleLoggerProvider(), None, None) + let legacyReferenceResolver = +#if CROSS_PLATFORM_COMPILER + SimulatedMSBuildReferenceResolver.SimulatedMSBuildResolver +#else + MSBuildReferenceResolver.Resolver +#endif + + mainCompile (ctok, argv, legacyReferenceResolver, (*bannerAlreadyPrinted*)false, (*openBinariesInMemory*)false, (*defaultCopyFSharpCore*)true, quitProcessExiter, ConsoleLoggerProvider(), None, None) 0 [] diff --git a/src/fsharp/fsi/fsimain.fs b/src/fsharp/fsi/fsimain.fs index b87c795a605..002cfa54a4f 100644 --- a/src/fsharp/fsi/fsimain.fs +++ b/src/fsharp/fsi/fsimain.fs @@ -235,6 +235,12 @@ let evaluateSession(argv: string[]) = None #endif + let legacyReferenceResolver = +#if CROSS_PLATFORM_COMPILER + SimulatedMSBuildReferenceResolver.SimulatedMSBuildResolver +#else + MSBuildReferenceResolver.Resolver +#endif // Update the configuration to include 'StartServer', WinFormsEventLoop and 'GetOptionalConsoleReadLine()' let rec fsiConfig = { new FsiEvaluationSessionHostConfig () with @@ -251,21 +257,21 @@ let evaluateSession(argv: string[]) = member __.ReportUserCommandLineArgs args = fsiConfig0.ReportUserCommandLineArgs args member __.EventLoopRun() = #if !FX_NO_WINFORMS - match fsiWinFormsLoop.Value with + match (if fsiSession.IsGui then fsiWinFormsLoop.Value else None) with | Some l -> (l :> IEventLoop).Run() | _ -> #endif fsiConfig0.EventLoopRun() member __.EventLoopInvoke(f) = #if !FX_NO_WINFORMS - match fsiWinFormsLoop.Value with + match (if fsiSession.IsGui then fsiWinFormsLoop.Value else None) with | Some l -> (l :> IEventLoop).Invoke(f) | _ -> #endif fsiConfig0.EventLoopInvoke(f) member __.EventLoopScheduleRestart() = #if !FX_NO_WINFORMS - match fsiWinFormsLoop.Value with + match (if fsiSession.IsGui then fsiWinFormsLoop.Value else None) with | Some l -> (l :> IEventLoop).ScheduleRestart() | _ -> #endif @@ -279,7 +285,7 @@ let evaluateSession(argv: string[]) = member __.GetOptionalConsoleReadLine(probe) = getConsoleReadLine(probe) } // Create the console - and fsiSession = FsiEvaluationSession.Create (fsiConfig, argv, Console.In, Console.Out, Console.Error, collectible=false, legacyReferenceResolver=MSBuildReferenceResolver.Resolver) + and fsiSession : FsiEvaluationSession = FsiEvaluationSession.Create (fsiConfig, argv, Console.In, Console.Out, Console.Error, collectible=false, legacyReferenceResolver=legacyReferenceResolver) #if !FX_NO_WINFORMS diff --git a/src/fsharp/test.snk b/src/fsharp/test.snk new file mode 100644 index 00000000000..c16543bdc48 Binary files /dev/null and b/src/fsharp/test.snk differ diff --git a/src/utils/HashMultiMap.fs b/src/utils/HashMultiMap.fs index 134597efc6a..89f3a4fc2a4 100644 --- a/src/utils/HashMultiMap.fs +++ b/src/utils/HashMultiMap.fs @@ -10,10 +10,13 @@ open Microsoft.FSharp.Collections // one entry. So use two hash tables: one for the main entries and one for the overflow. [] type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>) = + let firstEntries = Dictionary<_,_>(n,hasheq) + let rest = Dictionary<_,_>(3,hasheq) new (hasheq : IEqualityComparer<'Key>) = HashMultiMap<'Key,'Value>(11, hasheq) + new (seq : seq<'Key * 'Value>, hasheq : IEqualityComparer<'Key>) as x = new HashMultiMap<'Key,'Value>(11, hasheq) then seq |> Seq.iter (fun (k,v) -> x.Add(k,v)) @@ -35,7 +38,9 @@ type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>) rest.Clear() member x.FirstEntries = firstEntries + member x.Rest = rest + member x.Copy() = let res = HashMultiMap<'Key,'Value>(firstEntries.Count,firstEntries.Comparer) for kvp in firstEntries do @@ -114,6 +119,7 @@ type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>) member x.Count = firstEntries.Count interface IEnumerable> with + member s.GetEnumerator() = let elems = List<_>(firstEntries.Count + rest.Count) for kvp in firstEntries do @@ -123,34 +129,48 @@ type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>) (elems.GetEnumerator() :> IEnumerator<_>) interface System.Collections.IEnumerable with + member s.GetEnumerator() = ((s :> seq<_>).GetEnumerator() :> System.Collections.IEnumerator) interface IDictionary<'Key, 'Value> with + member s.Item with get x = s.[x] and set x v = s.[x] <- v member s.Keys = ([| for kvp in s -> kvp.Key |] :> ICollection<'Key>) + member s.Values = ([| for kvp in s -> kvp.Value |] :> ICollection<'Value>) + member s.Add(k,v) = s.[k] <- v + member s.ContainsKey(k) = s.ContainsKey(k) + member s.TryGetValue(k,r) = if s.ContainsKey(k) then (r <- s.[k]; true) else false + member s.Remove(k:'Key) = let res = s.ContainsKey(k) in s.Remove(k); res interface ICollection> with + member s.Add(x) = s.[x.Key] <- x.Value + member s.Clear() = s.Clear() + member s.Remove(x) = let res = s.ContainsKey(x.Key) if res && Unchecked.equals s.[x.Key] x.Value then s.Remove(x.Key); res + member s.Contains(x) = s.ContainsKey(x.Key) && Unchecked.equals s.[x.Key] x.Value + member s.CopyTo(arr,arrIndex) = s |> Seq.iteri (fun j x -> arr.[arrIndex+j] <- x) + member s.IsReadOnly = false + member s.Count = s.Count diff --git a/src/utils/ResizeArray.fs b/src/utils/ResizeArray.fs index b8720222dea..66613044349 100644 --- a/src/utils/ResizeArray.fs +++ b/src/utils/ResizeArray.fs @@ -10,9 +10,13 @@ open Microsoft.FSharp.Core.OptimizedClosures module internal ResizeArray = let length (arr: ResizeArray<'T>) = arr.Count + let get (arr: ResizeArray<'T>) (n: int) = arr.[n] + let set (arr: ResizeArray<'T>) (n: int) (x:'T) = arr.[n] <- x + let create (n: int) x = new ResizeArray<_> (seq { for _ in 1 .. n -> x }) + let init (n: int) (f: int -> 'T) = new ResizeArray<_> (seq { for i in 0 .. n-1 -> f i }) let blit (arr1: ResizeArray<'T>) start1 (arr2: ResizeArray<'T>) start2 len = @@ -25,6 +29,7 @@ module internal ResizeArray = arr2.[start2+i] <- arr1.[start1 + i] let concat (arrs: ResizeArray<'T> list) = new ResizeArray<_> (seq { for arr in arrs do for x in arr do yield x }) + let append (arr1: ResizeArray<'T>) (arr2: ResizeArray<'T>) = concat [arr1; arr2] let sub (arr: ResizeArray<'T>) start len = @@ -176,10 +181,13 @@ module internal ResizeArray = res let toArray (arr: ResizeArray<'T>) = arr.ToArray() + let ofArray (arr: 'T[]) = new ResizeArray<_>(arr) + let toSeq (arr: ResizeArray<'T>) = Seq.readonly arr let sort f (arr: ResizeArray<'T>) = arr.Sort (System.Comparison(f)) + let sortBy f (arr: ResizeArray<'T>) = arr.Sort (System.Comparison(fun x y -> compare (f x) (f y))) diff --git a/src/utils/TaggedCollections.fsi b/src/utils/TaggedCollections.fsi index ba99df33762..c877cbe7eb5 100644 --- a/src/utils/TaggedCollections.fsi +++ b/src/utils/TaggedCollections.fsi @@ -107,10 +107,13 @@ namespace Internal.Utilities.Collections.Tagged member ToArray: unit -> 'T array interface ICollection<'T> + interface IEnumerable<'T> + interface System.Collections.IEnumerable interface System.IComparable + override Equals : obj -> bool type internal Set<'T> = Set<'T, IComparer<'T>> @@ -128,14 +131,13 @@ namespace Internal.Utilities.Collections.Tagged /// Immutable maps. A constraint tag carries information about the class of key-comparers being used. [] type internal Map<'Key,'Value,'ComparerTag> when 'ComparerTag :> IComparer<'Key> = + /// Return a new map with the binding added to the given map. member Add: 'Key * 'Value -> Map<'Key,'Value,'ComparerTag> /// Return True if there are no bindings in the map. member IsEmpty: bool - //member Comparer : 'ComparerTag - /// The empty map, and use the given comparer comparison function for all operations associated /// with any maps built from this map. static member Empty: 'ComparerTag -> Map<'Key,'Value,'ComparerTag> @@ -213,7 +215,9 @@ namespace Internal.Utilities.Collections.Tagged interface IEnumerable> interface System.Collections.IEnumerable + interface System.IComparable + override Equals : obj -> bool type internal Map<'Key,'Value> = Map<'Key, 'Value, IComparer<'Key>> diff --git a/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj b/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj index f0cc28128c1..0522cf51f50 100644 --- a/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj +++ b/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj @@ -41,6 +41,8 @@ True $(NUnitLibDir)\nunit.framework.dll + + $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Framework.dll @@ -54,6 +56,20 @@ $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Tasks.Core.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Framework.14.3.0\lib\net45\Microsoft.Build.Framework.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.14.3.0\lib\net45\Microsoft.Build.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Utilities.Core.14.3.0\lib\net45\Microsoft.Build.Utilities.Core.dll + + + $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Tasks.Core.14.3.0\lib\net45\Microsoft.Build.Tasks.Core.dll + + {702A7979-BCF9-4C41-853E-3ADFC9897890} diff --git a/tests/FSharp.Compiler.UnitTests/ProductVersion.fs b/tests/FSharp.Compiler.UnitTests/ProductVersion.fs index db57334b730..94c87bf0e1a 100644 --- a/tests/FSharp.Compiler.UnitTests/ProductVersion.fs +++ b/tests/FSharp.Compiler.UnitTests/ProductVersion.fs @@ -1,6 +1,7 @@ namespace FSharp.Compiler.UnitTests open System +open System.IO open System.Text open NUnit.Framework @@ -111,16 +112,19 @@ module TypeProviderDesignTimeComponentLoading = [] let ``check tooling paths for type provider design time component loading`` () = - let expected = - [ @"typeproviders\fsharp41\net461" - @"tools\fsharp41\net461" - @"typeproviders\fsharp41\net452" - @"tools\fsharp41\net452" - @"typeproviders\fsharp41\net451" - @"tools\fsharp41\net451" - @"typeproviders\fsharp41\net45" - @"tools\fsharp41\net45" - @"typeproviders\fsharp41\netstandard2.0" - @"tools\fsharp41\netstandard2.0" ] + let expected = + [ Path.Combine("typeproviders", "fsharp41", "net461") + Path.Combine("tools", "fsharp41", "net461") + Path.Combine("typeproviders", "fsharp41", "net452") + Path.Combine("tools", "fsharp41", "net452") + Path.Combine("typeproviders", "fsharp41", "net451") + Path.Combine("tools", "fsharp41", "net451") + Path.Combine("typeproviders", "fsharp41", "net45") + Path.Combine("tools", "fsharp41", "net45") + Path.Combine("typeproviders", "fsharp41", "netstandard2.0") + Path.Combine("tools", "fsharp41", "netstandard2.0") + ] let actual = Microsoft.FSharp.Compiler.ExtensionTyping.toolingCompatiblePaths() - Assert.areEqual expected actual + printfn "actual = %A" actual + printfn "expected = %A" expected + Assert.True((expected=actual)) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj b/tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj index f1e384f1d64..6dde86b7177 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj @@ -118,8 +118,8 @@ - - FSharp.Core.UnitTests.dll.config + + FSharp.Core.Unittests.dll.config FSCoreVersion $(FSCoreVersion) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs index 0cc041bdfd9..252fa2913f0 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs @@ -612,24 +612,30 @@ type AsyncModule() = x := !x + 1 // Side effect! return "" } - let memFunc = Utils.memoizeAsync <| someSlowFunc + let memFunc : string -> Async = Utils.memoizeAsync <| someSlowFunc async { + Console.WriteLine "Do the same memoized thing many ways...." do! memFunc "a" |> Async.Ignore do! memFunc "a" |> Async.Ignore do! memFunc "a" |> Async.Ignore do! [|1 .. 30|] |> Seq.map(fun _ -> (memFunc "a")) |> Async.Parallel |> Async.Ignore + + Console.WriteLine "Still more ways...." for _i = 1 to 30 do Async.Start( memFunc "a" |> Async.Ignore ) Async.Start( memFunc "a" |> Async.Ignore ) do! Async.Sleep 500 do! memFunc "a" |> Async.Ignore do! memFunc "a" |> Async.Ignore + Console.WriteLine "Still more ways again...." for _i = 1 to 30 do Async.Start( memFunc "a" |> Async.Ignore ) + Console.WriteLine "Still more ways again again...." do! [|1 .. 30|] |> Seq.map(fun _ -> (memFunc "a")) |> Async.Parallel |> Async.Ignore } |> Async.RunSynchronously + Console.WriteLine "Checking result...." Assert.AreEqual(1, !x)