Merge coreclr into dev15-sxs
This commit is contained in:
Коммит
fad2a69bd1
|
@ -32,6 +32,7 @@ Release
|
|||
vsdebug
|
||||
vsrelease
|
||||
Proto
|
||||
sign_temp
|
||||
.libs
|
||||
Makefile
|
||||
configure
|
||||
|
@ -73,6 +74,7 @@ src/fsharp/FSharp.LanguageService.Compiler/pplex.fs
|
|||
src/fsharp/FSharp.LanguageService.Compiler/pppars.fs
|
||||
src/fsharp/FSharp.LanguageService.Compiler/pppars.fsi
|
||||
vsintegration/src/unittests/Unittests.fsi
|
||||
vsintegration/src/FSharp.ProjectSystem.FSharp/ctofiles/MenusAndCommands.cto
|
||||
tests/*FSharp_Failures.env
|
||||
tests/*FSharp_Failures.lst
|
||||
tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Module01.dll
|
||||
|
@ -94,4 +96,5 @@ tests/fsharpqa/Source/*FSharpQA_Failures.lst
|
|||
*.orig
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.cto
|
||||
tests/**/FSharp.Core.dll
|
||||
|
|
|
@ -4,9 +4,14 @@
|
|||
<add key="disableSourceControlIntegration" value="true" />
|
||||
</solution>
|
||||
<packageSources>
|
||||
<add key="myget.org dotnet-corefx" value="https://www.myget.org/F/dotnet-corefx/" />
|
||||
<add key="myget.org dotnet-buildtools" value="https://www.myget.org/F/dotnet-buildtools/" />
|
||||
<add key="myget.org fsharp-daily" value="https://www.myget.org/F/fsharp-daily/" />
|
||||
|
||||
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
|
||||
<clear />
|
||||
<add key="myget.org fsharp-daily" value="https://www.myget.org/F/fsharp-daily/api/v3/index.json" />
|
||||
<add key="dotnet-core" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" />
|
||||
<add key="myget.org dotnet-buildtools" value="https://www.myget.org/F/dotnet-buildtools/api/v3/index.json" />
|
||||
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
|
||||
|
||||
</packageSources>
|
||||
</configuration>
|
||||
|
|
Двоичные данные
.nuget/NuGet.exe
Двоичные данные
.nuget/NuGet.exe
Двоичный файл не отображается.
44
DEVGUIDE.md
44
DEVGUIDE.md
|
@ -102,8 +102,12 @@ For **Debug** this corresponds to these steps, which you can run individually fo
|
|||
msbuild src/fsharp-library-unittests-build.proj /p:TargetFramework=portable7
|
||||
msbuild src/fsharp-library-unittests-build.proj /p:TargetFramework=portable78
|
||||
msbuild src/fsharp-library-unittests-build.proj /p:TargetFramework=portable259
|
||||
msbuild VisualFSharp.sln
|
||||
msbuild vsintegration/fsharp-vsintegration-src-build.proj
|
||||
msbuild vsintegration/fsharp-vsintegration-project-templates-build.proj
|
||||
msbuild vsintegration/fsharp-vsintegration-item-templates-build.proj
|
||||
msbuild vsintegration/fsharp-vsintegration-deployment-build.proj
|
||||
msbuild vsintegration\fsharp-vsintegration-unittests-build.proj
|
||||
msbuild tests/fsharp/FSharp.Tests.fsproj
|
||||
src\update.cmd debug -ngen
|
||||
tests\BuildTestTools.cmd debug
|
||||
|
||||
|
@ -123,44 +127,20 @@ For **Release** this corresponds to these steps, which you can run individually
|
|||
msbuild src/fsharp-library-unittests-build.proj /p:TargetFramework=portable7 /p:Configuration=Release
|
||||
msbuild src/fsharp-library-unittests-build.proj /p:TargetFramework=portable78 /p:Configuration=Release
|
||||
msbuild src/fsharp-library-unittests-build.proj /p:TargetFramework=portable259 /p:Configuration=Release
|
||||
msbuild VisualFSharp.sln /p:Configuration=Release
|
||||
msbuild vsintegration\fsharp-vsintegration-unittests-build.proj /p:Configuration=Release
|
||||
msbuild vsintegration/fsharp-vsintegration-src-build.proj /p:Configuration=Release
|
||||
msbuild vsintegration/fsharp-vsintegration-project-templates-build.proj /p:Configuration=Release
|
||||
msbuild vsintegration/fsharp-vsintegration-item-templates-build.proj /p:Configuration=Release
|
||||
msbuild vsintegration/fsharp-vsintegration-deployment-build.proj /p:Configuration=Release
|
||||
msbuild vsintegration\fsharp-vsintegration-unittests-build.proj /p:Configuration=Release
|
||||
msbuild tests/fsharp/FSharp.Tests.fsproj /p:Configuration=Release
|
||||
src\update.cmd release -ngen
|
||||
tests\BuildTestTools.cmd release
|
||||
|
||||
### 4. [Optional] Install the Visual F# IDE Tools and Clobber the F# SDK on the machine
|
||||
|
||||
**Note:** Step #2 below will install a VSIX extension into Visual Studio 2015 that changes the Visual F# IDE Tools
|
||||
components installed into Visual Studio 2015. You can revert this step by disabling or uninstalling the addin.
|
||||
|
||||
**Note:** Step #3 below will clobber the machine-wide installed F# SDK on your machine. This replaces the ``fsi.exe``/``fsiAnyCpu.exe`` used
|
||||
by Visual F# Interactive and the ``fsc.exe`` used by ``Microsoft.FSharp.targets``. Repairing Visual Studio 2015 is currently the
|
||||
only way to revert this step.
|
||||
|
||||
**Note:** After you complete the install, the FSharp.Core referenced by your projects will not be updated. If you want to make
|
||||
a project that references your updated FSharp.Core, you must explicitly change the ``TargetFSharpCoreVersion`` in the .fsproj
|
||||
file to ``4.4.0.5099`` (or a corresponding portable version number with suffix ``5099``).
|
||||
|
||||
For **Debug**:
|
||||
|
||||
1. Ensure that the VSIX package is uninstalled. In VS, select Tools/Extensions and Updates and if the package `VisualStudio.FSharp.EnableOpenSource` is installed, select Uninstall
|
||||
1. Run ``debug\net40\bin\EnableOpenSource.vsix``
|
||||
1. Run ``vsintegration\update-vsintegration.cmd debug`` (clobbers the installed F# SDK)
|
||||
|
||||
For **Release**:
|
||||
|
||||
1. Ensure that the VSIX package is uninstalled. In VS, select Tools/Extensions and Updates and if the package `VisualStudio.FSharp.EnableOpenSource` is installed, select Uninstall
|
||||
1. Run ``release\net40\bin\EnableOpenSource.vsix``
|
||||
1. Run ``vsintegration\update-vsintegration.cmd release`` (clobbers the installed F# SDK)
|
||||
|
||||
Restart Visual Studio, it should now be running your freshly-built Visual F# IDE Tools with updated F# Interactive.
|
||||
|
||||
|
||||
### Notes on the build
|
||||
|
||||
1. The `update.cmd` script adds required strong name validation skips, and NGens the compiler and libraries. This requires admin privileges.
|
||||
1. The compiler binaries produced are "private" and strong-named signed with a test key.
|
||||
1. Some additional tools are required to build the compiler, notably `fslex.exe`, `fsyacc.exe`, `FSharp.PowerPack.Build.Tasks.dll` and the other tools found in the `lkg` directory.
|
||||
1. Some additional tools are required to build the compiler, notably `fslex.exe`, `fsyacc.exe`, `FSharp.PowerPack.Build.Tasks.dll`, `FsSrGen.exe`, `FSharp.SRGen.Build.Tasks.dll`, and the other tools found in the `lkg` directory.
|
||||
1. The overall bootstrapping process executes as follows
|
||||
- We first need an existing F# compiler. We use the one in the `lkg` directory. Let's assume this compiler has an `FSharp.Core.dll` with version X.
|
||||
- We use this compiler to compile the source in this distribution, to produce a "proto" compiler, dropped to the `proto` directory. When run, this compiler still relies on `FSharp.Core.dll` with version X.
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
|
||||
|
||||
Please provide a succinct description of the issue.
|
||||
|
||||
#### Repro steps
|
||||
|
||||
Provide the steps required to reproduce the problem
|
||||
|
||||
1. Step A
|
||||
|
||||
2. Step B
|
||||
|
||||
#### Expected behavior
|
||||
|
||||
Provide a description of the expected behaviour.
|
||||
|
||||
#### Actual behavior
|
||||
|
||||
Provide a description of the actual behaviour observed.
|
||||
|
||||
#### Known workarounds
|
||||
|
||||
Provide a description of any known workarounds.
|
||||
|
||||
#### Related information
|
||||
|
||||
Provide any related information
|
||||
|
||||
* Operating system
|
||||
* Branch
|
||||
* .NET Runtime, CoreCLR or Mono Version
|
||||
* Editing Tools (e.g. Visual Studio Version)
|
||||
* Links to F# RFCs or entries on http://fslang.uservoice.com
|
||||
* Links to performance testing scripts
|
||||
* Indications of severity
|
||||
|
||||
|
988
VisualFSharp.sln
988
VisualFSharp.sln
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -15,9 +15,9 @@ build_script:
|
|||
install:
|
||||
# by default, all script lines are interpreted as batch
|
||||
# The newest version of MSBuild installed will overwrite the older ones.
|
||||
- set PATH=%ProgramFiles(x86)%\MSBuild\15.0\Bin;%PATH%
|
||||
- set PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin;%PATH%
|
||||
- set PATH=%ProgramFiles(x86)%\MSBuild\12.0\Bin;%PATH%
|
||||
- set PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin;%PATH%
|
||||
- set PATH=%ProgramFiles(x86)%\MSBuild\15.0\Bin;%PATH%
|
||||
|
||||
test: off
|
||||
version: 0.0.1.{build}
|
||||
|
|
288
build.cmd
288
build.cmd
|
@ -1,4 +1,4 @@
|
|||
@echo off
|
||||
@if "%_echo%"=="" echo off
|
||||
|
||||
:ARGUMENTS_VALIDATION
|
||||
|
||||
|
@ -13,7 +13,7 @@ echo Build and run a subset of test suites
|
|||
echo.
|
||||
echo Usage:
|
||||
echo.
|
||||
echo build.cmd ^<all^|build^|debug^|release^|compiler^|pcls^|vs^|ci^|ci_part1^|ci_part2^>
|
||||
echo build.cmd ^<all^|build^|debug^|release^|compiler^|coreclr^|pcls^|vs^|ci^|ci_part1^|ci_part2^>
|
||||
echo.
|
||||
echo No arguments default to 'build'
|
||||
echo.
|
||||
|
@ -28,18 +28,20 @@ exit /b 1
|
|||
|
||||
set BUILD_PROTO=0
|
||||
set BUILD_NET40=1
|
||||
set BUILD_CORECLR=1
|
||||
set BUILD_PORTABLE=0
|
||||
set BUILD_VS=0
|
||||
set BUILD_FSHARP_DATA_TYPEPROVIDERS=0
|
||||
set BUILD_CONFIG=Release
|
||||
set BUILD_CONFIG_LOWERCASE=release
|
||||
|
||||
set TEST_COMPILERUNIT=0
|
||||
set TEST_NET40_COREUNIT=0
|
||||
set TEST_PORTABLE_COREUNIT=0
|
||||
set TEST_VS=0
|
||||
set TEST_FSHARP_SUITE=0
|
||||
set TEST_TAGS=
|
||||
set TEST_FSHARPQA_SUITE=0
|
||||
set BUILD_CONFIG=Release
|
||||
set BUILD_CONFIG_LOWERCASE=release
|
||||
set TEST_TAGS=
|
||||
|
||||
setlocal enableDelayedExpansion
|
||||
set /a counter=0
|
||||
|
@ -49,24 +51,19 @@ for /l %%x in (1 1 9) do (
|
|||
)
|
||||
setlocal disableDelayedExpansion
|
||||
echo.
|
||||
echo.
|
||||
|
||||
goto :MAIN
|
||||
|
||||
:SET_CONFIG
|
||||
set ARG=%~1
|
||||
|
||||
if "%ARG%" == "1" if "%2" == "" (
|
||||
set ARG=vuild
|
||||
)
|
||||
if "%ARG%" == "1" if "%2" == "" (set ARG=build)
|
||||
|
||||
if "%2" == "" if not "%ARG%" == "build" goto :EOF
|
||||
|
||||
echo Parse argument %ARG%
|
||||
|
||||
if /i '%ARG%' == 'compiler' (
|
||||
set TEST_COMPILERUNIT=1
|
||||
)
|
||||
if /i '%ARG%' == 'compiler' (set TEST_COMPILERUNIT=1)
|
||||
|
||||
if /i '%ARG%' == 'pcls' (
|
||||
set BUILD_PORTABLE=1
|
||||
|
@ -96,12 +93,15 @@ if /i '%ARG%' == 'ci' (
|
|||
set BUILD_PORTABLE=1
|
||||
set BUILD_VS=1
|
||||
set BUILD_FSHARP_DATA_TYPEPROVIDERS=1
|
||||
|
||||
set TEST_COMPILERUNIT=1
|
||||
set TEST_NET40_COREUNIT=1
|
||||
set TEST_PORTABLE_COREUNIT=1
|
||||
set TEST_FSHARP_SUITE=1
|
||||
set TEST_FSHARPQA_SUITE=1
|
||||
set TEST_VS=0
|
||||
set TEST_TAGS=
|
||||
set CONF_FSHARPQA_SUITE=Smoke
|
||||
)
|
||||
|
||||
REM These divide 'ci' into three chunks which can be done in parallel
|
||||
|
@ -111,9 +111,12 @@ if /i '%ARG%' == 'ci_part1' (
|
|||
set BUILD_PORTABLE=1
|
||||
set BUILD_VS=1
|
||||
set BUILD_FSHARP_DATA_TYPEPROVIDERS=1
|
||||
|
||||
set TEST_COMPILERUNIT=1
|
||||
set TEST_NET40_COREUNIT=1
|
||||
set TEST_PORTABLE_COREUNIT=1
|
||||
set TEST_CORECLR=1
|
||||
set TEST_TAGS=
|
||||
set TEST_VS=1
|
||||
)
|
||||
|
||||
|
@ -134,7 +137,6 @@ if /i '%ARG%' == 'smoke' (
|
|||
set TEST_FSHARP_SUITE=1
|
||||
set TEST_FSHARPQA_SUITE=0
|
||||
set TEST_TAGS=Smoke
|
||||
|
||||
)
|
||||
|
||||
if /i '%ARG%' == 'debug' (
|
||||
|
@ -156,6 +158,7 @@ REM after this point, ARG variable should not be used, use only BUILD_* or TEST_
|
|||
echo Build/Tests configuration:
|
||||
echo.
|
||||
echo BUILD_NET40=%BUILD_NET40%
|
||||
echo BUILD_CORECLR=%BUILD_CORECLR%
|
||||
echo BUILD_PORTABLE=%BUILD_PORTABLE%
|
||||
echo BUILD_VS=%BUILD_VS%
|
||||
echo BUILD_FSHARP_DATA_TYPEPROVIDERS=%BUILD_FSHARP_DATA_TYPEPROVIDERS%
|
||||
|
@ -170,6 +173,13 @@ echo TEST_FSHARPQA_SUITE=%TEST_FSHARPQA_SUITE%
|
|||
echo TEST_TAGS=%TEST_TAGS%
|
||||
echo.
|
||||
|
||||
REM Remove lingering copies of the OSS FSharp.Core from the GAC
|
||||
gacutil /u "FSharp.Core, Version=4.4.1.9055, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
|
||||
|
||||
if "%RestorePackages%"=="" (
|
||||
set RestorePackages=true
|
||||
)
|
||||
|
||||
@echo on
|
||||
|
||||
:: Check prerequisites
|
||||
|
@ -197,93 +207,133 @@ if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe. && goto :fail
|
|||
if defined APPVEYOR (
|
||||
rem See <http://www.appveyor.com/docs/build-phase>
|
||||
if exist "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" (
|
||||
rem HACK HACK HACK
|
||||
set _msbuildexe=%_msbuildexe% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
||||
rem HACK HACK HACK
|
||||
set _msbuildexe=%_msbuildexe% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
||||
)
|
||||
)
|
||||
set msbuildflags=/maxcpucount
|
||||
set _ngenexe="%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ngen.exe"
|
||||
if not exist %_ngenexe% echo Error: Could not find ngen.exe. && goto :failure
|
||||
|
||||
%_ngenexe% install .\.nuget\NuGet.exe
|
||||
if '%RestorePackages%' == 'true' (
|
||||
%_ngenexe% install .\.nuget\NuGet.exe
|
||||
|
||||
.\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages -ConfigFile .nuget\nuget.config
|
||||
@if ERRORLEVEL 1 echo Error: Nuget restore failed && goto :failure
|
||||
.\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages -ConfigFile .nuget\nuget.config
|
||||
@if ERRORLEVEL 1 echo Error: Nuget restore failed && goto :failure
|
||||
)
|
||||
|
||||
set DOTNET_HOME .\packages\dotnet
|
||||
|
||||
rem check to see if the dotnet cli tool exists
|
||||
set _dotnetexe=.\packages\dotnet\dotnet.exe
|
||||
if not exist %_dotnetexe% (
|
||||
echo Error: Could not find %_dotnetexe%.
|
||||
rem do zipfile install nonsense
|
||||
if not exist packages ( md packages )
|
||||
if exist packages\dotnet ( rd packages /s /q )
|
||||
powershell.exe -executionpolicy unrestricted -command .\scripts\install-dotnetcli.ps1 https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-dev-win-x64.latest.zip packages
|
||||
@if ERRORLEVEL 1 echo Error: fetch dotnetcli failed && goto :failure
|
||||
popd
|
||||
)
|
||||
|
||||
pushd .\lkg & ..\%_dotnetexe% restore &popd
|
||||
@if ERRORLEVEL 1 echo Error: dotnet restore failed && goto :failure
|
||||
pushd .\lkg & ..\%_dotnetexe% publish project.json &popd
|
||||
@if ERRORLEVEL 1 echo Error: dotnet publish failed && goto :failure
|
||||
|
||||
rem rename fsc and coreconsole to allow fsc.exe to to start compiler
|
||||
pushd .\lkg\bin\Debug\dnxcore50\win7-x64\publish
|
||||
ren fsc.exe fsc.dll
|
||||
copy corehost.exe fsc.exe
|
||||
popd
|
||||
|
||||
rem rename fsi and coreconsole to allow fsi.exe to to start interative
|
||||
pushd .\lkg\bin\Debug\dnxcore50\win7-x64\publish
|
||||
ren fsi.exe fsi.dll
|
||||
copy corehost.exe fsi.exe
|
||||
popd
|
||||
|
||||
:: Build Proto
|
||||
if NOT EXIST Proto\net40\bin\fsc-proto.exe (
|
||||
%_msbuildexe% %msbuildflags% src\fsharp-proto-build.proj
|
||||
@if ERRORLEVEL 1 echo Error: compiler proto build failed && goto :failure
|
||||
)
|
||||
if NOT EXIST Proto\net40\bin\fsc-proto.exe (set BUILD_PROTO=1)
|
||||
|
||||
:: Build
|
||||
if '%BUILD_PROTO%' == '1' (
|
||||
%_msbuildexe% %msbuildflags% src\fsharp-proto-build.proj
|
||||
@if ERRORLEVEL 1 echo Error: compiler proto build failed && goto :failure
|
||||
%_msbuildexe% %msbuildflags% src\fsharp-proto-build.proj
|
||||
@if ERRORLEVEL 1 echo Error: compiler proto build failed && goto :failure
|
||||
|
||||
%_ngenexe% install Proto\net40\bin\fsc-proto.exe
|
||||
@if ERRORLEVEL 1 echo Error: NGen of proto failed && goto :failure
|
||||
)
|
||||
|
||||
%_ngenexe% install Proto\net40\bin\fsc-proto.exe
|
||||
@if ERRORLEVEL 1 echo Error: NGen of proto failed && goto :failure
|
||||
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library build failed && goto :failure
|
||||
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-compiler-build.proj /p:Configuration=%BUILD_CONFIG%
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-compiler-build.proj /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages%
|
||||
@if ERRORLEVEL 1 echo Error: compiler build failed && goto :failure
|
||||
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages%
|
||||
@if ERRORLEVEL 1 echo Error: library build failed && goto :failure
|
||||
|
||||
if '%BUILD_FSHARP_DATA_TYPEPROVIDERS%' == '1' (
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-typeproviders-build.proj /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: type provider build failed && goto :failure
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-typeproviders-build.proj /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages%
|
||||
@if ERRORLEVEL 1 echo Error: type provider build failed && goto :failure
|
||||
)
|
||||
|
||||
if '%BUILD_CORECLR%' == '1' (
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:TargetFramework=coreclr /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages%
|
||||
@if ERRORLEVEL 1 echo Error: library coreclr build failed && goto :failure
|
||||
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-compiler-build.proj /p:TargetFramework=coreclr /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages%
|
||||
@if ERRORLEVEL 1 echo Error: compiler coreclr build failed && goto :failure
|
||||
|
||||
if '%TEST_CORECLR%' == '1' (
|
||||
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=coreclr /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure
|
||||
)
|
||||
)
|
||||
|
||||
if '%BUILD_PORTABLE%' == '1' (
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:TargetFramework=portable47 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library portable47 build failed && goto :failure
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:TargetFramework=portable7 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library portable7 build failed && goto :failure
|
||||
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:TargetFramework=portable7 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library portable7 build failed && goto :failure
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:TargetFramework=portable47 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library portable47 build failed && goto :failure
|
||||
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:TargetFramework=portable78 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library portable78 build failed && goto :failure
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:TargetFramework=portable78 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library portable78 build failed && goto :failure
|
||||
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:TargetFramework=portable259 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library portable259 build failed && goto :failure
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:TargetFramework=portable259 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library portable259 build failed && goto :failure
|
||||
)
|
||||
|
||||
if '%TEST_COMPILERUNIT%' == '1' (
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-compiler-unittests-build.proj /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: compiler unittests build failed && goto :failure
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-compiler-unittests-build.proj /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: compiler unittests build failed && goto :failure
|
||||
)
|
||||
if '%TEST_COREUNIT%' == '1' (
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-unittests-build.proj /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure
|
||||
if '%TEST_NET40_COREUNIT%' == '1' (
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-unittests-build.proj /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure
|
||||
)
|
||||
|
||||
if '%TEST_PORTABLE_COREUNIT%' == '1' (
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable47 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library unittests build failed portable47 && goto :failure
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable7 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure
|
||||
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable7 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library unittests build failed portable7 && goto :failure
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable47 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure
|
||||
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable78 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library unittests build failed portable78 && goto :failure
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable78 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure
|
||||
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable259 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library unittests build failed portable259 && goto :failure
|
||||
%_msbuildexe% %msbuildflags% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable259 /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure
|
||||
)
|
||||
|
||||
if '%BUILD_VS%' == '1' (
|
||||
%_msbuildexe% %msbuildflags% VisualFSharp.sln /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: VS integration build failed && goto :failure
|
||||
%_msbuildexe% %msbuildflags% VisualFSharp.sln /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: VS integration build failed && goto :failure
|
||||
)
|
||||
|
||||
@echo on
|
||||
call src\update.cmd %BUILD_CONFIG_LOWERCASE% -ngen
|
||||
|
||||
REM Remove lingering copies of the OSS FSharp.Core from the GAC
|
||||
gacutil /u "FSharp.Core, Version=4.4.1.9055, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
|
||||
|
||||
REM This clobbers the installed F# SDK on the machine
|
||||
call vsintegration\update-vsintegration.cmd %BUILD_CONFIG_LOWERCASE%
|
||||
pushd tests
|
||||
|
||||
@echo on
|
||||
|
@ -292,88 +342,74 @@ call BuildTestTools.cmd %BUILD_CONFIG_LOWERCASE%
|
|||
|
||||
@echo on
|
||||
if '%TEST_FSHARP_SUITE%' == '1' (
|
||||
set FSHARP_TEST_SUITE_USE_NUNIT_RUNNER=true
|
||||
set FSHARP_TEST_SUITE_USE_NUNIT_RUNNER=true
|
||||
|
||||
%_msbuildexe% %msbuildflags% fsharp\fsharp.tests.fsproj /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: fsharp cambridge tests for nunit failed && goto :failure
|
||||
%_msbuildexe% %msbuildflags% fsharp\fsharp.tests.fsproj /p:Configuration=%BUILD_CONFIG%
|
||||
@if ERRORLEVEL 1 echo Error: fsharp cambridge tests for nunit failed && goto :failure
|
||||
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% fsharp %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 (
|
||||
type testresults\FSharpNunit_Error.log
|
||||
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% fsharp %TEST_TAGS%' failed
|
||||
goto :failure
|
||||
)
|
||||
set FSHARP_TEST_SUITE_USE_NUNIT_RUNNER=
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% fsharp %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 (
|
||||
type testresults\FSharpNunit_Error.log
|
||||
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% fsharp %TEST_TAGS%' failed
|
||||
goto :failure
|
||||
)
|
||||
set FSHARP_TEST_SUITE_USE_NUNIT_RUNNER=
|
||||
)
|
||||
|
||||
if '%TEST_FSHARPQA_SUITE%' == '1' (
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% fsharpqa %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 (
|
||||
type testresults\fsharpqa_failures.log
|
||||
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% fsharpqa %TEST_TAGS%' failed
|
||||
goto :failure
|
||||
)
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% fsharpqa %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 (
|
||||
type testresults\fsharpqa_failures.log
|
||||
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% fsharpqa %TEST_TAGS%' failed
|
||||
goto :failure
|
||||
)
|
||||
)
|
||||
|
||||
if '%TEST_COMPILERUNIT%' == '1' (
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% compilerunit %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 (
|
||||
type testresults\CompilerUnit_net40_Error.log
|
||||
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% compilerunit' failed
|
||||
goto :failure
|
||||
)
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% compilerunit %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 (
|
||||
type testresults\CompilerUnit_net40_Error.log
|
||||
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% compilerunit' failed
|
||||
goto :failure
|
||||
)
|
||||
)
|
||||
|
||||
if '%TEST_NET40_COREUNIT%' == '1' (
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunit %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 (
|
||||
type testresults\CoreUnit_net40_Error.log
|
||||
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunit' failed
|
||||
goto :failure
|
||||
)
|
||||
if '%TEST_PORTABLE_COREUNIT%' == '1' (
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitall %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 (
|
||||
@echo "type testresults\CoreUnit_net40_Error.log "
|
||||
type testresults\CoreUnit_net40_Error.log
|
||||
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunit' failed
|
||||
goto :failure
|
||||
)
|
||||
)
|
||||
if '%TEST_PORTABLE_COREUNIT%' == '0' (
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunit %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 (
|
||||
type testresults\CoreUnit_net40_Error.log
|
||||
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunit' failed
|
||||
goto :failure
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if '%TEST_PORTABLE_COREUNIT%' == '1' (
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitportable47 %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 (
|
||||
type testresults\CoreUnit_portable47_Error.log
|
||||
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitportable47 %TEST_TAGS%' failed
|
||||
goto :failure
|
||||
)
|
||||
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitportable7 %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 (
|
||||
type testresults\CoreUnit_portable7_Error.log
|
||||
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitportable7 %TEST_TAGS%' failed
|
||||
goto :failure
|
||||
)
|
||||
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitportable78 %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 (
|
||||
type testresults\CoreUnit_portable78_Error.log
|
||||
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitportable78 %TEST_TAGS%' failed
|
||||
goto :failure
|
||||
)
|
||||
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitportable259 %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 (
|
||||
type testresults\CoreUnit_portable259_Error.log
|
||||
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitportable259 %TEST_TAGS%' failed
|
||||
goto :failure
|
||||
)
|
||||
if '%TEST_NET40_COREUNIT%' == '0' (
|
||||
if '%TEST_PORTABLE_COREUNIT%' == '1' (
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitall %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 (
|
||||
type testresults\CoreUnit_portable47_Error.log
|
||||
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% coreunitall %TEST_TAGS%' failed
|
||||
goto :failure
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if '%TEST_VS%' == '1' (
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% ideunit %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 (
|
||||
type testresults\IDEUnit_Error.log
|
||||
echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWERCASE% ideunit %TEST_TAGS%' failed
|
||||
goto :failure
|
||||
)
|
||||
call RunTests.cmd %BUILD_CONFIG_LOWERCASE% ideunit %TEST_TAGS%
|
||||
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd %BUILD_CONFIG_LOWER% ideunit %TEST_TAGS%' failed && goto :failure
|
||||
)
|
||||
|
||||
@echo "Finished"
|
||||
popd
|
||||
|
||||
goto :eof
|
||||
|
||||
:failure
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
The copy of FSharp.Core in this directory is version 2.0.50726.900, required by legacy Power Pack libraries in the parent directory.
|
||||
The copy of FSharp.Core in this directory is version 2.0.50726.900, required by FSharp.SRGen.Build.Tasks.dll and other legacy Power Pack libraries in the parent directory.
|
||||
|
||||
This copy of FSharp.Core.dll should not be referenced as an LKG, it is present merely as a workaround to enable the legacy libraries to work without needing to update the GAC.
|
Двоичный файл не отображается.
|
@ -0,0 +1,67 @@
|
|||
<!--
|
||||
***********************************************************************************************
|
||||
FSharp.SRGen.targets
|
||||
|
||||
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
|
||||
created a backup copy. Incorrect changes to this file will make it
|
||||
impossible to load or build your projects from the command-line or the IDE.
|
||||
|
||||
Copyright (C) Microsoft Corporation. Apache 2.0 License.
|
||||
***********************************************************************************************
|
||||
-->
|
||||
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<UsingTask TaskName="FsSrGen" AssemblyFile="FSharp.SRGen.Build.Tasks.dll"/>
|
||||
<PropertyGroup>
|
||||
<PrepareForBuildDependsOn>ProcessFsSrGen;$(PrepareForBuildDependsOn)</PrepareForBuildDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Build FsSrGen files. -->
|
||||
<Target
|
||||
Name="CallFsSrGen"
|
||||
Inputs="@(FsSrGen)"
|
||||
Outputs="@(FsSrGen->'$(IntermediateOutputPath)%(Filename).fs');@(FsSrGen->'$(IntermediateOutputPath)%(Filename).resx')"
|
||||
Condition="'@(FsSrGen)'!=''">
|
||||
<!-- Create the output directory in case it doesn't exist yet -->
|
||||
<MakeDir Directories="$(IntermediateOutputPath)"/>
|
||||
<!-- Run the tool -->
|
||||
<FsSrGen
|
||||
InputFile="%(FsSrGen.FullPath)"
|
||||
ToolPath="$(FsSrGenToolPath)"
|
||||
OutputFsFile="$(IntermediateOutputPath)%(FsSrGen.Filename).fs"
|
||||
OutputResxFile="$(IntermediateOutputPath)%(FsSrGen.Filename).resx"
|
||||
>
|
||||
</FsSrGen>
|
||||
</Target>
|
||||
|
||||
<!-- Process FsSrGen rules. No 'Inputs' and 'Outputs' means this rule always runs if there is any @FsSrGen, even if up-to-date. -->
|
||||
<Target
|
||||
Name="ProcessFsSrGen"
|
||||
DependsOnTargets="CallFsSrGen"
|
||||
Condition="'@(FsSrGen)'!=''">
|
||||
<!-- Make the outputs magically part of the project -->
|
||||
<CreateItem Include="$(IntermediateOutputPath)%(FsSrGen.Filename).fs">
|
||||
<Output TaskParameter="Include" ItemName="CompileBefore"/>
|
||||
</CreateItem>
|
||||
<CreateItem Include="$(IntermediateOutputPath)%(FsSrGen.Filename).resx"
|
||||
AdditionalMetadata="ManifestResourceName=%(FsSrGen.Filename)">
|
||||
<!-- Note AdditionalMetadata above; we need the name in the manifest to be Foo.resources and not e.g. obj.Debug.Foo.resources -->
|
||||
<Output TaskParameter="Include" ItemName="EmbeddedResource"/>
|
||||
</CreateItem>
|
||||
<!-- Add them to the list of things under the IntermediateOutputPath that should be 'clean'ed -->
|
||||
<CreateItem Include="$(IntermediateOutputPath)%(FsSrGen.Filename).fs">
|
||||
<Output TaskParameter="Include" ItemName="FileWrites"/>
|
||||
</CreateItem>
|
||||
<CreateItem Include="$(IntermediateOutputPath)%(FsSrGen.Filename).resx">
|
||||
<Output TaskParameter="Include" ItemName="FileWrites"/>
|
||||
</CreateItem>
|
||||
<!-- below, turn off this in VS, so that all90.sln does not take forever to load -->
|
||||
<Exec Condition="'$(EnsureThereAreNoUnusedFsSrGenResources)'!='false' And '$(BuildingInsideVisualStudio)'!='true'"
|
||||
Command="$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin\FindUnusedResources.exe %(FsSrGen.FullPath) $(FSharpSourcesRoot)" />
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<AvailableItemName Include="FsSrGen">
|
||||
<Visible>false</Visible>
|
||||
</AvailableItemName>
|
||||
</ItemGroup>
|
||||
</Project>
|
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
|
||||
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
|
||||
<clear />
|
||||
<add key="myget.org fsharp-daily" value="https://www.myget.org/F/fsharp-daily/api/v3/index.json" />
|
||||
<add key="dotnet-core" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" />
|
||||
<add key="myget.org dotnet-buildtools" value="https://www.myget.org/F/dotnet-buildtools/api/v3/index.json" />
|
||||
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
|
||||
|
||||
</packageSources>
|
||||
</configuration>
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"Microsoft.FSharp.Compiler.Host.netcore": "1.0.0-alpha-160406",
|
||||
},
|
||||
"runtimes": {
|
||||
"win7-x86": { },
|
||||
"win7-x64": { },
|
||||
"osx.10.10-x64": { },
|
||||
"ubuntu.14.04-x64": { }
|
||||
},
|
||||
"frameworks": {
|
||||
"dnxcore50": {
|
||||
"imports": "portable-net45+win8"
|
||||
}
|
||||
}
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,43 @@
|
|||
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<ItemGroup>
|
||||
<ProjectsWithDefaultFramework Include="src/fsharp-library-build.proj" />
|
||||
<ProjectsWithDefaultFramework Include="src/fsharp-compiler-build.proj" />
|
||||
<ProjectsWithDefaultFramework Include="src/fsharp-typeproviders-build.proj" />
|
||||
<ProjectsWithDefaultFramework Include="vsintegration/fsharp-vsintegration-src-build.proj" />
|
||||
<ProjectsWithDefaultFramework Include="vsintegration/fsharp-vsintegration-project-templates-build.proj" />
|
||||
<ProjectsWithDefaultFramework Include="vsintegration/fsharp-vsintegration-item-templates-build.proj" />
|
||||
<ProjectsWithDefaultFramework Include="vsintegration/fsharp-vsintegration-deployment-build.proj" />
|
||||
<ProjectsWithDefaultFramework Include="vsintegration/fsharp-vsintegration-unittests-build.proj" />
|
||||
<ProjectsWithDefaultFramework Include="src/fsharp-library-unittests-build.proj" />
|
||||
<ProjectsWithDefaultFramework Include="src/fsharp-compiler-unittests-build.proj" />
|
||||
<ProjectsWithDefaultFramework Include="tests/fsharp/FSharp.Tests.fsproj" />
|
||||
|
||||
<ProjectsWithPortableFramework Include="src/fsharp-library-build.proj" />
|
||||
<ProjectsWithPortableFramework Include="src/fsharp-library-unittests-build.proj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="Build">
|
||||
<MSBuild Projects="@(ProjectsWithDefaultFramework)" Targets="Build" BuildInParallel="true"/>
|
||||
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Build" BuildInParallel="true" Properties="TargetFramework=portable47"/>
|
||||
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Build" BuildInParallel="true" Properties="TargetFramework=portable7"/>
|
||||
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Build" BuildInParallel="true" Properties="TargetFramework=portable78"/>
|
||||
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Build" BuildInParallel="true" Properties="TargetFramework=portable259"/>
|
||||
</Target>
|
||||
|
||||
<Target Name="Rebuild">
|
||||
<MSBuild Projects="@(ProjectsWithDefaultFramework)" Targets="Rebuild" BuildInParallel="true"/>
|
||||
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Rebuild" BuildInParallel="true" Properties="TargetFramework=portable47"/>
|
||||
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Rebuild" BuildInParallel="true" Properties="TargetFramework=portable7"/>
|
||||
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Rebuild" BuildInParallel="true" Properties="TargetFramework=portable78"/>
|
||||
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Rebuild" BuildInParallel="true" Properties="TargetFramework=portable259"/>
|
||||
</Target>
|
||||
|
||||
<Target Name="Clean">
|
||||
<MSBuild Projects="@(ProjectsWithDefaultFramework)" Targets="Clean" BuildInParallel="true"/>
|
||||
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Clean" BuildInParallel="true" Properties="TargetFramework=portable47"/>
|
||||
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Clean" BuildInParallel="true" Properties="TargetFramework=portable7"/>
|
||||
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Clean" BuildInParallel="true" Properties="TargetFramework=portable78"/>
|
||||
<MSBuild Projects="@(ProjectsWithPortableFramework)" Targets="Clean" BuildInParallel="true" Properties="TargetFramework=portable259"/>
|
||||
</Target>
|
||||
</Project>
|
|
@ -19,7 +19,7 @@ def static getBuildJobName(def configuration, def os) {
|
|||
osList.each { os ->
|
||||
|
||||
def lowerConfiguration = configuration.toLowerCase()
|
||||
|
||||
|
||||
// Calculate job name
|
||||
def jobName = getBuildJobName(configuration, os)
|
||||
|
||||
|
@ -45,9 +45,9 @@ def static getBuildJobName(def configuration, def os) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: set to false after tests are fully enabled
|
||||
def skipIfNoTestFiles = true
|
||||
|
||||
// TODO: set to false after tests are fully enabled
|
||||
def skipIfNoTestFiles = true
|
||||
|
||||
Utilities.setMachineAffinity(newJob, os, 'latest-or-auto')
|
||||
Utilities.standardJobSetup(newJob, project, isPullRequest, "*/${branch}")
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.DotNet.BuildTools" version="1.0.25-prerelease-00140" />
|
||||
<package id="FSharp.Data" version="2.2.5" />
|
||||
<package id="FsCheck" version="2.0.3" />
|
||||
<package id="NUnit.Runners" version="3.0.0" targetFramework="net45" />
|
||||
<package id="NUnit" version="3.0.0" targetFramework="net45" />
|
||||
<package id="NUnit.Console" version="3.0.0" targetFramework="net45" />
|
||||
<package id="NUnitLite" version="3.0.0" targetFramework="net45" />
|
||||
<package id="System.Collections.Immutable" version="1.2.0-rc3-23805" />
|
||||
<package id="System.Reflection.Metadata" version="1.3.0-beta-23816" />
|
||||
<package id="Microsoft.DiaSymReader.PortablePdb" version="1.0.0-rc-60301" />
|
||||
<package id="Microsoft.DiaSymReader" version="1.0.7" />
|
||||
<package id="NUnit3TestAdapter" version="3.0.8-ctp-8" targetFramework="net45" />
|
||||
<package id="FsSrGen" version="2.0.0" targetFramework="net46" />
|
||||
<package id="FSharp.SRGen.Build.Tasks" version="2.0.0" targetFramework="net46" />
|
||||
<package id="MicroBuild.Core" version="0.2.0" />
|
||||
</packages>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<# Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. #>
|
||||
|
||||
<# Download and install the dotnet cli #>
|
||||
|
||||
$clipath = $args[0]
|
||||
$BackUpPath = [System.IO.Path]::Combine($args[1], "dotnet-latest.zip")
|
||||
$Destination = [System.IO.Path]::Combine($args[1], "dotnet")
|
||||
|
||||
Invoke-WebRequest -UseBasicParsing $clipath -OutFile $BackUpPath
|
||||
Add-Type -assembly "system.io.compression.filesystem"
|
||||
[io.compression.zipfile]::ExtractToDirectory($BackUpPath, $destination)
|
|
@ -26,7 +26,7 @@
|
|||
<Optimize Condition=" '$(Optimize)' == '' ">false</Optimize>
|
||||
<ErrorReport Condition=" '$(ErrorReport)' == '' ">prompt</ErrorReport>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<OtherFlags>$(OtherFlags) --no-jit-optimize --jit-tracking /warnon:3180</OtherFlags>
|
||||
<OtherFlags>$(OtherFlags) --no-jit-optimize --jit-tracking</OtherFlags>
|
||||
<DefineConstants Condition=" '$(ProjectLanguage)' != 'VisualBasic' ">DEBUG;TRACE;CODE_ANALYSIS;$(DefineConstants)</DefineConstants>
|
||||
<DefineConstants Condition=" '$(ProjectLanguage)' == 'VisualBasic' ">DEBUG=True,TRACE=True,CODE_ANALYSIS=True,$(DefineConstants)</DefineConstants>
|
||||
<SIGN_WITH_MSFT_KEY Condition=" '$(SIGN_WITH_MSFT_KEY)' == '' ">false</SIGN_WITH_MSFT_KEY>
|
||||
|
@ -85,4 +85,22 @@
|
|||
<MSBuildVersionSuffix>core</MSBuildVersionSuffix>
|
||||
<MSBuildVersionSuffix Condition="'$(VisualStudioVersion)' == '12.0'">V12.0</MSBuildVersionSuffix>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<BuildRevision>$([System.DateTime]::Now.ToString(`yyMMdd`))</BuildRevision>
|
||||
<NuGetReleaseVersion>1.0.0</NuGetReleaseVersion>
|
||||
<NuGetPreReleaseVersion>$(NuGetReleaseVersion)-alpha</NuGetPreReleaseVersion>
|
||||
<NuGetPerBuildPreReleaseVersion Condition="'$(BuildRevision)' != ''">$(NuGetPreReleaseVersion)-$(BuildRevision.Trim())</NuGetPerBuildPreReleaseVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<FsiToolPath>$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin</FsiToolPath>
|
||||
<FsSrGenToolPath>$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin</FsSrGenToolPath>
|
||||
<FsLexToolPath>$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin</FsLexToolPath>
|
||||
<FsYaccToolPath>$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin</FsYaccToolPath>
|
||||
<FsiToolExe>fsi.exe</FsiToolExe>
|
||||
<FsLexToolExe>fslex.exe</FsLexToolExe>
|
||||
<FsYaccToolExe>fsyacc.exe</FsYaccToolExe>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -3,49 +3,59 @@
|
|||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<IsPortableProfile Condition="'$(TargetFramework)' == 'portable47' or '$(TargetFramework)' == 'portable7' or '$(TargetFramework)' == 'portable78' or '$(TargetFramework)' == 'portable259'">true</IsPortableProfile>
|
||||
<FSCoreVersion Condition="'$(TargetFramework)' != 'net20' and $(IsPortableProfile) != 'true'">4.4.1.9055</FSCoreVersion>
|
||||
<FSCoreVersion Condition="'$(TargetFramework)' == 'net20'">2.4.1.9055</FSCoreVersion>
|
||||
<FSCoreVersion Condition="'$(TargetFramework)' == 'portable7'">3.7.41.9055</FSCoreVersion>
|
||||
<FSCoreVersion Condition="'$(TargetFramework)' == 'portable47'">3.47.41.9055</FSCoreVersion>
|
||||
<FSCoreVersion Condition="'$(TargetFramework)' == 'portable78'">3.78.41.9055</FSCoreVersion>
|
||||
<FSCoreVersion Condition="'$(TargetFramework)' == 'portable259'">3.259.41.9055</FSCoreVersion>
|
||||
<FSCoreVersion Condition="'$(TargetFramework)' != 'net20' and $(IsPortableProfile) != 'true'">4.4.1.0</FSCoreVersion>
|
||||
<FSCoreVersion Condition="'$(TargetFramework)' == 'net20'">2.4.1.0</FSCoreVersion>
|
||||
<FSCoreVersion Condition="'$(TargetFramework)' == 'portable7'">3.7.41.0</FSCoreVersion>
|
||||
<FSCoreVersion Condition="'$(TargetFramework)' == 'portable47'">3.47.41.0</FSCoreVersion>
|
||||
<FSCoreVersion Condition="'$(TargetFramework)' == 'portable78'">3.78.41.0</FSCoreVersion>
|
||||
<FSCoreVersion Condition="'$(TargetFramework)' == 'portable259'">3.259.41.0</FSCoreVersion>
|
||||
</PropertyGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(Configuration)' == 'Debug' or '$(Configuration)' == 'Release' or '$(Configuration)' == 'VSDebug' or '$(Configuration)' == 'VSRelease' ">
|
||||
<PropertyGroup>
|
||||
<SkipSigning>false</SkipSigning><!-- Skip using the ,net toolset to generate signing . -->
|
||||
<UseOpenSourceSign>true</UseOpenSourceSign>
|
||||
</PropertyGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(ProjectLanguage)' == 'FSharp'">
|
||||
<Choose>
|
||||
<When Condition="'$(AssemblyName)' == 'FSharp.Core'">
|
||||
<PropertyGroup>
|
||||
<OtherFlags>$(OtherFlags) --version:$(FSCoreVersion)</OtherFlags>
|
||||
<When Condition="'$(AssemblyName)' == 'FSharp.Core' or '$(AssemblyName)' == 'FSharp.Build' or '$(AssemblyName)' == 'FSharp.Compiler' or '$(AssemblyName)' == 'FSharp.Compiler.Interactive.Settings' or '$(AssemblyName)' == 'FSharp.Compiler.Server.Shared' or '$(AssemblyName)' == 'fsc' or '$(AssemblyName)' == 'fsi' or '$(AssemblyName)' == 'FsiAnyCPU' or '$(AssemblyName)' == 'FSharp.Data.TypeProviders' or '$(AssemblyName)' == 'FSharp.Compiler.Unittests'" >
|
||||
<PropertyGroup Condition="'$(AssemblyName)' == 'FSharp.Core' and ('$(TargetFramework)' == 'portable47' or '$(TargetFramework)' == 'portable7' or '$(TargetFramework)' == 'portable78' or '$(TargetFramework)' == 'portable259' or '$(TargetFramework)' == 'coreclr')">
|
||||
<IsPortableProfile>true</IsPortableProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OtherFlags>$(OtherFlags) --delaysign+ --keyfile:"$(FSharpSourcesRoot)\fsharp\msft.pubkey"</OtherFlags>
|
||||
<DefineConstants>STRONG_NAME_AND_DELAY_SIGN_FSHARP_COMPILER_WITH_MSFT_KEY;$(DefineConstants)</DefineConstants>
|
||||
<StrongNames>true</StrongNames>
|
||||
<MicroBuildAssemblyVersion>$(FSCoreVersion)</MicroBuildAssemblyVersion>
|
||||
<MicroBuildAssemblyFileLanguage>fs</MicroBuildAssemblyFileLanguage>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="'$(AssemblyName)' == 'FSharp.LanguageService' or '$(AssemblyName)' == 'FSharp.LanguageService.Compiler' or '$(AssemblyName)' == 'FSharp.LanguageService.Base' or '$(AssemblyName)' == 'FSharp.Editor' or '$(AssemblyName)' == 'FSharp.VS.FSI' or '$(AssemblyName)' == 'FSharp.ProjectSystem.FSharp'">
|
||||
<When Condition="'$(AssemblyName)' == 'FSharp.LanguageService' or '$(AssemblyName)' == 'FSharp.LanguageService.Compiler' or '$(AssemblyName)' == 'FSharp.Editor' or '$(AssemblyName)' == 'FSharp.VS.FSI' or '$(AssemblyName)' == 'FSharp.ProjectSystem.FSharp'">
|
||||
<PropertyGroup>
|
||||
<OtherFlags>$(OtherFlags) --version:15.0.0.9055 --delaysign+ --keyfile:"$(FSharpSourcesRoot)\fsharp\msft.pubkey"</OtherFlags>
|
||||
<OtherFlags>$(OtherFlags) --delaysign+ --keyfile:"$(FSharpSourcesRoot)\fsharp\msft.pubkey"</OtherFlags>
|
||||
<DefineConstants>STRONG_NAME_AND_DELAY_SIGN_FSHARP_COMPILER_WITH_MSFT_KEY;$(DefineConstants)</DefineConstants>
|
||||
<StrongNames>true</StrongNames>
|
||||
<MicroBuildAssemblyVersion>14.4.1.0</MicroBuildAssemblyVersion>
|
||||
<MicroBuildAssemblyFileLanguage>fs</MicroBuildAssemblyFileLanguage>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<!-- do not strong-name the runtime unit tests, as they have non-strong-named dependencies -->
|
||||
<When Condition="'$(AssemblyName)' == 'FSharp.Core.Unittests'">
|
||||
<PropertyGroup>
|
||||
<OtherFlags>$(OtherFlags) --version:4.4.1.9055</OtherFlags>
|
||||
<SkipSigning>true</SkipSigning><!-- Skip using the ,net toolset to generate signing . -->
|
||||
<UseOpenSourceSign>false</UseOpenSourceSign>
|
||||
<MicroBuildAssemblyVersion>$(FSCoreVersion)</MicroBuildAssemblyVersion>
|
||||
<MicroBuildAssemblyFileLanguage>fs</MicroBuildAssemblyFileLanguage>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<PropertyGroup Condition="'$(SIGN_WITH_MSFT_KEY)' == 'true'">
|
||||
<OtherFlags>$(OtherFlags) --version:4.4.1.9055 --delaysign+ --keyfile:"$(FSharpSourcesRoot)\fsharp\msft.pubkey"</OtherFlags>
|
||||
<OtherFlags>$(OtherFlags) --delaysign+ --keyfile:"$(FSharpSourcesRoot)\fsharp\msft.pubkey"</OtherFlags>
|
||||
<DefineConstants>STRONG_NAME_AND_DELAY_SIGN_FSHARP_COMPILER_WITH_MSFT_KEY;$(DefineConstants)</DefineConstants>
|
||||
<StrongNames>true</StrongNames>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(SIGN_WITH_MSFT_KEY)' != 'true'">
|
||||
<OtherFlags>$(OtherFlags) --version:4.4.1.9055 --keyfile:"$(FSharpSourcesRoot)\fsharp\test.snk"</OtherFlags>
|
||||
<DefineConstants>STRONG_NAME_FSHARP_COMPILER_WITH_TEST_KEY;$(DefineConstants)</DefineConstants>
|
||||
<StrongNames>true</StrongNames>
|
||||
<MicroBuildAssemblyVersion>$(FSCoreVersion)</MicroBuildAssemblyVersion>
|
||||
<MicroBuildAssemblyFileLanguage>fs</MicroBuildAssemblyFileLanguage>
|
||||
</PropertyGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
|
@ -57,6 +67,8 @@
|
|||
<DefineConstants>STRONG_NAME_AND_DELAY_SIGN_FSHARP_COMPILER_WITH_MSFT_KEY;$(DefineConstants)</DefineConstants>
|
||||
<StrongNames>true</StrongNames>
|
||||
<DelaySign>true</DelaySign>
|
||||
<MicroBuildAssemblyVersion>$(FSCoreVersion)</MicroBuildAssemblyVersion>
|
||||
<MicroBuildAssemblyFileLanguage>fs</MicroBuildAssemblyFileLanguage>
|
||||
</PropertyGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
|
@ -65,8 +77,9 @@
|
|||
<PropertyGroup Condition="'$(StrongNames)' != 'true'">
|
||||
<!-- For the proto build, portable and Silverlight framework implementations, we don't use strong names. -->
|
||||
<!-- For Silverlight, there is no way to disable strong name verification, so using the Microsoft name is not possible -->
|
||||
<OtherFlags>$(OtherFlags) --version:4.4.1.9055</OtherFlags>
|
||||
<DefineConstants>NO_STRONG_NAMES;$(DefineConstants)</DefineConstants>
|
||||
<MicroBuildAssemblyVersion>$(FSCoreVersion)</MicroBuildAssemblyVersion>
|
||||
<MicroBuildAssemblyFileLanguage>fs</MicroBuildAssemblyFileLanguage>
|
||||
</PropertyGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
|
@ -89,7 +102,7 @@
|
|||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Flags used to build the bootstrap compiler. -->
|
||||
<!-- Flags used to build the bootstrap compiler. -->
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Proto'">
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>DEBUG;NO_STRONG_NAMES;$(DefineConstants)</DefineConstants>
|
||||
|
@ -100,10 +113,17 @@
|
|||
<IntermediateOutputPath>obj\$(Configuration)\$(TargetFramework)\</IntermediateOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Produce portable pdbs -->
|
||||
<PropertyGroup Condition="'$(Configuration)'!='Proto'">
|
||||
<OtherFlags>$(OtherFlags) --debug:full</OtherFlags>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);OPEN_BUILD</DefineConstants>
|
||||
<!-- Disable uwa toolchain nuget package resolve logic. -->
|
||||
<NuGetTargets Condition="'$(NuGetTargets)' == ''">false</NuGetTargets>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<NUnitVersion>3.0.0</NUnitVersion>
|
||||
<NUnitFullVersion>3.0.5797.27534</NUnitFullVersion>
|
||||
|
@ -112,8 +132,6 @@
|
|||
<FsCheckVersion>2.0.3</FsCheckVersion>
|
||||
<FsCheckFullVersion>2.0.3.0</FsCheckFullVersion>
|
||||
<FsCheckLibDir>$(FSharpSourcesRoot)\..\packages\FsCheck.$(FsCheckVersion)\lib\</FsCheckLibDir>
|
||||
<FsSrGenVersion>2.0.0</FsSrGenVersion>
|
||||
<FsSrGenBuildTasksVersion>2.0.0</FsSrGenBuildTasksVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- v2.0-specific flags -->
|
||||
|
@ -134,6 +152,9 @@
|
|||
<DefineConstants>$(DefineConstants);FX_NO_CUSTOMATTRIBUTEDATA</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_BIGINT</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_CONDITIONAL_WEAK_TABLE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);ENABLE_MONO_SUPPORT</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_MSBUILDRESOLVER_RUNTIMELIKE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_LCIDFROMCODEPAGE</DefineConstants>
|
||||
<OtherFlags>$(OtherFlags) --simpleresolution</OtherFlags>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -147,15 +168,76 @@
|
|||
<DefineConstants>$(DefineConstants);QUERIES_IN_FSLIB</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);PUT_TYPE_PROVIDERS_IN_FSCORE;</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_ATLEAST_LINQ</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);ENABLE_MONO_SUPPORT</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_MSBUILDRESOLVER_RUNTIMELIKE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_LCIDFROMCODEPAGE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_RESX_RESOURCE_READER</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_RESIDENT_COMPILER</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);SHADOW_COPY_REFERENCES</DefineConstants>
|
||||
<TargetFrameworkProfile></TargetFrameworkProfile>
|
||||
<!-- MSbuild works out the assembly references -->
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='coreclr'">
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<DefineConstants>$(DefineConstants);FSHARP_CORE_4_5</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_BEGINEND_READWRITE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_ATLEAST_45</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_ATLEAST_40</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_ATLEAST_35</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_ATLEAST_PORTABLE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);QUERIES_IN_FSLIB</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);PUT_TYPE_PROVIDERS_IN_FSCORE;</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_ATLEAST_LINQ</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_RESHAPED_GLOBALIZATION</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_RESHAPED_REFLECTION</DefineConstants>
|
||||
<DefineConstants Condition="'$(AssemblyName)'!='FSharp.Core'">$(DefineConstants);FX_RESHAPED_REFLECTION_CORECLR</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);RESHAPED_MSBUILD</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_CONVERTER</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_ARRAY_LONG_LENGTH</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_DEFAULT_DEPENDENCY_TYPE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_BINARY_SERIALIZATION</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_CUSTOMATTRIBUTEDATA</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_REFLECTION_MODULE_HANDLES</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_WEB_CLIENT</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_EVENTWAITHANDLE_NO_IDISPOSABLE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_EXIT_CONTEXT_FLAGS</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_WAITONE_MILLISECONDS</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_PARAMETERIZED_THREAD_START</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_THREAD</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_SECURITY_PERMISSIONS</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);NO_HEAPTERMINATION</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_REDUCED_EXCEPTIONS</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_PDB_READER</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_PDB_WRITER</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_SYMBOLSTORE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_LINKEDRESOURCES</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_CORHOST_SIGNER</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_RESHAPED_REFEMIT</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_APP_DOMAINS</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_SYSTEM_CONFIGURATION</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_RESHAPED_CONSOLE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_RUNTIMEENVIRONMENT</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);NO_LOGGING_GUI</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);NO_DEBUG_LOG</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);NO_WIN_REGISTRY</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);NO_SERVERCODEPAGES</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_REDUCED_CONSOLE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_WINFORMS</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_THREADABORT</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);TODO_REWORK_ASSEMBLY_LOAD</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);TODO_REWORK_SERVER</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);NO_LOADER_OPTIMIZATION</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);SILVERLIGHT_COMPILER_FSHARP_CORE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);I_DONT_KNOW_HOW_TO_DO_THIS_YET</DefineConstants>
|
||||
<TargetFrameworkProfile>profile7</TargetFrameworkProfile> <!-- We are currently directly referencing corefx assemblies, so profile7 is not really true -->
|
||||
<ImplicitlyExpandTargetFramework>false</ImplicitlyExpandTargetFramework> <!-- To stop msbuild being helpfull and referencing the dlls for the profile -->
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Target Portable Profile 47 -->
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='portable47'">
|
||||
|
||||
<DefineConstants>$(DefineConstants);FSHARP_CORE_PORTABLE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_ATLEAST_35</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_CONCURRENT_DICTIONARY</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_ATLEAST_PORTABLE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_ARRAY_LONG_LENGTH</DefineConstants>
|
||||
|
@ -197,11 +279,11 @@
|
|||
<DefineConstants>$(DefineConstants);FX_NO_EXCEPTIONDISPATCHINFO</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_ATLEAST_LINQ</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_THREAD</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_THREADPOOL</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_WAITONE_MILLISECONDS</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_TPL_PARALLEL</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);PUT_TYPE_PROVIDERS_IN_FSCORE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_CUSTOMATTRIBUTEDATA</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_MISSINGMETHODEXCEPTION</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);DONT_INCLUDE_DEPRECATED</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);QUERIES_IN_FSLIB</DefineConstants>
|
||||
<TargetFrameworkProfile>Profile47</TargetFrameworkProfile>
|
||||
|
@ -213,8 +295,8 @@
|
|||
<DefineConstants>$(DefineConstants);FSHARP_CORE_NETCORE_PORTABLE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FSHARP_CORE_NETCORE_PORTABLE7</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);QUERIES_IN_FSLIB</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_ATLEAST_35</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_ATLEAST_PORTABLE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_BEGINEND_READWRITE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_ARRAY_LONG_LENGTH</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_EXIT</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_CHAR_PARSE</DefineConstants>
|
||||
|
@ -233,9 +315,9 @@
|
|||
<DefineConstants>$(DefineConstants);FX_NO_REGISTERED_WAIT_HANDLES</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_ATLEAST_LINQ</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_THREAD</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_THREADPOOL</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);PUT_TYPE_PROVIDERS_IN_FSCORE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_CUSTOMATTRIBUTEDATA</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_MISSINGMETHODEXCEPTION</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_RESHAPED_REFLECTION</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_EXIT_CONTEXT_FLAGS</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_EVENTWAITHANDLE_NO_IDISPOSABLE</DefineConstants>
|
||||
|
@ -249,6 +331,7 @@
|
|||
<DefineConstants>$(DefineConstants);FSHARP_CORE_NETCORE_PORTABLE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FSHARP_CORE_NETCORE_PORTABLE78</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);QUERIES_IN_FSLIB</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_BEGINEND_READWRITE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_CONVERTER</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_RESHAPED_REFLECTION</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_ARRAY_LONG_LENGTH</DefineConstants>
|
||||
|
@ -271,9 +354,9 @@
|
|||
<DefineConstants>$(DefineConstants);FX_EVENTWAITHANDLE_NO_IDISPOSABLE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_EXIT_CONTEXT_FLAGS</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_REGISTERED_WAIT_HANDLES</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_THREADPOOL</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);PUT_TYPE_PROVIDERS_IN_FSCORE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_CUSTOMATTRIBUTEDATA</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_MISSINGMETHODEXCEPTION</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_CONCURRENT_DICTIONARY</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_ATLEAST_LINQ</DefineConstants>
|
||||
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
|
||||
|
@ -284,6 +367,7 @@
|
|||
<PropertyGroup Condition="'$(TargetFramework)'=='portable259'">
|
||||
<DefineConstants>$(DefineConstants);FSHARP_CORE_NETCORE_PORTABLE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FSHARP_CORE_NETCORE_PORTABLE259</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_BEGINEND_READWRITE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);QUERIES_IN_FSLIB</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_CONVERTER</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_RESHAPED_REFLECTION</DefineConstants>
|
||||
|
@ -307,9 +391,9 @@
|
|||
<DefineConstants>$(DefineConstants);FX_EVENTWAITHANDLE_NO_IDISPOSABLE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_EXIT_CONTEXT_FLAGS</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_REGISTERED_WAIT_HANDLES</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_THREADPOOL</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);PUT_TYPE_PROVIDERS_IN_FSCORE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_CUSTOMATTRIBUTEDATA</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_MISSINGMETHODEXCEPTION</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_NO_CONCURRENT_DICTIONARY</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);FX_ATLEAST_LINQ</DefineConstants>
|
||||
<TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
|
||||
|
@ -655,11 +739,11 @@
|
|||
<When Condition="'$(BuildWith)' == 'LKG'">
|
||||
<PropertyGroup>
|
||||
<FSharpTargetsPath>..\lkg\FSharp-$(LkgVersion)\bin\Microsoft.FSharp.Targets</FSharpTargetsPath>
|
||||
<FscToolPath>$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin</FscToolPath>
|
||||
<FscToolPath>$(FSharpSourcesRoot)\..\lkg\bin\Debug\dnxcore50\win7-x64\publish</FscToolPath>
|
||||
<FSCoreLKGPath>$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin\FSharp.Core.dll</FSCoreLKGPath>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="'$(TargetFramework)'=='portable47' OR '$(TargetFramework)'=='portable7' OR '$(TargetFramework)'=='portable78' OR '$(TargetFramework)'=='portable259'">
|
||||
<When Condition="'$(TargetFramework)'=='portable47' OR '$(TargetFramework)'=='portable7' OR '$(TargetFramework)'=='portable78' OR '$(TargetFramework)'=='portable259' OR '$(TargetFramework)'=='coreclr'">
|
||||
<PropertyGroup>
|
||||
<FSharpTargetsPath>..\Proto\$(protoCLIDir)\bin\Microsoft.Portable.FSharp-proto.Targets</FSharpTargetsPath>
|
||||
</PropertyGroup>
|
||||
|
@ -707,21 +791,42 @@
|
|||
</Choose>
|
||||
<Import Condition="'$(ProjectLanguage)' == 'FSharp'" Project="$(FSharpTargetsPath)"/>
|
||||
|
||||
<!-- Reference an existing FSI.EXE for use from within MSBuild -->
|
||||
<PropertyGroup>
|
||||
<FsSrGenToolPath>$(FSharpSourcesRoot)\..\packages\FsSrGen.$(FsSrGenVersion)\lib\net46</FsSrGenToolPath>
|
||||
<FsLexToolPath>$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin</FsLexToolPath>
|
||||
<FsYaccToolPath>$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin</FsYaccToolPath>
|
||||
<FsLexToolExe>fslex.exe</FsLexToolExe>
|
||||
<FsYaccToolExe>fsyacc.exe</FsYaccToolExe>
|
||||
</PropertyGroup>
|
||||
<!-- Hook up DNX to enable solution refresh of packages -->
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='coreclr'">
|
||||
|
||||
<NuGetPackagesPath Condition="'$(NuGetPackagesPath)' == ''">$(FSharpSourcesRoot)\..\packages</NuGetPackagesPath>
|
||||
|
||||
<!-- fix this to be not so unfortunate looking -->
|
||||
<BuildToolsDir>$(MSBuildThisFileDirectory)..\packages\Microsoft.DotNet.BuildTools.1.0.25-prerelease-00140\lib\</BuildToolsDir>
|
||||
|
||||
<!-- Implicitly needed by packageresolve.targets. Should file a bug for a better error message here -->
|
||||
<PackagesDir>$(NuGetPackagesPath)\</PackagesDir>
|
||||
|
||||
<NuGetToolPath Condition="'$(NuGetToolPath)' == ''">$(FSharpSourcesRoot)\..\.nuget\</NuGetToolPath>
|
||||
<NuGetConfigCommandLine>-ConfigFile "$(NuGetConfigFile)"</NuGetConfigCommandLine>
|
||||
|
||||
<NugetRestoreCommand>"$(NuGetToolPath)NuGet.exe"</NugetRestoreCommand>
|
||||
<NugetRestoreCommand>$(NugetRestoreCommand) install</NugetRestoreCommand>
|
||||
<NugetRestoreCommand>$(NugetRestoreCommand) -OutputDirectory "$(NuGetPackagesPath)"</NugetRestoreCommand>
|
||||
<NugetRestoreCommand>$(NugetRestoreCommand) -Config "$(NuGetToolPath)NuGet.Config"</NugetRestoreCommand>
|
||||
|
||||
<DnuRestoreCommand>"$(NuGetToolPath)NuGet.exe"</DnuRestoreCommand>
|
||||
<DnuRestoreCommand>$(DnuRestoreCommand) restore</DnuRestoreCommand>
|
||||
<DnuRestoreCommand>$(DnuRestoreCommand) -OutputDirectory "$(NuGetPackagesPath)"</DnuRestoreCommand>
|
||||
<DnuRestoreCommand>$(DnuRestoreCommand) -Config "$(NuGetToolPath)NuGet.Config"</DnuRestoreCommand>
|
||||
|
||||
<!-- Current version of DNX does not support all semantics used in our packages,
|
||||
so we ignore the pre-calculation in the lock file and calculate asset applicability in the build task -->
|
||||
<NuGetIngoreLockFile>true</NuGetIngoreLockFile>
|
||||
</PropertyGroup>
|
||||
<Import Condition="'$(TargetFramework)'=='coreclr'" Project="$(BuildToolsDir)Build.Common.Targets" />
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Hook compilation phase to do custom work -->
|
||||
<CompileDependsOn>ValidateConfiguration;$(CompileDependsOn);CustomCopyLocalFiles</CompileDependsOn>
|
||||
<RootNamespace></RootNamespace>
|
||||
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
|
||||
<EnsureThereAreNoUnusedFsSrGenResources>false</EnsureThereAreNoUnusedFsSrGenResources>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="ValidateConfiguration">
|
||||
|
@ -729,9 +834,10 @@
|
|||
Text="Configuration '$(Configuration)' is not one of the supported configurations: Debug, Release, Proto"
|
||||
Condition="'$(Configuration)'!='Release' and '$(Configuration)'!='Debug' and '$(Configuration)'!='VSRelease' and '$(Configuration)'!='VSDebug' and '$(Configuration)'!='Proto'"/>
|
||||
<Error
|
||||
Text="TargetFramework '$(TargetFramework)' is not one of the supported configurations: 'empty', net20, net40, sl3-wp, sl5, sl5-compiler, portable47, portable7, portable78, portable259"
|
||||
Text="TargetFramework '$(TargetFramework)' is not one of the supported configurations: 'empty', net20, net40, coreclr, sl3-wp, sl5, sl5-compiler, portable47, portable7, portable78, portable259"
|
||||
Condition="! ('$(TargetFramework)' == 'net40' or
|
||||
'$(TargetFramework)' == 'net20' or
|
||||
'$(TargetFramework)' == 'coreclr' or
|
||||
'$(TargetFramework)' == 'sl5' or
|
||||
'$(TargetFramework)' == 'sl3-wp' or
|
||||
'$(TargetFramework)' == 'portable47' or
|
||||
|
@ -740,7 +846,7 @@
|
|||
'$(TargetFramework)' == 'portable259')"/>
|
||||
<Error
|
||||
Text="TargetFramework '$(TargetFramework)' is only supported when building FSharp.Core.dll and FSharp.Core.Unittests.dll. All other components must be built with TargetFramework=net40"
|
||||
Condition="'$(AssemblyName)' != 'FSharp.Core' and '$(AssemblyName)' != 'FSharp.Core.Unittests' and '$(TargetFramework)' != 'net40'"/>
|
||||
Condition="'$(AssemblyName)' != 'FSharp.Core' and '$(AssemblyName)' != 'FSharp.Core.Unittests' and '$(TargetFramework)' != 'net40' and '$(TargetFramework)' != 'coreclr'"/>
|
||||
|
||||
</Target>
|
||||
|
||||
|
@ -759,8 +865,9 @@
|
|||
</CreateItem>
|
||||
</Target>
|
||||
|
||||
<Import Project="..\packages\FSharp.SRGen.Build.Tasks.$(FsSrGenBuildTasksVersion)\content\FSharp.SRGen.targets" />
|
||||
|
||||
<Import Project="..\lkg\FSharp-$(LkgVersion)\bin\FSharp.SRGen.targets" />
|
||||
<Import Project="Microbuild.Settings.targets" />
|
||||
|
||||
<Target Name="ReorderCompileItems"
|
||||
BeforeTargets="CoreCompile"
|
||||
Condition="'$(GenerateTargetFrameworkAttribute)' == 'true' AND '$(AssemblyName)' == 'FSharp.Core'">
|
||||
|
@ -770,7 +877,8 @@
|
|||
<CompileBefore Remove="@(CompileBefore)"/>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
<Target Name="BeforeBuild" BeforeTargets="Build">
|
||||
<Exec Command=".\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages" WorkingDirectory="$(FSharpSourcesRoot)\.."/>
|
||||
<Target Name="BeforeBuild" BeforeTargets="Build" Condition="'$(RestorePackages)' == ''">
|
||||
<Exec Command=".\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages -ConfigFile .\.nuget\NuGet.Config" WorkingDirectory="$(FSharpSourcesRoot)\.."/>
|
||||
<Exec Command=".\.nuget\NuGet.exe restore .\tests\fsharp\project.json -PackagesDirectory packages -ConfigFile .\.nuget\NuGet.Config" WorkingDirectory="$(FSharpSourcesRoot)\.." Condition="'$(TargetFramework)' == 'coreclr'"/>
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,205 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<MicroBuildCoreVersion>0.2.0</MicroBuildCoreVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\packages\MicroBuild.Core.$(MicroBuildCoreVersion)\build\MicroBuild.Core.props" />
|
||||
|
||||
<UsingTask TaskName="LocalizeTemplateProjectsTask" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
|
||||
<ParameterGroup>
|
||||
<OutDir ParameterType="System.String" Required="true" />
|
||||
<TemplateCategory ParameterType="System.String" Required="true" />
|
||||
<AssemblyName ParameterType="System.String" Required="true" />
|
||||
<TemplateFiles ParameterType="System.String[]" Required="true" />
|
||||
<LocalizedFiles ParameterType="System.String[]" Required="true" />
|
||||
<LocLanguages ParameterType="System.String" Required="true" />
|
||||
</ParameterGroup>
|
||||
|
||||
<Task>
|
||||
<Reference Include="System.IO.Compression.FileSystem"/>
|
||||
|
||||
<Using Namespace="System"/>
|
||||
<Using Namespace="System.IO"/>
|
||||
<Using Namespace="System.IO.Compression"/>
|
||||
|
||||
<Code Type="Fragment" Language="cs">
|
||||
<![CDATA[
|
||||
Log.LogMessage("Localizing template: " + AssemblyName, MessageImportance.High);
|
||||
Log.LogMessage(String.Empty, MessageImportance.High);
|
||||
var absoluteOutDir = Path.GetFullPath(OutDir);
|
||||
|
||||
foreach (var lang in LocLanguages.Split(','))
|
||||
{
|
||||
var isDefaultLocale = lang.ToUpper() == "ENU";
|
||||
|
||||
Log.LogMessage("---------------------------------------------------", MessageImportance.High);
|
||||
Log.LogMessage("Localizing template for language: " + lang, MessageImportance.High);
|
||||
Log.LogMessage(String.Empty, MessageImportance.High);
|
||||
|
||||
var tempZipFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
|
||||
Log.LogMessage("Copying template files to: " + tempZipFolder, MessageImportance.High);
|
||||
Directory.CreateDirectory(tempZipFolder);
|
||||
|
||||
foreach (var sourceFile in TemplateFiles)
|
||||
{
|
||||
var destinationFile = Path.Combine(tempZipFolder, new FileInfo(sourceFile).Name);
|
||||
File.Copy(sourceFile, destinationFile);
|
||||
Log.LogMessage(" > Copied: " + destinationFile, MessageImportance.High);
|
||||
}
|
||||
|
||||
if (isDefaultLocale)
|
||||
{
|
||||
Log.LogMessage("Skipping localized files (default locale)", MessageImportance.High);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.LogMessage("Copying localized files", MessageImportance.High);
|
||||
|
||||
foreach (var localizedFileItem in LocalizedFiles)
|
||||
{
|
||||
var fileName = new FileInfo(localizedFileItem).Name;
|
||||
var sourceFile = Path.Combine(absoluteOutDir, "localize", lang, TemplateCategory, AssemblyName, fileName);
|
||||
var destinationFile = Path.Combine(tempZipFolder, fileName);
|
||||
|
||||
if (File.Exists(sourceFile) == false)
|
||||
{
|
||||
throw new FileNotFoundException("Localized file not found: " + sourceFile, sourceFile);
|
||||
}
|
||||
|
||||
File.Delete(destinationFile);
|
||||
File.Copy(sourceFile, destinationFile);
|
||||
Log.LogMessage(" > Copied: " + destinationFile, MessageImportance.High);
|
||||
}
|
||||
}
|
||||
|
||||
var templateOutputPath = isDefaultLocale
|
||||
? Path.Combine(absoluteOutDir, TemplateCategory, AssemblyName)
|
||||
: Path.Combine(absoluteOutDir, "localize", lang, TemplateCategory, AssemblyName);
|
||||
|
||||
if (Directory.Exists(templateOutputPath) == false)
|
||||
{
|
||||
Directory.CreateDirectory(templateOutputPath);
|
||||
}
|
||||
|
||||
var templateOutputFile = Path.Combine(templateOutputPath, AssemblyName + ".zip");
|
||||
|
||||
if (File.Exists(templateOutputFile))
|
||||
{
|
||||
File.Delete(templateOutputFile);
|
||||
}
|
||||
|
||||
Log.LogMessage("Zipping template to: " + templateOutputFile, MessageImportance.High);
|
||||
ZipFile.CreateFromDirectory(tempZipFolder, templateOutputFile);
|
||||
Directory.Delete(tempZipFolder, true);
|
||||
|
||||
Log.LogMessage("---------------------------------------------------", MessageImportance.High);
|
||||
Log.LogMessage(string.Empty, MessageImportance.High);
|
||||
}
|
||||
]]>
|
||||
</Code>
|
||||
</Task>
|
||||
</UsingTask>
|
||||
|
||||
<UsingTask TaskName="GenerateAssemblyFileVersionTask" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
|
||||
<ParameterGroup>
|
||||
<Language ParameterType="System.String" Required="true" />
|
||||
<ProductVersion ParameterType="System.String" Required="true" />
|
||||
<BuildNumber ParameterType="System.String" Required="true" />
|
||||
<AssemblyFileVersionPath ParameterType="System.String" Output="true" />
|
||||
</ParameterGroup>
|
||||
|
||||
<Task>
|
||||
<Using Namespace="System"/>
|
||||
<Using Namespace="System.Text.RegularExpressions"/>
|
||||
|
||||
<Code Type="Fragment" Language="cs">
|
||||
<![CDATA[
|
||||
// Remove DRAFT version string inserted by Microbuild (if it exists)
|
||||
BuildNumber = BuildNumber.Replace(".DRAFT", string.Empty);
|
||||
var buildNumberMatch = Regex.Match(BuildNumber, "(\\d{4})(\\d{2})(\\d{2})\\.(\\d+)");
|
||||
|
||||
if (buildNumberMatch.Success == false)
|
||||
{
|
||||
throw new ArgumentException("Invalid build number: " + BuildNumber);
|
||||
}
|
||||
|
||||
var productFileVersion = string.Join(".", buildNumberMatch.Groups[1].Value, buildNumberMatch.Groups[2].Value, buildNumberMatch.Groups[3].Value, buildNumberMatch.Groups[4].Value);
|
||||
|
||||
Log.LogMessage("Using ProductVersion: " + ProductVersion, MessageImportance.High);
|
||||
Log.LogMessage("Using ProductFileVersion: " + productFileVersion, MessageImportance.High);
|
||||
|
||||
var stringBuilder = new StringBuilder();
|
||||
|
||||
switch (Language.ToLower())
|
||||
{
|
||||
case "cs":
|
||||
stringBuilder.AppendLine("[assembly: System.Reflection.AssemblyInformationalVersion(\"" + ProductVersion + "\")]");
|
||||
stringBuilder.AppendLine("[assembly: System.Reflection.AssemblyVersion(\"" + ProductVersion + "\")]");
|
||||
stringBuilder.AppendLine("[assembly: System.Reflection.AssemblyFileVersion(\"" + productFileVersion + "\")]");
|
||||
break;
|
||||
case "fs":
|
||||
stringBuilder.AppendLine("namespace AssemblyInfo");
|
||||
stringBuilder.AppendLine("[<assembly: System.Reflection.AssemblyInformationalVersion(\"" + ProductVersion + "\")>]");
|
||||
stringBuilder.AppendLine("[<assembly: System.Reflection.AssemblyVersion(\"" + ProductVersion + "\")>]");
|
||||
stringBuilder.AppendLine("[<assembly: System.Reflection.AssemblyFileVersion(\"" + productFileVersion + "\")>]");
|
||||
stringBuilder.AppendLine("do ()");
|
||||
break;
|
||||
case "vb":
|
||||
stringBuilder.AppendLine("<Assembly: Reflection.AssemblyInformationalVersion(\"" + ProductVersion + "\")>");
|
||||
stringBuilder.AppendLine("<Assembly: Reflection.AssemblyVersion(\"" + ProductVersion + "\")>");
|
||||
stringBuilder.AppendLine("<Assembly: Reflection.AssemblyFileVersion(\"" + productFileVersion + "\")>");
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Language " + Language + " is not supported");
|
||||
}
|
||||
|
||||
AssemblyFileVersionPath = Path.GetTempFileName() + "." + Language;
|
||||
Log.LogMessage("Generating AssemblyFileVersion file: " + AssemblyFileVersionPath, MessageImportance.High);
|
||||
File.WriteAllText(AssemblyFileVersionPath, stringBuilder.ToString());
|
||||
]]>
|
||||
</Code>
|
||||
</Task>
|
||||
</UsingTask>
|
||||
|
||||
<Target Name="LocalizeTemplateProjects" AfterTargets="Localize">
|
||||
<LocalizeTemplateProjectsTask
|
||||
OutDir="$(OutDir)"
|
||||
TemplateCategory="$(TemplateCategory)"
|
||||
AssemblyName="$(AssemblyName)"
|
||||
TemplateFiles="@(TemplateFiles)"
|
||||
LocalizedFiles="@(FilesToLocalize)"
|
||||
LocLanguages="$(Languages)"
|
||||
Condition="'$(GenerateLocalizedTemplates)' == 'true' and '$(Languages)' != ''" />
|
||||
</Target>
|
||||
|
||||
<Target Name="GenerateAssemblyFileVersion" BeforeTargets="CoreCompile">
|
||||
<!-- Put build number 0 and today's date if this was a local build -->
|
||||
<PropertyGroup>
|
||||
<BUILD_BUILDNUMBER Condition="'$(BUILD_BUILDNUMBER)' == ''">$([System.DateTime]::Now.ToString(yyyyMMdd.0))</BUILD_BUILDNUMBER>
|
||||
</PropertyGroup>
|
||||
|
||||
<GenerateAssemblyFileVersionTask
|
||||
Language="$(MicroBuildAssemblyFileLanguage)"
|
||||
ProductVersion="$(MicroBuildAssemblyVersion)"
|
||||
BuildNumber="$(BUILD_BUILDNUMBER)"
|
||||
Condition="'$(MicroBuildAssemblyFileLanguage)' != '' and '$(MicroBuildAssemblyVersion)' != ''">
|
||||
<Output TaskParameter="AssemblyFileVersionPath" PropertyName="AssemblyFileVersionPath"/>
|
||||
</GenerateAssemblyFileVersionTask>
|
||||
|
||||
<!-- For FSharp.Core, assembly version must be inserted after all Core files, as it defines F# basic types (strings) -->
|
||||
<ItemGroup Condition="'$(AssemblyName)' == 'FSharp.Core'">
|
||||
<Compile Include="$(AssemblyFileVersionPath)" />
|
||||
</ItemGroup>
|
||||
<!-- For other assemblies, this must be inserted before all source files, to keep exe's EntryPoints (if any) as the last source file -->
|
||||
<ItemGroup Condition="'$(AssemblyName)' != 'FSharp.Core'">
|
||||
<TempCompile Include="$(AssemblyFileVersionPath)" />
|
||||
<TempCompile Include="@(Compile)" />
|
||||
<Compile Remove="@(Compile)" />
|
||||
<Compile Include="@(TempCompile)" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Import Project="..\packages\MicroBuild.Core.$(MicroBuildCoreVersion)\build\MicroBuild.Core.targets" />
|
||||
</Project>
|
|
@ -19,10 +19,11 @@ open System.Collections.Concurrent
|
|||
|
||||
let logging = false
|
||||
|
||||
let runningOnMono =
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
// Officially supported way to detect if we are running on Mono.
|
||||
// See http://www.mono-project.com/FAQ:_Technical
|
||||
// "How can I detect if am running in Mono?" section
|
||||
let runningOnMono =
|
||||
try
|
||||
System.Type.GetType("Mono.Runtime") <> null
|
||||
with e->
|
||||
|
@ -31,7 +32,10 @@ let runningOnMono =
|
|||
// This is related to bug 5506--the issue is actually a bug in VSTypeResolutionService.EnsurePopulated which is
|
||||
// called by OnTypeResolveEvent. The function throws a NullReferenceException. I'm working with that team to get
|
||||
// their issue fixed but we need to be robust here anyway.
|
||||
false
|
||||
false
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
|
||||
let _ = if logging then dprintn "* warning: Il.logging is on"
|
||||
|
||||
|
@ -437,6 +441,34 @@ type AssemblyRefData =
|
|||
/// Global state: table of all assembly references keyed by AssemblyRefData
|
||||
let AssemblyRefUniqueStampGenerator = new UniqueStampGenerator<AssemblyRefData>()
|
||||
|
||||
let compareVersions x y =
|
||||
match x,y with
|
||||
| None, None -> 0
|
||||
| Some _, None -> 1
|
||||
| None, Some _ -> -1
|
||||
| Some(x1,x2,x3,x4), Some(y1,y2,y3,y4) ->
|
||||
if y1>x1 then 1
|
||||
elif y1<x1 then -1
|
||||
elif y2>x2 then 1
|
||||
elif y2<x1 then -1
|
||||
elif y3>x3 then 1
|
||||
elif y3<x1 then -1
|
||||
elif y4>x4 then 1
|
||||
elif y4<x1 then -1
|
||||
else 0
|
||||
|
||||
let isMscorlib data =
|
||||
if System.String.Compare(data.assemRefName, "mscorlib") = 0 then true
|
||||
else false
|
||||
|
||||
let GetReferenceUnifiedVersion data =
|
||||
let mutable highest = data.assemRefVersion
|
||||
if not (isMscorlib data) then
|
||||
for ref in AssemblyRefUniqueStampGenerator.Table do
|
||||
if System.String.Compare(ref.assemRefName, data.assemRefName) = 0 && highest < ref.assemRefVersion then
|
||||
highest <- ref.assemRefVersion
|
||||
highest
|
||||
|
||||
[<Sealed>]
|
||||
type ILAssemblyRef(data) =
|
||||
let uniqueStamp = AssemblyRefUniqueStampGenerator.Encode(data)
|
||||
|
@ -444,7 +476,7 @@ type ILAssemblyRef(data) =
|
|||
member x.Hash=data.assemRefHash
|
||||
member x.PublicKey=data.assemRefPublicKeyInfo
|
||||
member x.Retargetable=data.assemRefRetargetable
|
||||
member x.Version=data.assemRefVersion
|
||||
member x.Version=GetReferenceUnifiedVersion data
|
||||
member x.Locale=data.assemRefLocale
|
||||
member x.UniqueStamp=uniqueStamp
|
||||
override x.GetHashCode() = uniqueStamp
|
||||
|
@ -1448,16 +1480,16 @@ let typesOfILParamsRaw (ps:ILParameters) : ILTypes = ps |> ILList.map (fun p ->
|
|||
let typesOfILParamsList (ps:ILParameter list) = ps |> List.map (fun p -> p.Type)
|
||||
|
||||
[<StructuralEquality; StructuralComparison>]
|
||||
type ILGenericVariance =
|
||||
| NonVariant
|
||||
| CoVariant
|
||||
| ContraVariant
|
||||
type ILGenericVariance =
|
||||
| NonVariant
|
||||
| CoVariant
|
||||
| ContraVariant
|
||||
|
||||
type ILGenericParameterDef =
|
||||
{ Name: string;
|
||||
Constraints: ILTypes;
|
||||
Variance: ILGenericVariance;
|
||||
HasReferenceTypeConstraint: bool;
|
||||
HasReferenceTypeConstraint: bool;
|
||||
CustomAttrs : ILAttributes;
|
||||
HasNotNullableValueTypeConstraint: bool;
|
||||
HasDefaultConstructorConstraint: bool; }
|
||||
|
@ -4472,20 +4504,18 @@ type ILGlobals with
|
|||
| Some res -> res
|
||||
|
||||
member this.mkDebuggerStepThroughAttribute() = mkILCustomAttribute this (mkSystemDiagnosticsDebugTypeRef this tname_DebuggerStepThroughAttribute, [], [], [])
|
||||
member this.mkDebuggableAttribute (jitTracking, jitOptimizerDisabled) =
|
||||
mkILCustomAttribute this (mkSystemDiagnosticsDebuggableTypeRef this, [this.typ_Bool; this.typ_Bool], [ILAttribElem.Bool jitTracking; ILAttribElem.Bool jitOptimizerDisabled], [])
|
||||
member this.mkDebuggableAttribute (jitOptimizerDisabled) =
|
||||
mkILCustomAttribute this (mkSystemDiagnosticsDebuggableTypeRef this, [this.typ_Bool; this.typ_Bool], [ILAttribElem.Bool false; ILAttribElem.Bool jitOptimizerDisabled], [])
|
||||
|
||||
|
||||
member this.mkDebuggableAttributeV2(jitTracking, ignoreSymbolStoreSequencePoints, jitOptimizerDisabled,enableEnC) =
|
||||
member this.mkDebuggableAttributeV2(ignoreSymbolStoreSequencePoints, jitOptimizerDisabled, enableEnC) =
|
||||
let tref = mkSystemDiagnosticsDebuggableTypeRef this
|
||||
mkILCustomAttribute this
|
||||
(tref,[mkILNonGenericValueTy (tref_DebuggableAttribute_DebuggingModes this)],
|
||||
[ILAttribElem.Int32(
|
||||
(* See System.Diagnostics.DebuggableAttribute.DebuggingModes *)
|
||||
(if jitTracking then 1 else 0) |||
|
||||
(if jitOptimizerDisabled then 256 else 0) |||
|
||||
(if ignoreSymbolStoreSequencePoints then 2 else 0) |||
|
||||
(if enableEnC then 4 else 0))],[])
|
||||
(* See System.Diagnostics.DebuggableAttribute.DebuggingModes *)
|
||||
[ILAttribElem.Int32( (if jitOptimizerDisabled then 256 else 0) |||
|
||||
(if ignoreSymbolStoreSequencePoints then 2 else 0) |||
|
||||
(if enableEnC then 4 else 0))],[])
|
||||
|
||||
member this.mkCompilerGeneratedAttribute () = mkILCustomAttribute this (tref_CompilerGeneratedAttribute this, [], [], [])
|
||||
|
||||
|
|
|
@ -1775,9 +1775,9 @@ type ILGlobals =
|
|||
mutable debuggerTypeProxyAttributeCache : ILAttribute option }
|
||||
|
||||
with
|
||||
member mkDebuggableAttribute: bool (* debug tracking *) * bool (* disable JIT optimizations *) -> ILAttribute
|
||||
/// Some commonly used custom attibutes
|
||||
member mkDebuggableAttributeV2 : bool (* jitTracking *) * bool (* ignoreSymbolStoreSequencePoints *) * bool (* disable JIT optimizations *) * bool (* enable EnC *) -> ILAttribute
|
||||
member mkDebuggableAttribute: bool (* disable JIT optimizations *) -> ILAttribute
|
||||
/// Some commonly used custom attibutes
|
||||
member mkDebuggableAttributeV2 : bool (* ignoreSymbolStoreSequencePoints *) * bool (* disable JIT optimizations *) * bool (* enable EnC *) -> ILAttribute
|
||||
member mkCompilerGeneratedAttribute : unit -> ILAttribute
|
||||
member mkDebuggerNonUserCodeAttribute : unit -> ILAttribute
|
||||
member mkDebuggerStepThroughAttribute : unit -> ILAttribute
|
||||
|
@ -2277,7 +2277,9 @@ type ILPropertyRef =
|
|||
member Name: string
|
||||
interface System.IComparable
|
||||
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
val runningOnMono: bool
|
||||
#endif
|
||||
|
||||
type ILReferences =
|
||||
{ AssemblyReferences: ILAssemblyRef list;
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
/// Configurable AppDomain-global diagnostics channel for the Abstract IL library
|
||||
///
|
||||
/// REVIEW: review if we should just switch to System.Diagnostics
|
||||
/// Configurable Diagnostics channel for the Abstract IL library
|
||||
|
||||
module internal Microsoft.FSharp.Compiler.AbstractIL.Diagnostics
|
||||
|
||||
open Internal.Utilities
|
||||
|
||||
open Microsoft.FSharp.Compiler.AbstractIL
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal
|
||||
|
||||
let diagnosticsLog = ref (Some stdout)
|
||||
let dflushn () = match !diagnosticsLog with None -> () | Some d -> d.WriteLine(); d.Flush()
|
||||
let dflush () = match !diagnosticsLog with None -> () | Some d -> d.Flush()
|
||||
let dprintn (s:string) =
|
||||
match !diagnosticsLog with None -> () | Some d -> d.Write s; d.Write "\n"; dflush()
|
||||
match !diagnosticsLog with None -> () | Some d -> d.Write s; d.Write "\n"; dflush()
|
||||
|
||||
let dprintf (fmt: Format<_,_,_,_>) =
|
||||
Printf.kfprintf dflush (match !diagnosticsLog with None -> System.IO.TextWriter.Null | Some d -> d) fmt
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
module internal Microsoft.FSharp.Compiler.AbstractIL.Diagnostics
|
||||
|
||||
open System.IO
|
||||
open Microsoft.FSharp.Compiler.AbstractIL
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal
|
||||
open Microsoft.FSharp.Core.Printf
|
||||
|
||||
val public setDiagnosticsChannel: TextWriter option -> unit
|
||||
|
@ -19,4 +17,3 @@ val public dprintfn: TextWriterFormat<'a> -> 'a
|
|||
val public dprintf: TextWriterFormat<'a> -> 'a
|
||||
|
||||
val public dprintn: string -> unit
|
||||
|
||||
|
|
|
@ -9,12 +9,17 @@ open System.Collections
|
|||
open System.Collections.Generic
|
||||
open Internal.Utilities
|
||||
open Internal.Utilities.Collections
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics
|
||||
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
open Microsoft.FSharp.Core.ReflectionAdapters
|
||||
#endif
|
||||
|
||||
// Logical shift right treating int32 as unsigned integer.
|
||||
// Code that uses this should probably be adjusted to use unsigned integer types.
|
||||
let (>>>&) (x:int32) (n:int32) = int32 (uint32 x >>> n)
|
||||
|
||||
let notlazy v = Lazy.CreateFromValue v
|
||||
let notlazy v = Lazy<_>.CreateFromValue v
|
||||
|
||||
let isSome x = match x with None -> false | _ -> true
|
||||
let isNone x = match x with None -> true | _ -> false
|
||||
|
@ -25,6 +30,20 @@ let isNonNull (x : 'T) = match (x :> obj) with null -> false | _ -> true
|
|||
let nonNull msg x = if isNonNull x then x else failwith ("null: " ^ msg)
|
||||
let (===) x y = LanguagePrimitives.PhysicalEquality x y
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Library: ReportTime
|
||||
//---------------------------------------------------------------------
|
||||
let reportTime =
|
||||
let tFirst = ref None
|
||||
let tPrev = ref None
|
||||
fun showTimes descr ->
|
||||
if showTimes then
|
||||
let t = System.Diagnostics.Process.GetCurrentProcess().UserProcessorTime.TotalSeconds
|
||||
let prev = match !tPrev with None -> 0.0 | Some t -> t
|
||||
let first = match !tFirst with None -> (tFirst := Some t; t) | Some t -> t
|
||||
dprintf "ilwrite: TIME %10.3f (total) %10.3f (delta) - %s\n" (t - first) (t - prev) descr
|
||||
tPrev := Some t
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Library: projections
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -189,6 +208,11 @@ module Option =
|
|||
|
||||
module List =
|
||||
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
open PrimReflectionAdapters
|
||||
open Microsoft.FSharp.Core.ReflectionAdapters
|
||||
#endif
|
||||
|
||||
let sortWithOrder (c: IComparer<'T>) elements = List.sortWith (Order.toFunction c) elements
|
||||
|
||||
let splitAfter n l =
|
||||
|
@ -732,6 +756,7 @@ type UniqueStampGenerator<'T when 'T : equality>() =
|
|||
nItems <- nItems + 1
|
||||
idx
|
||||
member this.Encode(str) = encode str
|
||||
member this.Table = encodeTab.Keys
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// memoize tables (all entries cached, never collected)
|
||||
|
@ -966,6 +991,11 @@ module Shim =
|
|||
|
||||
open System.IO
|
||||
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
open PrimReflectionAdapters
|
||||
open Microsoft.FSharp.Core.ReflectionAdapters
|
||||
#endif
|
||||
|
||||
type IFileSystem =
|
||||
abstract ReadAllBytesShim: fileName:string -> byte[]
|
||||
abstract FileStreamReadShim: fileName:string -> System.IO.Stream
|
||||
|
|
|
@ -17,7 +17,7 @@ open System.Collections.Generic
|
|||
open Internal.Utilities
|
||||
open Microsoft.FSharp.Compiler.AbstractIL
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal
|
||||
#if NO_PDB_READER
|
||||
#if FX_NO_PDB_READER
|
||||
#else
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Support
|
||||
#endif
|
||||
|
@ -209,7 +209,11 @@ type MemoryMappedFile(hMap: MemoryMapping.HANDLE, start:nativeint) =
|
|||
|
||||
override m.ReadUTF8String i =
|
||||
let n = m.CountUtf8String i
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
System.Text.Encoding.UTF8.GetString(NativePtr.ofNativeInt (m.Addr i), n)
|
||||
#else
|
||||
new System.String(NativePtr.ofNativeInt (m.Addr i), 0, n, System.Text.Encoding.UTF8)
|
||||
#endif
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
@ -243,14 +247,14 @@ type ByteFile(bytes:byte[]) =
|
|||
let b0 = is.ReadByte addr
|
||||
let b1 = is.ReadByte (addr+1)
|
||||
uint16 b0 ||| (uint16 b1 <<< 8)
|
||||
|
||||
|
||||
let seekReadByte (is:BinaryFile) addr = is.ReadByte addr
|
||||
let seekReadBytes (is:BinaryFile) addr len = is.ReadBytes addr len
|
||||
let seekReadInt32 (is:BinaryFile) addr = is.ReadInt32 addr
|
||||
let seekReadUInt16 (is:BinaryFile) addr = is.ReadUInt16 addr
|
||||
|
||||
|
||||
let seekReadByteAsInt32 is addr = int32 (seekReadByte is addr)
|
||||
|
||||
|
||||
let seekReadInt64 is addr =
|
||||
let b0 = seekReadByte is addr
|
||||
let b1 = seekReadByte is (addr+1)
|
||||
|
@ -264,7 +268,7 @@ let seekReadInt64 is addr =
|
|||
(int64 b4 <<< 32) ||| (int64 b5 <<< 40) ||| (int64 b6 <<< 48) ||| (int64 b7 <<< 56)
|
||||
|
||||
let seekReadUInt16AsInt32 is addr = int32 (seekReadUInt16 is addr)
|
||||
|
||||
|
||||
let seekReadCompressedUInt32 is addr =
|
||||
let b0 = seekReadByte is addr
|
||||
if b0 <= 0x7Fuy then int b0, addr+1
|
||||
|
@ -301,13 +305,13 @@ let seekReadUserString is addr =
|
|||
let len, addr = seekReadCompressedUInt32 is addr
|
||||
let bytes = seekReadBytes is addr (len - 1)
|
||||
System.Text.Encoding.Unicode.GetString(bytes, 0, bytes.Length)
|
||||
|
||||
|
||||
let seekReadGuid is addr = seekReadBytes is addr 0x10
|
||||
|
||||
let seekReadUncodedToken is addr =
|
||||
i32ToUncodedToken (seekReadInt32 is addr)
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Primitives to help read signatures. These do not use the file cursor
|
||||
//---------------------------------------------------------------------
|
||||
|
@ -914,7 +918,7 @@ type ILReaderContext =
|
|||
{ ilg: ILGlobals;
|
||||
dataEndPoints: Lazy<int32 list>;
|
||||
sorted: int64;
|
||||
#if NO_PDB_READER
|
||||
#if FX_NO_PDB_READER
|
||||
pdb: obj option;
|
||||
#else
|
||||
pdb: (PdbReader * (string -> ILSourceDocument)) option;
|
||||
|
@ -1018,7 +1022,7 @@ type ILReaderContext =
|
|||
seekReadMethodDefAsMethodData : int -> MethodData;
|
||||
seekReadGenericParams : GenericParamsIdx -> ILGenericParameterDef list;
|
||||
seekReadFieldDefAsFieldSpec : int -> ILFieldSpec; }
|
||||
|
||||
|
||||
let count c =
|
||||
#if DEBUG
|
||||
incr c
|
||||
|
@ -1456,7 +1460,7 @@ let readBlobHeapAsDouble ctxt vidx = fst (sigptrGetDouble (readBlobHeap ctxt vid
|
|||
// (e) the start of the native resources attached to the binary if any
|
||||
// ----------------------------------------------------------------------*)
|
||||
|
||||
#if NO_PDB_READER
|
||||
#if FX_NO_LINKEDRESOURCES
|
||||
let readNativeResources _ctxt = []
|
||||
#else
|
||||
let readNativeResources ctxt =
|
||||
|
@ -1538,7 +1542,7 @@ let rec seekReadModule ctxt (subsys,subsysversion,useHighEntropyVA, ilOnly,only3
|
|||
let ilModuleName = readStringHeap ctxt nameIdx
|
||||
let nativeResources = readNativeResources ctxt
|
||||
|
||||
{ Manifest =
|
||||
{ Manifest =
|
||||
if ctxt.getNumRows (TableNames.Assembly) > 0 then Some (seekReadAssemblyManifest ctxt 1)
|
||||
else None;
|
||||
CustomAttrs = seekReadCustomAttrs ctxt (TaggedIndex(hca_Module,idx));
|
||||
|
@ -2877,7 +2881,7 @@ and seekReadTopCode ctxt numtypars (sz:int) start seqpoints =
|
|||
let instrs = ibuf.ToArray()
|
||||
instrs,rawToLabel, lab2pc, raw2nextLab
|
||||
|
||||
#if NO_PDB_READER
|
||||
#if FX_NO_PDB_READER
|
||||
and seekReadMethodRVA ctxt (_idx,nm,_internalcall,noinline,numtypars) rva =
|
||||
#else
|
||||
and seekReadMethodRVA ctxt (idx,nm,_internalcall,noinline,numtypars) rva =
|
||||
|
@ -2891,7 +2895,7 @@ and seekReadMethodRVA ctxt (idx,nm,_internalcall,noinline,numtypars) rva =
|
|||
// -- an overall range for the method
|
||||
// -- the sequence points for the method
|
||||
let localPdbInfos, methRangePdbInfo, seqpoints =
|
||||
#if NO_PDB_READER
|
||||
#if FX_NO_PDB_READER
|
||||
[], None, []
|
||||
#else
|
||||
match ctxt.pdb with
|
||||
|
@ -2950,7 +2954,7 @@ and seekReadMethodRVA ctxt (idx,nm,_internalcall,noinline,numtypars) rva =
|
|||
with e ->
|
||||
// "* Warning: PDB info for method "+nm+" could not be read and will be ignored: "+e.Message
|
||||
[],None,[]
|
||||
#endif // NO_PDB_READER
|
||||
#endif
|
||||
|
||||
let baseRVA = ctxt.anyV2P("method rva",rva)
|
||||
// ": reading body of method "+nm+" at rva "+string rva+", phys "+string baseRVA
|
||||
|
@ -3249,7 +3253,7 @@ and seekReadTopExportedTypes ctxt () =
|
|||
done;
|
||||
List.rev !res)
|
||||
|
||||
#if NO_PDB_READER
|
||||
#if FX_NO_PDB_READER
|
||||
#else
|
||||
let getPdbReader opts infile =
|
||||
match opts.pdbPath with
|
||||
|
@ -3822,10 +3826,16 @@ let rec genOpenBinaryReader infile is opts =
|
|||
//-----------------------------------------------------------------------
|
||||
// Set up the PDB reader so we can read debug info for methods.
|
||||
// ----------------------------------------------------------------------
|
||||
#if NO_PDB_READER
|
||||
#if FX_NO_PDB_READER
|
||||
let pdb = None
|
||||
#else
|
||||
let pdb = if runningOnMono then None else getPdbReader opts infile
|
||||
let pdb =
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
if runningOnMono then
|
||||
None
|
||||
else
|
||||
#endif
|
||||
getPdbReader opts infile
|
||||
#endif
|
||||
|
||||
let rowAddr (tab:TableName) idx = tablePhysLocations.[tab.Index] + (idx - 1) * tableRowSizes.[tab.Index]
|
||||
|
@ -3949,10 +3959,11 @@ let mkDefault ilg =
|
|||
pdbPath= None;
|
||||
ilGlobals = ilg }
|
||||
|
||||
#if NO_PDB_READER
|
||||
let ClosePdbReader _x = ()
|
||||
#else
|
||||
let ClosePdbReader pdb =
|
||||
#if FX_NO_PDB_READER
|
||||
ignore pdb
|
||||
()
|
||||
#else
|
||||
match pdb with
|
||||
| Some (pdbr,_) -> pdbReadClose pdbr
|
||||
| None -> ()
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
|
||||
module internal Microsoft.FSharp.Compiler.AbstractIL.ILRuntimeWriter
|
||||
|
||||
|
||||
open Internal.Utilities
|
||||
open Microsoft.FSharp.Compiler.AbstractIL
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal
|
||||
|
@ -25,6 +25,10 @@ open System.Reflection.Emit
|
|||
open System.Runtime.InteropServices
|
||||
open System.Collections.Generic
|
||||
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
open Microsoft.FSharp.Core.ReflectionAdapters
|
||||
#endif
|
||||
|
||||
let codeLabelOrder = ComparisonIdentity.Structural<ILCodeLabel>
|
||||
|
||||
// Convert the output of convCustomAttr
|
||||
|
@ -39,31 +43,28 @@ let wrapCustomAttr setCustomAttr (cinfo, bytes) =
|
|||
|
||||
let logRefEmitCalls = false
|
||||
|
||||
type System.AppDomain with
|
||||
member x.DefineDynamicAssemblyAndLog(asmName,flags,asmDir:string) =
|
||||
let asmB = x.DefineDynamicAssembly(asmName,flags,asmDir)
|
||||
if logRefEmitCalls then
|
||||
printfn "open System"
|
||||
printfn "open System.Reflection"
|
||||
printfn "open System.Reflection.Emit"
|
||||
printfn "let assemblyBuilder%d = System.AppDomain.CurrentDomain.DefineDynamicAssembly(AssemblyName(Name=\"%s\"),enum %d,%A)" (abs <| hash asmB) asmName.Name (LanguagePrimitives.EnumToValue flags) asmDir
|
||||
asmB
|
||||
|
||||
|
||||
type System.Reflection.Emit.AssemblyBuilder with
|
||||
member asmB.DefineDynamicModuleAndLog(a,b,c) =
|
||||
member asmB.DefineDynamicModuleAndLog(a,b,c) =
|
||||
#if FX_RESHAPED_REFEMIT
|
||||
ignore b
|
||||
ignore c
|
||||
let modB = asmB.DefineDynamicModule(a)
|
||||
#else
|
||||
let modB = asmB.DefineDynamicModule(a,b,c)
|
||||
if logRefEmitCalls then printfn "let moduleBuilder%d = assemblyBuilder%d.DefineDynamicModule(%A,%A,%A)" (abs <| hash modB) (abs <| hash asmB) a b c
|
||||
#endif
|
||||
modB
|
||||
|
||||
member asmB.SetCustomAttributeAndLog(cinfo,bytes) =
|
||||
if logRefEmitCalls then printfn "assemblyBuilder%d.SetCustomAttribute(%A, %A)" (abs <| hash asmB) cinfo bytes
|
||||
wrapCustomAttr asmB.SetCustomAttribute (cinfo, bytes)
|
||||
|
||||
#if FX_RESHAPED_REFEMIT
|
||||
#else
|
||||
member asmB.AddResourceFileAndLog(nm1, nm2, attrs) =
|
||||
if logRefEmitCalls then printfn "assemblyBuilder%d.AddResourceFile(%A, %A, enum %d)" (abs <| hash asmB) nm1 nm2 (LanguagePrimitives.EnumToValue attrs)
|
||||
asmB.AddResourceFile(nm1,nm2,attrs)
|
||||
|
||||
#endif
|
||||
member asmB.SetCustomAttributeAndLog(cab) =
|
||||
if logRefEmitCalls then printfn "assemblyBuilder%d.SetCustomAttribute(%A)" (abs <| hash asmB) cab
|
||||
asmB.SetCustomAttribute(cab)
|
||||
|
@ -74,11 +75,13 @@ type System.Reflection.Emit.ModuleBuilder with
|
|||
if logRefEmitCalls then printfn "moduleBuilder%d.GetArrayMethod(%A,%A,%A,%A,%A)" (abs <| hash modB) aty nm flags rty tys
|
||||
modB.GetArrayMethod(aty,nm,flags,rty,tys)
|
||||
|
||||
#if FX_RESHAPED_REFEMIT
|
||||
#else
|
||||
member modB.DefineDocumentAndLog(file,lang,vendor,doctype) =
|
||||
let symDoc = modB.DefineDocument(file,lang,vendor,doctype)
|
||||
if logRefEmitCalls then printfn "let docWriter%d = moduleBuilder%d.DefineDocument(%A,System.Guid(\"%A\"),System.Guid(\"%A\"),System.Guid(\"%A\"))" (abs <| hash symDoc) (abs <| hash modB) file lang vendor doctype
|
||||
symDoc
|
||||
|
||||
#endif
|
||||
member modB.GetTypeAndLog(nameInModule,flag1,flag2) =
|
||||
if logRefEmitCalls then printfn "moduleBuilder%d.GetType(%A,%A,%A) |> ignore" (abs <| hash modB) nameInModule flag1 flag2
|
||||
modB.GetType(nameInModule,flag1,flag2)
|
||||
|
@ -88,10 +91,12 @@ type System.Reflection.Emit.ModuleBuilder with
|
|||
if logRefEmitCalls then printfn "let typeBuilder%d = moduleBuilder%d.DefineType(%A,enum %d)" (abs <| hash typB) (abs <| hash modB) name (LanguagePrimitives.EnumToValue attrs)
|
||||
typB
|
||||
|
||||
#if FX_RESHAPED_REFEMIT
|
||||
#else
|
||||
member modB.DefineManifestResourceAndLog(name,stream,attrs) =
|
||||
if logRefEmitCalls then printfn "moduleBuilder%d.DefineManifestResource(%A,%A,enum %d)" (abs <| hash modB) name stream (LanguagePrimitives.EnumToValue attrs)
|
||||
modB.DefineManifestResource(name,stream,attrs)
|
||||
|
||||
#endif
|
||||
member modB.SetCustomAttributeAndLog(cinfo,bytes) =
|
||||
if logRefEmitCalls then printfn "moduleBuilder%d.SetCustomAttribute(%A, %A)" (abs <| hash modB) cinfo bytes
|
||||
wrapCustomAttr modB.SetCustomAttribute (cinfo,bytes)
|
||||
|
@ -141,58 +146,67 @@ type System.Reflection.Emit.MethodBuilder with
|
|||
if logRefEmitCalls then printfn "methodBuilder%d.SetCustomAttribute(%A, %A)" (abs <| hash methB) cinfo bytes
|
||||
wrapCustomAttr methB.SetCustomAttribute (cinfo,bytes)
|
||||
|
||||
|
||||
|
||||
|
||||
type System.Reflection.Emit.TypeBuilder with
|
||||
member typB.CreateTypeAndLog() =
|
||||
if logRefEmitCalls then printfn "typeBuilder%d.CreateType()" (abs <| hash typB)
|
||||
#if FX_RESHAPED_REFEMIT
|
||||
typB.CreateTypeInfo().AsType()
|
||||
#else
|
||||
typB.CreateType()
|
||||
|
||||
member typB.DefineNestedTypeAndLog(name,attrs) =
|
||||
#endif
|
||||
member typB.DefineNestedTypeAndLog(name,attrs) =
|
||||
let res = typB.DefineNestedType(name,attrs)
|
||||
if logRefEmitCalls then printfn "let typeBuilder%d = typeBuilder%d.DefineNestedType(\"%s\",enum %d)" (abs <| hash res) (abs <| hash typB) name (LanguagePrimitives.EnumToValue attrs)
|
||||
res
|
||||
|
||||
member typB.DefineMethodAndLog(name,attrs,cconv) =
|
||||
|
||||
member typB.DefineMethodAndLog(name,attrs,cconv) =
|
||||
let methB = typB.DefineMethod(name,attrs,cconv)
|
||||
if logRefEmitCalls then printfn "let methodBuilder%d = typeBuilder%d.DefineMethod(\"%s\",enum %d,enum %d)" (abs <| hash methB) (abs <| hash typB) name (LanguagePrimitives.EnumToValue attrs) (LanguagePrimitives.EnumToValue cconv)
|
||||
methB
|
||||
|
||||
member typB.DefineGenericParametersAndLog(gps) =
|
||||
member typB.DefineGenericParametersAndLog(gps) =
|
||||
if logRefEmitCalls then printfn "typeBuilder%d.DefineGenericParameters(%A)" (abs <| hash typB) gps
|
||||
typB.DefineGenericParameters(gps)
|
||||
|
||||
member typB.DefineConstructorAndLog(attrs,cconv,parms) =
|
||||
member typB.DefineConstructorAndLog(attrs,cconv,parms) =
|
||||
let consB = typB.DefineConstructor(attrs,cconv,parms)
|
||||
if logRefEmitCalls then printfn "let constructorBuilder%d = typeBuilder%d.DefineConstructor(enum %d,%A,%A)" (abs <| hash consB) (abs <| hash typB) (LanguagePrimitives.EnumToValue attrs) cconv parms
|
||||
consB
|
||||
|
||||
member typB.DefineFieldAndLog(nm,ty:System.Type,attrs) =
|
||||
member typB.DefineFieldAndLog(nm,ty:System.Type,attrs) =
|
||||
if logRefEmitCalls then printfn "typeBuilder%d.DefineField(\"%s\",typeof<%s>,enum %d)" (abs <| hash typB) nm ty.FullName (LanguagePrimitives.EnumToValue attrs)
|
||||
typB.DefineField(nm,ty,attrs)
|
||||
|
||||
member typB.DefinePropertyAndLog(nm,attrs,ty,args) =
|
||||
member typB.DefinePropertyAndLog(nm,attrs,ty,args) =
|
||||
if logRefEmitCalls then printfn "typeBuilder%d.DefineProperty(\"%A\",enum %d,%A,%A)" (abs <| hash typB) nm (LanguagePrimitives.EnumToValue attrs) ty args
|
||||
typB.DefineProperty(nm,attrs,ty,args)
|
||||
|
||||
member typB.DefineEventAndLog(nm,attrs,ty) =
|
||||
member typB.DefineEventAndLog(nm,attrs,ty) =
|
||||
if logRefEmitCalls then printfn "typeBuilder%d.DefineEvent(\"%A\",enum %d,%A)" (abs <| hash typB) nm (LanguagePrimitives.EnumToValue attrs) ty
|
||||
typB.DefineEvent(nm,attrs,ty)
|
||||
|
||||
member typB.SetParentAndLog(ty:System.Type) =
|
||||
member typB.SetParentAndLog(ty:System.Type) =
|
||||
if logRefEmitCalls then printfn "typeBuilder%d.SetParent(typeof<%s>)" (abs <| hash typB) ty.FullName
|
||||
typB.SetParent(ty)
|
||||
|
||||
member typB.AddInterfaceImplementationAndLog(ty) =
|
||||
member typB.AddInterfaceImplementationAndLog(ty) =
|
||||
if logRefEmitCalls then printfn "typeBuilder%d.AddInterfaceImplementation(%A)" (abs <| hash typB) ty
|
||||
typB.AddInterfaceImplementation(ty)
|
||||
|
||||
member typB.InvokeMemberAndLog(nm,flags,args) =
|
||||
if logRefEmitCalls then printfn "typeBuilder%d.InvokeMember(\"%s\",enum %d,null,null,%A,Globalization.CultureInfo.InvariantCulture)" (abs <| hash typB) nm (LanguagePrimitives.EnumToValue flags) args
|
||||
typB.InvokeMember(nm,flags,null,null,args,Globalization.CultureInfo.InvariantCulture)
|
||||
member typB.InvokeMemberAndLog(nm,_flags,args) =
|
||||
#if FX_RESHAPED_REFEMIT
|
||||
let t = typB.CreateTypeAndLog()
|
||||
let m =
|
||||
if t <> null then t.GetMethod(nm, (args |> Seq.map(fun x -> x.GetType()) |> Seq.toArray))
|
||||
else null
|
||||
if m <> null then m.Invoke(null, args)
|
||||
else raise (MissingMethodException(nm))
|
||||
#else
|
||||
if logRefEmitCalls then printfn "typeBuilder%d.InvokeMember(\"%s\",enum %d,null,null,%A,Globalization.CultureInfo.InvariantCulture)" (abs <| hash typB) nm (LanguagePrimitives.EnumToValue _flags) args
|
||||
typB.InvokeMember(nm,_flags,null,null,args,Globalization.CultureInfo.InvariantCulture)
|
||||
#endif
|
||||
|
||||
member typB.SetCustomAttributeAndLog(cinfo,bytes) =
|
||||
member typB.SetCustomAttributeAndLog(cinfo,bytes) =
|
||||
if logRefEmitCalls then printfn "typeBuilder%d.SetCustomAttribute(%A, %A)" (abs <| hash typB) cinfo bytes
|
||||
wrapCustomAttr typB.SetCustomAttribute (cinfo,bytes)
|
||||
|
||||
|
@ -209,10 +223,12 @@ type System.Reflection.Emit.ILGenerator with
|
|||
if logRefEmitCalls then printfn "ilg%d.MarkLabel(label%d_%d)" (abs <| hash ilG) (abs <| hash ilG) (abs <| hash lab)
|
||||
ilG.MarkLabel(lab)
|
||||
|
||||
#if FX_RESHAPED_REFEMIT
|
||||
#else
|
||||
member ilG.MarkSequencePointAndLog(symDoc, l1, c1, l2, c2) =
|
||||
if logRefEmitCalls then printfn "ilg%d.MarkSequencePoint(docWriter%d, %A, %A, %A, %A)" (abs <| hash ilG) (abs <| hash symDoc) l1 c1 l2 c2
|
||||
ilG.MarkSequencePoint(symDoc, l1, c1, l2, c2)
|
||||
|
||||
#endif
|
||||
member ilG.BeginExceptionBlockAndLog() =
|
||||
if logRefEmitCalls then printfn "ilg%d.BeginExceptionBlock()" (abs <| hash ilG)
|
||||
ilG.BeginExceptionBlock()
|
||||
|
@ -284,7 +300,7 @@ let equalTypes (s:Type) (t:Type) = s.Equals(t)
|
|||
let equalTypeLists ss tt = List.lengthsEqAndForall2 equalTypes ss tt
|
||||
|
||||
let getGenericArgumentsOfType (typT : Type) =
|
||||
if typT .IsGenericType then typT .GetGenericArguments() else [| |]
|
||||
if typT.IsGenericType then typT.GetGenericArguments() else [| |]
|
||||
let getGenericArgumentsOfMethod (methI : MethodInfo) =
|
||||
if methI.IsGenericMethod then methI.GetGenericArguments() else [| |]
|
||||
|
||||
|
@ -306,8 +322,11 @@ let convAssemblyRef (aref:ILAssemblyRef) =
|
|||
asmName.Version <- System.Version (int32 major,int32 minor,int32 build, int32 rev)
|
||||
Option.iter setVersion aref.Version;
|
||||
// asmName.ProcessorArchitecture <- System.Reflection.ProcessorArchitecture.MSIL;
|
||||
#if FX_RESHAPED_GLOBALIZATION
|
||||
#else
|
||||
//Option.iter (fun name -> asmName.CultureInfo <- System.Globalization.CultureInfo.CreateSpecificCulture(name)) aref.Locale;
|
||||
asmName.CultureInfo <- System.Globalization.CultureInfo.InvariantCulture;
|
||||
#endif
|
||||
asmName
|
||||
|
||||
/// The global environment
|
||||
|
@ -336,11 +355,11 @@ let convTypeRefAux (cenv:cenv) (tref:ILTypeRef) =
|
|||
| None ->
|
||||
let asmName = convAssemblyRef asmref
|
||||
FileSystem.AssemblyLoad(asmName)
|
||||
let typT = assembly.GetType(qualifiedName, throwOnError=true)
|
||||
let typT = assembly.GetType(qualifiedName)
|
||||
typT |> nonNull "convTypeRefAux"
|
||||
| ILScopeRef.Module _
|
||||
| ILScopeRef.Local _ ->
|
||||
let typT = Type.GetType(qualifiedName, throwOnError=true)
|
||||
let typT = Type.GetType(qualifiedName)
|
||||
typT |> nonNull "convTypeRefAux"
|
||||
|
||||
|
||||
|
@ -389,6 +408,9 @@ let envUpdateCreatedTypeRef emEnv (tref:ILTypeRef) =
|
|||
let typT,typB,typeDef,_createdTypOpt = Zmap.force tref emEnv.emTypMap "envGetTypeDef: failed"
|
||||
if typB.IsCreated() then
|
||||
let typ = typB.CreateTypeAndLog()
|
||||
#if FSHARP_CORE_4_5
|
||||
#else
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
// Bug DevDev2 40395: Mono 2.6 and 2.8 has a bug where executing code that includes an array type
|
||||
// match "match x with :? C[] -> ..." before the full loading of an object of type
|
||||
// causes a failure when C is later loaded. One workaround for this is to attempt to do a fake allocation
|
||||
|
@ -399,7 +421,8 @@ let envUpdateCreatedTypeRef emEnv (tref:ILTypeRef) =
|
|||
try
|
||||
System.Runtime.Serialization.FormatterServices.GetUninitializedObject(typ) |> ignore
|
||||
with e -> ()
|
||||
|
||||
#endif
|
||||
#endif
|
||||
{emEnv with emTypMap = Zmap.add tref (typT,typB,typeDef,Some typ) emEnv.emTypMap}
|
||||
else
|
||||
#if DEBUG
|
||||
|
@ -503,7 +526,7 @@ let rec convTypeSpec cenv emEnv preferCreated (tspec:ILTypeSpec) =
|
|||
|
||||
and convTypeAux cenv emEnv preferCreated typ =
|
||||
match typ with
|
||||
| ILType.Void -> Type.GetType("System.Void",true)
|
||||
| ILType.Void -> Type.GetType("System.Void")
|
||||
| ILType.Array (shape,eltType) ->
|
||||
let baseT = convTypeAux cenv emEnv preferCreated eltType |> nonNull "convType: array base"
|
||||
let nDims = shape.Rank
|
||||
|
@ -593,16 +616,20 @@ let convFieldInit x =
|
|||
// it isn't we resort to this technique...
|
||||
let TypeBuilderInstantiationT =
|
||||
let ty =
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
if runningOnMono then
|
||||
Type.GetType("System.Reflection.MonoGenericClass")
|
||||
else
|
||||
#endif
|
||||
Type.GetType("System.Reflection.Emit.TypeBuilderInstantiation")
|
||||
assert (not (isNull ty))
|
||||
ty
|
||||
|
||||
let typeIsNotQueryable (typ : Type) =
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
let typ = typ.GetTypeInfo()
|
||||
#endif
|
||||
(typ :? TypeBuilder) || ((typ.GetType()).Equals(TypeBuilderInstantiationT))
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// convFieldSpec
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -688,7 +715,11 @@ let queryableTypeGetMethod cenv emEnv parentT (mref:ILMethodRef) =
|
|||
parentT.GetMethod(mref.Name,cconv ||| BindingFlags.Public ||| BindingFlags.NonPublic,
|
||||
null,
|
||||
argTs,
|
||||
(null:ParameterModifier[]))
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
(null:obj[]))
|
||||
#else
|
||||
(null:ParameterModifier[]))
|
||||
#endif
|
||||
// This can fail if there is an ambiguity w.r.t. return type
|
||||
with _ -> null
|
||||
if (isNonNull methInfo && equalTypes resT methInfo.ReturnType) then
|
||||
|
@ -1111,10 +1142,12 @@ let rec emitInstr cenv (modB : ModuleBuilder) emEnv (ilG:ILGenerator) instr =
|
|||
let aty = convType cenv emEnv (ILType.Array(shape,typ))
|
||||
let ety = aty.GetElementType()
|
||||
let meth =
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
// See bug 6254: Mono has a bug in reflection-emit dynamic calls to the "Get", "Address" or "Set" methods on arrays
|
||||
if runningOnMono then
|
||||
getArrayMethInfo shape.Rank ety
|
||||
else
|
||||
#endif
|
||||
modB.GetArrayMethodAndLog(aty,"Get",System.Reflection.CallingConventions.HasThis,ety,Array.create shape.Rank (typeof<int>) )
|
||||
ilG.EmitAndLog(OpCodes.Call,meth)
|
||||
|
||||
|
@ -1124,10 +1157,12 @@ let rec emitInstr cenv (modB : ModuleBuilder) emEnv (ilG:ILGenerator) instr =
|
|||
let aty = convType cenv emEnv (ILType.Array(shape,typ))
|
||||
let ety = aty.GetElementType()
|
||||
let meth =
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
// See bug 6254: Mono has a bug in reflection-emit dynamic calls to the "Get", "Address" or "Set" methods on arrays
|
||||
if runningOnMono then
|
||||
setArrayMethInfo shape.Rank ety
|
||||
else
|
||||
#endif
|
||||
modB.GetArrayMethodAndLog(aty,"Set",System.Reflection.CallingConventions.HasThis,(null:Type),Array.append (Array.create shape.Rank (typeof<int>)) (Array.ofList [ ety ]))
|
||||
ilG.EmitAndLog(OpCodes.Call,meth)
|
||||
|
||||
|
@ -1144,11 +1179,14 @@ let rec emitInstr cenv (modB : ModuleBuilder) emEnv (ilG:ILGenerator) instr =
|
|||
| I_refanyval typ -> ilG.EmitAndLog(OpCodes.Refanyval,convType cenv emEnv typ)
|
||||
| I_rethrow -> ilG.EmitAndLog(OpCodes.Rethrow)
|
||||
| I_break -> ilG.EmitAndLog(OpCodes.Break)
|
||||
#if FX_RESHAPED_REFEMIT
|
||||
#else
|
||||
| I_seqpoint src ->
|
||||
if cenv.generatePdb && not (src.Document.File.EndsWith("stdin",StringComparison.Ordinal)) then
|
||||
let guid x = match x with None -> Guid.Empty | Some g -> Guid(g:byte[]) in
|
||||
let symDoc = modB.DefineDocumentAndLog(src.Document.File, guid src.Document.Language, guid src.Document.Vendor, guid src.Document.DocumentType)
|
||||
ilG.MarkSequencePointAndLog(symDoc, src.Line, src.Column, src.EndLine, src.EndColumn)
|
||||
#endif
|
||||
| I_arglist -> ilG.EmitAndLog(OpCodes.Arglist)
|
||||
| I_localloc -> ilG.EmitAndLog(OpCodes.Localloc)
|
||||
| I_cpblk (align,vol) -> emitInstrAlign ilG align;
|
||||
|
@ -1161,7 +1199,7 @@ let rec emitInstr cenv (modB : ModuleBuilder) emEnv (ilG:ILGenerator) instr =
|
|||
emitInstr cenv modB emEnv ilG (mkLdcInt32 m);
|
||||
emitInstr cenv modB emEnv ilG (mkNormalCall(mkILNonGenericMethSpecInTy(cenv.ilg.typ_Array, ILCallingConv.Instance, "GetLength", [cenv.ilg.typ_int32], cenv.ilg.typ_int32)))
|
||||
| I_other e when isIlxExtInstr e -> Printf.failwithf "the ILX instruction %s cannot be emitted" (e.ToString())
|
||||
| i -> Printf.failwithf "the IL instruction %s cannot be emitted" (i.ToString())
|
||||
| i -> Printf.failwithf "the IL instruction %s cannot be emitted" (i.ToString())
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// emitCode
|
||||
|
@ -1235,9 +1273,12 @@ let emitCode cenv modB emEnv (ilG:ILGenerator) code =
|
|||
let emitLocal cenv emEnv (ilG : ILGenerator) (local: ILLocal) =
|
||||
let ty = convType cenv emEnv local.Type
|
||||
let locBuilder = ilG.DeclareLocalAndLog(ty, local.IsPinned)
|
||||
#if FX_NO_PDB_WRITER
|
||||
#else
|
||||
match local.DebugInfo with
|
||||
| Some(nm, start, finish) -> locBuilder.SetLocalSymInfo(nm, start, finish)
|
||||
| None -> ()
|
||||
#endif
|
||||
locBuilder
|
||||
|
||||
let emitILMethodBody cenv modB emEnv (ilG:ILGenerator) ilmbody =
|
||||
|
@ -1290,7 +1331,11 @@ let buildGenParamsPass1 _emEnv defineGenericParameters (gps : ILGenericParameter
|
|||
|
||||
|
||||
let buildGenParamsPass1b cenv emEnv (genArgs : Type array) (gps : ILGenericParameterDefs) =
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
let genpBs = genArgs |> Array.map (fun x -> (x.GetTypeInfo() :?> GenericTypeParameterBuilder))
|
||||
#else
|
||||
let genpBs = genArgs |> Array.map (fun x -> (x :?> GenericTypeParameterBuilder))
|
||||
#endif
|
||||
gps |> List.iteri (fun i (gp:ILGenericParameterDef) ->
|
||||
let gpB = genpBs.[i]
|
||||
// the Constraints are either the parent (base) type or interfaces.
|
||||
|
@ -1407,11 +1452,13 @@ let rec buildMethodPass2 cenv tref (typB:TypeBuilder) emEnv (mdef : ILMethodDef)
|
|||
else
|
||||
emEnv
|
||||
match mdef.mdBody.Contents with
|
||||
#if FX_RESHAPED_REFEMIT
|
||||
#else
|
||||
| MethodBody.PInvoke p ->
|
||||
let argtys = convTypesToArray cenv emEnv mdef.ParameterTypes
|
||||
let rty = convType cenv emEnv mdef.Return.Type
|
||||
|
||||
let pcc =
|
||||
|
||||
let pcc =
|
||||
match p.CallingConv with
|
||||
| PInvokeCallingConvention.Cdecl -> CallingConvention.Cdecl
|
||||
| PInvokeCallingConvention.Stdcall -> CallingConvention.StdCall
|
||||
|
@ -1419,14 +1466,12 @@ let rec buildMethodPass2 cenv tref (typB:TypeBuilder) emEnv (mdef : ILMethodDef)
|
|||
| PInvokeCallingConvention.Fastcall -> CallingConvention.FastCall
|
||||
| PInvokeCallingConvention.None
|
||||
| PInvokeCallingConvention.WinApi -> CallingConvention.Winapi
|
||||
|
||||
let pcs =
|
||||
match p.CharEncoding with
|
||||
| PInvokeCharEncoding.None -> CharSet.None
|
||||
| PInvokeCharEncoding.Ansi -> CharSet.Ansi
|
||||
| PInvokeCharEncoding.Unicode -> CharSet.Unicode
|
||||
| PInvokeCharEncoding.Auto -> CharSet.Auto
|
||||
|
||||
(* p.ThrowOnUnmappableChar *)
|
||||
(* p.CharBestFit *)
|
||||
(* p.NoMangle *)
|
||||
|
@ -1444,6 +1489,7 @@ let rec buildMethodPass2 cenv tref (typB:TypeBuilder) emEnv (mdef : ILMethodDef)
|
|||
pcs)
|
||||
methB.SetImplementationFlagsAndLog(implflags);
|
||||
envBindMethodRef emEnv mref methB
|
||||
#endif
|
||||
|
||||
| _ ->
|
||||
match mdef.Name with
|
||||
|
@ -1459,7 +1505,7 @@ let rec buildMethodPass2 cenv tref (typB:TypeBuilder) emEnv (mdef : ILMethodDef)
|
|||
// Method generic type parameters
|
||||
buildGenParamsPass1 emEnv methB.DefineGenericParametersAndLog mdef.GenericParams;
|
||||
let genArgs = getGenericArgumentsOfMethod methB
|
||||
let emEnv = envPushTyvars emEnv (Array.append (getGenericArgumentsOfType typB) genArgs)
|
||||
let emEnv = envPushTyvars emEnv (Array.append (getGenericArgumentsOfType (typB.AsType())) genArgs)
|
||||
buildGenParamsPass1b cenv emEnv genArgs mdef.GenericParams;
|
||||
// set parameter and return types (may depend on generic args)
|
||||
methB.SetParametersAndLog(convTypesToArray cenv emEnv mdef.ParameterTypes);
|
||||
|
@ -1495,7 +1541,7 @@ let rec buildMethodPass3 cenv tref modB (typB:TypeBuilder) emEnv (mdef : ILMetho
|
|||
|
||||
let methB = envGetMethB emEnv mref
|
||||
let emEnv = envPushTyvars emEnv (Array.append
|
||||
(getGenericArgumentsOfType typB)
|
||||
(getGenericArgumentsOfType (typB.AsType()))
|
||||
(getGenericArgumentsOfMethod methB))
|
||||
|
||||
match mdef.Return.CustomAttrs.AsList with
|
||||
|
@ -1616,7 +1662,7 @@ let buildEventPass3 cenv (typB:TypeBuilder) emEnv (eventDef : ILEventDef) =
|
|||
//----------------------------------------------------------------------------
|
||||
|
||||
let buildMethodImplsPass3 cenv _tref (typB:TypeBuilder) emEnv (mimpl : IL.ILMethodImplDef) =
|
||||
let bodyMethInfo = convMethodRef cenv emEnv (typB :> Type) mimpl.OverrideBy.MethodRef // doc: must be MethodBuilder
|
||||
let bodyMethInfo = convMethodRef cenv emEnv (typB.AsType()) mimpl.OverrideBy.MethodRef // doc: must be MethodBuilder
|
||||
let (OverridesSpec (mref,dtyp)) = mimpl.Overrides
|
||||
let declMethTI = convType cenv emEnv dtyp
|
||||
let declMethInfo = convMethodRef cenv emEnv declMethTI mref
|
||||
|
@ -1727,7 +1773,7 @@ and buildTypeTypeDef cenv emEnv modB (typB : TypeBuilder) nesting tdef =
|
|||
let rec buildTypeDefPass1b cenv nesting emEnv (tdef : ILTypeDef) =
|
||||
let tref = mkRefForNestedILTypeDef ILScopeRef.Local (nesting,tdef)
|
||||
let typB = envGetTypB emEnv tref
|
||||
let genArgs = getGenericArgumentsOfType typB
|
||||
let genArgs = getGenericArgumentsOfType (typB.AsType())
|
||||
let emEnv = envPushTyvars emEnv genArgs
|
||||
// Parent may reference types being defined, so has to come after it's Pass1 creation
|
||||
tdef.Extends |> Option.iter (fun typ -> typB.SetParentAndLog(convType cenv emEnv typ));
|
||||
|
@ -1745,7 +1791,7 @@ let rec buildTypeDefPass1b cenv nesting emEnv (tdef : ILTypeDef) =
|
|||
let rec buildTypeDefPass2 cenv nesting emEnv (tdef : ILTypeDef) =
|
||||
let tref = mkRefForNestedILTypeDef ILScopeRef.Local (nesting,tdef)
|
||||
let typB = envGetTypB emEnv tref
|
||||
let emEnv = envPushTyvars emEnv (getGenericArgumentsOfType typB)
|
||||
let emEnv = envPushTyvars emEnv (getGenericArgumentsOfType (typB.AsType()))
|
||||
// add interface impls
|
||||
tdef.Implements |> convTypes cenv emEnv |> ILList.iter (fun implT -> typB.AddInterfaceImplementationAndLog(implT));
|
||||
// add methods, properties
|
||||
|
@ -1765,7 +1811,7 @@ let rec buildTypeDefPass2 cenv nesting emEnv (tdef : ILTypeDef) =
|
|||
let rec buildTypeDefPass3 cenv nesting modB emEnv (tdef : ILTypeDef) =
|
||||
let tref = mkRefForNestedILTypeDef ILScopeRef.Local (nesting,tdef)
|
||||
let typB = envGetTypB emEnv tref
|
||||
let emEnv = envPushTyvars emEnv (getGenericArgumentsOfType typB)
|
||||
let emEnv = envPushTyvars emEnv (getGenericArgumentsOfType (typB.AsType()))
|
||||
// add method bodies, properties, events
|
||||
tdef.Methods |> Seq.iter (buildMethodPass3 cenv tref modB typB emEnv);
|
||||
tdef.Properties.AsList |> List.iter (buildPropertyPass3 cenv tref typB emEnv);
|
||||
|
@ -1865,7 +1911,10 @@ let createTypeRef (visited : Dictionary<_,_>, created : Dictionary<_,_>) emEnv t
|
|||
if not (visited.ContainsKey(tref)) || visited.[tref] > priority then
|
||||
visited.[tref] <- priority;
|
||||
let tdef = envGetTypeDef emEnv tref
|
||||
if verbose2 then dprintf "- traversing type %s\n" typB.FullName;
|
||||
if verbose2 then dprintf "- traversing type %s\n" typB.FullName;
|
||||
#if FX_NO_APP_DOMAINS
|
||||
traverseTypeDef priority tref tdef;
|
||||
#else
|
||||
let typeCreationHandler =
|
||||
let nestingToProbe = tref.Enclosing
|
||||
ResolveEventHandler(
|
||||
|
@ -1883,7 +1932,8 @@ let createTypeRef (visited : Dictionary<_,_>, created : Dictionary<_,_>) emEnv t
|
|||
try
|
||||
traverseTypeDef priority tref tdef;
|
||||
finally
|
||||
System.AppDomain.CurrentDomain.remove_TypeResolve typeCreationHandler
|
||||
System.AppDomain.CurrentDomain.remove_TypeResolve typeCreationHandler
|
||||
#endif
|
||||
if not (created.ContainsKey(tref)) then
|
||||
created.[tref] <- true;
|
||||
if verbose2 then dprintf "- creating type %s\n" typB.FullName;
|
||||
|
@ -1935,35 +1985,57 @@ let buildModuleFragment cenv emEnv (asmB : AssemblyBuilder) (modB : ModuleBuilde
|
|||
tdefs |> List.iter (buildModuleTypePass4 (visited,created) emEnv)
|
||||
let emEnv = Seq.fold envUpdateCreatedTypeRef emEnv created.Keys // update typT with the created typT
|
||||
emitCustomAttrs cenv emEnv modB.SetCustomAttributeAndLog m.CustomAttrs;
|
||||
#if FX_RESHAPED_REFEMIT
|
||||
ignore asmB
|
||||
#else
|
||||
m.Resources.AsList |> List.iter (fun r ->
|
||||
let attribs = (match r.Access with ILResourceAccess.Public -> ResourceAttributes.Public | ILResourceAccess.Private -> ResourceAttributes.Private)
|
||||
match r.Location with
|
||||
| ILResourceLocation.Local bf ->
|
||||
modB.DefineManifestResourceAndLog(r.Name, new System.IO.MemoryStream(bf()), attribs)
|
||||
| ILResourceLocation.File (mr,_n) ->
|
||||
| ILResourceLocation.File (mr,_) ->
|
||||
asmB.AddResourceFileAndLog(r.Name, mr.Name, attribs)
|
||||
| ILResourceLocation.Assembly _ ->
|
||||
failwith "references to resources other assemblies may not be emitted using System.Reflection");
|
||||
#endif
|
||||
emEnv
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// test hook
|
||||
//----------------------------------------------------------------------------
|
||||
let defineDynamicAssemblyAndLog(asmName,flags,asmDir:string) =
|
||||
#if FX_NO_APP_DOMAINS
|
||||
let asmB = AssemblyBuilder.DefineDynamicAssembly(asmName,flags)
|
||||
#else
|
||||
let currentDom = System.AppDomain.CurrentDomain
|
||||
let asmB = currentDom.DefineDynamicAssembly(asmName,flags,asmDir)
|
||||
#endif
|
||||
if logRefEmitCalls then
|
||||
printfn "open System"
|
||||
printfn "open System.Reflection"
|
||||
printfn "open System.Reflection.Emit"
|
||||
printfn "let assemblyBuilder%d = System.AppDomain.CurrentDomain.DefineDynamicAssembly(AssemblyName(Name=\"%s\"),enum %d,%A)" (abs <| hash asmB) asmName.Name (LanguagePrimitives.EnumToValue flags) asmDir
|
||||
asmB
|
||||
|
||||
let mkDynamicAssemblyAndModule (assemblyName, optimize, debugInfo, collectible) =
|
||||
let filename = assemblyName ^ ".dll"
|
||||
let currentDom = System.AppDomain.CurrentDomain
|
||||
let asmDir = "."
|
||||
let asmName = new AssemblyName()
|
||||
asmName.Name <- assemblyName;
|
||||
let asmAccess = if collectible then AssemblyBuilderAccess.RunAndCollect else AssemblyBuilderAccess.RunAndSave
|
||||
let asmB = currentDom.DefineDynamicAssemblyAndLog(asmName,asmAccess,asmDir)
|
||||
let asmAccess =
|
||||
if collectible then AssemblyBuilderAccess.RunAndCollect
|
||||
#if FX_RESHAPED_REFEMIT
|
||||
else AssemblyBuilderAccess.Run
|
||||
#else
|
||||
else AssemblyBuilderAccess.RunAndSave
|
||||
#endif
|
||||
let asmB = defineDynamicAssemblyAndLog(asmName,asmAccess,asmDir)
|
||||
if not optimize then
|
||||
let daType = typeof<System.Diagnostics.DebuggableAttribute>;
|
||||
let daCtor = daType.GetConstructor [| typeof<System.Diagnostics.DebuggableAttribute.DebuggingModes> |]
|
||||
let daBuilder = new CustomAttributeBuilder(daCtor, [| System.Diagnostics.DebuggableAttribute.DebuggingModes.DisableOptimizations ||| System.Diagnostics.DebuggableAttribute.DebuggingModes.Default |])
|
||||
asmB.SetCustomAttributeAndLog(daBuilder);
|
||||
|
||||
|
||||
let modB = asmB.DefineDynamicModuleAndLog(assemblyName,filename,debugInfo)
|
||||
asmB,modB
|
||||
|
||||
|
@ -1979,7 +2051,7 @@ let emitModuleFragment (ilg, emEnv, asmB : AssemblyBuilder, modB : ModuleBuilder
|
|||
// invoke entry point methods
|
||||
let execEntryPtFun ((typB : TypeBuilder),methodName) () =
|
||||
try
|
||||
ignore (typB.InvokeMemberAndLog(methodName,BindingFlags.InvokeMethod ||| BindingFlags.Public ||| BindingFlags.Static,[| |]));
|
||||
ignore (typB.InvokeMemberAndLog(methodName,BindingFlags.InvokeMethod ||| BindingFlags.Public ||| BindingFlags.Static,[| |]));
|
||||
None
|
||||
with
|
||||
| :? System.Reflection.TargetInvocationException as e ->
|
||||
|
|
|
@ -0,0 +1,258 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
module internal Microsoft.FSharp.Compiler.AbstractIL.Internal.StrongNameSign
|
||||
|
||||
#nowarn "9"
|
||||
|
||||
open System
|
||||
open System.IO
|
||||
open System.Collections.Immutable
|
||||
open System.Reflection.PortableExecutable
|
||||
open System.Security.Cryptography
|
||||
open System.Runtime.InteropServices
|
||||
|
||||
type KeyType =
|
||||
| Public
|
||||
| KeyPair
|
||||
|
||||
let ALG_TYPE_RSA = int (2 <<< 9)
|
||||
let ALG_CLASS_KEY_EXCHANGE = int (5 <<< 13)
|
||||
let ALG_CLASS_SIGNATURE = int(1 <<< 13)
|
||||
let CALG_RSA_KEYX = int(ALG_CLASS_KEY_EXCHANGE ||| ALG_TYPE_RSA)
|
||||
let CALG_RSA_SIGN = int(ALG_CLASS_SIGNATURE ||| ALG_TYPE_RSA)
|
||||
|
||||
let ALG_CLASS_HASH = int(4 <<< 13)
|
||||
let ALG_TYPE_ANY = int(0)
|
||||
let CALG_SHA1 = int(ALG_CLASS_HASH ||| ALG_TYPE_ANY ||| 4)
|
||||
let CALG_SHA_256 = int(ALG_CLASS_HASH ||| ALG_TYPE_ANY ||| 12)
|
||||
let CALG_SHA_384 = int(ALG_CLASS_HASH ||| ALG_TYPE_ANY ||| 13)
|
||||
let CALG_SHA_512 = int(ALG_CLASS_HASH ||| ALG_TYPE_ANY ||| 14)
|
||||
|
||||
let PUBLICKEYBLOB = int(0x6)
|
||||
let PRIVATEKEYBLOB = int(0x7)
|
||||
let BLOBHEADER_CURRENT_BVERSION = int(0x2)
|
||||
let BLOBHEADER_LENGTH = int(20)
|
||||
let RSA_PUB_MAGIC = int(0x31415352)
|
||||
let RSA_PRIV_MAGIC = int(0x32415352)
|
||||
|
||||
let getResourceString (_, str) = str
|
||||
|
||||
[<StructLayout(LayoutKind.Explicit)>]
|
||||
type ByteArrayUnion =
|
||||
struct
|
||||
[<FieldOffset(0)>]
|
||||
val UnderlyingArray: byte[]
|
||||
|
||||
[<FieldOffset(0)>]val ImmutableArray: ImmutableArray<byte>
|
||||
new (immutableArray:ImmutableArray<byte>) = { UnderlyingArray = Array.empty<byte> ; ImmutableArray = immutableArray}
|
||||
end
|
||||
|
||||
let getUnderlyingArray (array:ImmutableArray<byte>) =ByteArrayUnion(array).UnderlyingArray
|
||||
|
||||
// Compute a hash over the elements of an assembly manifest file that should
|
||||
// remain static (skip checksum, Authenticode signatures and strong name signature blob)
|
||||
let hashAssembly (peReader:PEReader) (hashAlgorithm:IncrementalHash ) =
|
||||
// Hash content of all headers
|
||||
let peHeaders = peReader.PEHeaders;
|
||||
let peHeaderOffset = peHeaders.PEHeaderStartOffset;
|
||||
|
||||
// Even though some data in OptionalHeader is different for 32 and 64, this field is the same
|
||||
let checkSumOffset = peHeaderOffset + 0x40; // offsetof(IMAGE_OPTIONAL_HEADER, CheckSum)
|
||||
let securityDirectoryEntryOffset, peHeaderSize =
|
||||
match peHeaders.PEHeader.Magic with
|
||||
| PEMagic.PE32 -> peHeaderOffset + 0x80, 0xE0 // offsetof(IMAGE_OPTIONAL_HEADER32, DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY]), sizeof(IMAGE_OPTIONAL_HEADER32)
|
||||
| PEMagic.PE32Plus -> peHeaderOffset + 0x90,0xF0 // offsetof(IMAGE_OPTIONAL_HEADER64, DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY]), sizeof(IMAGE_OPTIONAL_HEADER64)
|
||||
| _ -> raise (BadImageFormatException(getResourceString(FSComp.SR.ilSignInvalidMagicValue())))
|
||||
|
||||
let allHeadersSize = peHeaderOffset + peHeaderSize + int(peHeaders.CoffHeader.NumberOfSections) * 0x28; // sizeof(IMAGE_SECTION_HEADER)
|
||||
let allHeaders =
|
||||
let array:byte[] = Array.zeroCreate<byte> allHeadersSize
|
||||
peReader.GetEntireImage().GetContent().CopyTo(0, array, 0, allHeadersSize);
|
||||
array
|
||||
|
||||
// Clear checksum and security data directory
|
||||
for i in 0 .. 3 do allHeaders.[checkSumOffset + i] <- 0uy
|
||||
for i in 0 .. 7 do allHeaders.[securityDirectoryEntryOffset + i] <- 0uy
|
||||
hashAlgorithm.AppendData(allHeaders, 0, allHeadersSize)
|
||||
|
||||
// Hash content of all sections
|
||||
let signatureDirectory = peHeaders.CorHeader.StrongNameSignatureDirectory
|
||||
let signatureStart =
|
||||
match peHeaders.TryGetDirectoryOffset(signatureDirectory) with
|
||||
| true, value -> value
|
||||
| _ -> raise (BadImageFormatException(getResourceString(FSComp.SR.ilSignBadImageFormat())))
|
||||
let signatureEnd = signatureStart + signatureDirectory.Size
|
||||
let buffer = getUnderlyingArray (peReader.GetEntireImage().GetContent())
|
||||
let sectionHeaders = peHeaders.SectionHeaders
|
||||
|
||||
for i in 0 .. (sectionHeaders.Length - 1) do
|
||||
let section = sectionHeaders.[i]
|
||||
let mutable st = section.PointerToRawData
|
||||
let en = st + section.SizeOfRawData
|
||||
|
||||
if st <= signatureStart && signatureStart < en then do
|
||||
// The signature should better end within this section as well
|
||||
if not ( (st < signatureEnd) && (signatureEnd <= en)) then raise (BadImageFormatException())
|
||||
|
||||
// Signature starts within this section - hash everything up to the signature start
|
||||
hashAlgorithm.AppendData(buffer, st, signatureStart - st)
|
||||
|
||||
// Trim what we have written
|
||||
st <- signatureEnd
|
||||
|
||||
hashAlgorithm.AppendData(buffer, st, en - st)
|
||||
()
|
||||
hashAlgorithm.GetHashAndReset()
|
||||
|
||||
type BlobReader =
|
||||
val mutable _blob:byte[]
|
||||
val mutable _offset:int
|
||||
new (blob:byte[]) = { _blob = blob; _offset = 0; }
|
||||
|
||||
member x.ReadInt32:int =
|
||||
let offset = x._offset
|
||||
x._offset <- offset + 4
|
||||
int(x._blob.[offset]) ||| (int (x._blob.[offset + 1]) <<< 8) ||| (int (x._blob.[offset + 2]) <<< 16) ||| (int (x._blob.[offset + 3]) <<< 24)
|
||||
|
||||
member x.ReadBigInteger (length:int):byte[] =
|
||||
let arr:byte[] = Array.zeroCreate<byte> length
|
||||
Array.Copy(x._blob, x._offset, arr, 0, length) |> ignore
|
||||
x._offset <- x._offset + length;
|
||||
arr |> Array.rev
|
||||
|
||||
let RSAParamatersFromBlob (blob:byte[]) keyType =
|
||||
let mutable reader = BlobReader(blob)
|
||||
if reader.ReadInt32 <> 0x00000207 && keyType = KeyType.KeyPair then raise (CryptographicException(getResourceString(FSComp.SR.ilSignPrivateKeyExpected())))
|
||||
reader.ReadInt32 |>ignore // ALG_ID
|
||||
if reader.ReadInt32 <> RSA_PRIV_MAGIC then raise (CryptographicException(getResourceString(FSComp.SR.ilSignRsaKeyExpected()))) // 'RSA2'
|
||||
let byteLen, halfLen =
|
||||
let bitLen = reader.ReadInt32
|
||||
match bitLen % 16 with
|
||||
| 0 -> (bitLen / 8, bitLen / 16)
|
||||
| _ -> raise (CryptographicException(getResourceString(FSComp.SR.ilSignInvalidBitLen())))
|
||||
let mutable key = RSAParameters()
|
||||
key.Exponent <- reader.ReadBigInteger(4)
|
||||
key.Modulus <- reader.ReadBigInteger(byteLen)
|
||||
key.P <- reader.ReadBigInteger(halfLen)
|
||||
key.Q <- reader.ReadBigInteger(halfLen)
|
||||
key.DP <- reader.ReadBigInteger(halfLen)
|
||||
key.DQ <- reader.ReadBigInteger(halfLen)
|
||||
key.InverseQ <- reader.ReadBigInteger(halfLen)
|
||||
key.D <- reader.ReadBigInteger(byteLen)
|
||||
key
|
||||
|
||||
let toCLRKeyBlob (rsaParameters:RSAParameters) (algId:int) : byte[] =
|
||||
let validateRSAField (field:byte[]) expected (name:string) =
|
||||
if field <> null && field.Length <> expected then
|
||||
raise (CryptographicException(String.Format(getResourceString(FSComp.SR.ilSignInvalidRSAParams()), name)))
|
||||
|
||||
// The original FCall this helper emulates supports other algId's - however, the only algid we need to support is CALG_RSA_KEYX. We will not port the codepaths dealing with other algid's.
|
||||
if algId <> CALG_RSA_KEYX then raise (CryptographicException(getResourceString(FSComp.SR.ilSignInvalidAlgId())))
|
||||
|
||||
// Validate the RSA structure first.
|
||||
if rsaParameters.Modulus = null then raise (CryptographicException(String.Format(getResourceString(FSComp.SR.ilSignInvalidRSAParams()), "Modulus")))
|
||||
if rsaParameters.Exponent = null || rsaParameters.Exponent.Length > 4 then raise (CryptographicException(String.Format(getResourceString(FSComp.SR.ilSignInvalidRSAParams()), "Exponent")))
|
||||
|
||||
let modulusLength = rsaParameters.Modulus.Length
|
||||
let halfModulusLength = (modulusLength + 1) / 2
|
||||
|
||||
// We assume that if P != null, then so are Q, DP, DQ, InverseQ and D and indicate KeyPair RSA Parameters
|
||||
let isPrivate =
|
||||
if rsaParameters.P <> null then
|
||||
validateRSAField (rsaParameters.P) halfModulusLength "P"
|
||||
validateRSAField (rsaParameters.Q) halfModulusLength "Q"
|
||||
validateRSAField (rsaParameters.DP) halfModulusLength "DP"
|
||||
validateRSAField (rsaParameters.InverseQ) halfModulusLength "InverseQ"
|
||||
validateRSAField (rsaParameters.D) halfModulusLength "D"
|
||||
true
|
||||
else false
|
||||
|
||||
let key =
|
||||
use ms = new MemoryStream()
|
||||
use bw = new BinaryWriter(ms)
|
||||
|
||||
bw.Write(int(CALG_RSA_SIGN)) // CLRHeader.aiKeyAlg
|
||||
bw.Write(int(CALG_SHA1)) // CLRHeader.aiHashAlg
|
||||
bw.Write(int(modulusLength + BLOBHEADER_LENGTH)) // CLRHeader.KeyLength
|
||||
|
||||
// Write out the BLOBHEADER
|
||||
bw.Write(byte(if isPrivate = true then PRIVATEKEYBLOB else PUBLICKEYBLOB)) // BLOBHEADER.bType
|
||||
bw.Write(byte(BLOBHEADER_CURRENT_BVERSION)) // BLOBHEADER.bVersion
|
||||
bw.Write(int16(0)) // BLOBHEADER.wReserved
|
||||
bw.Write(int(CALG_RSA_SIGN)) // BLOBHEADER.aiKeyAlg
|
||||
|
||||
// Write the RSAPubKey header
|
||||
bw.Write(int(if isPrivate then RSA_PRIV_MAGIC else RSA_PUB_MAGIC)) // RSAPubKey.magic
|
||||
bw.Write(int(modulusLength * 8)) // RSAPubKey.bitLen
|
||||
|
||||
let expAsDword =
|
||||
let mutable buffer = int(0)
|
||||
for i in 0 .. rsaParameters.Exponent.Length - 1 do
|
||||
buffer <- (buffer <<< 8) ||| int(rsaParameters.Exponent.[i])
|
||||
buffer
|
||||
|
||||
bw.Write(expAsDword) // RSAPubKey.pubExp
|
||||
bw.Write(rsaParameters.Modulus |> Array.rev) // Copy over the modulus for both public and private
|
||||
if isPrivate = true then do
|
||||
bw.Write(rsaParameters.P |> Array.rev)
|
||||
bw.Write(rsaParameters.Q |> Array.rev)
|
||||
bw.Write(rsaParameters.DP |> Array.rev)
|
||||
bw.Write(rsaParameters.DQ |> Array.rev)
|
||||
bw.Write(rsaParameters.InverseQ |> Array.rev)
|
||||
bw.Write(rsaParameters.D |> Array.rev)
|
||||
|
||||
bw.Flush()
|
||||
ms.ToArray()
|
||||
key
|
||||
|
||||
let createSignature (hash:byte[]) (keyBlob:byte[]) keyType =
|
||||
use rsa = RSA.Create()
|
||||
rsa.ImportParameters(RSAParamatersFromBlob keyBlob keyType)
|
||||
let signature = rsa.SignHash(hash, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1)
|
||||
signature |>Array.rev
|
||||
|
||||
let patchSignature (stream:Stream) (peReader:PEReader) (signature:byte[]) =
|
||||
let peHeaders = peReader.PEHeaders
|
||||
let signatureDirectory = peHeaders.CorHeader.StrongNameSignatureDirectory
|
||||
let signatureOffset =
|
||||
if signatureDirectory.Size > signature.Length then raise (BadImageFormatException(getResourceString(FSComp.SR.ilSignInvalidSignatureSize())))
|
||||
match peHeaders.TryGetDirectoryOffset(signatureDirectory) with
|
||||
| false, _ -> raise (BadImageFormatException(getResourceString(FSComp.SR.ilSignNoSignatureDirectory())))
|
||||
| true, signatureOffset -> int64(signatureOffset)
|
||||
stream.Seek(signatureOffset, SeekOrigin.Begin) |>ignore
|
||||
stream.Write(signature, 0, signature.Length)
|
||||
|
||||
let corHeaderFlagsOffset = int64(peHeaders.CorHeaderStartOffset + 16) // offsetof(IMAGE_COR20_HEADER, Flags)
|
||||
stream.Seek(corHeaderFlagsOffset, SeekOrigin.Begin) |>ignore
|
||||
stream.WriteByte((byte)(peHeaders.CorHeader.Flags ||| CorFlags.StrongNameSigned))
|
||||
()
|
||||
|
||||
let signStream stream keyBlob =
|
||||
use peReader = new PEReader(stream, PEStreamOptions.PrefetchEntireImage ||| PEStreamOptions.LeaveOpen)
|
||||
let hash =
|
||||
use hashAlgorithm = IncrementalHash.CreateHash(HashAlgorithmName.SHA1)
|
||||
hashAssembly peReader hashAlgorithm
|
||||
let signature = createSignature hash keyBlob KeyType.KeyPair
|
||||
patchSignature stream peReader signature
|
||||
|
||||
let signFile filename keyBlob =
|
||||
use fs = File.Open(filename, FileMode.Open, FileAccess.ReadWrite)
|
||||
signStream fs keyBlob
|
||||
|
||||
let signatureSize (pk:byte[]) =
|
||||
if pk.Length < 25 then raise (CryptographicException(getResourceString(FSComp.SR.ilSignInvalidPKBlob())))
|
||||
let mutable reader = BlobReader(pk)
|
||||
reader.ReadBigInteger(12) |> ignore // Skip CLRHeader
|
||||
reader.ReadBigInteger(8) |> ignore // Skip BlobHeader
|
||||
let magic = reader.ReadInt32 // Read magic
|
||||
if not (magic = RSA_PRIV_MAGIC || magic = RSA_PUB_MAGIC) then // RSAPubKey.magic
|
||||
raise (CryptographicException(getResourceString(FSComp.SR.ilSignInvalidPKBlob())))
|
||||
let x = reader.ReadInt32 / 8
|
||||
x
|
||||
|
||||
// Returns a CLR Format Blob public key
|
||||
let getPublicKeyForKeyPair keyBlob =
|
||||
use rsa = RSA.Create()
|
||||
rsa.ImportParameters(RSAParamatersFromBlob keyBlob KeyType.KeyPair)
|
||||
let rsaParameters = rsa.ExportParameters(false)
|
||||
toCLRKeyBlob rsaParameters CALG_RSA_KEYX
|
|
@ -1,46 +1,46 @@
|
|||
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
module internal Microsoft.FSharp.Compiler.AbstractIL.Internal.Support
|
||||
module internal Microsoft.FSharp.Compiler.AbstractIL.Internal.Support
|
||||
|
||||
|
||||
let DateTime1970Jan01 = new System.DateTime(1970,1,1,0,0,0,System.DateTimeKind.Utc) (* ECMA Spec (Oct2002), Part II, 24.2.2 PE File Header. *)
|
||||
let absilWriteGetTimeStamp () = (System.DateTime.UtcNow - DateTime1970Jan01).TotalSeconds |> int
|
||||
|
||||
|
||||
open Internal.Utilities
|
||||
open Microsoft.FSharp.Compiler.AbstractIL
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal
|
||||
open Microsoft.FSharp.Compiler.AbstractIL
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Bytes
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library
|
||||
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library
|
||||
#if FX_NO_CORHOST_SIGNER
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal.StrongNameSign
|
||||
#endif
|
||||
open System
|
||||
open System.IO
|
||||
open System.Text
|
||||
open System.Reflection
|
||||
|
||||
#if FX_NO_SYMBOLSTORE
|
||||
#else
|
||||
open System.Diagnostics.SymbolStore
|
||||
#endif
|
||||
open System.Runtime.InteropServices
|
||||
open System.Runtime.CompilerServices
|
||||
|
||||
#if FX_NO_LINKEDRESOURCES
|
||||
#else
|
||||
// Force inline, so GetLastWin32Error calls are immediately after interop calls as seen by FxCop under Debug build.
|
||||
let inline ignore _x = ()
|
||||
|
||||
// Native Resource linking/unlinking
|
||||
type IStream = System.Runtime.InteropServices.ComTypes.IStream
|
||||
#endif
|
||||
|
||||
let check _action (hresult) =
|
||||
if uint32 hresult >= 0x80000000ul then
|
||||
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(hresult)
|
||||
//printf "action = %s, hresult = 0x%nx \n" action hresult
|
||||
|
||||
// Depending on the configuration, we may want to include the output file extension in the name
|
||||
// of the debug symbols file. This function takes output file name and returns debug file name.
|
||||
let getDebugFileName outfile =
|
||||
if IL.runningOnMono then
|
||||
outfile+".mdb"
|
||||
else
|
||||
(Filename.chopExtension outfile)+".pdb"
|
||||
|
||||
type PEFileType = X86 | X64
|
||||
|
||||
let MAX_PATH = 260
|
||||
|
@ -57,6 +57,8 @@ let bytesToQWord ((b0 : byte) , (b1 : byte) , (b2 : byte) , (b3 : byte) , (b4 :
|
|||
let dwToBytes n = [| (byte)(n &&& 0xff) ; (byte)((n >>> 8) &&& 0xff) ; (byte)((n >>> 16) &&& 0xff) ; (byte)((n >>> 24) &&& 0xff) |], 4
|
||||
let wToBytes (n : int16) = [| (byte)(n &&& 0xffs) ; (byte)((n >>> 8) &&& 0xffs) |], 2
|
||||
|
||||
#if FX_NO_LINKEDRESOURCES
|
||||
#else
|
||||
// REVIEW: factor these classes under one hierarchy, use reflection for creation from buffer and toBytes()
|
||||
// Though, everything I'd like to unify is static - metaclasses?
|
||||
type IMAGE_FILE_HEADER (m:int16, secs:int16, tds:int32, ptst:int32, nos:int32, soh:int16, c:int16) =
|
||||
|
@ -578,7 +580,6 @@ type ResFormatNode(tid:int32, nid:int32, lid:int32, dataOffset:int32, pbLinkedRe
|
|||
SaveChunk(bNil, 4 - dwFiller)
|
||||
|
||||
!size
|
||||
|
||||
|
||||
let linkNativeResources (unlinkedResources:byte[] list) (ulLinkedResourceBaseRVA:int32) (fileType:PEFileType) (outputFilePath:string) =
|
||||
let nPEFileType = match fileType with X86 -> 0 | X64 -> 2
|
||||
|
@ -597,14 +598,13 @@ let linkNativeResources (unlinkedResources:byte[] list) (ulLinkedResourceBaseRV
|
|||
let corSystemDir = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
|
||||
// We'll use the current dir and a random file name rather than System.IO.Path.GetTempFileName
|
||||
// to try and prevent the command line invocation string from being > MAX_PATH
|
||||
|
||||
|
||||
|
||||
let outputFilePaths =
|
||||
if outputFilePath = "" then
|
||||
[ FileSystem.GetTempPathShim() ]
|
||||
else
|
||||
[ FileSystem.GetTempPathShim() ; (outputFilePath ^ "\\") ]
|
||||
|
||||
|
||||
// Get a unique random file
|
||||
let rec GetUniqueRandomFileName(path) =
|
||||
let tfn = path ^ System.IO.Path.GetRandomFileName()
|
||||
|
@ -613,17 +613,17 @@ let linkNativeResources (unlinkedResources:byte[] list) (ulLinkedResourceBaseRV
|
|||
else
|
||||
tfn
|
||||
|
||||
|
||||
|
||||
let machine = if 2 = nPEFileType then "X64" else "X86"
|
||||
let cmdLineArgsPreamble = sprintf "/NOLOGO /READONLY /MACHINE:%s" machine
|
||||
|
||||
|
||||
let cvtres = corSystemDir^"cvtres.exe "
|
||||
|
||||
|
||||
let createCvtresArgs path =
|
||||
let tempObjFileName = GetUniqueRandomFileName(path)
|
||||
let mutable cmdLineArgs = sprintf "%s \"/Out:%s\"" cmdLineArgsPreamble tempObjFileName
|
||||
let mutable resFiles : string list = []
|
||||
|
||||
|
||||
for _ulr in unlinkedResources do
|
||||
let tempResFileName = GetUniqueRandomFileName(path)
|
||||
resFiles <- tempResFileName :: resFiles ;
|
||||
|
@ -631,7 +631,7 @@ let linkNativeResources (unlinkedResources:byte[] list) (ulLinkedResourceBaseRV
|
|||
let trf = resFiles
|
||||
let cmd = cmdLineArgs
|
||||
cmd,tempObjFileName,trf
|
||||
|
||||
|
||||
let cmdLineArgs,tempObjFileName,tempResFileNames =
|
||||
let attempts =
|
||||
outputFilePaths |>
|
||||
|
@ -643,20 +643,20 @@ let linkNativeResources (unlinkedResources:byte[] list) (ulLinkedResourceBaseRV
|
|||
| (i,t,f) :: _rest -> i,t,f // use the first one, since they're listed in order of precedence
|
||||
tempResFiles <- files
|
||||
(invoc,tmp,files)
|
||||
|
||||
|
||||
let cvtresInvocation = cvtres ^ cmdLineArgs
|
||||
|
||||
|
||||
try
|
||||
let mutable iFiles = 0
|
||||
|
||||
|
||||
for ulr in unlinkedResources do
|
||||
// REVIEW: What can go wrong here? What happens when the various file calls fail
|
||||
// dump the unlinked resource bytes into the temp file
|
||||
System.IO.File.WriteAllBytes(tempResFileNames.[iFiles], ulr) ;
|
||||
iFiles <- iFiles + 1
|
||||
|
||||
|
||||
// call cvtres.exe using the full cmd line string we've generated
|
||||
|
||||
|
||||
// check to see if the generated string is too long - if it is, fail with E_FAIL
|
||||
if cvtresInvocation.Length >= MAX_PATH then
|
||||
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(E_FAIL)
|
||||
|
@ -667,12 +667,12 @@ let linkNativeResources (unlinkedResources:byte[] list) (ulLinkedResourceBaseRV
|
|||
psi.CreateNoWindow <- true ; // REVIEW: For some reason, this still creates a window unless WindowStyle is set to hidden
|
||||
psi.WindowStyle <- System.Diagnostics.ProcessWindowStyle.Hidden ;
|
||||
let p = System.Diagnostics.Process.Start(psi)
|
||||
|
||||
|
||||
// Wait for the process to finish
|
||||
p.WaitForExit()
|
||||
|
||||
|
||||
check "Process.Start" p.ExitCode // TODO: really need to check against 0
|
||||
|
||||
|
||||
// Conversion was successful, so read the object file
|
||||
objBytes <- FileSystem.ReadAllBytesShim(tempObjFileName) ;
|
||||
//Array.Copy(objBytes, pbUnlinkedResource, pbUnlinkedResource.Length)
|
||||
|
@ -680,99 +680,96 @@ let linkNativeResources (unlinkedResources:byte[] list) (ulLinkedResourceBaseRV
|
|||
finally
|
||||
// clean up the temp files
|
||||
List.iter (fun tempResFileName -> FileSystem.FileDelete(tempResFileName)) tempResFiles
|
||||
|
||||
|
||||
// Part 2: Read the COFF file held in pbUnlinkedResource, spit it out into pResBuffer and apply the COFF fixups
|
||||
// pResBuffer will become the .rsrc section of the PE file
|
||||
if (objBytes = Unchecked.defaultof<byte[]>) then
|
||||
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(E_FAIL)
|
||||
|
||||
let hMod = bytesToIFH objBytes 0
|
||||
|
||||
|
||||
if hMod.SizeOfOptionalHeader <> 0s then
|
||||
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(E_FAIL)
|
||||
|
||||
|
||||
let rsrc01Name = 0x313024637273722eL // ".rsrc$01"
|
||||
let rsrc02Name = 0x323024637273722eL // ".rsrc$02"
|
||||
let nullHdr = Unchecked.defaultof<IMAGE_SECTION_HEADER>
|
||||
let mutable rsrc01 = nullHdr
|
||||
let mutable rsrc02 = nullHdr
|
||||
|
||||
|
||||
for i = 0 to (int)hMod.NumberOfSections do
|
||||
let pSection = bytesToISH objBytes (IMAGE_FILE_HEADER.Width + (IMAGE_SECTION_HEADER.Width * i))
|
||||
if pSection.Name = rsrc01Name then
|
||||
rsrc01 <- pSection
|
||||
else if pSection.Name = rsrc02Name then
|
||||
rsrc02 <- pSection
|
||||
|
||||
|
||||
if (nullHdr = rsrc01) || (nullHdr = rsrc02) then
|
||||
// One of the rsrc sections wasn't found
|
||||
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(E_FAIL)
|
||||
|
||||
|
||||
let size = rsrc01.SizeOfRawData + rsrc02.SizeOfRawData
|
||||
|
||||
|
||||
let pResBuffer = Bytes.zeroCreate size
|
||||
|
||||
// Copy over the raw data
|
||||
Bytes.blit objBytes rsrc01.PointerToRawData pResBuffer 0 rsrc01.SizeOfRawData
|
||||
|
||||
|
||||
// map all the relocs in .rsrc$01 using the reloc and symbol tables in the COFF object
|
||||
let symbolTableHead = hMod.PointerToSymbolTable
|
||||
let IMAGE_SYM_CLASS_STATIC = 0x3uy
|
||||
let IMAGE_SYM_TYPE_NULL = 0x0s
|
||||
|
||||
|
||||
let GetSymbolEntry (buffer : byte[]) (idx : int) =
|
||||
bytesToIS buffer (symbolTableHead + (idx * IMAGE_SYMBOL.Width) )
|
||||
|
||||
|
||||
for iReloc = 0 to (int)(rsrc01.NumberOfRelocations - 1s) do
|
||||
let pReloc = bytesToIR objBytes (rsrc01.PointerToRelocations + (iReloc * IMAGE_RELOCATION.Width))
|
||||
let IdxSymbol = pReloc.SymbolTableIndex
|
||||
let pSymbolEntry = GetSymbolEntry objBytes IdxSymbol
|
||||
|
||||
|
||||
// Ensure the symbol entry is valid for a resource
|
||||
if ((pSymbolEntry.StorageClass <> IMAGE_SYM_CLASS_STATIC) ||
|
||||
(pSymbolEntry.Type <> IMAGE_SYM_TYPE_NULL) ||
|
||||
(pSymbolEntry.SectionNumber <> 3s)) then
|
||||
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(E_FAIL)
|
||||
|
||||
|
||||
// Ensure that RVA is a valid address inside rsrc02
|
||||
if pSymbolEntry.Value >= rsrc02.SizeOfRawData then
|
||||
// pSymbolEntry.Value is too big
|
||||
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(E_FAIL)
|
||||
|
||||
|
||||
// store the value
|
||||
let vBuff, vSize = dwToBytes (ulLinkedResourceBaseRVA + rsrc01.SizeOfRawData + pSymbolEntry.Value)
|
||||
//Bytes.blit objBytes rsrc02.PointerToRawData pResBuffer pReloc.VirtualAddress rsrc02.SizeOfRawData
|
||||
Bytes.blit vBuff 0 pResBuffer pReloc.VirtualAddress vSize
|
||||
// Copy $02 (resource raw into pResBuffer
|
||||
Bytes.blit objBytes rsrc02.PointerToRawData pResBuffer rsrc01.SizeOfRawData rsrc02.SizeOfRawData
|
||||
|
||||
|
||||
// return the buffer
|
||||
pResBuffer
|
||||
|
||||
|
||||
|
||||
let unlinkResource (ulLinkedResourceBaseRVA:int32) (pbLinkedResource:byte[]) =
|
||||
let mutable nResNodes = 0
|
||||
|
||||
|
||||
let pirdType = bytesToIRD pbLinkedResource 0
|
||||
let mutable pirdeType = Unchecked.defaultof<IMAGE_RESOURCE_DIRECTORY_ENTRY>
|
||||
let nEntries = pirdType.NumberOfNamedEntries + pirdType.NumberOfIdEntries
|
||||
|
||||
|
||||
// determine entry buffer size
|
||||
// TODO: coalesce these two loops
|
||||
for iEntry = 0 to ((int)nEntries - 1) do
|
||||
pirdeType <- bytesToIRDE pbLinkedResource (IMAGE_RESOURCE_DIRECTORY.Width + (iEntry * IMAGE_RESOURCE_DIRECTORY_ENTRY.Width)) ;
|
||||
|
||||
|
||||
if pirdeType.DataIsDirectory then
|
||||
let nameBase = pirdeType.OffsetToDirectory
|
||||
let pirdName = bytesToIRD pbLinkedResource nameBase
|
||||
let mutable pirdeName = Unchecked.defaultof<IMAGE_RESOURCE_DIRECTORY_ENTRY>
|
||||
let nEntries2 = pirdName.NumberOfNamedEntries + pirdName.NumberOfIdEntries
|
||||
|
||||
|
||||
for iEntry2 = 0 to ((int)nEntries2 - 1) do
|
||||
pirdeName <- bytesToIRDE pbLinkedResource (nameBase + (iEntry2 * IMAGE_RESOURCE_DIRECTORY_ENTRY.Width)) ;
|
||||
|
||||
|
||||
if pirdeName.DataIsDirectory then
|
||||
let langBase = pirdeName.OffsetToDirectory
|
||||
let pirdLang = bytesToIRD pbLinkedResource langBase
|
||||
|
@ -783,10 +780,10 @@ let unlinkResource (ulLinkedResourceBaseRVA:int32) (pbLinkedResource:byte[]) =
|
|||
nResNodes <- nResNodes + 1 ;
|
||||
else
|
||||
nResNodes <- nResNodes + 1 ;
|
||||
|
||||
|
||||
let pResNodes : ResFormatNode [] = Array.zeroCreate nResNodes
|
||||
nResNodes <- 0 ;
|
||||
|
||||
|
||||
// fill out the entry buffer
|
||||
for iEntry = 0 to ((int)nEntries - 1) do
|
||||
pirdeType <- bytesToIRDE pbLinkedResource (IMAGE_RESOURCE_DIRECTORY.Width + (iEntry * IMAGE_RESOURCE_DIRECTORY_ENTRY.Width)) ;
|
||||
|
@ -803,7 +800,7 @@ let unlinkResource (ulLinkedResourceBaseRVA:int32) (pbLinkedResource:byte[]) =
|
|||
for iEntry2 = 0 to ((int)nEntries2 - 1) do
|
||||
pirdeName <- bytesToIRDE pbLinkedResource (nameBase + (iEntry2 * IMAGE_RESOURCE_DIRECTORY_ENTRY.Width)) ;
|
||||
let dwNameID = pirdeName.Name
|
||||
|
||||
|
||||
if pirdeName.DataIsDirectory then
|
||||
let langBase = pirdeName.OffsetToDirectory
|
||||
let pirdLang = bytesToIRD pbLinkedResource langBase
|
||||
|
@ -832,31 +829,33 @@ let unlinkResource (ulLinkedResourceBaseRVA:int32) (pbLinkedResource:byte[]) =
|
|||
let rfn = ResFormatNode(dwTypeID, 0, 0, pirdeType.OffsetToData, pbLinkedResource) // REVIEW: I believe these 0s are what's causing the duplicate res naming problems
|
||||
pResNodes.[nResNodes] <- rfn ;
|
||||
nResNodes <- nResNodes + 1 ;
|
||||
|
||||
|
||||
// Ok, all tree leaves are in ResFormatNode structs, and nResNodes ptrs are in pResNodes
|
||||
let mutable size = 0
|
||||
if nResNodes <> 0 then
|
||||
size <- size + ResFormatHeader.Width ; // sizeof(ResFormatHeader)
|
||||
for i = 0 to (nResNodes - 1) do
|
||||
size <- size + pResNodes.[i].Save(ulLinkedResourceBaseRVA, pbLinkedResource, Unchecked.defaultof<byte[]>, 0) ;
|
||||
|
||||
|
||||
let pResBuffer = Bytes.zeroCreate size
|
||||
|
||||
|
||||
if nResNodes <> 0 then
|
||||
let mutable resBufferOffset = 0
|
||||
|
||||
|
||||
// Write a dummy header
|
||||
let rfh = ResFormatHeader()
|
||||
let rfhBytes = rfh.toBytes()
|
||||
Bytes.blit rfhBytes 0 pResBuffer 0 ResFormatHeader.Width
|
||||
resBufferOffset <- resBufferOffset + ResFormatHeader.Width ;
|
||||
|
||||
|
||||
for i = 0 to (nResNodes - 1) do
|
||||
resBufferOffset <- resBufferOffset + pResNodes.[i].Save(ulLinkedResourceBaseRVA, pbLinkedResource, pResBuffer, resBufferOffset) ;
|
||||
|
||||
pResBuffer
|
||||
|
||||
pResBuffer
|
||||
#endif
|
||||
|
||||
#if FX_NO_PDB_WRITER
|
||||
#else
|
||||
// PDB Writing
|
||||
|
||||
[<ComImport; Interface>]
|
||||
|
@ -1009,14 +1008,16 @@ type ISymUnmanagedWriter2 =
|
|||
|
||||
type PdbWriter = { symWriter : ISymUnmanagedWriter2 }
|
||||
type PdbDocumentWriter = { symDocWriter : ISymUnmanagedDocumentWriter } (* pointer to pDocumentWriter COM object *)
|
||||
|
||||
type idd =
|
||||
{ iddCharacteristics: int32;
|
||||
iddMajorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *)
|
||||
iddMinorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *)
|
||||
iddType: int32;
|
||||
iddData: byte[];}
|
||||
#endif
|
||||
|
||||
#if FX_NO_PDB_WRITER
|
||||
#else
|
||||
let pdbInitialize (binaryName:string) (pdbName:string) =
|
||||
// collect necessary COM types
|
||||
let CorMetaDataDispenser = System.Type.GetTypeFromProgID("CLRMetaData.CorMetaDataDispenser")
|
||||
|
@ -1136,7 +1137,7 @@ let pdbDefineSequencePoints (writer:PdbWriter) (docWriter: PdbDocumentWriter) (p
|
|||
let endColumns = (Array.map (fun (_,_,_,_,x) -> x) pts)
|
||||
writer.symWriter.DefineSequencePoints(docWriter.symDocWriter, pts.Length, offsets, lines, columns, endLines, endColumns)
|
||||
|
||||
let pdbGetDebugInfo (writer: PdbWriter) =
|
||||
let pdbWriteDebugInfo (writer: PdbWriter) =
|
||||
let mutable iDD = new ImageDebugDirectory()
|
||||
let mutable length = 0
|
||||
writer.symWriter.GetDebugInfo(&iDD, 0, &length, null)
|
||||
|
@ -1148,8 +1149,11 @@ let pdbGetDebugInfo (writer: PdbWriter) =
|
|||
iddMinorVersion = (int32)iDD.MinorVersion;
|
||||
iddType = iDD.Type;
|
||||
iddData = data}
|
||||
#endif
|
||||
|
||||
|
||||
#if FX_NO_PDB_WRITER
|
||||
#else
|
||||
// PDB reading
|
||||
type PdbReader = { symReader: ISymbolReader }
|
||||
type PdbDocument = { symDocument: ISymbolDocument }
|
||||
|
@ -1261,12 +1265,40 @@ let pdbVariableGetSignature (variable:PdbVariable) : byte[] =
|
|||
// the tuple is (AddressKind, AddressField1)
|
||||
let pdbVariableGetAddressAttributes (variable:PdbVariable) : (int32 * int32) =
|
||||
(int32 variable.symVariable.AddressKind,variable.symVariable.AddressField1)
|
||||
#endif
|
||||
|
||||
// Key signing
|
||||
type keyContainerName = string
|
||||
type keyPair = byte[]
|
||||
type pubkey = byte[]
|
||||
type pubkeyOptions = byte[] * bool
|
||||
|
||||
#if FX_NO_CORHOST_SIGNER
|
||||
|
||||
let signerOpenPublicKeyFile filePath = FileSystem.ReadAllBytesShim(filePath)
|
||||
|
||||
let signerOpenKeyPairFile filePath = FileSystem.ReadAllBytesShim(filePath)
|
||||
|
||||
let signerGetPublicKeyForKeyPair (kp:keyPair) : pubkey =
|
||||
let reply = (StrongNameSign.getPublicKeyForKeyPair kp)
|
||||
reply
|
||||
|
||||
let signerGetPublicKeyForKeyContainer (_kcName:keyContainerName) : pubkey =
|
||||
raise (NotImplementedException("signerGetPublicKeyForKeyContainer is not yet implemented"))
|
||||
|
||||
let signerCloseKeyContainer (_kc:keyContainerName) :unit =
|
||||
raise (NotImplementedException("signerCloseKeyContainer is not yet implemented"))
|
||||
|
||||
let signerSignatureSize (pk:pubkey) : int =
|
||||
(StrongNameSign.signatureSize pk)
|
||||
|
||||
let signerSignFileWithKeyPair (fileName:string) (kp:keyPair) :unit =
|
||||
(StrongNameSign.signFile fileName kp)
|
||||
|
||||
let signerSignFileWithKeyContainer (_fileName:string) (_kcName:keyContainerName) : unit =
|
||||
raise (NotImplementedException("signerSignFileWithKeyContainer is not yet implemented"))
|
||||
|
||||
#else
|
||||
// new mscoree functionality
|
||||
// This type represents methods that we don't currently need, so I'm leaving unimplemented
|
||||
type UnusedCOMMethod = unit -> unit
|
||||
|
@ -1374,13 +1406,11 @@ let CreateInterface (
|
|||
([<MarshalAs(UnmanagedType.LPStruct)>] _guid : System.Guid),
|
||||
([<MarshalAs(UnmanagedType.Interface)>] _metaHost :
|
||||
ICLRMetaHost byref)) : unit = failwith "CreateInterface"
|
||||
|
||||
let signerOpenPublicKeyFile filePath =
|
||||
FileSystem.ReadAllBytesShim(filePath)
|
||||
|
||||
let signerOpenKeyPairFile filePath =
|
||||
FileSystem.ReadAllBytesShim(filePath)
|
||||
|
||||
|
||||
let signerOpenPublicKeyFile filePath = FileSystem.ReadAllBytesShim(filePath)
|
||||
|
||||
let signerOpenKeyPairFile filePath = FileSystem.ReadAllBytesShim(filePath)
|
||||
|
||||
let mutable iclrsn : ICLRStrongName option = None
|
||||
let getICLRStrongName () =
|
||||
match iclrsn with
|
||||
|
@ -1452,3 +1482,4 @@ let signerSignFileWithKeyContainer fileName kcName =
|
|||
let iclrSN = getICLRStrongName()
|
||||
iclrSN.StrongNameSignatureGeneration(fileName, kcName, Unchecked.defaultof<byte[]>, 0u, ppb, &pcb) |> ignore
|
||||
iclrSN.StrongNameSignatureVerificationEx(fileName, true, &ok) |> ignore
|
||||
#endif
|
||||
|
|
|
@ -7,27 +7,34 @@
|
|||
/// The implementation of the functions can be found in ilsupp-*.fs
|
||||
module internal Microsoft.FSharp.Compiler.AbstractIL.Internal.Support
|
||||
|
||||
|
||||
type PdbReader
|
||||
#if FX_NO_PDB_WRITER
|
||||
#else
|
||||
type PdbWriter
|
||||
val pdbReadClose: PdbReader -> unit
|
||||
val pdbInitialize : string -> string -> PdbWriter
|
||||
val absilWriteGetTimeStamp: unit -> int32
|
||||
#endif
|
||||
#if FX_NO_PDB_READER
|
||||
#else
|
||||
type PdbReader
|
||||
val pdbReadClose: PdbReader -> unit
|
||||
#endif
|
||||
|
||||
val absilWriteGetTimeStamp: unit -> int32
|
||||
|
||||
open System
|
||||
open System.Runtime.InteropServices
|
||||
#if FX_NO_SYMBOLSTORE
|
||||
#else
|
||||
open System.Diagnostics.SymbolStore
|
||||
#endif
|
||||
open Internal.Utilities
|
||||
open Microsoft.FSharp.Compiler.AbstractIL
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.IL
|
||||
|
||||
#if FX_NO_LINKEDRESOURCES
|
||||
#else
|
||||
type IStream = System.Runtime.InteropServices.ComTypes.IStream
|
||||
|
||||
|
||||
/// Takes the output file name and returns debug file name.
|
||||
val getDebugFileName: string -> string
|
||||
#endif
|
||||
|
||||
/// Unmanaged resource file linker - for native resources (not managed ones).
|
||||
/// The function may be called twice, once with a zero-RVA and
|
||||
|
@ -35,9 +42,14 @@ val getDebugFileName: string -> string
|
|||
/// required buffer is returned.
|
||||
type PEFileType = X86 | X64
|
||||
|
||||
#if FX_NO_LINKEDRESOURCES
|
||||
#else
|
||||
val linkNativeResources: unlinkedResources:byte[] list -> rva:int32 -> PEFileType -> tempFilePath:string -> byte[]
|
||||
val unlinkResource: int32 -> byte[] -> byte[]
|
||||
#endif
|
||||
|
||||
#if FX_NO_PDB_WRITER
|
||||
#else
|
||||
/// PDB reader and associated types
|
||||
type PdbDocument
|
||||
type PdbMethod
|
||||
|
@ -76,8 +88,10 @@ val pdbScopeGetLocals: PdbMethodScope -> PdbVariable array
|
|||
val pdbVariableGetName: PdbVariable -> string
|
||||
val pdbVariableGetSignature: PdbVariable -> byte[]
|
||||
val pdbVariableGetAddressAttributes: PdbVariable -> int32 (* kind *) * int32 (* addrField1 *)
|
||||
#endif
|
||||
|
||||
|
||||
#if FX_NO_PDB_WRITER
|
||||
#else
|
||||
//---------------------------------------------------------------------
|
||||
// PDB writer.
|
||||
//---------------------------------------------------------------------
|
||||
|
@ -106,7 +120,8 @@ val pdbCloseScope: PdbWriter -> int -> unit
|
|||
val pdbDefineLocalVariable: PdbWriter -> string -> byte[] -> int32 -> unit
|
||||
val pdbSetMethodRange: PdbWriter -> PdbDocumentWriter -> int -> int -> PdbDocumentWriter -> int -> int -> unit
|
||||
val pdbDefineSequencePoints: PdbWriter -> PdbDocumentWriter -> (int * int * int * int * int) array -> unit
|
||||
val pdbGetDebugInfo: PdbWriter -> idd
|
||||
val pdbWriteDebugInfo: PdbWriter -> idd
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Strong name signing
|
||||
|
@ -115,12 +130,13 @@ val pdbGetDebugInfo: PdbWriter -> idd
|
|||
type keyContainerName = string
|
||||
type keyPair = byte[]
|
||||
type pubkey = byte[]
|
||||
type pubkeyOptions = byte[] * bool
|
||||
|
||||
val signerOpenPublicKeyFile: string -> pubkey
|
||||
val signerOpenKeyPairFile: string -> keyPair
|
||||
val signerSignatureSize: pubkey -> int
|
||||
val signerGetPublicKeyForKeyPair: keyPair -> pubkey
|
||||
val signerGetPublicKeyForKeyContainer: string -> pubkey
|
||||
val signerCloseKeyContainer: keyContainerName -> unit
|
||||
val signerSignatureSize: pubkey -> int
|
||||
val signerSignFileWithKeyPair: string -> keyPair -> unit
|
||||
val signerSignFileWithKeyContainer: string -> keyContainerName -> unit
|
||||
|
|
|
@ -12,6 +12,12 @@ open Microsoft.FSharp.Compiler.AbstractIL.Internal
|
|||
open Microsoft.FSharp.Compiler.AbstractIL.Internal.BinaryConstants
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Support
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter
|
||||
|
||||
#if FX_NO_CORHOST_SIGNER
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal.StrongNameSign
|
||||
#endif
|
||||
|
||||
open Microsoft.FSharp.Compiler.DiagnosticMessage
|
||||
open Microsoft.FSharp.Compiler.ErrorLogger
|
||||
open Microsoft.FSharp.Compiler.Range
|
||||
|
@ -23,21 +29,6 @@ open System.IO
|
|||
let showEntryLookups = false
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Library
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
let reportTime =
|
||||
let tFirst = ref None
|
||||
let tPrev = ref None
|
||||
fun showTimes descr ->
|
||||
if showTimes then
|
||||
let t = System.Diagnostics.Process.GetCurrentProcess().UserProcessorTime.TotalSeconds
|
||||
let prev = match !tPrev with None -> 0.0 | Some t -> t
|
||||
let first = match !tFirst with None -> (tFirst := Some t; t) | Some t -> t
|
||||
dprintf "ilwrite: TIME %10.3f (total) %10.3f (delta) - %s\n" (t - first) (t - prev) descr
|
||||
tPrev := Some t
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Byte, byte array fragments and other concrete representations
|
||||
// manipulations.
|
||||
|
@ -71,7 +62,6 @@ let align alignment n = ((n + alignment - 1) / alignment) * alignment
|
|||
// Concrete token representations etc. used in PE files
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
|
||||
type ByteBuffer with
|
||||
|
||||
/// Z32 = compressed unsigned integer
|
||||
|
@ -113,10 +103,10 @@ let getUncodedToken (tab:TableName) idx = ((tab.Index <<< 24) ||| idx)
|
|||
|
||||
// From ECMA for UserStrings:
|
||||
// This final byte holds the value 1 if and only if any UTF16 character within the string has any bit set in its top byte, or its low byte is any of the following:
|
||||
// 0x01–0x08, 0x0E–0x1F, 0x27, 0x2D,
|
||||
// 0x01-0x08, 0x0E-0x1F, 0x27, 0x2D,
|
||||
// 0x7F. Otherwise, it holds 0. The 1 signifies Unicode characters that require handling beyond that normally provided for 8-bit encoding sets.
|
||||
|
||||
// HOWEVER, there is a discrepancy here between the ECMA spec and the Microsoft C# implementation. The code below follows the latter. We’ve raised the issue with both teams. See Dev10 bug 850073 for details.
|
||||
// HOWEVER, there is a discrepancy here between the ECMA spec and the Microsoft C# implementation. The code below follows the latter. We<EFBFBD>ve raised the issue with both teams. See Dev10 bug 850073 for details.
|
||||
|
||||
let markerForUnicodeBytes (b:byte[]) =
|
||||
let len = b.Length
|
||||
|
@ -153,341 +143,18 @@ let applyFixup32 (data:byte[]) offset v =
|
|||
data.[offset+2] <- b2 v
|
||||
data.[offset+3] <- b3 v
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// PDB data
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
type PdbDocumentData = ILSourceDocument
|
||||
|
||||
type PdbLocalVar =
|
||||
{ Name: string
|
||||
Signature: byte[]
|
||||
/// the local index the name corresponds to
|
||||
Index: int32 }
|
||||
|
||||
type PdbMethodScope =
|
||||
{ Children: PdbMethodScope array
|
||||
StartOffset: int
|
||||
EndOffset: int
|
||||
Locals: PdbLocalVar array
|
||||
(* REVIEW open_namespaces: pdb_namespace array *) }
|
||||
|
||||
type PdbSourceLoc =
|
||||
{ Document: int
|
||||
Line: int
|
||||
Column: int }
|
||||
|
||||
type PdbSequencePoint =
|
||||
{ Document: int
|
||||
Offset: int
|
||||
Line: int
|
||||
Column: int
|
||||
EndLine: int
|
||||
EndColumn: int }
|
||||
override x.ToString() = sprintf "(%d,%d)-(%d,%d)" x.Line x.Column x.EndLine x.EndColumn
|
||||
|
||||
type PdbMethodData =
|
||||
{ MethToken: int32
|
||||
MethName:string
|
||||
Params: PdbLocalVar array
|
||||
RootScope: PdbMethodScope
|
||||
Range: (PdbSourceLoc * PdbSourceLoc) option
|
||||
SequencePoints: PdbSequencePoint array }
|
||||
|
||||
module SequencePoint =
|
||||
let orderBySource sp1 sp2 =
|
||||
let c1 = compare sp1.Document sp2.Document
|
||||
if c1 <> 0 then c1 else
|
||||
let c1 = compare sp1.Line sp2.Line
|
||||
if c1 <> 0 then c1 else
|
||||
compare sp1.Column sp2.Column
|
||||
|
||||
let orderByOffset sp1 sp2 =
|
||||
compare sp1.Offset sp2.Offset
|
||||
|
||||
/// 28 is the size of the IMAGE_DEBUG_DIRECTORY in ntimage.h
|
||||
let sizeof_IMAGE_DEBUG_DIRECTORY = 28
|
||||
|
||||
[<NoEquality; NoComparison>]
|
||||
type PdbData =
|
||||
{ EntryPoint: int32 option
|
||||
// MVID of the generated .NET module (used by MDB files to identify debug info)
|
||||
ModuleID: byte[]
|
||||
Documents: PdbDocumentData[]
|
||||
Methods: PdbMethodData[] }
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// PDB Writer. The function [WritePdbInfo] abstracts the
|
||||
// imperative calls to the Symbol Writer API.
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
let WritePdbInfo fixupOverlappingSequencePoints showTimes f fpdb info =
|
||||
(try FileSystem.FileDelete fpdb with _ -> ())
|
||||
let pdbw = ref Unchecked.defaultof<PdbWriter>
|
||||
|
||||
try
|
||||
pdbw := pdbInitialize f fpdb
|
||||
with _ -> error(Error(FSComp.SR.ilwriteErrorCreatingPdb(fpdb), rangeCmdArgs))
|
||||
|
||||
match info.EntryPoint with
|
||||
| None -> ()
|
||||
| Some x -> pdbSetUserEntryPoint !pdbw x
|
||||
|
||||
let docs = info.Documents |> Array.map (fun doc -> pdbDefineDocument !pdbw doc.File)
|
||||
let getDocument i =
|
||||
if i < 0 || i > docs.Length then failwith "getDocument: bad doc number"
|
||||
docs.[i]
|
||||
reportTime showTimes (sprintf "PDB: Defined %d documents" info.Documents.Length)
|
||||
Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods
|
||||
|
||||
reportTime showTimes (sprintf "PDB: Sorted %d methods" info.Methods.Length)
|
||||
|
||||
// This next bit is a workaround. The sequence points we get
|
||||
// from F# (which has nothing to do with this module) are actually expression
|
||||
// marks, i.e. the source ranges they denote are typically
|
||||
// nested, and each point indicates where the
|
||||
// code for an expression with a particular range begins.
|
||||
// This is in many ways a much more convenient form to emit.
|
||||
// However, it is not the form that debug tools accept nicely.
|
||||
// However, sequence points are really a non-overlapping, non-nested
|
||||
// partition of the source code of a method. So here we shorten the
|
||||
// length of all sequence point marks so they do not go further than
|
||||
// the next sequence point in the source.
|
||||
let spCounts = info.Methods |> Array.map (fun x -> x.SequencePoints.Length)
|
||||
let allSps = Array.concat (Array.map (fun x -> x.SequencePoints) info.Methods |> Array.toList)
|
||||
let allSps = Array.mapi (fun i sp -> (i,sp)) allSps
|
||||
if fixupOverlappingSequencePoints then
|
||||
// sort the sequence points into source order
|
||||
Array.sortInPlaceWith (fun (_,sp1) (_,sp2) -> SequencePoint.orderBySource sp1 sp2) allSps
|
||||
// shorten the ranges of any that overlap with following sequence points
|
||||
// sort the sequence points back into offset order
|
||||
for i = 0 to Array.length allSps - 2 do
|
||||
let n,sp1 = allSps.[i]
|
||||
let _,sp2 = allSps.[i+1]
|
||||
if (sp1.Document = sp2.Document) &&
|
||||
(sp1.EndLine > sp2.Line ||
|
||||
(sp1.EndLine = sp2.Line &&
|
||||
sp1.EndColumn >= sp2.Column)) then
|
||||
let adjustToPrevLine = (sp1.Line < sp2.Line)
|
||||
allSps.[i] <- n,{sp1 with EndLine = (if adjustToPrevLine then sp2.Line-1 else sp2.Line)
|
||||
EndColumn = (if adjustToPrevLine then 80 else sp2.Column) }
|
||||
Array.sortInPlaceBy fst allSps
|
||||
|
||||
|
||||
|
||||
let spOffset = ref 0
|
||||
info.Methods |> Array.iteri (fun i minfo ->
|
||||
|
||||
let sps = Array.sub allSps !spOffset spCounts.[i]
|
||||
spOffset := !spOffset + spCounts.[i]
|
||||
begin match minfo.Range with
|
||||
| None -> ()
|
||||
| Some (a,b) ->
|
||||
pdbOpenMethod !pdbw minfo.MethToken
|
||||
|
||||
pdbSetMethodRange !pdbw
|
||||
(getDocument a.Document) a.Line a.Column
|
||||
(getDocument b.Document) b.Line b.Column
|
||||
|
||||
// Partition the sequence points by document
|
||||
let spsets =
|
||||
let res = (Map.empty : Map<int,PdbSequencePoint list ref>)
|
||||
let add res (_,sp) =
|
||||
let k = sp.Document
|
||||
match Map.tryFind k res with
|
||||
Some xsR -> xsR := sp :: !xsR; res
|
||||
| None -> Map.add k (ref [sp]) res
|
||||
|
||||
let res = Array.fold add res sps
|
||||
let res = Map.toList res // ordering may not be stable
|
||||
List.map (fun (_,x) -> Array.ofList !x) res
|
||||
|
||||
spsets |> List.iter (fun spset ->
|
||||
if spset.Length > 0 then
|
||||
Array.sortInPlaceWith SequencePoint.orderByOffset spset
|
||||
let sps =
|
||||
spset |> Array.map (fun sp ->
|
||||
// Ildiag.dprintf "token 0x%08lx has an sp at offset 0x%08x\n" minfo.MethToken sp.Offset
|
||||
(sp.Offset, sp.Line, sp.Column,sp.EndLine, sp.EndColumn))
|
||||
// Use of alloca in implementation of pdbDefineSequencePoints can give stack overflow here
|
||||
if sps.Length < 5000 then
|
||||
pdbDefineSequencePoints !pdbw (getDocument spset.[0].Document) sps)
|
||||
|
||||
// Write the scopes
|
||||
let rec writePdbScope top sco =
|
||||
if top || sco.Locals.Length <> 0 || sco.Children.Length <> 0 then
|
||||
pdbOpenScope !pdbw sco.StartOffset
|
||||
sco.Locals |> Array.iter (fun v -> pdbDefineLocalVariable !pdbw v.Name v.Signature v.Index)
|
||||
sco.Children |> Array.iter (writePdbScope false)
|
||||
pdbCloseScope !pdbw sco.EndOffset
|
||||
writePdbScope true minfo.RootScope
|
||||
|
||||
pdbCloseMethod !pdbw
|
||||
end)
|
||||
reportTime showTimes "PDB: Wrote methods"
|
||||
let res = pdbGetDebugInfo !pdbw
|
||||
|
||||
for pdbDoc in docs do
|
||||
pdbCloseDocument pdbDoc
|
||||
|
||||
pdbClose !pdbw f fpdb;
|
||||
reportTime showTimes "PDB: Closed"
|
||||
res
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Support functions for calling 'Mono.CompilerServices.SymbolWriter'
|
||||
// assembly dynamically if it is available to the compiler
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
open System.Reflection
|
||||
open Microsoft.FSharp.Reflection
|
||||
|
||||
// Dynamic invoke operator. Implements simple overload resolution based
|
||||
// on the name and number of parameters only.
|
||||
// Supports the following cases:
|
||||
// obj?Foo() // call with no arguments
|
||||
// obj?Foo(1, "a") // call with two arguments (extracted from tuple)
|
||||
// NOTE: This doesn’t actually handle all overloads. It just picks first entry with right
|
||||
// number of arguments.
|
||||
let (?) this memb (args:'Args) : 'R =
|
||||
// Get array of 'obj' arguments for the reflection call
|
||||
let args =
|
||||
if typeof<'Args> = typeof<unit> then [| |]
|
||||
elif FSharpType.IsTuple typeof<'Args> then Microsoft.FSharp.Reflection.FSharpValue.GetTupleFields(args)
|
||||
else [| box args |]
|
||||
|
||||
// Get methods and perform overload resolution
|
||||
let methods = this.GetType().GetMethods()
|
||||
let bestMatch = methods |> Array.tryFind (fun mi -> mi.Name = memb && mi.GetParameters().Length = args.Length)
|
||||
match bestMatch with
|
||||
| Some(mi) -> unbox(mi.Invoke(this, args))
|
||||
| None -> error(Error(FSComp.SR.ilwriteMDBMemberMissing(memb), rangeCmdArgs))
|
||||
|
||||
// Creating instances of needed classes from 'Mono.CompilerServices.SymbolWriter' assembly
|
||||
|
||||
let monoCompilerSvc = "Mono.CompilerServices.SymbolWriter, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"
|
||||
let ctor (asmName:string) (clsName:string) (args:obj[]) =
|
||||
let asm = Assembly.Load(asmName)
|
||||
let ty = asm.GetType(clsName)
|
||||
System.Activator.CreateInstance(ty, args)
|
||||
|
||||
let createSourceMethodImpl (name:string) (token:int) (namespaceID:int) =
|
||||
ctor monoCompilerSvc "Mono.CompilerServices.SymbolWriter.SourceMethodImpl" [| box name; box token; box namespaceID |]
|
||||
|
||||
let createWriter (f:string) =
|
||||
ctor monoCompilerSvc "Mono.CompilerServices.SymbolWriter.MonoSymbolWriter" [| box f |]
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// MDB Writer. Generate debug symbols using the MDB format
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
let WriteMdbInfo fmdb f info =
|
||||
// Note, if we can’t delete it code will fail later
|
||||
(try FileSystem.FileDelete fmdb with _ -> ())
|
||||
|
||||
// Try loading the MDB symbol writer from an assembly available on Mono dynamically
|
||||
// Report an error if the assembly is not available.
|
||||
let wr =
|
||||
try createWriter f
|
||||
with e -> error(Error(FSComp.SR.ilwriteErrorCreatingMdb(), rangeCmdArgs))
|
||||
|
||||
// NOTE: MonoSymbolWriter doesn't need information about entrypoints, so 'info.EntryPoint' is unused here.
|
||||
// Write information about Documents. Returns '(SourceFileEntry*CompileUnitEntry)[]'
|
||||
let docs =
|
||||
[| for doc in info.Documents do
|
||||
let doc = wr?DefineDocument(doc.File)
|
||||
let unit = wr?DefineCompilationUnit(doc)
|
||||
yield doc, unit |]
|
||||
|
||||
let getDocument i =
|
||||
if i < 0 || i >= Array.length docs then failwith "getDocument: bad doc number" else docs.[i]
|
||||
|
||||
// Sort methods and write them to the MDB file
|
||||
Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods
|
||||
for meth in info.Methods do
|
||||
// Creates an instance of 'SourceMethodImpl' which is a private class that implements 'IMethodDef' interface
|
||||
// We need this as an argument to 'OpenMethod' below. Using private class is ugly, but since we don't reference
|
||||
// the assembly, the only way to implement 'IMethodDef' interface would be dynamically using Reflection.Emit...
|
||||
let sm = createSourceMethodImpl meth.MethName meth.MethToken 0
|
||||
match meth.Range with
|
||||
| Some(mstart, _) ->
|
||||
// NOTE: 'meth.Params' is not needed, Mono debugger apparently reads this from meta-data
|
||||
let _, cue = getDocument mstart.Document
|
||||
wr?OpenMethod(cue, 0, sm) |> ignore
|
||||
|
||||
// Write sequence points
|
||||
for sp in meth.SequencePoints do
|
||||
wr?MarkSequencePoint(sp.Offset, cue?get_SourceFile(), sp.Line, sp.Column, false)
|
||||
|
||||
// Walk through the tree of scopes and write all variables
|
||||
let rec writeScope (scope:PdbMethodScope) =
|
||||
wr?OpenScope(scope.StartOffset) |> ignore
|
||||
for local in scope.Locals do
|
||||
wr?DefineLocalVariable(local.Index, local.Name)
|
||||
for child in scope.Children do
|
||||
writeScope(child)
|
||||
wr?CloseScope(scope.EndOffset)
|
||||
writeScope(meth.RootScope)
|
||||
|
||||
// Finished generating debug information for the curretn method
|
||||
wr?CloseMethod()
|
||||
| _ -> ()
|
||||
|
||||
// Finalize - MDB requires the MVID of the generated .NET module
|
||||
let moduleGuid = new System.Guid(info.ModuleID |> Array.map byte)
|
||||
wr?WriteSymbolFile(moduleGuid)
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Dumps debug info into a text file for testing purposes
|
||||
//---------------------------------------------------------------------
|
||||
open Printf
|
||||
|
||||
let DumpDebugInfo (outfile:string) (info:PdbData) =
|
||||
use sw = new StreamWriter(outfile + ".debuginfo")
|
||||
|
||||
fprintfn sw "ENTRYPOINT\r\n %b\r\n" info.EntryPoint.IsSome
|
||||
fprintfn sw "DOCUMENTS"
|
||||
for i, doc in Seq.zip [0 .. info.Documents.Length-1] info.Documents do
|
||||
fprintfn sw " [%d] %s" i doc.File
|
||||
fprintfn sw " Type: %A" doc.DocumentType
|
||||
fprintfn sw " Language: %A" doc.Language
|
||||
fprintfn sw " Vendor: %A" doc.Vendor
|
||||
|
||||
// Sort methods (because they are sorted in PDBs/MDBs too)
|
||||
fprintfn sw "\r\nMETHODS"
|
||||
Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods
|
||||
for meth in info.Methods do
|
||||
fprintfn sw " %s" meth.MethName
|
||||
fprintfn sw " Params: %A" [ for p in meth.Params -> sprintf "%d: %s" p.Index p.Name ]
|
||||
fprintfn sw " Range: %A" (meth.Range |> Option.map (fun (f, t) ->
|
||||
sprintf "[%d,%d:%d] - [%d,%d:%d]" f.Document f.Line f.Column t.Document t.Line t.Column))
|
||||
fprintfn sw " Points:"
|
||||
|
||||
for sp in meth.SequencePoints do
|
||||
fprintfn sw " - Doc: %d Offset:%d [%d:%d]-[%d-%d]" sp.Document sp.Offset sp.Line sp.Column sp.EndLine sp.EndColumn
|
||||
|
||||
// Walk through the tree of scopes and write all variables
|
||||
fprintfn sw " Scopes:"
|
||||
let rec writeScope offs (scope:PdbMethodScope) =
|
||||
fprintfn sw " %s- [%d-%d]" offs scope.StartOffset scope.EndOffset
|
||||
if scope.Locals.Length > 0 then
|
||||
fprintfn sw " %s Locals: %A" offs [ for p in scope.Locals -> sprintf "%d: %s" p.Index p.Name ]
|
||||
for child in scope.Children do writeScope (offs + " ") child
|
||||
writeScope "" meth.RootScope
|
||||
fprintfn sw ""
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Strong name signing
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
type ILStrongNameSigner =
|
||||
| PublicKeySigner of Support.pubkey
|
||||
| PublicKeyOptionsSigner of Support.pubkeyOptions
|
||||
| KeyPair of Support.keyPair
|
||||
| KeyContainer of Support.keyContainerName
|
||||
|
||||
static member OpenPublicKeyFile s = PublicKeySigner(Support.signerOpenPublicKeyFile s)
|
||||
|
||||
static member OpenPublicKeyOptions s p = PublicKeyOptionsSigner((Support.signerOpenPublicKeyFile s), p)
|
||||
|
||||
static member OpenPublicKey pubkey = PublicKeySigner(pubkey)
|
||||
|
||||
static member OpenKeyPairFile s = KeyPair(Support.signerOpenKeyPairFile s)
|
||||
|
@ -497,29 +164,42 @@ type ILStrongNameSigner =
|
|||
member s.Close() =
|
||||
match s with
|
||||
| PublicKeySigner _
|
||||
| PublicKeyOptionsSigner _
|
||||
| KeyPair _ -> ()
|
||||
| KeyContainer containerName -> Support.signerCloseKeyContainer(containerName)
|
||||
|
||||
member s.IsFullySigned =
|
||||
match s with
|
||||
| PublicKeySigner _ -> false
|
||||
| PublicKeyOptionsSigner pko -> let _, usePublicSign = pko
|
||||
usePublicSign
|
||||
| KeyPair _ | KeyContainer _ -> true
|
||||
|
||||
member s.PublicKey =
|
||||
match s with
|
||||
| PublicKeySigner p -> p
|
||||
| PublicKeySigner pk -> pk
|
||||
| PublicKeyOptionsSigner pko -> let pk, _ = pko
|
||||
pk
|
||||
| KeyPair kp -> Support.signerGetPublicKeyForKeyPair kp
|
||||
| KeyContainer kn -> Support.signerGetPublicKeyForKeyContainer kn
|
||||
|
||||
member s.SignatureSize =
|
||||
try Support.signerSignatureSize(s.PublicKey)
|
||||
with e ->
|
||||
failwith ("A call to StrongNameSignatureSize failed ("+e.Message+")")
|
||||
0x80
|
||||
let pkSignatureSize pk =
|
||||
try Support.signerSignatureSize(pk)
|
||||
with e ->
|
||||
failwith ("A call to StrongNameSignatureSize failed ("+e.Message+")")
|
||||
0x80
|
||||
match s with
|
||||
| PublicKeySigner pk -> pkSignatureSize pk
|
||||
| PublicKeyOptionsSigner pko -> let pk, _ = pko
|
||||
pkSignatureSize pk
|
||||
| KeyPair kp -> pkSignatureSize (Support.signerGetPublicKeyForKeyPair kp)
|
||||
| KeyContainer kn -> pkSignatureSize (Support.signerGetPublicKeyForKeyContainer kn)
|
||||
|
||||
member s.SignFile file =
|
||||
match s with
|
||||
| PublicKeySigner _ -> ()
|
||||
| PublicKeyOptionsSigner _ -> ()
|
||||
| KeyPair kp -> Support.signerSignFileWithKeyPair file kp
|
||||
| KeyContainer kn -> Support.signerSignFileWithKeyContainer file kn
|
||||
|
||||
|
@ -743,10 +423,10 @@ type MemberRefRow(mrp:RowElement,nmIdx:StringIndex,blobIdx:BlobIndex) =
|
|||
// This environment keeps track of how many generic parameters are in scope.
|
||||
// This lets us translate AbsIL type variable number to IL type variable numbering
|
||||
type ILTypeWriterEnv = { EnclosingTyparCount: int }
|
||||
let envForTypeDef (td:ILTypeDef) = { EnclosingTyparCount=td.GenericParams.Length }
|
||||
let envForMethodRef env (typ:ILType) = { EnclosingTyparCount=(match typ with ILType.Array _ -> env.EnclosingTyparCount | _ -> typ.GenericArgs.Length) }
|
||||
let envForNonGenericMethodRef _mref = { EnclosingTyparCount=System.Int32.MaxValue }
|
||||
let envForFieldSpec (fspec:ILFieldSpec) = { EnclosingTyparCount=fspec.EnclosingType.GenericArgs.Length }
|
||||
let envForTypeDef (td:ILTypeDef) = { EnclosingTyparCount=td.GenericParams.Length }
|
||||
let envForMethodRef env (typ:ILType) = { EnclosingTyparCount=(match typ with ILType.Array _ -> env.EnclosingTyparCount | _ -> typ.GenericArgs.Length) }
|
||||
let envForNonGenericMethodRef _mref = { EnclosingTyparCount=System.Int32.MaxValue }
|
||||
let envForFieldSpec (fspec:ILFieldSpec) = { EnclosingTyparCount=fspec.EnclosingType.GenericArgs.Length }
|
||||
let envForOverrideSpec (ospec:ILOverridesSpec) = { EnclosingTyparCount=ospec.EnclosingType.GenericArgs.Length }
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
@ -2623,7 +2303,7 @@ let GenILMethodBody mname cenv env (il: ILMethodBody) =
|
|||
methbuf.EmitByte (byte codeSize <<< 2 ||| e_CorILMethod_TinyFormat)
|
||||
methbuf.EmitBytes code
|
||||
methbuf.EmitPadding codePadding
|
||||
(requiredStringFixups', methbuf.Close()), seqpoints, scopes
|
||||
0x0, (requiredStringFixups', methbuf.Close()), seqpoints, scopes
|
||||
else
|
||||
// Use Fat format
|
||||
let flags =
|
||||
|
@ -2697,7 +2377,7 @@ let GenILMethodBody mname cenv env (il: ILMethodBody) =
|
|||
|
||||
let requiredStringFixups' = (12,requiredStringFixups)
|
||||
|
||||
(requiredStringFixups', methbuf.Close()), seqpoints, scopes
|
||||
localToken, (requiredStringFixups', methbuf.Close()), seqpoints, scopes
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// ILFieldDef --> FieldDef Row
|
||||
|
@ -2912,13 +2592,14 @@ let GenMethodDefAsRow cenv env midx (md: ILMethodDef) =
|
|||
(match md.mdBody.Contents with
|
||||
| MethodBody.IL ilmbody ->
|
||||
let addr = cenv.nextCodeAddr
|
||||
let (code, seqpoints, rootScope) = GenILMethodBody md.Name cenv env ilmbody
|
||||
let (localToken, code, seqpoints, rootScope) = GenILMethodBody md.Name cenv env ilmbody
|
||||
|
||||
// Now record the PDB record for this method - we write this out later.
|
||||
if cenv.generatePdb then
|
||||
cenv.pdbinfo.Add
|
||||
{ MethToken=getUncodedToken TableNames.Method midx
|
||||
MethName=md.Name
|
||||
LocalSignatureToken=localToken
|
||||
Params= [| |] (* REVIEW *)
|
||||
RootScope = rootScope
|
||||
Range=
|
||||
|
@ -3229,10 +2910,9 @@ and GetManifsetAsAssemblyRow cenv m =
|
|||
// Setting these causes peverify errors. Hence both ilread and ilwrite ignore them and refuse to set them.
|
||||
// Any debugging customattributes will automatically propagate
|
||||
// REVIEW: No longer appears to be the case...
|
||||
(if m.JitTracking then 0x8000 else 0x0) |||
|
||||
(if m.DisableJitOptimizations then 0x4000 else 0x0) |||
|
||||
(match m.PublicKey with None -> 0x0000 | Some _ -> 0x0001) |||
|
||||
0x0000)
|
||||
(if m.JitTracking then 0x8000 else 0x0) |||
|
||||
(if m.DisableJitOptimizations then 0x4000 else 0x0) |||
|
||||
(match m.PublicKey with None -> 0x0000 | Some _ -> 0x0001) ||| 0x0000)
|
||||
(match m.PublicKey with None -> Blob 0 | Some x -> Blob (GetBytesAsBlobIdx cenv x))
|
||||
StringE (GetStringHeapIdx cenv m.Name)
|
||||
(match m.Locale with None -> StringE 0 | Some x -> StringE (GetStringHeapIdx cenv x)) |]
|
||||
|
@ -3285,6 +2965,8 @@ let SortTableRows tab (rows:IGenericRow[]) =
|
|||
else
|
||||
rows
|
||||
|
||||
let timestamp = absilWriteGetTimeStamp ()
|
||||
|
||||
let GenModule (cenv : cenv) (modul: ILModuleDef) =
|
||||
let midx = AddUnsharedRow cenv TableNames.Module (GetModuleAsRow cenv modul)
|
||||
List.iter (GenResourcePass3 cenv) modul.Resources.AsList
|
||||
|
@ -3356,9 +3038,11 @@ let generateIL requiredDataFixups (desiredMetadataVersion,generatePdb, ilg : ILG
|
|||
|
||||
let pdbData =
|
||||
{ EntryPoint= (if isDll then None else Some entryPointToken)
|
||||
Timestamp = timestamp
|
||||
ModuleID = cenv.moduleGuid
|
||||
Documents = cenv.documents.EntriesAsArray
|
||||
Methods= cenv.pdbinfo.ToArray() }
|
||||
Methods = cenv.pdbinfo.ToArray()
|
||||
TableRowCounts = cenv.tables |> Seq.map(fun t -> t.Count) |> Seq.toArray }
|
||||
|
||||
let idxForNextedTypeDef (tds:ILTypeDef list, td:ILTypeDef) =
|
||||
let enc = tds |> List.map (fun td -> td.Name)
|
||||
|
@ -3396,7 +3080,6 @@ let generateIL requiredDataFixups (desiredMetadataVersion,generatePdb, ilg : ILG
|
|||
//=====================================================================
|
||||
// TABLES+BLOBS --> PHYSICAL METADATA+BLOBS
|
||||
//=====================================================================
|
||||
|
||||
type BinaryChunk =
|
||||
{ size: int32
|
||||
addr: int32 }
|
||||
|
@ -3409,9 +3092,13 @@ let count f arr =
|
|||
|
||||
module FileSystemUtilites =
|
||||
open System.Reflection
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
open Microsoft.FSharp.Core.ReflectionAdapters
|
||||
#endif
|
||||
let progress = try System.Environment.GetEnvironmentVariable("FSharp_DebugSetFilePermissions") <> null with _ -> false
|
||||
let setExecutablePermission filename =
|
||||
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
if runningOnMono then
|
||||
try
|
||||
let monoPosix = Assembly.Load("Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756")
|
||||
|
@ -3424,7 +3111,12 @@ module FileSystemUtilites =
|
|||
with e ->
|
||||
if progress then eprintf "failure: %s...\n" (e.ToString())
|
||||
// Fail silently
|
||||
|
||||
else
|
||||
#else
|
||||
ignore filename
|
||||
#endif
|
||||
()
|
||||
|
||||
let writeILMetadataAndCode (generatePdb,desiredMetadataVersion,ilg,emitTailcalls,showTimes) modul noDebugData cilStartAddress =
|
||||
|
||||
// When we know the real RVAs of the data section we fixup the references for the FieldRVA table.
|
||||
|
@ -3648,9 +3340,9 @@ let writeILMetadataAndCode (generatePdb,desiredMetadataVersion,ilg,emitTailcalls
|
|||
codedBigness 2 TableNames.ModuleRef ||
|
||||
codedBigness 2 TableNames.AssemblyRef ||
|
||||
codedBigness 2 TableNames.TypeRef
|
||||
|
||||
|
||||
let tablesBuf = ByteBuffer.Create 20000
|
||||
|
||||
|
||||
// Now the coded tables themselves - first the schemata header
|
||||
tablesBuf.EmitIntsAsBytes
|
||||
[| 0x00; 0x00; 0x00; 0x00;
|
||||
|
@ -3658,7 +3350,7 @@ let writeILMetadataAndCode (generatePdb,desiredMetadataVersion,ilg,emitTailcalls
|
|||
mdtableVersionMinor // minor version of table schemata
|
||||
|
||||
((if stringsBig then 0x01 else 0x00) ||| // bit vector for heap size
|
||||
(if guidsBig then 0x02 else 0x00) |||
|
||||
(if guidsBig then 0x02 else 0x00) |||
|
||||
(if blobsBig then 0x04 else 0x00))
|
||||
0x01 (* reserved, always 1 *) |]
|
||||
|
||||
|
@ -3814,8 +3506,6 @@ let writeILMetadataAndCode (generatePdb,desiredMetadataVersion,ilg,emitTailcalls
|
|||
|
||||
entryPointToken,code, codePadding,metadata,data,resources,!requiredDataFixups,pdbData,mappings
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// PHYSICAL METADATA+BLOBS --> PHYSICAL PE FORMAT
|
||||
//---------------------------------------------------------------------
|
||||
|
@ -3874,7 +3564,8 @@ let writeDirectory os dict =
|
|||
|
||||
let writeBytes (os: BinaryWriter) (chunk:byte[]) = os.Write(chunk,0,chunk.Length)
|
||||
|
||||
let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: ILStrongNameSigner option, fixupOverlappingSequencePoints, emitTailcalls, showTimes, dumpDebugInfo) modul noDebugData =
|
||||
let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: ILStrongNameSigner option, portablePDB,
|
||||
fixupOverlappingSequencePoints, emitTailcalls, showTimes, dumpDebugInfo) modul noDebugData =
|
||||
// Store the public key from the signer into the manifest. This means it will be written
|
||||
// to the binary and also acts as an indicator to leave space for delay sign
|
||||
|
||||
|
@ -3913,17 +3604,18 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer:
|
|||
end;
|
||||
{ modul with Manifest = match modul.Manifest with None -> None | Some m -> Some {m with PublicKey = pubkey} }
|
||||
|
||||
let timestamp = absilWriteGetTimeStamp ()
|
||||
|
||||
let os =
|
||||
try
|
||||
try
|
||||
// Ensure the output directory exists otherwise it will fail
|
||||
let dir = Path.GetDirectoryName(outfile)
|
||||
if not (Directory.Exists(dir)) then Directory.CreateDirectory(dir) |>ignore
|
||||
new BinaryWriter(FileSystem.FileStreamCreateShim(outfile))
|
||||
with e ->
|
||||
failwith ("Could not open file for writing (binary mode): " + outfile)
|
||||
|
||||
let pdbData,debugDirectoryChunk,debugDataChunk,textV2P,mappings =
|
||||
let pdbData,debugDirectoryChunk,debugDataChunk,textV2P,mappings =
|
||||
try
|
||||
|
||||
|
||||
let imageBaseReal = modul.ImageBase // FIXED CHOICE
|
||||
let alignVirt = modul.VirtualAlignment // FIXED CHOICE
|
||||
let alignPhys = modul.PhysicalAlignment // FIXED CHOICE
|
||||
|
@ -3934,7 +3626,6 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer:
|
|||
|
||||
|
||||
// HEADERS
|
||||
|
||||
let next = 0x0
|
||||
let headerSectionPhysLoc = 0x0
|
||||
let headerAddr = next
|
||||
|
@ -4054,15 +3745,22 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer:
|
|||
match modul.NativeResources with
|
||||
| [] -> [||]
|
||||
| resources ->
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
if runningOnMono then
|
||||
[||]
|
||||
else
|
||||
#endif
|
||||
#if FX_NO_LINKEDRESOURCES
|
||||
ignore resources
|
||||
ignore resourceFormat
|
||||
[||]
|
||||
#else
|
||||
let unlinkedResources = List.map Lazy.force resources
|
||||
begin
|
||||
try linkNativeResources unlinkedResources next resourceFormat (Path.GetDirectoryName(outfile))
|
||||
with e -> failwith ("Linking a native resource failed: "+e.Message+"")
|
||||
end
|
||||
|
||||
#endif
|
||||
let nativeResourcesSize = nativeResources.Length
|
||||
|
||||
let nativeResourcesChunk,next = chunk nativeResourcesSize next
|
||||
|
@ -4272,14 +3970,14 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer:
|
|||
writeInt32 os textSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x00009584
|
||||
writeInt32 os textSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x00020000
|
||||
writeInt32 os textSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. 0x00009600
|
||||
writeInt32 os textSectionPhysLoc // PointerToRawData RVA to section’s first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 00000200
|
||||
writeInt32 os textSectionPhysLoc // PointerToRawData RVA to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 00000200
|
||||
// 00000190
|
||||
writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section.
|
||||
writeInt32 os 0x00 // PointerToLinenumbers Always 0 (see Section 23.1).
|
||||
// 00000198
|
||||
writeInt32AsUInt16 os 0x00// NumberOfRelocations Number of relocations, set to 0 if unused.
|
||||
writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1).
|
||||
writeBytes os [| 0x20uy; 0x00uy; 0x00uy; 0x60uy |] // Characteristics Flags describing section’s characteristics, see below. IMAGE_SCN_CNT_CODE || IMAGE_SCN_MEM_EXECUTE || IMAGE_SCN_MEM_READ
|
||||
writeBytes os [| 0x20uy; 0x00uy; 0x00uy; 0x60uy |] // Characteristics Flags describing section's characteristics, see below. IMAGE_SCN_CNT_CODE || IMAGE_SCN_MEM_EXECUTE || IMAGE_SCN_MEM_READ
|
||||
|
||||
write (Some dataSectionHeaderChunk.addr) os "data section header" [| |]
|
||||
|
||||
|
@ -4290,7 +3988,7 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer:
|
|||
writeInt32 os dataSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x0000c000
|
||||
// 000001b0
|
||||
writeInt32 os dataSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. e.g. 0x00000200
|
||||
writeInt32 os dataSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section’s first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 0x00009800
|
||||
writeInt32 os dataSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 0x00009800
|
||||
// 000001b8
|
||||
writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section.
|
||||
writeInt32 os 0x00 // PointerToLinenumbers Always 0 (see Section 23.1).
|
||||
|
@ -4306,7 +4004,7 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer:
|
|||
writeInt32 os relocSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x0000c000
|
||||
// 000001b0
|
||||
writeInt32 os relocSectionPhysSize // SizeOfRawData Size of the initialized reloc on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00000200
|
||||
writeInt32 os relocSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section’s first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00009800
|
||||
writeInt32 os relocSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00009800
|
||||
// 000001b8
|
||||
writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section.
|
||||
writeInt32 os 0x00 // PointerToLinenumbers Always 0 (see Section 23.1).
|
||||
|
@ -4369,7 +4067,7 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer:
|
|||
// write 0x80 bytes of empty space for encrypted SHA1 hash, written by SN.EXE or call to signing API
|
||||
if signer <> None then
|
||||
write (Some (textV2P strongnameChunk.addr)) os "strongname" (Array.create strongnameChunk.size 0x0uy)
|
||||
|
||||
|
||||
write (Some (textV2P resourcesChunk.addr)) os "raw resources" [| |]
|
||||
writeBytes os resources
|
||||
write (Some (textV2P rawdataChunk.addr)) os "raw data" [| |]
|
||||
|
@ -4427,11 +4125,14 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer:
|
|||
writePadding os "end of .text" (dataSectionPhysLoc - textSectionPhysLoc - textSectionSize)
|
||||
|
||||
// DATA SECTION
|
||||
#if FX_NO_LINKEDRESOURCES
|
||||
#else
|
||||
match nativeResources with
|
||||
| [||] -> ()
|
||||
| resources ->
|
||||
write (Some (dataSectionVirtToPhys nativeResourcesChunk.addr)) os "raw native resources" [| |]
|
||||
writeBytes os resources
|
||||
#endif
|
||||
|
||||
if dummydatap.size <> 0x0 then
|
||||
write (Some (dataSectionVirtToPhys dummydatap.addr)) os "dummy data" [| 0x0uy |]
|
||||
|
@ -4461,74 +4162,76 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer:
|
|||
b0 reloc2; b1 reloc2; |]
|
||||
writePadding os "end of .reloc" (imageEndSectionPhysLoc - relocSectionPhysLoc - relocSectionSize)
|
||||
|
||||
os.Close()
|
||||
os.Dispose()
|
||||
|
||||
try
|
||||
FileSystemUtilites.setExecutablePermission outfile
|
||||
with _ ->
|
||||
()
|
||||
pdbData,debugDirectoryChunk,debugDataChunk,textV2P,mappings
|
||||
|
||||
// Looks like a finally...
|
||||
|
||||
// Looks like a finally
|
||||
with e ->
|
||||
(try
|
||||
os.Close()
|
||||
os.Dispose()
|
||||
FileSystem.FileDelete outfile
|
||||
with _ -> ())
|
||||
reraise()
|
||||
|
||||
|
||||
reportTime showTimes "Writing Image"
|
||||
|
||||
if dumpDebugInfo then
|
||||
DumpDebugInfo outfile pdbData
|
||||
|
||||
if dumpDebugInfo then logDebugInfo outfile pdbData
|
||||
|
||||
// Now we've done the bulk of the binary, do the PDB file and fixup the binary.
|
||||
begin match pdbfile with
|
||||
| None -> ()
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
| Some fmdb when runningOnMono ->
|
||||
WriteMdbInfo fmdb outfile pdbData
|
||||
|
||||
writeMdbInfo fmdb outfile pdbData
|
||||
#endif
|
||||
| Some fpdb ->
|
||||
try
|
||||
let idd = WritePdbInfo fixupOverlappingSequencePoints showTimes outfile fpdb pdbData
|
||||
let idd =
|
||||
#if FX_NO_PDB_WRITER
|
||||
ignore portablePDB
|
||||
writePortablePdbInfo fixupOverlappingSequencePoints showTimes fpdb pdbData
|
||||
#else
|
||||
if portablePDB then
|
||||
writePortablePdbInfo fixupOverlappingSequencePoints showTimes fpdb pdbData
|
||||
else
|
||||
writePdbInfo fixupOverlappingSequencePoints showTimes outfile fpdb pdbData
|
||||
#endif
|
||||
reportTime showTimes "Generate PDB Info"
|
||||
|
||||
// Now we have the debug data we can go back and fill in the debug directory in the image
|
||||
|
||||
// Now we have the debug data we can go back and fill in the debug directory in the image
|
||||
let fs2 = FileSystem.FileStreamWriteExistingShim(outfile)
|
||||
let os2 = new BinaryWriter(fs2)
|
||||
try
|
||||
// write the IMAGE_DEBUG_DIRECTORY
|
||||
os2.BaseStream.Seek (int64 (textV2P debugDirectoryChunk.addr), SeekOrigin.Begin) |> ignore
|
||||
writeInt32 os2 idd.iddCharacteristics // IMAGE_DEBUG_DIRECTORY.Characteristics
|
||||
writeInt32 os2 idd.iddCharacteristics // IMAGE_DEBUG_DIRECTORY.Characteristics
|
||||
writeInt32 os2 timestamp
|
||||
writeInt32AsUInt16 os2 idd.iddMajorVersion
|
||||
writeInt32AsUInt16 os2 idd.iddMinorVersion
|
||||
writeInt32 os2 idd.iddType
|
||||
writeInt32 os2 idd.iddData.Length // IMAGE_DEBUG_DIRECTORY.SizeOfData
|
||||
writeInt32 os2 debugDataChunk.addr // IMAGE_DEBUG_DIRECTORY.AddressOfRawData
|
||||
writeInt32 os2 (textV2P debugDataChunk.addr)// IMAGE_DEBUG_DIRECTORY.PointerToRawData
|
||||
writeInt32 os2 idd.iddData.Length // IMAGE_DEBUG_DIRECTORY.SizeOfData
|
||||
writeInt32 os2 debugDataChunk.addr // IMAGE_DEBUG_DIRECTORY.AddressOfRawData
|
||||
writeInt32 os2 (textV2P debugDataChunk.addr) // IMAGE_DEBUG_DIRECTORY.PointerToRawData
|
||||
|
||||
(* dprintf "idd.iddCharacteristics = %ld\n" idd.iddCharacteristics
|
||||
dprintf "iddMajorVersion = %ld\n" idd.iddMajorVersion
|
||||
dprintf "iddMinorVersion = %ld\n" idd.iddMinorVersion
|
||||
dprintf "iddType = %ld\n" idd.iddType
|
||||
dprintf "iddData = (%A) = %s\n" idd.iddData (System.Text.Encoding.UTF8.GetString idd.iddData) *)
|
||||
|
||||
// write the debug raw data as given us by the PDB writer
|
||||
os2.BaseStream.Seek (int64 (textV2P debugDataChunk.addr), SeekOrigin.Begin) |> ignore
|
||||
if debugDataChunk.size < idd.iddData.Length then
|
||||
failwith "Debug data area is not big enough. Debug info may not be usable"
|
||||
if debugDataChunk.size < idd.iddData.Length then failwith "Debug data area is not big enough. Debug info may not be usable"
|
||||
writeBytes os2 idd.iddData
|
||||
os2.Close()
|
||||
os2.Dispose()
|
||||
with e ->
|
||||
failwith ("Error while writing debug directory entry: "+e.Message)
|
||||
(try os2.Close(); FileSystem.FileDelete outfile with _ -> ())
|
||||
(try os2.Dispose(); FileSystem.FileDelete outfile with _ -> ())
|
||||
reraise()
|
||||
with e ->
|
||||
reraise()
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
ignore debugDataChunk
|
||||
reportTime showTimes "Finalize PDB"
|
||||
|
||||
/// Sign the binary. No further changes to binary allowed past this point!
|
||||
|
@ -4539,20 +4242,20 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer:
|
|||
s.SignFile outfile
|
||||
s.Close()
|
||||
with e ->
|
||||
failwith ("Warning: A call to StrongNameSignatureGeneration failed ("+e.Message+")")
|
||||
failwith ("Warning: A call to SignFile failed ("+e.Message+")")
|
||||
(try s.Close() with _ -> ())
|
||||
(try FileSystem.FileDelete outfile with _ -> ())
|
||||
()
|
||||
|
||||
reportTime showTimes "Signing Image"
|
||||
//Finished writing and signing the binary and debug info...
|
||||
|
||||
mappings
|
||||
|
||||
|
||||
type options =
|
||||
{ ilg: ILGlobals
|
||||
{ ilg: ILGlobals;
|
||||
pdbfile: string option
|
||||
portablePDB: bool
|
||||
signer: ILStrongNameSigner option
|
||||
fixupOverlappingSequencePoints: bool
|
||||
emitTailcalls : bool
|
||||
|
@ -4560,6 +4263,7 @@ type options =
|
|||
dumpDebugInfo:bool }
|
||||
|
||||
|
||||
let WriteILBinary (outfile, args, ilModule, noDebugData) =
|
||||
ignore (writeBinaryAndReportMappings (outfile, args.ilg, args.pdbfile, args.signer, args.fixupOverlappingSequencePoints, args.emitTailcalls, args.showTimes, args.dumpDebugInfo) ilModule noDebugData)
|
||||
|
||||
let WriteILBinary (outfile, (args: options), modul, noDebugData) =
|
||||
ignore (writeBinaryAndReportMappings (outfile, args.ilg, args.pdbfile, args.signer, args.portablePDB,
|
||||
args.fixupOverlappingSequencePoints, args.emitTailcalls, args.showTimes,
|
||||
args.dumpDebugInfo) modul noDebugData)
|
||||
|
|
|
@ -10,22 +10,20 @@ open Microsoft.FSharp.Compiler.AbstractIL.IL
|
|||
[<Sealed>]
|
||||
type ILStrongNameSigner =
|
||||
member PublicKey: byte[]
|
||||
static member OpenPublicKeyFile: string -> ILStrongNameSigner
|
||||
static member OpenPublicKeyOptions: string -> bool -> ILStrongNameSigner
|
||||
static member OpenPublicKey: byte[] -> ILStrongNameSigner
|
||||
static member OpenKeyPairFile: string -> ILStrongNameSigner
|
||||
static member OpenKeyContainer: string -> ILStrongNameSigner
|
||||
|
||||
type options =
|
||||
{ ilg: ILGlobals
|
||||
pdbfile: string option
|
||||
signer : ILStrongNameSigner option
|
||||
fixupOverlappingSequencePoints : bool
|
||||
emitTailcalls: bool
|
||||
showTimes : bool
|
||||
dumpDebugInfo : bool }
|
||||
{ ilg: ILGlobals
|
||||
pdbfile: string option
|
||||
portablePDB: bool
|
||||
signer : ILStrongNameSigner option
|
||||
fixupOverlappingSequencePoints : bool
|
||||
emitTailcalls: bool
|
||||
showTimes : bool
|
||||
dumpDebugInfo : bool }
|
||||
|
||||
/// Write a binary to the file system. Extra configuration parameters can also be specified.
|
||||
val WriteILBinary: filename: string * options: options * input: ILModuleDef * noDebugData: bool -> unit
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,633 @@
|
|||
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
module internal Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter
|
||||
|
||||
open System
|
||||
open System.Collections.Generic
|
||||
open System.Collections.Immutable
|
||||
open System.IO
|
||||
open System.Reflection
|
||||
open System.Reflection.Metadata
|
||||
open System.Reflection.Metadata.Ecma335
|
||||
open System.Reflection.Metadata.Ecma335.Blobs
|
||||
open System.Reflection.PortableExecutable
|
||||
open Internal.Utilities
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.IL
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Support
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library
|
||||
open Microsoft.FSharp.Compiler.ErrorLogger
|
||||
open Microsoft.FSharp.Compiler.Range
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// PDB types
|
||||
// --------------------------------------------------------------------
|
||||
type PdbDocumentData = ILSourceDocument
|
||||
|
||||
type PdbLocalVar =
|
||||
{ Name: string
|
||||
Signature: byte[]
|
||||
/// the local index the name corresponds to
|
||||
Index: int32 }
|
||||
|
||||
type PdbMethodScope =
|
||||
{ Children: PdbMethodScope array
|
||||
StartOffset: int
|
||||
EndOffset: int
|
||||
Locals: PdbLocalVar array
|
||||
(* REVIEW open_namespaces: pdb_namespace array *) }
|
||||
|
||||
type PdbSourceLoc =
|
||||
{ Document: int
|
||||
Line: int
|
||||
Column: int }
|
||||
|
||||
type PdbSequencePoint =
|
||||
{ Document: int
|
||||
Offset: int
|
||||
Line: int
|
||||
Column: int
|
||||
EndLine: int
|
||||
EndColumn: int }
|
||||
override x.ToString() = sprintf "(%d,%d)-(%d,%d)" x.Line x.Column x.EndLine x.EndColumn
|
||||
|
||||
type PdbMethodData =
|
||||
{ MethToken: int32
|
||||
MethName:string
|
||||
LocalSignatureToken: int32
|
||||
Params: PdbLocalVar array
|
||||
RootScope: PdbMethodScope
|
||||
Range: (PdbSourceLoc * PdbSourceLoc) option
|
||||
SequencePoints: PdbSequencePoint array }
|
||||
|
||||
module SequencePoint =
|
||||
let orderBySource sp1 sp2 =
|
||||
let c1 = compare sp1.Document sp2.Document
|
||||
if c1 <> 0 then
|
||||
c1
|
||||
else
|
||||
let c1 = compare sp1.Line sp2.Line
|
||||
if c1 <> 0 then
|
||||
c1
|
||||
else
|
||||
compare sp1.Column sp2.Column
|
||||
|
||||
let orderByOffset sp1 sp2 =
|
||||
compare sp1.Offset sp2.Offset
|
||||
|
||||
/// 28 is the size of the IMAGE_DEBUG_DIRECTORY in ntimage.h
|
||||
let sizeof_IMAGE_DEBUG_DIRECTORY = 28
|
||||
|
||||
[<NoEquality; NoComparison>]
|
||||
type PdbData =
|
||||
{ EntryPoint: int32 option
|
||||
Timestamp: int32
|
||||
ModuleID: byte[]
|
||||
Documents: PdbDocumentData[]
|
||||
Methods: PdbMethodData[]
|
||||
TableRowCounts: int[] }
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Portable PDB Writer
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
type idd =
|
||||
{ iddCharacteristics: int32;
|
||||
iddMajorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *)
|
||||
iddMinorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *)
|
||||
iddType: int32;
|
||||
iddData: byte[];}
|
||||
|
||||
let magicNumber = 0x53445352L
|
||||
let pdbGetDebugInfo (mvid:byte[]) (filepath:string) =
|
||||
let iddDataBuffer =
|
||||
let path = (System.Text.Encoding.UTF8.GetBytes filepath)
|
||||
let buffer = Array.zeroCreate (sizeof<int32> + mvid.Length + sizeof<int32> + path.Length + 1)
|
||||
|
||||
let offset, size = 0, sizeof<int32> // Magic Number RSDS dword: 0x53445352L
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(magicNumber), 0, buffer, offset, size)
|
||||
|
||||
let offset, size = offset + size, mvid.Length // mvid Guid
|
||||
Buffer.BlockCopy(mvid, 0, buffer, offset, size)
|
||||
|
||||
let offset, size = offset + size, sizeof<int32> // # of pdb files generated (1)
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(1), 0, buffer, offset, size)
|
||||
|
||||
let offset = offset + size // Path to pdb string
|
||||
Buffer.BlockCopy(path, 0, buffer, offset, path.Length)
|
||||
buffer
|
||||
|
||||
{ iddCharacteristics = 0x0; // Reserved
|
||||
iddMajorVersion = 0x0; // VersionMajor should be 0
|
||||
iddMinorVersion = 0x0; // VersionMinor should be 0
|
||||
iddType = 0x2; // IMAGE_DEBUG_TYPE_CODEVIEW
|
||||
iddData = iddDataBuffer } // Path name to the pdb file when built
|
||||
|
||||
// Document checksum algorithms
|
||||
let guidSourceHashMD5 = System.Guid(0x406ea660u, 0x64cfus, 0x4c82us, 0xb6uy, 0xf0uy, 0x42uy, 0xd4uy, 0x81uy, 0x72uy, 0xa7uy, 0x99uy) //406ea660-64cf-4c82-b6f0-42d48172a799
|
||||
let hashSizeOfMD5 = 16
|
||||
|
||||
// If the FIPS algorithm policy is enabled on the computer (e.g., for US government employees and contractors)
|
||||
// then obtaining the MD5 implementation in BCL will throw.
|
||||
// In this case, catch the failure, and not set a checksum.
|
||||
let checkSum (url:string) =
|
||||
try
|
||||
use file = FileSystem.FileStreamReadShim(url)
|
||||
use md5 = System.Security.Cryptography.MD5.Create()
|
||||
let checkSum = md5.ComputeHash(file)
|
||||
Some (guidSourceHashMD5, checkSum)
|
||||
with _ -> None
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// PDB Writer. The function [WritePdbInfo] abstracts the
|
||||
// imperative calls to the Symbol Writer API.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// This function takes output file name and returns debug file name.
|
||||
let getDebugFileName outfile =
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
if IL.runningOnMono then
|
||||
outfile + ".mdb"
|
||||
else
|
||||
#endif
|
||||
(Filename.chopExtension outfile) + ".pdb"
|
||||
|
||||
let sortMethods showTimes info =
|
||||
reportTime showTimes (sprintf "PDB: Defined %d documents" info.Documents.Length)
|
||||
Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods
|
||||
reportTime showTimes (sprintf "PDB: Sorted %d methods" info.Methods.Length)
|
||||
()
|
||||
|
||||
let getRowCounts tableRowCounts =
|
||||
let builder = ImmutableArray.CreateBuilder<int>(tableRowCounts |> Array.length)
|
||||
tableRowCounts |> Seq.iter(fun x -> builder.Add(x))
|
||||
builder.MoveToImmutable()
|
||||
|
||||
let fixupOverlappingSequencePoints fixupSPs showTimes methods =
|
||||
// This next bit is a workaround. The sequence points we get
|
||||
// from F# (which has nothing to do with this module) are actually expression
|
||||
// marks, i.e. the source ranges they denote are typically
|
||||
// nested, and each point indicates where the
|
||||
// code for an expression with a particular range begins.
|
||||
// This is in many ways a much more convenient form to emit.
|
||||
// However, it is not the form that debug tools accept nicely.
|
||||
// However, sequence points are really a non-overlapping, non-nested
|
||||
// partition of the source code of a method. So here we shorten the
|
||||
// length of all sequence point marks so they do not go further than
|
||||
// the next sequence point in the source.
|
||||
let spCounts = methods |> Array.map (fun x -> x.SequencePoints.Length)
|
||||
let allSps = methods |> Array.map (fun x -> x.SequencePoints)
|
||||
|> Array.concat
|
||||
|> Array.mapi (fun i sp -> i, sp)
|
||||
if fixupSPs then
|
||||
// sort the sequence points into source order
|
||||
Array.sortInPlaceWith (fun (_,sp1) (_,sp2) -> SequencePoint.orderBySource sp1 sp2) allSps
|
||||
// shorten the ranges of any that overlap with following sequence points
|
||||
// sort the sequence points back into offset order
|
||||
for i = 0 to Array.length allSps - 2 do
|
||||
let n,sp1 = allSps.[i]
|
||||
let _,sp2 = allSps.[i+1]
|
||||
if (sp1.Document = sp2.Document) &&
|
||||
(sp1.EndLine > sp2.Line ||
|
||||
(sp1.EndLine = sp2.Line &&
|
||||
sp1.EndColumn >= sp2.Column)) then
|
||||
let adjustToPrevLine = (sp1.Line < sp2.Line)
|
||||
allSps.[i] <- n,{sp1 with EndLine = (if adjustToPrevLine then sp2.Line-1 else sp2.Line)
|
||||
EndColumn = (if adjustToPrevLine then 80 else sp2.Column) }
|
||||
reportTime showTimes (sprintf "PDB: fixupOverlappingSequencePoints %d" (allSps |> Array.length) )
|
||||
Array.sortInPlaceBy fst allSps
|
||||
spCounts, allSps
|
||||
|
||||
let writePortablePdbInfo (fixupSPs:bool) showTimes fpdb (info:PdbData) =
|
||||
|
||||
try FileSystem.FileDelete fpdb with _ -> ()
|
||||
|
||||
sortMethods showTimes info
|
||||
let _spCounts, _allSps = fixupOverlappingSequencePoints fixupSPs showTimes info.Methods
|
||||
let externalRowCounts = getRowCounts info.TableRowCounts
|
||||
let docs =
|
||||
if info.Documents = null then
|
||||
Array.empty<PdbDocumentData>
|
||||
else
|
||||
info.Documents
|
||||
|
||||
let metadata = MetadataBuilder()
|
||||
let serializeDocumentName (name:string) =
|
||||
let count s c = s |> Seq.filter(fun ch -> if c = ch then true else false) |> Seq.length
|
||||
|
||||
let s1, s2 = '/', '\\'
|
||||
let separator = if (count name s1) >= (count name s2) then s1 else s2
|
||||
|
||||
let writer = new BlobBuilder()
|
||||
writer.WriteByte(byte(separator))
|
||||
|
||||
for part in name.Split( [| separator |] ) do
|
||||
let partIndex = MetadataTokens.GetHeapOffset(BlobHandle.op_Implicit(metadata.GetBlobUtf8(part)))
|
||||
writer.WriteCompressedInteger(int(partIndex))
|
||||
|
||||
metadata.GetBlob(writer);
|
||||
|
||||
let corSymLanguageTypeFSharp = System.Guid(0xAB4F38C9u, 0xB6E6us, 0x43baus, 0xBEuy, 0x3Buy, 0x58uy, 0x08uy, 0x0Buy, 0x2Cuy, 0xCCuy, 0xE3uy)
|
||||
let documentIndex =
|
||||
let mutable index = new Dictionary<string, DocumentHandle>(docs.Length)
|
||||
metadata.SetCapacity(TableIndex.Document, docs.Length)
|
||||
for doc in docs do
|
||||
let handle =
|
||||
match checkSum doc.File with
|
||||
| Some (hashAlg, checkSum) ->
|
||||
serializeDocumentName doc.File,
|
||||
metadata.GetGuid(hashAlg),
|
||||
metadata.GetBlob(checkSum.ToImmutableArray()),
|
||||
metadata.GetGuid(corSymLanguageTypeFSharp)
|
||||
| None ->
|
||||
serializeDocumentName doc.File,
|
||||
metadata.GetGuid(System.Guid.Empty),
|
||||
metadata.GetBlob(ImmutableArray<byte>.Empty),
|
||||
metadata.GetGuid(corSymLanguageTypeFSharp)
|
||||
|> metadata.AddDocument
|
||||
index.Add(doc.File, handle)
|
||||
index
|
||||
|
||||
metadata.SetCapacity(TableIndex.MethodDebugInformation, info.Methods.Length)
|
||||
info.Methods |> Array.iteri (fun _i minfo ->
|
||||
let docHandle, sequencePointBlob =
|
||||
let sps =
|
||||
if minfo.SequencePoints = null then
|
||||
Array.empty<PdbSequencePoint>
|
||||
else
|
||||
match minfo.Range with
|
||||
| None -> Array.empty<PdbSequencePoint>
|
||||
| Some (_,_) -> minfo.SequencePoints
|
||||
|
||||
let getDocumentHandle d =
|
||||
if docs.Length = 0 || d < 0 || d > docs.Length then
|
||||
Unchecked.defaultof<DocumentHandle>
|
||||
else
|
||||
match documentIndex.TryGetValue(docs.[d].File) with
|
||||
| false, _ -> Unchecked.defaultof<DocumentHandle>
|
||||
| true, f -> f
|
||||
|
||||
// Return a document that the entire method body is declared within.
|
||||
// If part of the method body is in another document returns nil handle.
|
||||
let tryGetSingleDocumentIndex =
|
||||
let mutable singleDocumentIndex = 0
|
||||
for i in 1 .. sps.Length - 1 do
|
||||
let index = sps.[i].Document
|
||||
if index <> singleDocumentIndex then
|
||||
singleDocumentIndex <- index
|
||||
singleDocumentIndex
|
||||
|
||||
if sps.Length = 0 then
|
||||
Unchecked.defaultof<DocumentHandle>, Unchecked.defaultof<BlobHandle>
|
||||
else
|
||||
let builder = new BlobBuilder()
|
||||
builder.WriteCompressedInteger(minfo.LocalSignatureToken)
|
||||
|
||||
let mutable previousNonHiddenStartLine = -1
|
||||
let mutable previousNonHiddenStartColumn = -1
|
||||
let mutable previousDocumentIndex = -1
|
||||
let mutable singleDocumentIndex = tryGetSingleDocumentIndex
|
||||
let mutable currentDocumentIndex = previousDocumentIndex
|
||||
|
||||
for i in 0 .. (sps.Length - 1) do
|
||||
|
||||
if previousDocumentIndex <> currentDocumentIndex then
|
||||
// optional document in header or document record:
|
||||
if previousDocumentIndex <> -1 then
|
||||
// optional document in header or document record
|
||||
builder.WriteCompressedInteger(0)
|
||||
builder.WriteCompressedInteger(currentDocumentIndex)
|
||||
previousDocumentIndex <- currentDocumentIndex
|
||||
|
||||
// delta IL offset:
|
||||
if i > 0 then
|
||||
builder.WriteCompressedInteger(sps.[i].Offset - sps.[i - 1].Offset)
|
||||
else
|
||||
builder.WriteCompressedInteger(sps.[i].Offset)
|
||||
|
||||
// F# does not support hidden sequence points yet !!!
|
||||
// if (sequencePoints[i].IsHidden)
|
||||
// {
|
||||
// builder.WriteInt16(0);
|
||||
// continue;
|
||||
// }
|
||||
|
||||
let deltaLines = sps.[i].EndLine - sps.[i].Line;
|
||||
let deltaColumns = sps.[i].EndColumn - sps.[i].Column;
|
||||
builder.WriteCompressedInteger(deltaLines);
|
||||
|
||||
if deltaLines = 0 then
|
||||
builder.WriteCompressedInteger(deltaColumns)
|
||||
else
|
||||
builder.WriteCompressedSignedInteger(deltaColumns)
|
||||
|
||||
// delta Start Lines & Columns:
|
||||
if previousNonHiddenStartLine < 0 then
|
||||
builder.WriteCompressedInteger(sps.[i].Line)
|
||||
builder.WriteCompressedInteger(sps.[i].Column)
|
||||
else
|
||||
builder.WriteCompressedSignedInteger(sps.[i].Line - previousNonHiddenStartLine)
|
||||
builder.WriteCompressedSignedInteger(sps.[i].Column - previousNonHiddenStartColumn)
|
||||
|
||||
previousNonHiddenStartLine <- sps.[i].Line
|
||||
previousNonHiddenStartColumn <- sps.[i].Column
|
||||
|
||||
getDocumentHandle singleDocumentIndex, metadata.GetBlob(builder)
|
||||
|
||||
// Write the scopes
|
||||
let mutable lastLocalVariableHandle = Unchecked.defaultof<LocalVariableHandle>
|
||||
let nextHandle handle = MetadataTokens.LocalVariableHandle(MetadataTokens.GetRowNumber(LocalVariableHandle.op_Implicit(handle)) + 1)
|
||||
let rec writePdbScope top scope =
|
||||
if top || scope.Locals.Length <> 0 || scope.Children.Length <> 0 then
|
||||
lastLocalVariableHandle <- nextHandle lastLocalVariableHandle
|
||||
metadata.AddLocalScope(MetadataTokens.MethodDefinitionHandle(minfo.MethToken),
|
||||
Unchecked.defaultof<ImportScopeHandle>,
|
||||
lastLocalVariableHandle,
|
||||
Unchecked.defaultof<LocalConstantHandle>,
|
||||
scope.StartOffset,
|
||||
scope.EndOffset - scope.StartOffset) |>ignore
|
||||
for localVariable in scope.Locals do
|
||||
lastLocalVariableHandle <- metadata.AddLocalVariable(LocalVariableAttributes.None, localVariable.Index, metadata.GetString(localVariable.Name))
|
||||
scope.Children |> Array.iter (writePdbScope false)
|
||||
|
||||
writePdbScope true minfo.RootScope
|
||||
metadata.AddMethodDebugInformation(docHandle, sequencePointBlob) |> ignore)
|
||||
|
||||
let entryPoint =
|
||||
match info.EntryPoint with
|
||||
| None -> MetadataTokens.MethodDefinitionHandle(0)
|
||||
| Some x -> MetadataTokens.MethodDefinitionHandle(x)
|
||||
|
||||
let pdbContentId = ContentId(info.ModuleID, BitConverter.GetBytes(info.Timestamp))
|
||||
let serializer = StandaloneDebugMetadataSerializer(metadata, externalRowCounts, entryPoint, false)
|
||||
let blobBuilder = new BlobBuilder()
|
||||
serializer.SerializeMetadata(blobBuilder, (fun builder -> pdbContentId)) |> ignore
|
||||
|
||||
reportTime showTimes "PDB: Created"
|
||||
use portablePdbStream = new FileStream(fpdb, FileMode.Create, FileAccess.ReadWrite)
|
||||
blobBuilder.WriteContentTo(portablePdbStream)
|
||||
reportTime showTimes "PDB: Closed"
|
||||
pdbGetDebugInfo info.ModuleID fpdb
|
||||
|
||||
#if FX_NO_PDB_WRITER
|
||||
#else
|
||||
//---------------------------------------------------------------------
|
||||
// PDB Writer. The function [WritePdbInfo] abstracts the
|
||||
// imperative calls to the Symbol Writer API.
|
||||
//---------------------------------------------------------------------
|
||||
let writePdbInfo fixupOverlappingSequencePoints showTimes f fpdb info =
|
||||
|
||||
try FileSystem.FileDelete fpdb with _ -> ()
|
||||
|
||||
let pdbw = ref Unchecked.defaultof<PdbWriter>
|
||||
|
||||
try
|
||||
pdbw := pdbInitialize f fpdb
|
||||
with _ -> error(Error(FSComp.SR.ilwriteErrorCreatingPdb(fpdb), rangeCmdArgs))
|
||||
|
||||
match info.EntryPoint with
|
||||
| None -> ()
|
||||
| Some x -> pdbSetUserEntryPoint !pdbw x
|
||||
|
||||
let docs = info.Documents |> Array.map (fun doc -> pdbDefineDocument !pdbw doc.File)
|
||||
let getDocument i =
|
||||
if i < 0 || i > docs.Length then failwith "getDocument: bad doc number"
|
||||
docs.[i]
|
||||
reportTime showTimes (sprintf "PDB: Defined %d documents" info.Documents.Length)
|
||||
Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods
|
||||
reportTime showTimes (sprintf "PDB: Sorted %d methods" info.Methods.Length)
|
||||
|
||||
// This next bit is a workaround. The sequence points we get
|
||||
// from F# (which has nothing to do with this module) are actually expression
|
||||
// marks, i.e. the source ranges they denote are typically
|
||||
// nested, and each point indicates where the
|
||||
// code for an expression with a particular range begins.
|
||||
// This is in many ways a much more convenient form to emit.
|
||||
// However, it is not the form that debug tools accept nicely.
|
||||
// However, sequence points are really a non-overlapping, non-nested
|
||||
// partition of the source code of a method. So here we shorten the
|
||||
// length of all sequence point marks so they do not go further than
|
||||
// the next sequence point in the source.
|
||||
let spCounts = info.Methods |> Array.map (fun x -> x.SequencePoints.Length)
|
||||
let allSps = Array.concat (Array.map (fun x -> x.SequencePoints) info.Methods |> Array.toList)
|
||||
let allSps = Array.mapi (fun i sp -> (i,sp)) allSps
|
||||
if fixupOverlappingSequencePoints then
|
||||
// sort the sequence points into source order
|
||||
Array.sortInPlaceWith (fun (_,sp1) (_,sp2) -> SequencePoint.orderBySource sp1 sp2) allSps
|
||||
// shorten the ranges of any that overlap with following sequence points
|
||||
// sort the sequence points back into offset order
|
||||
for i = 0 to Array.length allSps - 2 do
|
||||
let n,sp1 = allSps.[i]
|
||||
let _,sp2 = allSps.[i+1]
|
||||
if (sp1.Document = sp2.Document) &&
|
||||
(sp1.EndLine > sp2.Line ||
|
||||
(sp1.EndLine = sp2.Line &&
|
||||
sp1.EndColumn >= sp2.Column)) then
|
||||
let adjustToPrevLine = (sp1.Line < sp2.Line)
|
||||
allSps.[i] <- n,{sp1 with EndLine = (if adjustToPrevLine then sp2.Line-1 else sp2.Line)
|
||||
EndColumn = (if adjustToPrevLine then 80 else sp2.Column) }
|
||||
Array.sortInPlaceBy fst allSps
|
||||
|
||||
let spOffset = ref 0
|
||||
info.Methods |> Array.iteri (fun i minfo ->
|
||||
|
||||
let sps = Array.sub allSps !spOffset spCounts.[i]
|
||||
spOffset := !spOffset + spCounts.[i]
|
||||
begin match minfo.Range with
|
||||
| None -> ()
|
||||
| Some (a,b) ->
|
||||
pdbOpenMethod !pdbw minfo.MethToken
|
||||
|
||||
pdbSetMethodRange !pdbw
|
||||
(getDocument a.Document) a.Line a.Column
|
||||
(getDocument b.Document) b.Line b.Column
|
||||
|
||||
// Partition the sequence points by document
|
||||
let spsets =
|
||||
let res = (Map.empty : Map<int,PdbSequencePoint list ref>)
|
||||
let add res (_,sp) =
|
||||
let k = sp.Document
|
||||
match Map.tryFind k res with
|
||||
| Some xsR -> xsR := sp :: !xsR; res
|
||||
| None -> Map.add k (ref [sp]) res
|
||||
|
||||
let res = Array.fold add res sps
|
||||
let res = Map.toList res // ordering may not be stable
|
||||
List.map (fun (_,x) -> Array.ofList !x) res
|
||||
|
||||
spsets |> List.iter (fun spset ->
|
||||
if spset.Length > 0 then
|
||||
Array.sortInPlaceWith SequencePoint.orderByOffset spset
|
||||
let sps =
|
||||
spset |> Array.map (fun sp ->
|
||||
// Ildiag.dprintf "token 0x%08lx has an sp at offset 0x%08x\n" minfo.MethToken sp.Offset
|
||||
(sp.Offset, sp.Line, sp.Column,sp.EndLine, sp.EndColumn))
|
||||
// Use of alloca in implementation of pdbDefineSequencePoints can give stack overflow here
|
||||
if sps.Length < 5000 then
|
||||
pdbDefineSequencePoints !pdbw (getDocument spset.[0].Document) sps)
|
||||
|
||||
// Write the scopes
|
||||
let rec writePdbScope top sco =
|
||||
if top || sco.Locals.Length <> 0 || sco.Children.Length <> 0 then
|
||||
pdbOpenScope !pdbw sco.StartOffset
|
||||
sco.Locals |> Array.iter (fun v -> pdbDefineLocalVariable !pdbw v.Name v.Signature v.Index)
|
||||
sco.Children |> Array.iter (writePdbScope false)
|
||||
pdbCloseScope !pdbw sco.EndOffset
|
||||
writePdbScope true minfo.RootScope
|
||||
|
||||
pdbCloseMethod !pdbw
|
||||
end)
|
||||
reportTime showTimes "PDB: Wrote methods"
|
||||
|
||||
let res = pdbWriteDebugInfo !pdbw
|
||||
for pdbDoc in docs do pdbCloseDocument pdbDoc
|
||||
pdbClose !pdbw f fpdb;
|
||||
|
||||
reportTime showTimes "PDB: Closed"
|
||||
{ iddCharacteristics = res.iddCharacteristics;
|
||||
iddMajorVersion = res.iddMajorVersion;
|
||||
iddMinorVersion = res.iddMinorVersion;
|
||||
iddType = res.iddType;
|
||||
iddData = res.iddData}
|
||||
#endif
|
||||
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
//---------------------------------------------------------------------
|
||||
// Support functions for calling 'Mono.CompilerServices.SymbolWriter'
|
||||
// assembly dynamically if it is available to the compiler
|
||||
//---------------------------------------------------------------------
|
||||
open Microsoft.FSharp.Reflection
|
||||
|
||||
// Dynamic invoke operator. Implements simple overload resolution based
|
||||
// on the name and number of parameters only.
|
||||
// Supports the following cases:
|
||||
// obj?Foo() // call with no arguments
|
||||
// obj?Foo(1, "a") // call with two arguments (extracted from tuple)
|
||||
// NOTE: This doesn<EFBFBD>t actually handle all overloads. It just picks first entry with right
|
||||
// number of arguments.
|
||||
let (?) this memb (args:'Args) : 'R =
|
||||
// Get array of 'obj' arguments for the reflection call
|
||||
let args =
|
||||
if typeof<'Args> = typeof<unit> then [| |]
|
||||
elif FSharpType.IsTuple typeof<'Args> then Microsoft.FSharp.Reflection.FSharpValue.GetTupleFields(args)
|
||||
else [| box args |]
|
||||
|
||||
// Get methods and perform overload resolution
|
||||
let methods = this.GetType().GetMethods()
|
||||
let bestMatch = methods |> Array.tryFind (fun mi -> mi.Name = memb && mi.GetParameters().Length = args.Length)
|
||||
match bestMatch with
|
||||
| Some(mi) -> unbox(mi.Invoke(this, args))
|
||||
| None -> error(Error(FSComp.SR.ilwriteMDBMemberMissing(memb), rangeCmdArgs))
|
||||
|
||||
// Creating instances of needed classes from 'Mono.CompilerServices.SymbolWriter' assembly
|
||||
|
||||
let monoCompilerSvc = new AssemblyName("Mono.CompilerServices.SymbolWriter, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756")
|
||||
let ctor (asmName:AssemblyName) clsName (args:obj[]) =
|
||||
let asm = Assembly.Load(asmName)
|
||||
let ty = asm.GetType(clsName)
|
||||
System.Activator.CreateInstance(ty, args)
|
||||
|
||||
let createSourceMethodImpl (name:string) (token:int) (namespaceID:int) =
|
||||
ctor monoCompilerSvc "Mono.CompilerServices.SymbolWriter.SourceMethodImpl" [| box name; box token; box namespaceID |]
|
||||
|
||||
let createWriter (f:string) =
|
||||
ctor monoCompilerSvc "Mono.CompilerServices.SymbolWriter.MonoSymbolWriter" [| box f |]
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// MDB Writer. Generate debug symbols using the MDB format
|
||||
//---------------------------------------------------------------------
|
||||
let writeMdbInfo fmdb f info =
|
||||
// Note, if we can<EFBFBD>t delete it code will fail later
|
||||
try FileSystem.FileDelete fmdb with _ -> ()
|
||||
|
||||
// Try loading the MDB symbol writer from an assembly available on Mono dynamically
|
||||
// Report an error if the assembly is not available.
|
||||
let wr =
|
||||
try createWriter f
|
||||
with e -> error(Error(FSComp.SR.ilwriteErrorCreatingMdb(), rangeCmdArgs))
|
||||
|
||||
// NOTE: MonoSymbolWriter doesn't need information about entrypoints, so 'info.EntryPoint' is unused here.
|
||||
// Write information about Documents. Returns '(SourceFileEntry*CompileUnitEntry)[]'
|
||||
let docs =
|
||||
[| for doc in info.Documents do
|
||||
let doc = wr?DefineDocument(doc.File)
|
||||
let unit = wr?DefineCompilationUnit(doc)
|
||||
yield doc, unit |]
|
||||
|
||||
let getDocument i =
|
||||
if i < 0 || i >= Array.length docs then failwith "getDocument: bad doc number" else docs.[i]
|
||||
|
||||
// Sort methods and write them to the MDB file
|
||||
Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods
|
||||
for meth in info.Methods do
|
||||
// Creates an instance of 'SourceMethodImpl' which is a private class that implements 'IMethodDef' interface
|
||||
// We need this as an argument to 'OpenMethod' below. Using private class is ugly, but since we don't reference
|
||||
// the assembly, the only way to implement 'IMethodDef' interface would be dynamically using Reflection.Emit...
|
||||
let sm = createSourceMethodImpl meth.MethName meth.MethToken 0
|
||||
match meth.Range with
|
||||
| Some(mstart, _) ->
|
||||
// NOTE: 'meth.Params' is not needed, Mono debugger apparently reads this from meta-data
|
||||
let _, cue = getDocument mstart.Document
|
||||
wr?OpenMethod(cue, 0, sm) |> ignore
|
||||
|
||||
// Write sequence points
|
||||
for sp in meth.SequencePoints do
|
||||
wr?MarkSequencePoint(sp.Offset, cue?get_SourceFile(), sp.Line, sp.Column, false)
|
||||
|
||||
// Walk through the tree of scopes and write all variables
|
||||
let rec writeScope (scope:PdbMethodScope) =
|
||||
wr?OpenScope(scope.StartOffset) |> ignore
|
||||
for local in scope.Locals do
|
||||
wr?DefineLocalVariable(local.Index, local.Name)
|
||||
for child in scope.Children do
|
||||
writeScope(child)
|
||||
wr?CloseScope(scope.EndOffset)
|
||||
writeScope(meth.RootScope)
|
||||
|
||||
// Finished generating debug information for the curretn method
|
||||
wr?CloseMethod()
|
||||
| _ -> ()
|
||||
|
||||
// Finalize - MDB requires the MVID of the generated .NET module
|
||||
let moduleGuid = new System.Guid(info.ModuleID |> Array.map byte)
|
||||
wr?WriteSymbolFile(moduleGuid)
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Dumps debug info into a text file for testing purposes
|
||||
//---------------------------------------------------------------------
|
||||
open Printf
|
||||
|
||||
let logDebugInfo (outfile:string) (info:PdbData) =
|
||||
use sw = new StreamWriter(new FileStream(outfile + ".debuginfo", FileMode.Create))
|
||||
|
||||
fprintfn sw "ENTRYPOINT\r\n %b\r\n" info.EntryPoint.IsSome
|
||||
fprintfn sw "DOCUMENTS"
|
||||
for i, doc in Seq.zip [0 .. info.Documents.Length-1] info.Documents do
|
||||
fprintfn sw " [%d] %s" i doc.File
|
||||
fprintfn sw " Type: %A" doc.DocumentType
|
||||
fprintfn sw " Language: %A" doc.Language
|
||||
fprintfn sw " Vendor: %A" doc.Vendor
|
||||
|
||||
// Sort methods (because they are sorted in PDBs/MDBs too)
|
||||
fprintfn sw "\r\nMETHODS"
|
||||
Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods
|
||||
for meth in info.Methods do
|
||||
fprintfn sw " %s" meth.MethName
|
||||
fprintfn sw " Params: %A" [ for p in meth.Params -> sprintf "%d: %s" p.Index p.Name ]
|
||||
fprintfn sw " Range: %A" (meth.Range |> Option.map (fun (f, t) ->
|
||||
sprintf "[%d,%d:%d] - [%d,%d:%d]" f.Document f.Line f.Column t.Document t.Line t.Column))
|
||||
fprintfn sw " Points:"
|
||||
|
||||
for sp in meth.SequencePoints do
|
||||
fprintfn sw " - Doc: %d Offset:%d [%d:%d]-[%d-%d]" sp.Document sp.Offset sp.Line sp.Column sp.EndLine sp.EndColumn
|
||||
|
||||
// Walk through the tree of scopes and write all variables
|
||||
fprintfn sw " Scopes:"
|
||||
let rec writeScope offs (scope:PdbMethodScope) =
|
||||
fprintfn sw " %s- [%d-%d]" offs scope.StartOffset scope.EndOffset
|
||||
if scope.Locals.Length > 0 then
|
||||
fprintfn sw " %s Locals: %A" offs [ for p in scope.Locals -> sprintf "%d: %s" p.Index p.Name ]
|
||||
for child in scope.Children do writeScope (offs + " ") child
|
||||
writeScope "" meth.RootScope
|
||||
fprintfn sw ""
|
|
@ -0,0 +1,81 @@
|
|||
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
/// The ILPdbWriter
|
||||
module internal Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter
|
||||
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.IL
|
||||
open Microsoft.FSharp.Compiler.ErrorLogger
|
||||
open Microsoft.FSharp.Compiler.Range
|
||||
open System.Collections.Generic
|
||||
|
||||
type PdbDocumentData = ILSourceDocument
|
||||
|
||||
type PdbLocalVar =
|
||||
{ Name: string
|
||||
Signature: byte[]
|
||||
/// the local index the name corresponds to
|
||||
Index: int32 }
|
||||
|
||||
type PdbMethodScope =
|
||||
{ Children: PdbMethodScope array
|
||||
StartOffset: int
|
||||
EndOffset: int
|
||||
Locals: PdbLocalVar array
|
||||
(* REVIEW open_namespaces: pdb_namespace array *) }
|
||||
|
||||
type PdbSourceLoc =
|
||||
{ Document: int
|
||||
Line: int
|
||||
Column: int }
|
||||
|
||||
type PdbSequencePoint =
|
||||
{ Document: int
|
||||
Offset: int
|
||||
Line: int
|
||||
Column: int
|
||||
EndLine: int
|
||||
EndColumn: int }
|
||||
override ToString: unit -> string
|
||||
|
||||
type PdbMethodData =
|
||||
{ MethToken: int32
|
||||
MethName:string
|
||||
LocalSignatureToken: int32
|
||||
Params: PdbLocalVar array
|
||||
RootScope: PdbMethodScope
|
||||
Range: (PdbSourceLoc * PdbSourceLoc) option
|
||||
SequencePoints: PdbSequencePoint array }
|
||||
|
||||
[<NoEquality; NoComparison>]
|
||||
type PdbData =
|
||||
{ EntryPoint: int32 option
|
||||
Timestamp: int32
|
||||
ModuleID: byte[] // MVID of the generated .NET module (used by MDB files to identify debug info)
|
||||
Documents: PdbDocumentData[]
|
||||
Methods: PdbMethodData[]
|
||||
TableRowCounts: int[] }
|
||||
|
||||
|
||||
/// Takes the output file name and returns debug file name.
|
||||
val getDebugFileName: string -> string
|
||||
|
||||
/// 28 is the size of the IMAGE_DEBUG_DIRECTORY in ntimage.h
|
||||
val sizeof_IMAGE_DEBUG_DIRECTORY : System.Int32
|
||||
val logDebugInfo : string -> PdbData -> unit
|
||||
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
val writeMdbInfo<'a> : string -> string -> PdbData -> 'a
|
||||
#endif
|
||||
|
||||
type idd =
|
||||
{ iddCharacteristics: int32;
|
||||
iddMajorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *)
|
||||
iddMinorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *)
|
||||
iddType: int32;
|
||||
iddData: byte[]; }
|
||||
|
||||
val writePortablePdbInfo : fixupOverlappingSequencePoints:bool -> showTimes:bool -> fpdb:string -> info:PdbData -> idd
|
||||
|
||||
#if !FX_NO_PDB_WRITER
|
||||
val writePdbInfo : fixupOverlappingSequencePoints:bool -> showTimes:bool -> f:string -> fpdb:string -> info:PdbData -> idd
|
||||
#endif
|
|
@ -15,7 +15,4 @@ do()
|
|||
#if STRONG_NAME_AND_DELAY_SIGN_FSHARP_COMPILER_WITH_MSFT_KEY
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("VisualFSharp.Unittests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
|
||||
#endif
|
||||
#if STRONG_NAME_FSHARP_COMPILER_WITH_TEST_KEY
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("VisualFSharp.Unittests, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
#endif
|
||||
do()
|
||||
|
|
|
@ -19,8 +19,4 @@ open System.Runtime.InteropServices
|
|||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("fsi, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("fsiAnyCpu, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
|
||||
#endif
|
||||
#if STRONG_NAME_FSHARP_COMPILER_WITH_TEST_KEY
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("fsi, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("fsiAnyCpu, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
#endif
|
||||
do()
|
||||
|
|
|
@ -21,9 +21,4 @@ open System.Runtime.InteropServices
|
|||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("fsiAnyCpu, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.VS.FSI, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
|
||||
#endif
|
||||
#if STRONG_NAME_FSHARP_COMPILER_WITH_TEST_KEY
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("fsi, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("fsiAnyCpu, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.VS.FSI, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
#endif
|
||||
do()
|
||||
|
|
|
@ -49,24 +49,6 @@ open System.Runtime.InteropServices
|
|||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.Compiler.Unittests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
|
||||
#endif
|
||||
|
||||
#if STRONG_NAME_FSHARP_COMPILER_WITH_TEST_KEY
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("fsc, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("fsi, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("fsiAnyCpu, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.LanguageService, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.LanguageService.Base, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.ProjectSystem.Base, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.ProjectSystem.FSharp, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.ProjectSystem.PropertyPages, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.Compiler.Interactive.Settings, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.Compiler.Server.Shared, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("VisualFSharp.Salsa, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("VisualFSharp.Unittests, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.Compiler.Unittests, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
|
||||
#endif
|
||||
|
||||
|
||||
#if BUILDING_WITH_LKG
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("fsc-proto, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
|
||||
#endif
|
||||
|
|
|
@ -15,7 +15,6 @@ do()
|
|||
#if NO_STRONG_NAMES
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("VisualFSharp.Unittests")>]
|
||||
#else
|
||||
[<assembly:AssemblyFileVersion("4.0.40401.9055")>]
|
||||
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("VisualFSharp.Unittests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
|
||||
#endif
|
||||
do()
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information,
|
||||
//
|
||||
// Build nuget package for the fsharp compiler
|
||||
//=========================================================================================
|
||||
open System.IO
|
||||
open System.Diagnostics
|
||||
|
||||
try
|
||||
//=========================================================================================
|
||||
// Command line arguments
|
||||
//=========================================================================================
|
||||
|
||||
// Try head was introduced in F# 4.0
|
||||
let tryHead (source : seq<_>) =
|
||||
let checkNonNull argName arg =
|
||||
match box arg with
|
||||
| null -> nullArg argName
|
||||
| _ -> ()
|
||||
checkNonNull "source" source
|
||||
use e = source.GetEnumerator()
|
||||
if (e.MoveNext()) then Some e.Current
|
||||
else None
|
||||
|
||||
let usage = @"usage: BuildNuGets.fsx --version:<build-version> -nuspec:<nuspec-path> --binaries:<binaries-dir>"
|
||||
|
||||
let Arguments = fsi.CommandLineArgs |> Seq.skip 1
|
||||
|
||||
let GetArgumentFromCommandLine switchName defaultValue =
|
||||
match Arguments |> Seq.filter(fun t -> t.StartsWith(switchName)) |> Seq.map(fun t -> t.Remove(0, switchName.Length).Trim()) |> tryHead with
|
||||
| Some(file) -> if file.Length <> 0 then file else defaultValue
|
||||
| _ -> defaultValue
|
||||
|
||||
let verbose = GetArgumentFromCommandLine "--verbosity:" @"normal"
|
||||
let version = GetArgumentFromCommandLine "--version:" @""
|
||||
let nuspec = GetArgumentFromCommandLine "--nuspec:" @""
|
||||
let bindir = GetArgumentFromCommandLine "--bindir:" @""
|
||||
let nuspecTitle = Path.GetFileNameWithoutExtension(nuspec)
|
||||
let layouts = Path.Combine(Path.GetFullPath(bindir), "layouts", nuspecTitle)
|
||||
let output = Path.Combine(Path.GetFullPath(bindir), "nuget")
|
||||
let isVerbose = verbose = "verbose"
|
||||
|
||||
let makeDirectory output =
|
||||
if not (Directory.Exists(output)) then Directory.CreateDirectory(output) |>ignore
|
||||
()
|
||||
|
||||
//=========================================================================================
|
||||
// Build Nuget Package
|
||||
//=========================================================================================
|
||||
let author = @"Microsoft"
|
||||
let licenseUrl = @"https://github.com/Microsoft/visualfsharp/blob/master/License.txt"
|
||||
let projectUrl = @"https://github.com/Microsoft/visualfsharp"
|
||||
let tags = @"Visual F# Compiler FSharp coreclr functional programming"
|
||||
|
||||
let nugetArgs = sprintf "pack %s -BasePath \"%s\" -OutputDirectory \"%s\" -ExcludeEmptyDirectories -prop licenseUrl=\"%s\" -prop version=\"%s\" -prop authors=\"%s\" -prop projectURL=\"%s\" -prop tags=\"%s\" -Verbosity detailed"
|
||||
nuspec
|
||||
bindir
|
||||
output
|
||||
licenseUrl
|
||||
version
|
||||
author
|
||||
projectUrl
|
||||
tags
|
||||
|
||||
let nugetExePath = Path.GetFullPath(Path.Combine(__SOURCE_DIRECTORY__, @"..\..\.nuget\nuget.exe"))
|
||||
let executeProcess filename arguments =
|
||||
let processWriteMessage (chan:TextWriter) (message:string) =
|
||||
match message with
|
||||
| null -> ()
|
||||
| _ as m -> chan.WriteLine(m) |>ignore
|
||||
let info = new ProcessStartInfo()
|
||||
let p = new Process()
|
||||
printfn "%s %s" filename arguments
|
||||
info.Arguments <- arguments
|
||||
info.UseShellExecute <- false
|
||||
info.RedirectStandardOutput <- true
|
||||
info.RedirectStandardError <- true
|
||||
info.CreateNoWindow <- true
|
||||
info.FileName <- filename
|
||||
p.StartInfo <- info
|
||||
p.OutputDataReceived.Add(fun x -> processWriteMessage stdout x.Data)
|
||||
p.ErrorDataReceived.Add(fun x -> processWriteMessage stderr x.Data)
|
||||
if p.Start() then
|
||||
p.BeginOutputReadLine()
|
||||
p.BeginErrorReadLine()
|
||||
p.WaitForExit()
|
||||
p.ExitCode
|
||||
else
|
||||
0
|
||||
makeDirectory output
|
||||
exit (executeProcess nugetExePath nugetArgs)
|
||||
with _ ->
|
||||
exit (1)
|
|
@ -6,14 +6,18 @@
|
|||
|
||||
<!-- Compiler: .NET 2.0 and 4.0 only -->
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net20' or
|
||||
'$(TargetFramework)' == 'net40'">
|
||||
<ProjectFiles Include="fsharp\FSharp.Build\FSharp.Build.fsproj"/>
|
||||
'$(TargetFramework)' == 'net40' or
|
||||
'$(TargetFramework)' == 'coreclr' ">
|
||||
<ProjectFiles Include="fsharp\FSharp.Build\FSharp.Build.fsproj" Condition="'$(TargetFramework)' != 'coreclr'" />
|
||||
<ProjectFiles Include="fsharp\FSharp.Compiler\FSharp.Compiler.fsproj"/>
|
||||
<ProjectFiles Include="fsharp\FSharp.Compiler.Server.Shared\FSharp.Compiler.Server.Shared.fsproj"/>
|
||||
<ProjectFiles Include="fsharp\FSharp.Compiler.Interactive.Settings\FSharp.Compiler.Interactive.Settings.fsproj"/>
|
||||
<ProjectFiles Include="fsharp\Fsc\Fsc.fsproj"/>
|
||||
<ProjectFiles Include="fsharp\fsi\Fsi.fsproj"/>
|
||||
<ProjectFiles Include="fsharp\fsiAnyCpu\FsiAnyCpu.fsproj"/>
|
||||
<ProjectFiles Include="fsharp\FSharp.Compiler.Server.Shared\FSharp.Compiler.Server.Shared.fsproj" Condition="'$(TargetFramework)' != 'coreclr'" />
|
||||
<ProjectFiles Include="fsharp\FSharp.Compiler.Interactive.Settings\FSharp.Compiler.Interactive.Settings.fsproj" />
|
||||
<ProjectFiles Include="fsharp\Fsc\Fsc.fsproj" />
|
||||
<ProjectFiles Include="fsharp\fsi\Fsi.fsproj" />
|
||||
<ProjectFiles Include="fsharp\fsiAnyCpu\FsiAnyCpu.fsproj" Condition="'$(TargetFramework)' != 'coreclr'" />
|
||||
|
||||
<ProjectFiles Include="fsharp\FSharp.Compiler.netcore.nuget\FSharp.Compiler.nuget.proj" Condition="'$(TargetFramework)' == 'coreclr'" />
|
||||
<ProjectFiles Include="fsharp\FSharp.Compiler.Host.netcore.nuget\FSharp.Compiler.Host.proj" Condition="'$(TargetFramework)' == 'coreclr'" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<!-- Core library: all frameworks -->
|
||||
<ItemGroup>
|
||||
<ProjectFiles Include="fsharp\FSharp.Core\FSharp.Core.fsproj"/>
|
||||
<ProjectFiles Include="fsharp\fsharp.core.netcore.nuget\FSharp.Core.netcore.nuget.proj" Condition="'$(TargetFramework)' == 'coreclr'" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="root.traversal.targets"/>
|
||||
|
|
|
@ -50,6 +50,10 @@ open Microsoft.FSharp.Core.CompilerServices
|
|||
#endif
|
||||
open System.Runtime.CompilerServices
|
||||
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
open Microsoft.FSharp.Core.ReflectionAdapters
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
|
||||
#if COMPILED_AS_LANGUAGE_SERVICE_DLL
|
||||
|
@ -1536,8 +1540,6 @@ let OutputErrorOrWarningContext prefix fileLineFn os err =
|
|||
Printf.bprintf os "%s%s\n" prefix line;
|
||||
Printf.bprintf os "%s%s%s\n" prefix (String.make iA '-') (String.make iLen '^')
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
let GetFSharpCoreLibraryName () = "FSharp.Core"
|
||||
|
@ -1549,11 +1551,23 @@ let GetFSharpCoreReferenceUsedByCompiler(useMonoResolution) =
|
|||
GetFSharpCoreLibraryName()+".dll"
|
||||
else
|
||||
let fsCoreName = GetFSharpCoreLibraryName()
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
// RESHAPED_REFLECTION does not have Assembly.GetReferencedAssemblies()
|
||||
// So use the fsharp.core.dll from alongside the fsc compiler.
|
||||
// This can also be used for the out of gac work on DEV15
|
||||
let fscCoreLocation =
|
||||
let fscLocation = typeof<TypeInThisAssembly>.Assembly.Location
|
||||
Path.Combine(Path.GetDirectoryName(fscLocation), fsCoreName + ".dll")
|
||||
if File.Exists(fscCoreLocation) then fsCoreName + ".dll"
|
||||
else failwithf "Internal error: Could not find %s" fsCoreName
|
||||
#else
|
||||
// TODO: Remove this when we do out of GAC for DEV 15 because above code will work everywhere.
|
||||
typeof<TypeInThisAssembly>.Assembly.GetReferencedAssemblies()
|
||||
|> Array.pick (fun name ->
|
||||
if name.Name = fsCoreName then Some(name.ToString())
|
||||
else None
|
||||
)
|
||||
#endif
|
||||
let GetFsiLibraryName () = "FSharp.Compiler.Interactive.Settings"
|
||||
|
||||
// This list is the default set of references for "non-project" files.
|
||||
|
@ -1579,7 +1593,7 @@ let DefaultBasicReferencesForOutOfProjectSources =
|
|||
// in which case the compiler will also be running as a .NET 2.0 process.
|
||||
//
|
||||
// NOTE: it seems this can now be removed now that .NET 4.x is minimally assumed when using this toolchain
|
||||
if (try System.Reflection.Assembly.Load "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" |> ignore; true with _ -> false) then
|
||||
if (try System.Reflection.Assembly.Load(new System.Reflection.AssemblyName("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")) |> ignore; true with _ -> false) then
|
||||
yield "System.Core"
|
||||
|
||||
yield "System.Runtime"
|
||||
|
@ -1611,7 +1625,39 @@ let SystemAssemblies primaryAssemblyName =
|
|||
yield "System.Core"
|
||||
yield "System.Runtime"
|
||||
yield "System.Observable"
|
||||
yield "System.Numerics"]
|
||||
yield "System.Numerics"
|
||||
|
||||
// Additions for coreclr and portable profiles
|
||||
yield "System.Collections"
|
||||
yield "System.Collections.Concurrent"
|
||||
yield "System.Console"
|
||||
yield "System.Diagnostics.Debug"
|
||||
yield "System.Diagnostics.Tools"
|
||||
yield "System.Globalization"
|
||||
yield "System.IO"
|
||||
yield "System.Linq"
|
||||
yield "System.Linq.Expressions"
|
||||
yield "System.Linq.Queryable"
|
||||
yield "System.Net.Requests"
|
||||
yield "System.Reflection"
|
||||
yield "System.Reflection.Emit"
|
||||
yield "System.Reflection.Emit.ILGeneration"
|
||||
yield "System.Reflection.Extensions"
|
||||
yield "System.Resources.ResourceManager"
|
||||
yield "System.Runtime.Extensions"
|
||||
yield "System.Runtime.InteropServices"
|
||||
yield "System.Runtime.InteropServices.PInvoke"
|
||||
yield "System.Runtime.Numerics"
|
||||
yield "System.Text.Encoding"
|
||||
yield "System.Text.Encoding.Extensions"
|
||||
yield "System.Text.RegularExpressions"
|
||||
yield "System.Threading"
|
||||
yield "System.Threading.Tasks"
|
||||
yield "System.Threading.Tasks.Parallel"
|
||||
yield "System.Threading.Thread"
|
||||
yield "System.Threading.ThreadPool"
|
||||
yield "System.Threading.Timer"
|
||||
]
|
||||
|
||||
// The set of references entered into the TcConfigBuilder for scripts prior to computing
|
||||
// the load closure.
|
||||
|
@ -1956,6 +2002,7 @@ type TcConfigBuilder =
|
|||
mutable container : string option
|
||||
|
||||
mutable delaysign : bool
|
||||
mutable publicsign : bool
|
||||
mutable version : VersionFlag
|
||||
mutable metadataVersion : string option
|
||||
mutable standalone : bool
|
||||
|
@ -1964,7 +2011,7 @@ type TcConfigBuilder =
|
|||
mutable onlyEssentialOptimizationData : bool
|
||||
mutable useOptimizationDataFile : bool
|
||||
mutable useSignatureDataFile : bool
|
||||
mutable jitTracking : bool
|
||||
mutable portablePDB : bool
|
||||
mutable ignoreSymbolStoreSequencePoints : bool
|
||||
mutable internConstantStrings : bool
|
||||
mutable extraOptimizationIterations : int
|
||||
|
@ -1995,8 +2042,11 @@ type TcConfigBuilder =
|
|||
mutable optsOn : bool (* optimizations are turned on *)
|
||||
mutable optSettings : Optimizer.OptimizationSettings
|
||||
mutable emitTailcalls : bool
|
||||
#if PREFERRED_UI_LANG
|
||||
mutable preferredUiLang: string option
|
||||
#else
|
||||
mutable lcid : int option
|
||||
|
||||
#endif
|
||||
mutable productNameForBannerText : string
|
||||
/// show the MS (c) notice, e.g. with help or fsi?
|
||||
mutable showBanner : bool
|
||||
|
@ -2037,11 +2087,12 @@ type TcConfigBuilder =
|
|||
// If true - the compiler will copy FSharp.Core.dll along the produced binaries
|
||||
mutable copyFSharpCore : bool
|
||||
|
||||
#if SHADOW_COPY_REFERENCES
|
||||
/// When false FSI will lock referenced assemblies requiring process restart, false = disable Shadow Copy false (*default*)
|
||||
mutable shadowCopyReferences : bool
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static member CreateNew (defaultFSharpBinariesDir,optimizeForMemory,implicitIncludeDir,isInteractive,isInvalidationSupported) =
|
||||
System.Diagnostics.Debug.Assert(FileSystem.IsPathRootedShim(implicitIncludeDir), sprintf "implicitIncludeDir should be absolute: '%s'" implicitIncludeDir)
|
||||
if (String.IsNullOrEmpty(defaultFSharpBinariesDir)) then
|
||||
|
@ -2091,7 +2142,11 @@ type TcConfigBuilder =
|
|||
resolutionAssemblyFoldersConditions = "";
|
||||
platform = None;
|
||||
prefer32Bit = false;
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
useMonoResolution = runningOnMono
|
||||
#else
|
||||
useMonoResolution = false
|
||||
#endif
|
||||
target = ConsoleExe
|
||||
debuginfo = false
|
||||
testFlagEmitFeeFeeAs100001 = false
|
||||
|
@ -2120,6 +2175,7 @@ type TcConfigBuilder =
|
|||
baseAddress = None
|
||||
|
||||
delaysign = false
|
||||
publicsign = false
|
||||
version = VersionNone
|
||||
metadataVersion = None
|
||||
standalone = false
|
||||
|
@ -2128,7 +2184,7 @@ type TcConfigBuilder =
|
|||
onlyEssentialOptimizationData = false
|
||||
useOptimizationDataFile = false
|
||||
useSignatureDataFile = false
|
||||
jitTracking = true
|
||||
portablePDB = true
|
||||
ignoreSymbolStoreSequencePoints = false
|
||||
internConstantStrings = true
|
||||
extraOptimizationIterations = 0
|
||||
|
@ -2156,7 +2212,11 @@ type TcConfigBuilder =
|
|||
optsOn = false
|
||||
optSettings = Optimizer.OptimizationSettings.Defaults
|
||||
emitTailcalls = true
|
||||
#if PREFERRED_UI_LANG
|
||||
preferredUiLang = None
|
||||
#else
|
||||
lcid = None
|
||||
#endif
|
||||
// See bug 6071 for product banner spec
|
||||
productNameForBannerText = (FSComp.SR.buildProductName(FSharpEnvironment.DotNetBuildString))
|
||||
showBanner = true
|
||||
|
@ -2177,7 +2237,9 @@ type TcConfigBuilder =
|
|||
emitDebugInfoInQuotations = false
|
||||
exename = None
|
||||
copyFSharpCore = true
|
||||
#if SHADOW_COPY_REFERENCES
|
||||
shadowCopyReferences = false
|
||||
#endif
|
||||
}
|
||||
|
||||
member tcConfigB.ResolveSourceFile(m,nm,pathLoadedFrom) =
|
||||
|
@ -2198,36 +2260,27 @@ type TcConfigBuilder =
|
|||
let modname = try Filename.chopExtension basic with _ -> basic
|
||||
modname+(ext())
|
||||
| Some f,_ -> f
|
||||
let assemblyName, assemblyNameIsInvalid =
|
||||
let assemblyName =
|
||||
let baseName = fileNameOfPath outfile
|
||||
let assemblyName = fileNameWithoutExtension baseName
|
||||
if not (Filename.checkSuffix (String.lowercase baseName) (ext())) then
|
||||
errorR(Error(FSComp.SR.buildMismatchOutputExtension(),rangeCmdArgs))
|
||||
assemblyName, true
|
||||
else
|
||||
assemblyName, false
|
||||
(fileNameWithoutExtension baseName)
|
||||
|
||||
let pdbfile =
|
||||
|
||||
if tcConfigB.debuginfo then
|
||||
// assembly name is invalid, we've already reported the error so just skip pdb name checks
|
||||
if assemblyNameIsInvalid then None else
|
||||
#if NO_PDB_WRITER
|
||||
Some (match tcConfigB.debugSymbolFile with None -> (Filename.chopExtension outfile)+ (if runningOnMono then ".mdb" else ".pdb") | Some f -> f)
|
||||
#else
|
||||
Some (match tcConfigB.debugSymbolFile with
|
||||
| None -> Microsoft.FSharp.Compiler.AbstractIL.Internal.Support.getDebugFileName outfile
|
||||
| None -> Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter.getDebugFileName outfile
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
| Some _ when runningOnMono ->
|
||||
// On Mono, the name of the debug file has to be "<assemblyname>.mdb" so specifying it explicitly is an error
|
||||
warning(Error(FSComp.SR.ilwriteMDBFileNameCannotBeChangedWarning(),rangeCmdArgs)) ; ()
|
||||
Microsoft.FSharp.Compiler.AbstractIL.Internal.Support.getDebugFileName outfile
|
||||
| Some f -> f)
|
||||
Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter.getDebugFileName outfile
|
||||
#endif
|
||||
| Some f -> f)
|
||||
elif (tcConfigB.debugSymbolFile <> None) && (not (tcConfigB.debuginfo)) then
|
||||
error(Error(FSComp.SR.buildPdbRequiresDebug(),rangeStartup))
|
||||
else None
|
||||
error(Error(FSComp.SR.buildPdbRequiresDebug(),rangeStartup))
|
||||
else
|
||||
None
|
||||
tcConfigB.outputFile <- Some(outfile)
|
||||
outfile,pdbfile,assemblyName
|
||||
outfile, pdbfile, assemblyName
|
||||
|
||||
member tcConfigB.TurnWarningOff(m,s:string) =
|
||||
use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind (BuildPhase.Parameter)
|
||||
|
@ -2306,7 +2359,11 @@ type TcConfigBuilder =
|
|||
ri,fileNameOfPath ri,ILResourceAccess.Public
|
||||
|
||||
|
||||
#if SHADOW_COPY_REFERENCES
|
||||
let OpenILBinary(filename,optimizeForMemory,openBinariesInMemory,ilGlobalsOpt, pdbPathOption, primaryAssemblyName, noDebugData, shadowCopyReferences) =
|
||||
#else
|
||||
let OpenILBinary(filename,optimizeForMemory,openBinariesInMemory,ilGlobalsOpt, pdbPathOption, primaryAssemblyName, noDebugData) =
|
||||
#endif
|
||||
let ilGlobals =
|
||||
// ILScopeRef.Local can be used only for primary assembly (mscorlib or System.Runtime) itself
|
||||
// Remaining assemblies should be opened using existing ilGlobals (so they can properly locate fundamental types)
|
||||
|
@ -2326,6 +2383,7 @@ let OpenILBinary(filename,optimizeForMemory,openBinariesInMemory,ilGlobalsOpt, p
|
|||
then ILBinaryReader.OpenILModuleReaderAfterReadingAllBytes filename opts
|
||||
else
|
||||
let location =
|
||||
#if SHADOW_COPY_REFERENCES
|
||||
// In order to use memory mapped files on the shadow copied version of the Assembly, we `preload the assembly
|
||||
// We swallow all exceptions so that we do not change the exception contract of this API
|
||||
if shadowCopyReferences then
|
||||
|
@ -2333,6 +2391,7 @@ let OpenILBinary(filename,optimizeForMemory,openBinariesInMemory,ilGlobalsOpt, p
|
|||
System.Reflection.Assembly.ReflectionOnlyLoadFrom(filename).Location
|
||||
with e -> filename
|
||||
else
|
||||
#endif
|
||||
filename
|
||||
ILBinaryReader.OpenILModuleReader location opts
|
||||
|
||||
|
@ -2453,10 +2512,12 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
|
|||
| Some(primaryAssemblyFilename) ->
|
||||
let filename = ComputeMakePathAbsolute data.implicitIncludeDir primaryAssemblyFilename
|
||||
try
|
||||
|
||||
#if SHADOW_COPY_REFERENCES
|
||||
use ilReader = OpenILBinary(filename,data.optimizeForMemory,data.openBinariesInMemory,None,None, data.primaryAssembly.Name, data.noDebugData, data.shadowCopyReferences)
|
||||
#else
|
||||
use ilReader = OpenILBinary(filename,data.optimizeForMemory,data.openBinariesInMemory,None,None, data.primaryAssembly.Name, data.noDebugData)
|
||||
#endif
|
||||
let ilModule = ilReader.ILModuleDef
|
||||
|
||||
match ilModule.ManifestOfAssembly.Version with
|
||||
| Some(v1,v2,v3,_) ->
|
||||
if v1 = 1us then
|
||||
|
@ -2513,7 +2574,11 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
|
|||
| Some(fslibFilename) ->
|
||||
let filename = ComputeMakePathAbsolute data.implicitIncludeDir fslibFilename
|
||||
try
|
||||
#if SHADOW_COPY_REFERENCES
|
||||
use ilReader = OpenILBinary(filename,data.optimizeForMemory,data.openBinariesInMemory,None,None, data.primaryAssembly.Name, data.noDebugData, data.shadowCopyReferences)
|
||||
#else
|
||||
use ilReader = OpenILBinary(filename,data.optimizeForMemory,data.openBinariesInMemory,None,None, data.primaryAssembly.Name, data.noDebugData)
|
||||
#endif
|
||||
checkFSharpBinaryCompatWithMscorlib filename ilReader.ILAssemblyRefs ilReader.ILModuleDef.ManifestOfAssembly.Version rangeStartup;
|
||||
let fslibRoot = Path.GetDirectoryName(FileSystem.GetFullPathShim(filename))
|
||||
fslibRoot (* , sprintf "v%d.%d" v1 v2 *)
|
||||
|
@ -2591,6 +2656,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
|
|||
member x.signer = data.signer
|
||||
member x.container = data.container
|
||||
member x.delaysign = data.delaysign
|
||||
member x.publicsign = data.publicsign
|
||||
member x.version = data.version
|
||||
member x.metadataVersion = data.metadataVersion
|
||||
member x.standalone = data.standalone
|
||||
|
@ -2599,7 +2665,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
|
|||
member x.onlyEssentialOptimizationData = data.onlyEssentialOptimizationData
|
||||
member x.useOptimizationDataFile = data.useOptimizationDataFile
|
||||
member x.useSignatureDataFile = data.useSignatureDataFile
|
||||
member x.jitTracking = data.jitTracking
|
||||
member x.portablePDB = data.portablePDB
|
||||
member x.ignoreSymbolStoreSequencePoints = data.ignoreSymbolStoreSequencePoints
|
||||
member x.internConstantStrings = data.internConstantStrings
|
||||
member x.extraOptimizationIterations = data.extraOptimizationIterations
|
||||
|
@ -2617,15 +2683,19 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
|
|||
member x.writeGeneratedILFiles = data.writeGeneratedILFiles
|
||||
member x.showOptimizationData = data.showOptimizationData
|
||||
#endif
|
||||
member x.showTerms = data.showTerms
|
||||
member x.showTerms = data.showTerms
|
||||
member x.writeTermsToFiles = data.writeTermsToFiles
|
||||
member x.doDetuple = data.doDetuple
|
||||
member x.doTLR = data.doTLR
|
||||
member x.doFinalSimplify = data.doFinalSimplify
|
||||
member x.optSettings = data.optSettings
|
||||
member x.emitTailcalls = data.emitTailcalls
|
||||
member x.lcid = data.lcid
|
||||
member x.optsOn = data.optsOn
|
||||
member x.doDetuple = data.doDetuple
|
||||
member x.doTLR = data.doTLR
|
||||
member x.doFinalSimplify = data.doFinalSimplify
|
||||
member x.optSettings = data.optSettings
|
||||
member x.emitTailcalls = data.emitTailcalls
|
||||
#if PREFERRED_UI_LANG
|
||||
member x.preferredUiLang = data.preferredUiLang
|
||||
#else
|
||||
member x.lcid = data.lcid
|
||||
#endif
|
||||
member x.optsOn = data.optsOn
|
||||
member x.productNameForBannerText = data.productNameForBannerText
|
||||
member x.showBanner = data.showBanner
|
||||
member x.showTimes = data.showTimes
|
||||
|
@ -2644,8 +2714,9 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
|
|||
member x.sqmNumOfSourceFiles = data.sqmNumOfSourceFiles
|
||||
member x.sqmSessionStartedTime = data.sqmSessionStartedTime
|
||||
member x.copyFSharpCore = data.copyFSharpCore
|
||||
#if SHADOW_COPY_REFERENCES
|
||||
member x.shadowCopyReferences = data.shadowCopyReferences
|
||||
|
||||
#endif
|
||||
static member Create(builder,validate) =
|
||||
use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind (BuildPhase.Parameter)
|
||||
TcConfig(builder,validate)
|
||||
|
@ -2664,13 +2735,19 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
|
|||
| Some x ->
|
||||
[tcConfig.MakePathAbsolute x]
|
||||
| None ->
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
// When running on Mono we lead everyone to believe we're doing .NET 2.0 compilation
|
||||
// by default.
|
||||
if runningOnMono then
|
||||
[System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()]
|
||||
else
|
||||
#endif
|
||||
try
|
||||
match tcConfig.resolutionEnvironment with
|
||||
#if FX_MSBUILDRESOLVER_RUNTIMELIKE
|
||||
| MSBuildResolver.RuntimeLike ->
|
||||
[System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()]
|
||||
#endif
|
||||
| _ ->
|
||||
let frameworkRoot = MSBuildResolver.DotNetFrameworkReferenceAssembliesRootDirectoryOnWindows
|
||||
let frameworkRootVersion = Path.Combine(frameworkRoot,tcConfig.targetFrameworkVersionMajorMinor)
|
||||
|
@ -2705,8 +2782,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
|
|||
/// is a resource that can be shared between any two IncrementalBuild objects that reference
|
||||
/// precisely S
|
||||
///
|
||||
/// Determined by looking at the set of assemblies in the framework assemblies directory, plus the
|
||||
/// F# core library.
|
||||
/// Determined by looking at the set of assemblies referenced by f# .
|
||||
///
|
||||
/// Returning true may mean that the file is locked and/or placed into the
|
||||
/// 'framework' reference set that is potentially shared across multiple compilations.
|
||||
|
@ -2833,10 +2909,8 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
|
|||
// NOTE!! if mode=ReportErrors then this method must not raise exceptions. It must just report the errors and recover
|
||||
static member TryResolveLibsUsingMSBuildRules (tcConfig:TcConfig,originalReferences:AssemblyReference list, errorAndWarningRange:range, mode:ResolveAssemblyReferenceMode) : AssemblyResolution list * UnresolvedAssemblyReference list =
|
||||
use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind (BuildPhase.Parameter)
|
||||
|
||||
if tcConfig.useMonoResolution then
|
||||
failwith "MSBuild resolution is not supported."
|
||||
|
||||
if originalReferences=[] then [],[]
|
||||
else
|
||||
// Group references by name with range values in the grouped value list.
|
||||
|
@ -2875,10 +2949,6 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
|
|||
|
||||
let targetFrameworkMajorMinor = tcConfig.targetFrameworkVersionMajorMinor
|
||||
|
||||
#if DEBUG
|
||||
assert(MSBuildResolver.SupportedNetFrameworkVersions.Contains targetFrameworkMajorMinor) // Resolve is flexible, but pinning down targetFrameworkMajorMinor.
|
||||
#endif
|
||||
|
||||
let targetProcessorArchitecture =
|
||||
match tcConfig.platform with
|
||||
| None -> "MSIL"
|
||||
|
@ -2947,7 +3017,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
|
|||
resolvedFrom=resolvedFile.resolvedFrom;
|
||||
fusionName=resolvedFile.fusionName
|
||||
redist=resolvedFile.redist;
|
||||
sysdir=tcConfig.IsSystemAssembly canonicalItemSpec;
|
||||
sysdir= tcConfig.IsSystemAssembly canonicalItemSpec;
|
||||
ilAssemblyRef = ref None})
|
||||
(maxIndexOfReference, assemblyResolutions))
|
||||
|
||||
|
@ -3812,16 +3882,16 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
|
|||
None
|
||||
else
|
||||
None
|
||||
|
||||
#if SHADOW_COPY_REFERENCES
|
||||
let ilILBinaryReader = OpenILBinary(filename,tcConfig.optimizeForMemory,tcConfig.openBinariesInMemory,ilGlobalsOpt,pdbPathOption, tcConfig.primaryAssembly.Name, tcConfig.noDebugData, tcConfig.shadowCopyReferences)
|
||||
|
||||
#else
|
||||
let ilILBinaryReader = OpenILBinary(filename,tcConfig.optimizeForMemory,tcConfig.openBinariesInMemory,ilGlobalsOpt,pdbPathOption, tcConfig.primaryAssembly.Name, tcConfig.noDebugData)
|
||||
#endif
|
||||
tcImports.AttachDisposeAction(fun _ -> (ilILBinaryReader :> IDisposable).Dispose())
|
||||
ilILBinaryReader.ILModuleDef, ilILBinaryReader.ILAssemblyRefs
|
||||
with e ->
|
||||
error(Error(FSComp.SR.buildErrorOpeningBinaryFile(filename, e.Message),m))
|
||||
|
||||
|
||||
|
||||
(* auxModTable is used for multi-module assemblies *)
|
||||
member tcImports.MkLoaderForMultiModuleIlAssemblies m =
|
||||
CheckDisposed()
|
||||
|
@ -4214,7 +4284,6 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
|
|||
let ilModule,ilAssemblyRefs = tcImports.OpenILBinaryModule(filename,m)
|
||||
RawFSharpAssemblyDataBackedByFileOnDisk (ilModule, ilAssemblyRefs) :> IRawFSharpAssemblyData
|
||||
|
||||
|
||||
let ilShortAssemName = assemblyData.ShortAssemblyName
|
||||
let ilScopeRef = assemblyData.ILScopeRef
|
||||
|
||||
|
@ -4325,7 +4394,6 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
|
|||
| Some assemblyResolution ->
|
||||
ResultD [assemblyResolution]
|
||||
| None ->
|
||||
|
||||
if tcConfigP.Get().useMonoResolution then
|
||||
let action =
|
||||
match mode with
|
||||
|
@ -4405,7 +4473,6 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
|
|||
else
|
||||
let fslibCcuInfo =
|
||||
let coreLibraryReference = tcConfig.CoreLibraryDllReference()
|
||||
//printfn "coreLibraryReference = %A" coreLibraryReference
|
||||
|
||||
let resolvedAssemblyRef =
|
||||
match tcResolutions.TryFindByOriginalReference coreLibraryReference with
|
||||
|
@ -4418,7 +4485,6 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
|
|||
|
||||
match resolvedAssemblyRef with
|
||||
| Some coreLibraryResolution ->
|
||||
//printfn "coreLibraryResolution = '%s'" coreLibraryResolution.resolvedPath
|
||||
match frameworkTcImports.RegisterAndImportReferencedAssemblies([coreLibraryResolution]) with
|
||||
| (_, [ResolvedImportedAssembly(fslibCcuInfo) ]) -> fslibCcuInfo
|
||||
| _ ->
|
||||
|
@ -4748,7 +4814,11 @@ module private ScriptPreprocessClosure =
|
|||
tcConfigB.resolutionEnvironment <-
|
||||
match codeContext with
|
||||
| CodeContext.Editing -> MSBuildResolver.DesigntimeLike
|
||||
#if FX_MSBUILDRESOLVER_RUNTIMELIKE
|
||||
| CodeContext.Compilation | CodeContext.Evaluation -> MSBuildResolver.RuntimeLike
|
||||
#else
|
||||
| CodeContext.Compilation | CodeContext.Evaluation -> MSBuildResolver.CompileTimeLike
|
||||
#endif
|
||||
tcConfigB.framework <- false
|
||||
// Indicates that there are some references not in BasicReferencesForScriptLoadClosure which should
|
||||
// be added conditionally once the relevant version of mscorlib.dll has been detected.
|
||||
|
@ -4983,10 +5053,13 @@ let CheckSimulateException(tcConfig:TcConfig) =
|
|||
| Some("tc-oom") -> raise(System.OutOfMemoryException())
|
||||
| Some("tc-an") -> raise(System.ArgumentNullException("simulated"))
|
||||
| Some("tc-invop") -> raise(System.InvalidOperationException())
|
||||
#if FX_REDUCED_EXCEPTIONS
|
||||
#else
|
||||
| Some("tc-av") -> raise(System.AccessViolationException())
|
||||
| Some("tc-nfn") -> raise(System.NotFiniteNumberException())
|
||||
#endif
|
||||
| Some("tc-aor") -> raise(System.ArgumentOutOfRangeException())
|
||||
| Some("tc-dv0") -> raise(System.DivideByZeroException())
|
||||
| Some("tc-nfn") -> raise(System.NotFiniteNumberException())
|
||||
| Some("tc-oe") -> raise(System.OverflowException())
|
||||
| Some("tc-atmm") -> raise(System.ArrayTypeMismatchException())
|
||||
| Some("tc-bif") -> raise(System.BadImageFormatException())
|
||||
|
|
|
@ -295,6 +295,7 @@ type TcConfigBuilder =
|
|||
mutable signer : string option
|
||||
mutable container : string option
|
||||
mutable delaysign : bool
|
||||
mutable publicsign : bool
|
||||
mutable version : VersionFlag
|
||||
mutable metadataVersion : string option
|
||||
mutable standalone : bool
|
||||
|
@ -303,7 +304,7 @@ type TcConfigBuilder =
|
|||
mutable onlyEssentialOptimizationData : bool
|
||||
mutable useOptimizationDataFile : bool
|
||||
mutable useSignatureDataFile : bool
|
||||
mutable jitTracking : bool
|
||||
mutable portablePDB : bool
|
||||
mutable ignoreSymbolStoreSequencePoints : bool
|
||||
mutable internConstantStrings : bool
|
||||
mutable extraOptimizationIterations : int
|
||||
|
@ -330,7 +331,11 @@ type TcConfigBuilder =
|
|||
mutable optsOn : bool
|
||||
mutable optSettings : Optimizer.OptimizationSettings
|
||||
mutable emitTailcalls : bool
|
||||
#if PREFERRED_UI_LANG
|
||||
mutable preferredUiLang: string option
|
||||
#else
|
||||
mutable lcid : int option
|
||||
#endif
|
||||
mutable productNameForBannerText : string
|
||||
mutable showBanner : bool
|
||||
mutable showTimes : bool
|
||||
|
@ -352,8 +357,10 @@ type TcConfigBuilder =
|
|||
mutable emitDebugInfoInQuotations : bool
|
||||
mutable exename : string option
|
||||
mutable copyFSharpCore : bool
|
||||
mutable shadowCopyReferences : bool }
|
||||
|
||||
#if SHADOW_COPY_REFERENCES
|
||||
mutable shadowCopyReferences : bool
|
||||
#endif
|
||||
}
|
||||
|
||||
static member CreateNew :
|
||||
defaultFSharpBinariesDir: string *
|
||||
|
@ -440,6 +447,7 @@ type TcConfig =
|
|||
member signer : string option
|
||||
member container : string option
|
||||
member delaysign : bool
|
||||
member publicsign : bool
|
||||
member version : VersionFlag
|
||||
member metadataVersion : string option
|
||||
member standalone : bool
|
||||
|
@ -448,7 +456,7 @@ type TcConfig =
|
|||
member onlyEssentialOptimizationData : bool
|
||||
member useOptimizationDataFile : bool
|
||||
member useSignatureDataFile : bool
|
||||
member jitTracking : bool
|
||||
member portablePDB : bool
|
||||
member ignoreSymbolStoreSequencePoints : bool
|
||||
member internConstantStrings : bool
|
||||
member extraOptimizationIterations : int
|
||||
|
@ -474,7 +482,11 @@ type TcConfig =
|
|||
member doFinalSimplify : bool
|
||||
member optSettings : Optimizer.OptimizationSettings
|
||||
member emitTailcalls : bool
|
||||
member lcid : int option
|
||||
#if PREFERRED_UI_LANG
|
||||
member preferredUiLang: string option
|
||||
#else
|
||||
member lcid : int option
|
||||
#endif
|
||||
member optsOn : bool
|
||||
member productNameForBannerText : string
|
||||
member showBanner : bool
|
||||
|
@ -510,8 +522,9 @@ type TcConfig =
|
|||
member sqmNumOfSourceFiles : int
|
||||
member sqmSessionStartedTime : int64
|
||||
member copyFSharpCore : bool
|
||||
#if SHADOW_COPY_REFERENCES
|
||||
member shadowCopyReferences : bool
|
||||
|
||||
#endif
|
||||
static member Create : TcConfigBuilder * validate: bool -> TcConfig
|
||||
|
||||
/// Represents a computation to return a TcConfig. Normally this is just a constant immutable TcConfig,
|
||||
|
|
|
@ -26,17 +26,24 @@ open Microsoft.FSharp.Compiler.AbstractIL.IL
|
|||
open Microsoft.FSharp.Compiler.Lib
|
||||
open Microsoft.FSharp.Compiler.Range
|
||||
open Microsoft.FSharp.Compiler.Lexhelp
|
||||
|
||||
#if NO_COMPILER_BACKEND
|
||||
#else
|
||||
open Microsoft.FSharp.Compiler.IlxGen
|
||||
#endif
|
||||
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
open Microsoft.FSharp.Core.ReflectionAdapters
|
||||
#endif
|
||||
|
||||
module Attributes =
|
||||
open System.Runtime.CompilerServices
|
||||
|
||||
//[<assembly: System.Security.SecurityTransparent>]
|
||||
#if FX_NO_DEFAULT_DEPENDENCY_TYPE
|
||||
#else
|
||||
[<Dependency("FSharp.Core",LoadHint.Always)>]
|
||||
#endif
|
||||
do()
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -102,7 +109,10 @@ let compilerOptionUsage (CompilerOption(s,tag,spec,_,_)) =
|
|||
let PrintCompilerOption (CompilerOption(_s,_tag,_spec,_,help) as compilerOption) =
|
||||
let flagWidth = 30 // fixed width for printing of flags, e.g. --warnaserror:<warn;...>
|
||||
let defaultLineWidth = 80 // the fallback width
|
||||
let lineWidth = try System.Console.BufferWidth with e -> defaultLineWidth
|
||||
let lineWidth =
|
||||
try
|
||||
System.Console.BufferWidth
|
||||
with e -> defaultLineWidth
|
||||
let lineWidth = if lineWidth=0 then defaultLineWidth else lineWidth (* Have seen BufferWidth=0 on Linux/Mono *)
|
||||
// Lines have this form: <flagWidth><space><description>
|
||||
// flagWidth chars - for flags description or padding on continuation lines.
|
||||
|
@ -464,10 +474,11 @@ let SetDebugSwitch (tcConfigB : TcConfigBuilder) (dtype : string option) (s : Op
|
|||
match dtype with
|
||||
| Some(s) ->
|
||||
match s with
|
||||
| "pdbonly" -> tcConfigB.jitTracking <- false
|
||||
| "full" -> tcConfigB.jitTracking <- true
|
||||
| "portable" -> tcConfigB.portablePDB <- true
|
||||
| "pdbonly" -> tcConfigB.portablePDB <- false
|
||||
| "full" -> tcConfigB.portablePDB <- false
|
||||
| _ -> error(Error(FSComp.SR.optsUnrecognizedDebugType(s), rangeCmdArgs))
|
||||
| None -> tcConfigB.jitTracking <- s = OptionSwitch.On
|
||||
| None -> tcConfigB.portablePDB <- false
|
||||
tcConfigB.debuginfo <- s = OptionSwitch.On
|
||||
|
||||
let setOutFileName tcConfigB s =
|
||||
|
@ -488,7 +499,7 @@ let tagFileList = "<file;...>"
|
|||
let tagDirList = "<dir;...>"
|
||||
let tagPathList = "<path;...>"
|
||||
let tagResInfo = "<resinfo>"
|
||||
let tagFullPDBOnly = "{full|pdbonly}"
|
||||
let tagFullPDBOnlyPortable = "{full|pdbonly|portable}"
|
||||
let tagWarnList = "<warn;...>"
|
||||
let tagSymbolList = "<symbol;...>"
|
||||
let tagAddress = "<address>"
|
||||
|
@ -509,14 +520,13 @@ let PrintOptionInfo (tcConfigB:TcConfigBuilder) =
|
|||
printfn " doDetuple . . . . . . : %+A" tcConfigB.doDetuple
|
||||
printfn " doTLR . . . . . . . . : %+A" tcConfigB.doTLR
|
||||
printfn " doFinalSimplify. . . . : %+A" tcConfigB.doFinalSimplify
|
||||
printfn " jitTracking . . . . . : %+A" tcConfigB.jitTracking
|
||||
printfn " portablePDB. . . . . . : %+A" tcConfigB.portablePDB
|
||||
printfn " debuginfo . . . . . . : %+A" tcConfigB.debuginfo
|
||||
printfn " resolutionEnvironment : %+A" tcConfigB.resolutionEnvironment
|
||||
printfn " product . . . . . . . : %+A" tcConfigB.productNameForBannerText
|
||||
printfn " copyFSharpCore . . . . : %+A" tcConfigB.copyFSharpCore
|
||||
tcConfigB.includes |> List.sort
|
||||
|> List.iter (printfn " include . . . . . . . : %A")
|
||||
|
||||
|
||||
// OptionBlock: Input files
|
||||
//-------------------------
|
||||
|
@ -570,7 +580,7 @@ let errorsAndWarningsFlags (tcConfigB : TcConfigBuilder) =
|
|||
|
||||
// OptionBlock: Output files
|
||||
//--------------------------
|
||||
|
||||
|
||||
let outputFileFlagsFsi (_tcConfigB : TcConfigBuilder) = []
|
||||
let outputFileFlagsFsc (tcConfigB : TcConfigBuilder) =
|
||||
[
|
||||
|
@ -579,7 +589,7 @@ let outputFileFlagsFsc (tcConfigB : TcConfigBuilder) =
|
|||
|
||||
CompilerOption("target", tagExe, OptionString (SetTarget tcConfigB), None,
|
||||
Some (FSComp.SR.optsBuildConsole()));
|
||||
|
||||
|
||||
CompilerOption("target", tagWinExe, OptionString (SetTarget tcConfigB), None,
|
||||
Some (FSComp.SR.optsBuildWindows()));
|
||||
|
||||
|
@ -592,6 +602,9 @@ let outputFileFlagsFsc (tcConfigB : TcConfigBuilder) =
|
|||
CompilerOption("delaysign", tagNone, OptionSwitch (fun s -> tcConfigB.delaysign <- (s = OptionSwitch.On)), None,
|
||||
Some (FSComp.SR.optsDelaySign()));
|
||||
|
||||
CompilerOption("publicsign", tagNone, OptionSwitch (fun s -> tcConfigB.publicsign <- (s = OptionSwitch.On)), None,
|
||||
Some (FSComp.SR.optsPublicSign()));
|
||||
|
||||
CompilerOption("doc", tagFile, OptionString (fun s -> tcConfigB.xmlDocOutputFile <- Some s), None,
|
||||
Some (FSComp.SR.optsWriteXml()));
|
||||
|
||||
|
@ -642,13 +655,13 @@ let resourcesFlagsFsc (tcConfigB : TcConfigBuilder) =
|
|||
|
||||
// OptionBlock: Code generation
|
||||
//-----------------------------
|
||||
|
||||
|
||||
let codeGenerationFlags (tcConfigB : TcConfigBuilder) =
|
||||
[
|
||||
CompilerOption("debug", tagNone, OptionSwitch (SetDebugSwitch tcConfigB None), None,
|
||||
Some (FSComp.SR.optsDebugPM()));
|
||||
|
||||
CompilerOption("debug", tagFullPDBOnly, OptionString (fun s -> SetDebugSwitch tcConfigB (Some(s)) OptionSwitch.On), None,
|
||||
|
||||
CompilerOption("debug", tagFullPDBOnlyPortable, OptionString (fun s -> SetDebugSwitch tcConfigB (Some(s)) OptionSwitch.On), None,
|
||||
Some (FSComp.SR.optsDebug()));
|
||||
|
||||
CompilerOption("optimize", tagNone, OptionSwitch (SetOptimizeSwitch tcConfigB) , None,
|
||||
|
@ -659,9 +672,9 @@ let codeGenerationFlags (tcConfigB : TcConfigBuilder) =
|
|||
|
||||
CompilerOption("crossoptimize", tagNone, OptionSwitch (crossOptimizeSwitch tcConfigB), None,
|
||||
Some (FSComp.SR.optsCrossoptimize()));
|
||||
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
||||
// OptionBlock: Language
|
||||
//----------------------
|
||||
|
@ -691,7 +704,7 @@ let libFlag (tcConfigB : TcConfigBuilder) =
|
|||
let libFlagAbbrev (tcConfigB : TcConfigBuilder) =
|
||||
CompilerOption("I", tagDirList, OptionStringList (fun s -> tcConfigB.AddIncludePath (rangeStartup,s,tcConfigB.implicitIncludeDir)), None,
|
||||
Some (FSComp.SR.optsShortFormOf("--lib")))
|
||||
|
||||
|
||||
let codePageFlag (tcConfigB : TcConfigBuilder) =
|
||||
CompilerOption("codepage", tagInt, OptionInt (fun n ->
|
||||
try
|
||||
|
@ -702,6 +715,11 @@ let codePageFlag (tcConfigB : TcConfigBuilder) =
|
|||
tcConfigB.inputCodePage <- Some(n)), None,
|
||||
Some (FSComp.SR.optsCodepage()))
|
||||
|
||||
#if PREFERRED_UI_LANG
|
||||
let preferredUiLang (tcConfigB: TcConfigBuilder) =
|
||||
CompilerOption("preferreduilang", tagString, OptionString (fun s -> tcConfigB.preferredUiLang <- Some(s)), None, Some(FSComp.SR.optsStrongKeyContainer()));
|
||||
#endif
|
||||
|
||||
let utf8OutputFlag (tcConfigB: TcConfigBuilder) =
|
||||
CompilerOption("utf8output", tagNone, OptionUnit (fun () -> tcConfigB.utf8output <- true), None,
|
||||
Some (FSComp.SR.optsUtf8output()))
|
||||
|
@ -713,11 +731,14 @@ let fullPathsFlag (tcConfigB : TcConfigBuilder) =
|
|||
let cliRootFlag (_tcConfigB : TcConfigBuilder) =
|
||||
CompilerOption("cliroot", tagString, OptionString (fun _ -> ()), Some(DeprecatedCommandLineOptionFull(FSComp.SR.optsClirootDeprecatedMsg(), rangeCmdArgs)),
|
||||
Some(FSComp.SR.optsClirootDescription()))
|
||||
|
||||
|
||||
let advancedFlagsBoth tcConfigB =
|
||||
[
|
||||
codePageFlag tcConfigB;
|
||||
utf8OutputFlag tcConfigB;
|
||||
#if PREFERRED_UI_LANG
|
||||
preferredUiLang tcConfigB;
|
||||
#endif
|
||||
fullPathsFlag tcConfigB;
|
||||
libFlag tcConfigB;
|
||||
]
|
||||
|
@ -752,15 +773,15 @@ let advancedFlagsFsc tcConfigB =
|
|||
yield CompilerOption("staticlink", tagFile, OptionString (fun s -> tcConfigB.extraStaticLinkRoots <- tcConfigB.extraStaticLinkRoots @ [s]), None,
|
||||
Some (FSComp.SR.optsStaticlink()));
|
||||
|
||||
#if ENABLE_MONO_SUPPORT
|
||||
if runningOnMono then
|
||||
yield CompilerOption("resident", tagFile, OptionUnit (fun () -> ()), None,
|
||||
Some (FSComp.SR.optsResident()));
|
||||
|
||||
#endif
|
||||
yield CompilerOption("pdb", tagString, OptionString (fun s -> tcConfigB.debugSymbolFile <- Some s), None,
|
||||
Some (FSComp.SR.optsPdb()));
|
||||
yield CompilerOption("simpleresolution", tagNone, OptionUnit (fun () -> tcConfigB.useMonoResolution<-true), None,
|
||||
Some (FSComp.SR.optsSimpleresolution()));
|
||||
|
||||
yield CompilerOption("highentropyva", tagNone, OptionSwitch (useHighEntropyVASwitch tcConfigB), None, Some (FSComp.SR.optsUseHighEntropyVA()))
|
||||
yield CompilerOption("subsystemversion", tagString, OptionString (subSystemVersionSwitch tcConfigB), None, Some (FSComp.SR.optsSubSystemVersion()))
|
||||
yield CompilerOption("targetprofile", tagString, OptionString (setTargetProfile tcConfigB), None, Some(FSComp.SR.optsTargetProfile()))
|
||||
|
@ -792,7 +813,11 @@ let testFlag tcConfigB =
|
|||
let vsSpecificFlags (tcConfigB: TcConfigBuilder) =
|
||||
[ CompilerOption("vserrors", tagNone, OptionUnit (fun () -> tcConfigB.errorStyle <- ErrorStyle.VSErrors), None, None);
|
||||
CompilerOption("validate-type-providers", tagNone, OptionUnit (id), None, None); // preserved for compatibility's sake, no longer has any effect
|
||||
#if PREFERRED_UI_LANG
|
||||
CompilerOption("LCID", tagInt, OptionInt (fun _n -> ()), None, None);
|
||||
#else
|
||||
CompilerOption("LCID", tagInt, OptionInt (fun n -> tcConfigB.lcid <- Some(n)), None, None);
|
||||
#endif
|
||||
CompilerOption("flaterrors", tagNone, OptionUnit (fun () -> tcConfigB.flatErrors <- true), None, None);
|
||||
CompilerOption("sqmsessionguid", tagNone, OptionString (fun s -> tcConfigB.sqmSessionGuid <- try System.Guid(s) |> Some with e -> None), None, None);
|
||||
CompilerOption("gccerrors", tagNone, OptionUnit (fun () -> tcConfigB.errorStyle <- ErrorStyle.GccErrors), None, None);
|
||||
|
@ -885,8 +910,8 @@ let deprecatedFlagsFsc tcConfigB =
|
|||
cliRootFlag tcConfigB;
|
||||
CompilerOption("jit-optimize", tagNone, OptionUnit (fun _ -> tcConfigB.optSettings <- { tcConfigB.optSettings with jitOptUser = Some true }), Some(DeprecatedCommandLineOptionNoDescription("--jit-optimize", rangeCmdArgs)), None);
|
||||
CompilerOption("no-jit-optimize", tagNone, OptionUnit (fun _ -> tcConfigB.optSettings <- { tcConfigB.optSettings with jitOptUser = Some false }), Some(DeprecatedCommandLineOptionNoDescription("--no-jit-optimize", rangeCmdArgs)), None);
|
||||
CompilerOption("jit-tracking", tagNone, OptionUnit (fun _ -> tcConfigB.jitTracking <- true), Some(DeprecatedCommandLineOptionNoDescription("--jit-tracking", rangeCmdArgs)), None);
|
||||
CompilerOption("no-jit-tracking", tagNone, OptionUnit (fun _ -> tcConfigB.jitTracking <- false), Some(DeprecatedCommandLineOptionNoDescription("--no-jit-tracking", rangeCmdArgs)), None);
|
||||
CompilerOption("jit-tracking", tagNone, OptionUnit (fun _ -> () ), Some(DeprecatedCommandLineOptionNoDescription("--jit-tracking", rangeCmdArgs)), None);
|
||||
CompilerOption("no-jit-tracking", tagNone, OptionUnit (fun _ -> () ), Some(DeprecatedCommandLineOptionNoDescription("--no-jit-tracking", rangeCmdArgs)), None);
|
||||
CompilerOption("progress", tagNone, OptionUnit (fun () -> progress := true), Some(DeprecatedCommandLineOptionNoDescription("--progress", rangeCmdArgs)), None);
|
||||
(compilingFsLibFlag tcConfigB) ;
|
||||
(compilingFsLib20Flag tcConfigB) ;
|
||||
|
@ -1109,10 +1134,16 @@ let ReportTime (tcConfig:TcConfig) descr =
|
|||
| Some("fsc-oom") -> raise(System.OutOfMemoryException())
|
||||
| Some("fsc-an") -> raise(System.ArgumentNullException("simulated"))
|
||||
| Some("fsc-invop") -> raise(System.InvalidOperationException())
|
||||
#if FX_REDUCED_EXCEPTIONS
|
||||
#else
|
||||
| Some("fsc-av") -> raise(System.AccessViolationException())
|
||||
#endif
|
||||
| Some("fsc-aor") -> raise(System.ArgumentOutOfRangeException())
|
||||
| Some("fsc-dv0") -> raise(System.DivideByZeroException())
|
||||
#if FX_REDUCED_EXCEPTIONS
|
||||
#else
|
||||
| Some("fsc-nfn") -> raise(System.NotFiniteNumberException())
|
||||
#endif
|
||||
| Some("fsc-oe") -> raise(System.OverflowException())
|
||||
| Some("fsc-atmm") -> raise(System.ArrayTypeMismatchException())
|
||||
| Some("fsc-bif") -> raise(System.BadImageFormatException())
|
||||
|
@ -1328,8 +1359,3 @@ let DoWithErrorColor isWarn f =
|
|||
f();
|
||||
finally
|
||||
ignoreFailureOnMono1_1_16 (fun () -> Console.ForegroundColor <- c)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -107,14 +107,15 @@ let rec AttachRange m (exn:exn) =
|
|||
type Exiter =
|
||||
abstract Exit : int -> 'T
|
||||
|
||||
let QuitProcessExiter =
|
||||
{ new Exiter with
|
||||
member x.Exit(n) =
|
||||
try
|
||||
System.Environment.Exit(n)
|
||||
with _ ->
|
||||
()
|
||||
failwithf "%s" <| FSComp.SR.elSysEnvExitDidntExit() }
|
||||
|
||||
let QuitProcessExiter =
|
||||
{ new Exiter with
|
||||
member x.Exit(n) =
|
||||
try
|
||||
System.Environment.Exit(n)
|
||||
with _ ->
|
||||
()
|
||||
failwithf "%s" <| FSComp.SR.elSysEnvExitDidntExit() }
|
||||
|
||||
/// Closed enumeration of build phases.
|
||||
type BuildPhase =
|
||||
|
@ -295,6 +296,10 @@ module ErrorLoggerExtensions =
|
|||
|
||||
// Reraise an exception if it is one we want to report to Watson.
|
||||
let ReraiseIfWatsonable(exn:exn) =
|
||||
#if FX_REDUCED_EXCEPTIONS
|
||||
ignore exn
|
||||
()
|
||||
#else
|
||||
match exn with
|
||||
// These few SystemExceptions which we don't report to Watson are because we handle these in some way in Build.fs
|
||||
| :? System.Reflection.TargetInvocationException -> ()
|
||||
|
@ -306,6 +311,7 @@ module ErrorLoggerExtensions =
|
|||
PreserveStackTrace(exn)
|
||||
raise exn
|
||||
| _ -> ()
|
||||
#endif
|
||||
|
||||
type ErrorLogger with
|
||||
member x.ErrorR exn = match exn with StopProcessing | ReportedError _ -> raise exn | _ -> x.ErrorSink(PhasedError.Create(exn,CompileThreadStatic.BuildPhase))
|
||||
|
@ -319,7 +325,10 @@ module ErrorLoggerExtensions =
|
|||
// Throws StopProcessing and exceptions raised by the ErrorSink(exn) handler.
|
||||
match exn with
|
||||
(* Don't send ThreadAbortException down the error channel *)
|
||||
#if FX_REDUCED_EXCEPTIONS
|
||||
#else
|
||||
| :? System.Threading.ThreadAbortException | WrappedError((:? System.Threading.ThreadAbortException),_) -> ()
|
||||
#endif
|
||||
| ReportedError _ | WrappedError(ReportedError _,_) -> ()
|
||||
| StopProcessing | WrappedError(StopProcessing,_) -> raise exn
|
||||
| _ ->
|
||||
|
|
|
@ -9,7 +9,6 @@ namespace Microsoft.FSharp.Compiler
|
|||
module internal ExtensionTyping =
|
||||
open System
|
||||
open System.IO
|
||||
open System.Reflection
|
||||
open System.Collections.Generic
|
||||
open Microsoft.FSharp.Core.CompilerServices
|
||||
open Microsoft.FSharp.Compiler.ErrorLogger
|
||||
|
@ -18,6 +17,12 @@ module internal ExtensionTyping =
|
|||
open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics // dprintfn
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library // frontAndBack
|
||||
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
open Microsoft.FSharp.Core.ReflectionAdapters
|
||||
#else
|
||||
type BindingFlags = System.Reflection.BindingFlags
|
||||
#endif
|
||||
|
||||
type TypeProviderDesignation = TypeProviderDesignation of string
|
||||
|
||||
exception ProvidedTypeResolution of range * System.Exception
|
||||
|
@ -62,7 +67,7 @@ module internal ExtensionTyping =
|
|||
if designTimeAssemblyNameString.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) then
|
||||
loadFromDir designTimeAssemblyNameString
|
||||
else
|
||||
let name = AssemblyName designTimeAssemblyNameString
|
||||
let name = System.Reflection.AssemblyName designTimeAssemblyNameString
|
||||
if name.Name.Equals(name.FullName, StringComparison.OrdinalIgnoreCase) then
|
||||
let fileName = designTimeAssemblyNameString+".dll"
|
||||
loadFromDir fileName
|
||||
|
@ -86,7 +91,9 @@ module internal ExtensionTyping =
|
|||
|
||||
let StripException (e:exn) =
|
||||
match e with
|
||||
| :? TargetInvocationException as e -> e.InnerException
|
||||
#if !FX_REDUCED_EXCEPTIONS
|
||||
| :? System.Reflection.TargetInvocationException as e -> e.InnerException
|
||||
#endif
|
||||
| :? TypeInitializationException as e -> e.InnerException
|
||||
| _ -> e
|
||||
|
||||
|
@ -143,29 +150,29 @@ module internal ExtensionTyping =
|
|||
m:range) =
|
||||
|
||||
let providerSpecs =
|
||||
try
|
||||
let designTimeAssemblyName =
|
||||
try
|
||||
Some (AssemblyName designTimeAssemblyNameString)
|
||||
with :? ArgumentException ->
|
||||
errorR(Error(FSComp.SR.etInvalidTypeProviderAssemblyName(runTimeAssemblyFileName,designTimeAssemblyNameString),m))
|
||||
None
|
||||
try
|
||||
let designTimeAssemblyName =
|
||||
try
|
||||
Some (System.Reflection.AssemblyName designTimeAssemblyNameString)
|
||||
with :? ArgumentException ->
|
||||
errorR(Error(FSComp.SR.etInvalidTypeProviderAssemblyName(runTimeAssemblyFileName,designTimeAssemblyNameString),m))
|
||||
None
|
||||
|
||||
[ match designTimeAssemblyName,resolutionEnvironment.outputFile with
|
||||
| Some designTimeAssemblyName, Some path when String.Compare(designTimeAssemblyName.Name, Path.GetFileNameWithoutExtension path, StringComparison.OrdinalIgnoreCase) = 0 ->
|
||||
()
|
||||
| Some _, _ ->
|
||||
for t in GetTypeProviderImplementationTypes (runTimeAssemblyFileName,designTimeAssemblyNameString,m) do
|
||||
let resolver = CreateTypeProvider (t, runTimeAssemblyFileName, resolutionEnvironment, isInvalidationSupported, isInteractive, systemRuntimeContainsType, systemRuntimeAssemblyVersion, m)
|
||||
match box resolver with
|
||||
| null -> ()
|
||||
| _ -> yield (resolver,ilScopeRefOfRuntimeAssembly)
|
||||
| None, _ ->
|
||||
() ]
|
||||
[ match designTimeAssemblyName,resolutionEnvironment.outputFile with
|
||||
| Some designTimeAssemblyName, Some path when String.Compare(designTimeAssemblyName.Name, Path.GetFileNameWithoutExtension path, StringComparison.OrdinalIgnoreCase) = 0 ->
|
||||
()
|
||||
| Some _, _ ->
|
||||
for t in GetTypeProviderImplementationTypes (runTimeAssemblyFileName,designTimeAssemblyNameString,m) do
|
||||
let resolver = CreateTypeProvider (t, runTimeAssemblyFileName, resolutionEnvironment, isInvalidationSupported, isInteractive, systemRuntimeContainsType, systemRuntimeAssemblyVersion, m)
|
||||
match box resolver with
|
||||
| null -> ()
|
||||
| _ -> yield (resolver,ilScopeRefOfRuntimeAssembly)
|
||||
| None, _ ->
|
||||
() ]
|
||||
|
||||
with :? TypeProviderError as tpe ->
|
||||
tpe.Iter(fun e -> errorR(NumberedError((e.Number,e.ContextualErrorMessage),m)) )
|
||||
[]
|
||||
with :? TypeProviderError as tpe ->
|
||||
tpe.Iter(fun e -> errorR(NumberedError((e.Number,e.ContextualErrorMessage),m)) )
|
||||
[]
|
||||
|
||||
let providers = Tainted<_>.CreateAll(providerSpecs)
|
||||
|
||||
|
@ -226,8 +233,11 @@ module internal ExtensionTyping =
|
|||
| -1 -> ()
|
||||
| n -> errorR(Error(FSComp.SR.etIllegalCharactersInNamespaceName(string s.[n],s),m))
|
||||
|
||||
|
||||
let bindingFlags = BindingFlags.DeclaredOnly ||| BindingFlags.Static ||| BindingFlags.Instance ||| BindingFlags.Public
|
||||
let bindingFlags =
|
||||
BindingFlags.DeclaredOnly |||
|
||||
BindingFlags.Static |||
|
||||
BindingFlags.Instance |||
|
||||
BindingFlags.Public
|
||||
|
||||
// NOTE: for the purposes of remapping the closure of generated types, the FullName is sufficient.
|
||||
// We do _not_ rely on object identity or any other notion of equivalence provided by System.Type
|
||||
|
@ -295,16 +305,28 @@ module internal ExtensionTyping =
|
|||
type CustomAttributeData = Microsoft.FSharp.Core.CompilerServices.IProvidedCustomAttributeData
|
||||
type CustomAttributeNamedArgument = Microsoft.FSharp.Core.CompilerServices.IProvidedCustomAttributeNamedArgument
|
||||
type CustomAttributeTypedArgument = Microsoft.FSharp.Core.CompilerServices.IProvidedCustomAttributeTypedArgument
|
||||
#else
|
||||
type CustomAttributeData = System.Reflection.CustomAttributeData
|
||||
type CustomAttributeNamedArgument = System.Reflection.CustomAttributeNamedArgument
|
||||
type CustomAttributeTypedArgument = System.Reflection.CustomAttributeTypedArgument
|
||||
#endif
|
||||
|
||||
|
||||
[<AllowNullLiteral; Sealed>]
|
||||
type ProvidedType (x:System.Type, ctxt: ProvidedTypeContext) =
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
inherit ProvidedMemberInfo(x.GetTypeInfo(),ctxt)
|
||||
#if FX_NO_CUSTOMATTRIBUTEDATA
|
||||
let provide () = ProvidedCustomAttributeProvider.Create (fun provider -> provider.GetMemberCustomAttributesData(x.GetTypeInfo()))
|
||||
#else
|
||||
let provide () = ProvidedCustomAttributeProvider.Create (fun _provider -> x.GetTypeInfo().GetCustomAttributesData())
|
||||
#endif
|
||||
#else
|
||||
inherit ProvidedMemberInfo(x,ctxt)
|
||||
#if FX_NO_CUSTOMATTRIBUTEDATA
|
||||
let provide () = ProvidedCustomAttributeProvider.Create (fun provider -> provider.GetMemberCustomAttributesData(x))
|
||||
#else
|
||||
let provide () = ProvidedCustomAttributeProvider.Create (fun _provider -> x.GetCustomAttributesData())
|
||||
#endif
|
||||
#endif
|
||||
interface IProvidedCustomAttributeProvider with
|
||||
member __.GetHasTypeProviderEditorHideMethodsAttribute(provider) = provide().GetHasTypeProviderEditorHideMethodsAttribute(provider)
|
||||
|
@ -334,7 +356,7 @@ module internal ExtensionTyping =
|
|||
member __.GetConstructors() = x.GetConstructors(bindingFlags) |> ProvidedConstructorInfo.CreateArray ctxt
|
||||
member __.GetFields() = x.GetFields(bindingFlags) |> ProvidedFieldInfo.CreateArray ctxt
|
||||
member __.GetField nm = x.GetField(nm, bindingFlags) |> ProvidedFieldInfo.Create ctxt
|
||||
member __.GetAllNestedTypes() = x.GetNestedTypes(bindingFlags ||| System.Reflection.BindingFlags.NonPublic) |> ProvidedType.CreateArray ctxt
|
||||
member __.GetAllNestedTypes() = x.GetNestedTypes(bindingFlags ||| BindingFlags.NonPublic) |> ProvidedType.CreateArray ctxt
|
||||
member __.GetNestedTypes() = x.GetNestedTypes(bindingFlags) |> ProvidedType.CreateArray ctxt
|
||||
/// Type.GetNestedType(string) can return null if there is no nested type with given name
|
||||
member __.GetNestedType nm = x.GetNestedType (nm, bindingFlags) |> ProvidedType.Create ctxt
|
||||
|
@ -439,6 +461,7 @@ module internal ExtensionTyping =
|
|||
#else
|
||||
let provide () = ProvidedCustomAttributeProvider.Create (fun _provider -> x.GetCustomAttributesData())
|
||||
#endif
|
||||
|
||||
member __.Name = x.Name
|
||||
/// DeclaringType can be null if MemberInfo belongs to Module, not to Type
|
||||
member __.DeclaringType = ProvidedType.Create ctxt x.DeclaringType
|
||||
|
@ -464,7 +487,7 @@ module internal ExtensionTyping =
|
|||
#endif
|
||||
member __.IsOptional = x.IsOptional
|
||||
member __.RawDefaultValue = x.RawDefaultValue
|
||||
member __.HasDefaultValue = x.Attributes.HasFlag(ParameterAttributes.HasDefault)
|
||||
member __.HasDefaultValue = x.Attributes.HasFlag(System.Reflection.ParameterAttributes.HasDefault)
|
||||
/// ParameterInfo.ParameterType cannot be null
|
||||
member __.ParameterType = ProvidedType.CreateWithNullCheck ctxt "ParameterType" x.ParameterType
|
||||
static member Create ctxt x = match x with null -> null | t -> ProvidedParameterInfo (t,ctxt)
|
||||
|
@ -520,12 +543,12 @@ module internal ExtensionTyping =
|
|||
itp2.GetStaticParametersForMethod(x)
|
||||
| _ ->
|
||||
// To allow a type provider to depend only on FSharp.Core 4.3.0.0, it can alternatively implement an appropriate method called GetStaticParametersForMethod
|
||||
let meth = provider.GetType().GetMethod( "GetStaticParametersForMethod", bindingFlags, null, [| typeof<MethodBase> |], null)
|
||||
let meth = provider.GetType().GetMethod( "GetStaticParametersForMethod", bindingFlags, null, [| typeof<System.Reflection.MethodBase> |], null)
|
||||
if isNull meth then [| |] else
|
||||
let paramsAsObj =
|
||||
try meth.Invoke(provider, bindingFlags ||| BindingFlags.InvokeMethod, null, [| box x |], null)
|
||||
with err -> raise (StripException (StripException err))
|
||||
paramsAsObj :?> ParameterInfo[]
|
||||
paramsAsObj :?> System.Reflection.ParameterInfo[]
|
||||
|
||||
staticParams |> ProvidedParameterInfo.CreateArray ctxt
|
||||
|
||||
|
@ -538,7 +561,7 @@ module internal ExtensionTyping =
|
|||
itp2.ApplyStaticArgumentsForMethod(x, fullNameAfterArguments, staticArgs)
|
||||
| _ ->
|
||||
// To allow a type provider to depend only on FSharp.Core 4.3.0.0, it can alternatively implement a method called GetStaticParametersForMethod
|
||||
let meth = provider.GetType().GetMethod( "ApplyStaticArgumentsForMethod", bindingFlags, null, [| typeof<MethodBase>; typeof<string>; typeof<obj[]> |], null)
|
||||
let meth = provider.GetType().GetMethod( "ApplyStaticArgumentsForMethod", bindingFlags, null, [| typeof<System.Reflection.MethodBase>; typeof<string>; typeof<obj[]> |], null)
|
||||
match meth with
|
||||
| null -> failwith (FSComp.SR.estApplyStaticArgumentsForMethodNotImplemented())
|
||||
| _ ->
|
||||
|
@ -547,11 +570,11 @@ module internal ExtensionTyping =
|
|||
with err -> raise (StripException (StripException err))
|
||||
|
||||
match mbAsObj with
|
||||
| :? MethodBase as mb -> mb
|
||||
| :? System.Reflection.MethodBase as mb -> mb
|
||||
| _ -> failwith (FSComp.SR.estApplyStaticArgumentsForMethodNotImplemented())
|
||||
match mb with
|
||||
| :? MethodInfo as mi -> (mi |> ProvidedMethodInfo.Create ctxt : ProvidedMethodInfo) :> ProvidedMethodBase
|
||||
| :? ConstructorInfo as ci -> (ci |> ProvidedConstructorInfo.Create ctxt : ProvidedConstructorInfo) :> ProvidedMethodBase
|
||||
| :? System.Reflection.MethodInfo as mi -> (mi |> ProvidedMethodInfo.Create ctxt : ProvidedMethodInfo) :> ProvidedMethodBase
|
||||
| :? System.Reflection.ConstructorInfo as ci -> (ci |> ProvidedConstructorInfo.Create ctxt : ProvidedConstructorInfo) :> ProvidedMethodBase
|
||||
| _ -> failwith (FSComp.SR.estApplyStaticArgumentsForMethodNotImplemented())
|
||||
|
||||
|
||||
|
@ -590,7 +613,10 @@ module internal ExtensionTyping =
|
|||
|
||||
static member CreateArray ctxt xs = match xs with null -> null | _ -> xs |> Array.map (ProvidedMethodInfo.Create ctxt)
|
||||
member __.Handle = x
|
||||
#if FX_NO_REFLECTION_METADATA_TOKENS
|
||||
#else
|
||||
member __.MetadataToken = x.MetadataToken
|
||||
#endif
|
||||
override __.Equals y = assert false; match y with :? ProvidedMethodInfo as y -> x.Equals y.Handle | _ -> false
|
||||
override __.GetHashCode() = assert false; x.GetHashCode()
|
||||
|
||||
|
|
|
@ -183,7 +183,10 @@ module internal ExtensionTyping =
|
|||
ProvidedMethodInfo =
|
||||
inherit ProvidedMethodBase
|
||||
member ReturnType : ProvidedType
|
||||
#if FX_NO_REFLECTION_METADATA_TOKENS
|
||||
#else
|
||||
member MetadataToken : int
|
||||
#endif
|
||||
|
||||
and [<AllowNullLiteral; Sealed; Class>]
|
||||
ProvidedParameterInfo =
|
||||
|
|
|
@ -812,6 +812,7 @@ optsBuildWindows,"Build a Windows executable"
|
|||
optsBuildLibrary,"Build a library (Short form: -a)"
|
||||
optsBuildModule,"Build a module that can be added to another assembly"
|
||||
optsDelaySign,"Delay-sign the assembly using only the public portion of the strong name key"
|
||||
optsPublicSign,"Public-sign the assembly using only the public portion of the strong name key, and mark the assembly as signed"
|
||||
optsWriteXml,"Write the xmldoc of the assembly to the given file"
|
||||
optsStrongKeyFile,"Specify a strong name key file"
|
||||
optsStrongKeyContainer,"Specify a strong name key container"
|
||||
|
@ -826,7 +827,7 @@ optsNowin32manifest,"Do not include the default Win32 manifest"
|
|||
optsResource,"Embed the specified managed resource"
|
||||
optsLinkresource,"Link the specified resource to this assembly where the resinfo format is <file>[,<string name>[,public|private]]"
|
||||
optsDebugPM,"Emit debug information (Short form: -g)"
|
||||
optsDebug,"Specify debugging type: full, pdbonly. ('full' is the default and enables attaching a debugger to a running program)."
|
||||
optsDebug,"Specify debugging type: full, portable, pdbonly. ('full' is the default and enables attaching a debugger to a running program. 'portable' is a cross-platform format)."
|
||||
optsOptimize,"Enable optimizations (Short form: -O)"
|
||||
optsTailcalls,"Enable or disable tailcalls"
|
||||
optsCrossoptimize,"Enable or disable cross-module optimizations"
|
||||
|
@ -877,6 +878,7 @@ optsUseHighEntropyVA,"Enable high-entropy ASLR"
|
|||
optsSubSystemVersion,"Specify subsystem version of this assembly"
|
||||
optsTargetProfile,"Specify target framework profile of this assembly. Valid values are mscorlib or netcore. Default - mscorlib"
|
||||
optsEmitDebugInfoInQuotations,"Emit debug information in quotations"
|
||||
optsPreferredUiLang," Specify the preferred output language culture name (e.g. es-ES, ja-JP)"
|
||||
optsNoCopyFsharpCore,"Don't copy FSharp.Core.dll along the produced binaries"
|
||||
1051,optsInvalidSubSystemVersion,"Invalid version '%s' for '--subsystemversion'. The version must be 4.00 or greater."
|
||||
1052,optsInvalidTargetProfile,"Invalid value '%s' for '--targetprofile', valid values are 'mscorlib' or 'netcore'."
|
||||
|
@ -952,8 +954,11 @@ lexfltSeparatorTokensOfPatternMatchMisaligned,"The '|' tokens separating rules o
|
|||
1133,nrNoConstructorsAvailableForType,"No constructors are available for the type '%s'"
|
||||
1134,nrUnionTypeNeedsQualifiedAccess,"The union type for union case '%s' was defined with the RequireQualifiedAccessAttribute. Include the name of the union type ('%s') in the name you are using."
|
||||
1135,nrRecordTypeNeedsQualifiedAccess,"The record type for the record field '%s' was defined with the RequireQualifiedAccessAttribute. Include the name of the record type ('%s') in the name you are using."
|
||||
1135,ilwriteErrorCreatingPdb,"Unexpected error creating debug information file '%s'"
|
||||
1136,ilwriteErrorCreatingPdb,"Unexpected error creating debug information file '%s'"
|
||||
1138,lexOutsideIntegerRange,"This number is outside the allowable range for this integer type"
|
||||
# -----------------------------------------------------------------------------
|
||||
# lex.fsl errors
|
||||
# -----------------------------------------------------------------------------
|
||||
lexCharNotAllowedInOperatorNames,"'%s' is not permitted as a character in operator names and is reserved for future use"
|
||||
lexUnexpectedChar,"Unexpected character '%s'"
|
||||
1140,lexByteArrayCannotEncode,"This byte array literal contains characters that do not encode as a single byte"
|
||||
|
@ -1063,6 +1068,21 @@ lexIndentOffForML,"Consider using a file with extension '.ml' or '.mli' instead"
|
|||
1243,parsUnexpectedQuotationOperatorInTypeAliasDidYouMeanVerbatimString,"Unexpected quotation operator '<@' in type definition. If you intend to pass a verbatim string as a static argument to a type provider, put a space between the '<' and '@' characters."
|
||||
1244,parsErrorParsingAsOperatorName,"Attempted to parse this as an operator name, but failed"
|
||||
1245,lexInvalidUnicodeLiteral,"\U%s is not a valid Unicode character escape sequence"
|
||||
# reshapedmsbuild.fs
|
||||
1300,toolLocationHelperUnsupportedFrameworkVersion,"The specified .NET Framework version "%s" is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion."
|
||||
# -----------------------------------------------------------------------------
|
||||
# ilsign errors
|
||||
# -----------------------------------------------------------------------------
|
||||
1301,ilSignInvalidMagicValue,"Invalid Magic value in CLR Header"
|
||||
1302,ilSignBadImageFormat,"Bad image format"
|
||||
1303,ilSignPrivateKeyExpected,"Private key expected"
|
||||
1304,ilSignRsaKeyExpected,"RSA key expected"
|
||||
1305,ilSignInvalidBitLen,"Invalid bit Length"
|
||||
1306,ilSignInvalidRSAParams,"Invalid RSAParameters structure - '{{0}}' expected"
|
||||
1307,ilSignInvalidAlgId,"Invalid algId - 'Exponent' expected"
|
||||
1308,ilSignInvalidSignatureSize,"Invalid signature size"
|
||||
1309,ilSignNoSignatureDirectory,"No signature directory"
|
||||
1310,ilSignInvalidPKBlob,"Invalid Public Key blob"
|
||||
# Fsc.exe resource strings
|
||||
fscTooManyErrors,"Exiting - too many errors"
|
||||
2001,docfileNoXmlSuffix,"The documentation file has no .xml suffix"
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
<ProjectGuid>{D8BC791F-C1A9-49DC-9432-0F3090537555}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<FsSrGen Include="..\FSharp.Build\FSBuild.txt">
|
||||
<Link>FSBuild.txt</Link>
|
||||
</FsSrGen>
|
||||
<FsSrGen Include="..\FSharp.Build\FSBuild.txt">
|
||||
<Link>FSBuild.txt</Link>
|
||||
</FsSrGen>
|
||||
<Compile Include="..\..\utils\CompilerLocationUtils.fs">
|
||||
<Link>CompilerLocationUtils.fs</Link>
|
||||
</Compile>
|
||||
|
|
|
@ -13,6 +13,14 @@
|
|||
<AllowCrossTargeting>true</AllowCrossTargeting>
|
||||
<ProjectGuid>{702A7979-BCF9-4C41-853E-3ADFC9897890}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<FilesToLocalize Include="$(OutDir)$(AssemblyName).dll">
|
||||
<TranslationFile>$(FSharpSourcesRoot)\..\loc\lcl\{Lang}\$(AssemblyName).dll.lcl</TranslationFile>
|
||||
<LciCommentFile>$(FSharpSourcesRoot)\..\loc\lci\$(AssemblyName).dll.lci</LciCommentFile>
|
||||
<HasLceComments>false</HasLceComments>
|
||||
<InProject>false</InProject>
|
||||
</FilesToLocalize>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FsSrGen Include="FSBuild.txt">
|
||||
<Link>FSBuild.txt</Link>
|
||||
|
@ -47,12 +55,23 @@
|
|||
<Reference Include="Microsoft.Build.Framework, Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build.Engine, Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build, Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build.Utilities.$(MSBuildVersionSuffix)" />
|
||||
<Reference Include="Microsoft.Build.Tasks.$(MSBuildVersionSuffix)" />
|
||||
<Reference Include="Microsoft.Build.Utilities.$(MSBuildVersionSuffix), Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build.Tasks.$(MSBuildVersionSuffix), Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj">
|
||||
<Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
|
||||
<Name>FSharp.Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(FSharpSourcesRoot)\FSharpSource.targets" />
|
||||
|
||||
<Target Name="GatherBinariesToBeSigned" AfterTargets="Localize">
|
||||
<ItemGroup>
|
||||
<BinariesToBeSigned Include="$(OutDir)$(AssemblyName).dll" />
|
||||
<BinariesToBeSigned Include="$(OutDir)localize\**\$(AssemblyName).resources.dll" />
|
||||
<FilesToSign Include="@(BinariesToBeSigned)">
|
||||
<Authenticode>Microsoft</Authenticode>
|
||||
<StrongName>StrongName</StrongName>
|
||||
</FilesToSign>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -168,7 +168,7 @@ type [<Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:Iden
|
|||
member fsc.DebugSymbols
|
||||
with get() = debugSymbols
|
||||
and set(b) = debugSymbols <- b
|
||||
// --debug <none/pdbonly/full>: Emit debugging information
|
||||
// --debug <none/portable/pdbonly/full>: Emit debugging information
|
||||
member fsc.DebugType
|
||||
with get() = debugType
|
||||
and set(s) = debugType <- s
|
||||
|
@ -384,9 +384,10 @@ type [<Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:Iden
|
|||
if debugType = null then null else
|
||||
match debugType.ToUpperInvariant() with
|
||||
| "NONE" -> null
|
||||
| "PORTABLE" -> "portable"
|
||||
| "PDBONLY" -> "pdbonly"
|
||||
| "FULL" -> "full"
|
||||
| _ -> null)
|
||||
| _ -> null)
|
||||
// NoFramework
|
||||
if noFramework then
|
||||
builder.AppendSwitch("--noframework")
|
||||
|
@ -480,7 +481,6 @@ type [<Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:Iden
|
|||
builder.AppendSwitch("--vserrors")
|
||||
|
||||
builder.AppendSwitchIfNotNull("--LCID:", vslcid)
|
||||
|
||||
if utf8output then
|
||||
builder.AppendSwitch("--utf8output")
|
||||
|
||||
|
|
|
@ -56,6 +56,9 @@
|
|||
<OtherFlags>--internal --lexlib Internal.Utilities.Text.Lexing --parslib Internal.Utilities.Text.Parsing</OtherFlags>
|
||||
<Link>ilpars.fsy</Link>
|
||||
</FsYacc>
|
||||
<Compile Include="..\..\utils\reshapedreflection.fs">
|
||||
<Link>Reflection\reshapedreflection.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\assemblyinfo\assemblyinfo.FSharp.Compiler.dll.fs">
|
||||
<Link>assemblyinfo.FSharp.Compiler.dll.fs</Link>
|
||||
</Compile>
|
||||
|
@ -104,6 +107,12 @@
|
|||
<Compile Include="..\FlatList.fs">
|
||||
<Link>FlatList.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ildiag.fsi">
|
||||
<Link>Utilities\ildiag.fsi</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ildiag.fs">
|
||||
<Link>Utilities\ildiag.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\illib.fs">
|
||||
<Link>illib.fs</Link>
|
||||
</Compile>
|
||||
|
@ -131,12 +140,6 @@
|
|||
<Compile Include="..\..\absil\bytes.fs">
|
||||
<Link>bytes.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ildiag.fsi">
|
||||
<Link>ildiag.fsi</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ildiag.fs">
|
||||
<Link>ildiag.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\ReferenceResolution.fsi">
|
||||
<Link>ReferenceResolution.fsi</Link>
|
||||
</Compile>
|
||||
|
@ -173,6 +176,9 @@
|
|||
<Compile Include="..\..\absil\ilmorph.fs">
|
||||
<Link>ilmorph.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ilsign.fs" Condition=" '$(TargetFramework)'=='coreclr'">
|
||||
<Link>ilsign.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ilsupp.fsi">
|
||||
<Link>ilsupp.fsi</Link>
|
||||
</Compile>
|
||||
|
@ -220,6 +226,12 @@
|
|||
<Compile Include="..\..\absil\ilwrite.fsi">
|
||||
<Link>ilwrite.fsi</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ilwritepdb.fsi">
|
||||
<Link>ilwritepdb.fsi</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ilwritepdb.fs">
|
||||
<Link>ilwritepdb.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ilwrite.fs">
|
||||
<Link>ilwrite.fs</Link>
|
||||
</Compile>
|
||||
|
@ -431,11 +443,16 @@
|
|||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="ISymWrapper, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build, Version=$(VisualStudioVersion).0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build.Utilities.$(MSBuildVersionSuffix), Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build.Tasks.$(MSBuildVersionSuffix), Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build.Framework, Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build.Engine, Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build, Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build.Utilities.$(MSBuildVersionSuffix)" />
|
||||
<Reference Include="Microsoft.Build.Tasks.$(MSBuildVersionSuffix)" />
|
||||
<Reference Include="Microsoft.DiaSymReader.PortablePdb"><HintPath>..\..\..\packages\Microsoft.DiaSymReader.PortablePdb.1.3.20160301.3\lib\portable-net45+win8\Microsoft.DiaSymReader.PortablePdb.dll</HintPath></Reference>
|
||||
<Reference Include="Microsoft.DiaSymReader"><HintPath>..\..\..\packages\Microsoft.DiaSymReader.1.0.7\lib\portable-net45+win8\Microsoft.DiaSymReader.dll</HintPath></Reference>
|
||||
<Reference Include="System.Reflection.Metadata"><HintPath>..\..\..\packages\System.Reflection.Metadata.1.3.0-beta-23816\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath></Reference>
|
||||
<Reference Include="System.Collections.Immutable"><HintPath>..\..\..\packages\System.Collections.Immutable.1.2.0-rc3-23805\lib\portable-net45+win8+wp8+wpa81</HintPath></Reference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(FSharpSourcesRoot)\FSharpSource.targets" />
|
||||
<Import Project="$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin\FSharp.PowerPack.targets" />
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<FSharpSourcesRoot>..\..</FSharpSourcesRoot>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(FSharpSourcesRoot)\FSharpSource.Settings.targets" />
|
||||
|
||||
<PropertyGroup>
|
||||
<pkgversion Condition=" '$(PKGVersion)' == '' ">$(NuGetPerBuildPreReleaseVersion)</pkgversion>
|
||||
<OutDir>$(FSharpSourcesRoot)\..\$(Configuration)\$(TargetFramework)\bin</OutDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="Build" Outputs="$(TargetPath)" DependsOnTargets="$(BuildDependsOn)">
|
||||
<Exec Command="$(FsiToolPath)\$(FsiToolExe) --exec layoutfschostnuget.fsx --nuspec:.\Microsoft.FSharp.Compiler.Host.netcore.nuspec --bindir:$(OutDir)"/>
|
||||
<Exec Command="$(FsiToolPath)\$(FsiToolExe) --exec ..\..\buildtools\buildnugets.fsx --version:$(pkgversion) --nuspec:.\Microsoft.FSharp.Compiler.Host.netcore.nuspec --bindir:$(OutDir)"/>
|
||||
</Target>
|
||||
|
||||
<Target Name="Rebuild" DependsOnTargets="Build" />
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>Microsoft.FSharp.Compiler.Host.netcore</id>
|
||||
<description>
|
||||
netcore compatible version of the fsharp compiler fsc.exe.
|
||||
|
||||
Supported Platforms:
|
||||
- .NET Core (dnxcore50)
|
||||
</description>
|
||||
<language>en-US</language>
|
||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||
<version>$version$</version>
|
||||
<authors>$authors$</authors>
|
||||
<licenseUrl>$licenseUrl$</licenseUrl>
|
||||
<projectUrl>$projectUrl$</projectUrl>
|
||||
<tags>$tags$</tags>
|
||||
<dependencies>
|
||||
<group>
|
||||
<dependency id="Microsoft.NETCore.Platforms" version="1.0.1-rc2-23911" />
|
||||
<dependency id="Microsoft.NETCore.Runtime.CoreCLR" version="1.0.2-rc2-23911" />
|
||||
<dependency id="Microsoft.NETCore" version="5.0.1-rc2-23911" />
|
||||
<dependency id="Microsoft.NETCore.ConsoleHost" version="1.0.0-rc2-23911" />
|
||||
<dependency id="Microsoft.NETCore.Windows.ApiSets" version="1.0.1-rc2-23911" />
|
||||
<dependency id="Microsoft.FSharp.Compiler.NetCore" version="$version$" />
|
||||
</group>
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
</files>
|
||||
</package>
|
|
@ -0,0 +1,56 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information,
|
||||
//
|
||||
// Layout the nuget host package for the fsharp compiler
|
||||
//=========================================================================================
|
||||
open System.IO
|
||||
|
||||
try
|
||||
//=========================================================================================
|
||||
// Command line arguments
|
||||
//=========================================================================================
|
||||
|
||||
// Try head was introduced in F# 4.0
|
||||
let tryHead (source : seq<_>) =
|
||||
let checkNonNull argName arg =
|
||||
match box arg with
|
||||
| null -> nullArg argName
|
||||
| _ -> ()
|
||||
checkNonNull "source" source
|
||||
use e = source.GetEnumerator()
|
||||
if (e.MoveNext()) then Some e.Current
|
||||
else None
|
||||
|
||||
let usage = @"usage: layoutfcsnhostnuget.fsx -nuspec:<nuspec-path> --binaries:<binaries-dir>"
|
||||
|
||||
let Arguments = fsi.CommandLineArgs |> Seq.skip 1
|
||||
|
||||
let GetArgumentFromCommandLine switchName defaultValue =
|
||||
match Arguments |> Seq.filter(fun t -> t.StartsWith(switchName)) |> Seq.map(fun t -> t.Remove(0, switchName.Length).Trim()) |> tryHead with
|
||||
| Some(file) -> if file.Length <> 0 then file else defaultValue
|
||||
| _ -> defaultValue
|
||||
|
||||
let verbose = GetArgumentFromCommandLine "--verbosity:" @"normal"
|
||||
let nuspec = GetArgumentFromCommandLine "--nuspec:" @""
|
||||
let bindir = GetArgumentFromCommandLine "--bindir:" @""
|
||||
let nuspecTitle = Path.GetFileNameWithoutExtension(nuspec)
|
||||
let layouts = Path.Combine(Path.GetFullPath(bindir), "layouts", nuspecTitle)
|
||||
let isVerbose = verbose = "verbose"
|
||||
|
||||
//=========================================================================================
|
||||
// Layout nuget package --- nothing to do here except make the directory
|
||||
//=========================================================================================
|
||||
let deleteDirectory output =
|
||||
if (Directory.Exists(output)) then Directory.Delete(output, true) |>ignore
|
||||
()
|
||||
|
||||
let makeDirectory output =
|
||||
if not (Directory.Exists(output)) then Directory.CreateDirectory(output) |>ignore
|
||||
()
|
||||
|
||||
//Clean intermediate directory
|
||||
deleteDirectory layouts; makeDirectory layouts
|
||||
|
||||
with e -> printfn "Exception: %s" e.Message
|
||||
printfn "Stacktrace: %s" e.StackTrace
|
||||
exit (1)
|
||||
exit (0)
|
|
@ -13,6 +13,7 @@
|
|||
<DefineConstants>EXTENSIONTYPING;$(DefineConstants)</DefineConstants>
|
||||
<AssemblyName>FSharp.Compiler.Interactive.Settings</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<OtherFlags Condition=" '$(TargetFramework)'=='coreclr'">$(OtherFlags) --targetprofile:netcore</OtherFlags>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<FsSrGen Include="..\FSInteractiveSettings.txt">
|
||||
|
@ -22,6 +23,9 @@
|
|||
<Compile Include="..\..\assemblyinfo\assemblyinfo.FSharp.Compiler.Interactive.Settings.dll.fs">
|
||||
<Link>Utilities/assemblyinfo.FSharp.Compiler.Interactive.Settings.dll.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\utils\reshapedreflection.fs">
|
||||
<Link>Reflection/reshapedreflection.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\fsiattrs.fs">
|
||||
<Link>Utilities/fsiattrs.fs</Link>
|
||||
</Compile>
|
||||
|
@ -32,9 +36,14 @@
|
|||
<Link>InteractiveSettings/fsiaux.fs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'coreclr'">
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'coreclr'">
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj">
|
||||
<Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
|
||||
<Name>FSharp.Core</Name>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.0.1-rc2-23911",
|
||||
"NETStandard.Library": "1.5.0-rc2-23911",
|
||||
"System.Linq.Expressions": "4.0.11-rc2-23911",
|
||||
"System.Reflection.TypeExtensions": "4.1.0-rc2-23911",
|
||||
"System.Runtime.Loader": "4.0.0-rc2-23911",
|
||||
"System.Threading.Thread": "4.0.0-rc2-23911",
|
||||
},
|
||||
"runtimes": {
|
||||
"win7-x86": { },
|
||||
"win7-x64": { },
|
||||
"osx.10.10-x64": { },
|
||||
"ubuntu.14.04-x64": { }
|
||||
},
|
||||
"frameworks": {
|
||||
"dnxcore50": { }
|
||||
}
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -14,9 +14,6 @@
|
|||
<TargetFrameworkVersion Condition="'$(TargetFramework)'=='net20'">v2.0</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<FsSrGen Include="..\fsiserver\FSServerShared.txt">
|
||||
<Link>FSServerShared.txt</Link>
|
||||
</FsSrGen>
|
||||
<Compile Include="InternalsVisibleTo.fs" />
|
||||
<Compile Include="..\..\assemblyinfo\assemblyinfo.FSharp.Compiler.Server.Shared.dll.fs">
|
||||
<Link>assemblyinfo.FSharp.Compiler.Server.Shared.dll.fs</Link>
|
||||
|
@ -25,10 +22,15 @@
|
|||
<Link>fsiserver.fs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'coreclr'">
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'coreclr'">
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Runtime.Remoting" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj">
|
||||
<Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
|
||||
<Name>FSharp.Core</Name>
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<FSharpSourcesRoot>..\..</FSharpSourcesRoot>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(FSharpSourcesRoot)\FSharpSource.Settings.targets" />
|
||||
|
||||
<PropertyGroup>
|
||||
<PkgVersion>$(NuGetPerBuildPreReleaseVersion)</PkgVersion>
|
||||
<OutDir>$(FSharpSourcesRoot)\..\$(Configuration)\$(TargetFramework)\bin</OutDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\fsharp\FSharp.Compiler\FSharp.Compiler.fsproj" />
|
||||
<ProjectReference Include="..\fsharp\FSharp.Compiler.Interactive.Settings\FSharp.Compiler.Interactive.Settings.fsproj" />
|
||||
<ProjectReference Include="..\fsharp\Fsc\Fsc.fsproj" />
|
||||
<ProjectReference Include="..\fsharp\Fsc\Fsi.fsproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="Build" Inputs="$(ProjectReference)" Outputs="$(TargetPath)" DependsOnTargets="$(BuildDependsOn)">
|
||||
<Exec Command="$(FsiToolPath)\$(FsiToolExe) --exec layoutfscnuget.fsx --nuspec:.\Microsoft.FSharp.Compiler.netcore.nuspec --bindir:$(OutDir)"/>
|
||||
<Exec Command="$(FsiToolPath)\$(FsiToolExe) --exec ..\..\buildtools\buildnugets.fsx --version:$(PkgVersion) --nuspec:.\Microsoft.FSharp.Compiler.netcore.nuspec --bindir:$(OutDir)"/>
|
||||
</Target>
|
||||
|
||||
<Target Name="Rebuild" DependsOnTargets="Build" />
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>Microsoft.FSharp.Compiler.netcore</id>
|
||||
<description>
|
||||
netcore compatible version of the fsharp compiler fsc.exe.
|
||||
Supported Platforms: - .NET Core (dnxcore50)
|
||||
</description>
|
||||
<language>en-US</language>
|
||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||
<version>$version$</version>
|
||||
<authors>$authors$</authors>
|
||||
<licenseUrl>$licenseUrl$</licenseUrl>
|
||||
<projectUrl>$projectUrl$</projectUrl>
|
||||
<tags>$tags$</tags>
|
||||
<dependencies>
|
||||
<group>
|
||||
<dependency id="Microsoft.FSharp.Core.netcore" version="$version$" />
|
||||
<dependency id="Microsoft.NETCore.Platforms" version="1.0.1-rc2-23911" />
|
||||
<dependency id="NETStandard.Library" version="1.5.0-rc2-23911" />
|
||||
<dependency id="System.Collections.Immutable" version="1.2.0-rc2-23911" />
|
||||
<dependency id="System.Diagnostics.Process" version="4.1.0-rc2-23911" />
|
||||
<dependency id="System.Diagnostics.TraceSource" version="4.0.0-rc2-23911" />
|
||||
<dependency id="System.Linq.Expressions" version="4.0.11-rc2-23911" />
|
||||
<dependency id="System.Linq.Queryable" version="4.0.1-rc2-23911" />
|
||||
<dependency id="System.Net.Requests" version="4.0.11-rc2-23911" />
|
||||
<dependency id="System.Reflection.Emit" version="4.0.1-rc2-23911" />
|
||||
<dependency id="System.Reflection.Emit.ILGeneration" version="4.0.1-rc2-23911" />
|
||||
<dependency id="System.Reflection.Metadata" version="1.3.0-rc2-23911" />
|
||||
<dependency id="System.Runtime.InteropServices" version="4.1.0-rc2-23911" />
|
||||
<dependency id="System.Runtime.InteropServices.PInvoke" version="4.0.0-rc2-23911" />
|
||||
<dependency id="System.Runtime.Loader" version="4.0.0-rc2-23911" />
|
||||
<dependency id="System.Security.Cryptography.Algorithms" version="4.1.0-rc2-23911" />
|
||||
<dependency id="System.Security.Cryptography.Primitives" version="4.0.0-rc2-23911" />
|
||||
<dependency id="System.Threading.Tasks.Parallel" version="4.0.1-rc2-23911" />
|
||||
<dependency id="System.Threading.Thread" version="4.0.0-rc2-23911" />
|
||||
<dependency id="System.Threading.ThreadPool" version="4.0.10-rc2-23911" />
|
||||
<dependency id="Microsoft.DiaSymReader.PortablePdb" version="1.0.0-rc-60301" />
|
||||
<dependency id="Microsoft.DiaSymReader" version="1.0.7" />
|
||||
</group>
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="fsc.exe" target="lib/DNXCore50" />
|
||||
<file src="FSharp.Compiler.dll" target="lib/DNXCore50" />
|
||||
<file src="default.win32manifest" target="runtimes/any/native/" />
|
||||
<file src="fsi.exe" target="lib/DNXCore50" />
|
||||
<file src="FSharp.Compiler.Interactive.Settings.dll" target="lib/DNXCore50" />
|
||||
</files>
|
||||
</package>
|
|
@ -0,0 +1,79 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information,
|
||||
//
|
||||
// Layout the nuget package for the fsharp compiler
|
||||
//=========================================================================================
|
||||
open System.IO
|
||||
|
||||
try
|
||||
//=========================================================================================
|
||||
// Command line arguments
|
||||
//=========================================================================================
|
||||
|
||||
// Try head was introduced in F# 4.0
|
||||
let tryHead (source : seq<_>) =
|
||||
let checkNonNull argName arg =
|
||||
match box arg with
|
||||
| null -> nullArg argName
|
||||
| _ -> ()
|
||||
checkNonNull "source" source
|
||||
use e = source.GetEnumerator()
|
||||
if (e.MoveNext()) then Some e.Current
|
||||
else None
|
||||
|
||||
let usage = @"usage: layoutfcsnuget.fsx -nuspec:<nuspec-path> --binaries:<binaries-dir>"
|
||||
|
||||
let Arguments = fsi.CommandLineArgs |> Seq.skip 1
|
||||
|
||||
let GetArgumentFromCommandLine switchName defaultValue =
|
||||
match Arguments |> Seq.filter(fun t -> t.StartsWith(switchName)) |> Seq.map(fun t -> t.Remove(0, switchName.Length).Trim()) |> tryHead with
|
||||
| Some(file) -> if file.Length <> 0 then file else defaultValue
|
||||
| _ -> defaultValue
|
||||
|
||||
let verbose = GetArgumentFromCommandLine "--verbosity:" @"normal"
|
||||
let nuspec = GetArgumentFromCommandLine "--nuspec:" @""
|
||||
let bindir = GetArgumentFromCommandLine "--bindir:" @""
|
||||
let nuspecTitle = Path.GetFileNameWithoutExtension(nuspec)
|
||||
printfn ">>%s<<" bindir
|
||||
printfn ">>%s<<" nuspecTitle
|
||||
let layouts = Path.Combine(Path.GetFullPath(bindir), "layouts", nuspecTitle)
|
||||
let isVerbose = verbose = "verbose"
|
||||
|
||||
//=========================================================================================
|
||||
// Layout nuget package
|
||||
//=========================================================================================
|
||||
let copyFile source dir =
|
||||
let dest =
|
||||
if not (Directory.Exists(dir)) then Directory.CreateDirectory(dir) |>ignore
|
||||
let result = Path.Combine(dir, Path.GetFileName(source))
|
||||
result
|
||||
if isVerbose then
|
||||
printfn "source: %s" source
|
||||
printfn "dest: %s" dest
|
||||
File.Copy(source, dest, true)
|
||||
|
||||
let deleteDirectory (output) =
|
||||
if (Directory.Exists(output)) then Directory.Delete(output, true) |>ignore
|
||||
()
|
||||
|
||||
let makeDirectory (output) =
|
||||
if not (Directory.Exists(output)) then Directory.CreateDirectory(output) |>ignore
|
||||
()
|
||||
|
||||
let fsharpCompilerFiles =
|
||||
seq {
|
||||
yield Path.Combine(bindir, "fsc.exe")
|
||||
yield Path.Combine(bindir, "FSharp.Core.dll")
|
||||
yield Path.Combine(bindir, "FSharp.Compiler.dll")
|
||||
yield Path.Combine(bindir, "FSharp.Core.sigdata")
|
||||
yield Path.Combine(bindir, "FSharp.Core.optdata")
|
||||
yield Path.Combine(bindir, "default.win32manifest")
|
||||
}
|
||||
|
||||
//Clean intermediate directoriy
|
||||
deleteDirectory(layouts); makeDirectory(layouts)
|
||||
fsharpCompilerFiles |> Seq.iter(fun source -> copyFile source layouts)
|
||||
|
||||
with e -> printfn "Exception: %s" e.Message
|
||||
printfn "Stacktrace: %s" e.StackTrace
|
||||
exit (1)
|
||||
exit (0)
|
|
@ -10,6 +10,8 @@
|
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<OutputType>Library</OutputType>
|
||||
<AssemblyName>FSharp.Compiler</AssemblyName>
|
||||
<DefineConstants>EXTENSIONTYPING;COMPILER;INCLUDE_METADATA_READER;INCLUDE_METADATA_WRITER;EXTENSIBLE_DUMPER;$(DefineConstants)</DefineConstants>
|
||||
<DefineConstants Condition="'$(TargetFramework)'=='coreclr'">$(DefineConstants);PREFERRED_UI_LANG</DefineConstants>
|
||||
<DefineConstants>EXTENSIONTYPING;$(DefineConstants)</DefineConstants>
|
||||
<DefineConstants>COMPILER;$(DefineConstants)</DefineConstants>
|
||||
<DefineConstants>INCLUDE_METADATA_READER;$(DefineConstants)</DefineConstants>
|
||||
|
@ -19,7 +21,19 @@
|
|||
<AllowCrossTargeting>true</AllowCrossTargeting>
|
||||
<BaseAddress>0x06800000</BaseAddress>
|
||||
<OtherFlags>$(OtherFlags) /warnon:1182</OtherFlags>
|
||||
<OtherFlags Condition=" '$(TargetFramework)'=='coreclr'">$(OtherFlags) --targetprofile:netcore</OtherFlags>
|
||||
</PropertyGroup>
|
||||
<!-- References -->
|
||||
<Import Project="$(FSharpSourcesRoot)\.nuget\NuGet.targets" Condition="Exists('$(FSharpSourcesRoot)\.nuget\NuGet.targets')" />
|
||||
<Import Project="$(FSharpSourcesRoot)\FSharpSource.targets" />
|
||||
<ItemGroup>
|
||||
<FilesToLocalize Include="$(OutDir)$(AssemblyName).dll">
|
||||
<TranslationFile>$(FSharpSourcesRoot)\..\loc\lcl\{Lang}\$(AssemblyName).dll.lcl</TranslationFile>
|
||||
<LciCommentFile>$(FSharpSourcesRoot)\..\loc\lci\$(AssemblyName).dll.lci</LciCommentFile>
|
||||
<HasLceComments>false</HasLceComments>
|
||||
<InProject>false</InProject>
|
||||
</FilesToLocalize>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\assemblyinfo\assemblyinfo.FSharp.Compiler.dll.fs">
|
||||
<Link>assemblyinfo.FSharp.Compiler.dll.fs</Link>
|
||||
|
@ -30,6 +44,12 @@
|
|||
<EmbeddedResource Include="..\FSStrings.resx">
|
||||
<Link>FSStrings.resx</Link>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="..\..\utils\reshapedreflection.fs">
|
||||
<Link>Reflection\reshapedreflection.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\utils\reshapedmsbuild.fs">
|
||||
<Link>Reflection\reshapedmsbuild.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\utils\sformat.fsi">
|
||||
<Link>ErrorText\sformat.fsi</Link>
|
||||
</Compile>
|
||||
|
@ -75,6 +95,12 @@
|
|||
<Compile Include="..\FlatList.fs">
|
||||
<Link>Utilities\FlatList.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ildiag.fsi">
|
||||
<Link>Utilities\ildiag.fsi</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ildiag.fs">
|
||||
<Link>Utilities\ildiag.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\illib.fs">
|
||||
<Link>Utilities\illib.fs</Link>
|
||||
</Compile>
|
||||
|
@ -102,12 +128,6 @@
|
|||
<Compile Include="..\..\absil\bytes.fs">
|
||||
<Link>Utilities\bytes.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ildiag.fsi">
|
||||
<Link>Utilities\ildiag.fsi</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ildiag.fs">
|
||||
<Link>Utilities\ildiag.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\InternalCollections.fsi">
|
||||
<Link>Utilities\InternalCollections.fsi</Link>
|
||||
</Compile>
|
||||
|
@ -187,6 +207,9 @@
|
|||
<Compile Include="..\..\absil\ilmorph.fs">
|
||||
<Link>AbsIL\ilmorph.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ilsign.fs" Condition=" '$(TargetFramework)'=='coreclr'">
|
||||
<Link>AbsIL\ilsign.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ilsupp.fsi">
|
||||
<Link>AbsIL\ilsupp.fsi</Link>
|
||||
</Compile>
|
||||
|
@ -214,6 +237,12 @@
|
|||
<Compile Include="..\..\absil\ilwrite.fsi">
|
||||
<Link>AbsIL\ilwrite.fsi</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ilwritepdb.fsi">
|
||||
<Link>AbsIL\ilwritepdb.fsi</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ilwritepdb.fs">
|
||||
<Link>AbsIL\ilwritepdb.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ilwrite.fs">
|
||||
<Link>AbsIL\ilwrite.fs</Link>
|
||||
</Compile>
|
||||
|
@ -447,11 +476,20 @@
|
|||
<Compile Include="..\fsc.fs">
|
||||
<Link>Driver\fsc.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="InternalsVisibleTo.fs">
|
||||
<Compile Include="..\vs\IncrementalBuild.fsi">
|
||||
<Link>Driver\IncrementalBuild.fsi</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\vs\IncrementalBuild.fs">
|
||||
<Link>Driver\IncrementalBuild.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="InternalsVisibleTo.fs" Condition="'$(TargetFramework)' != 'coreclr'">
|
||||
<Link>InternalsVisibleTo.fs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'coreclr'">
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'coreclr'">
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
@ -461,8 +499,14 @@
|
|||
<Reference Include="Microsoft.Build.Framework, Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build.Engine, Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build, Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build.Utilities.$(MSBuildVersionSuffix)" />
|
||||
<Reference Include="Microsoft.Build.Tasks.$(MSBuildVersionSuffix)" />
|
||||
<Reference Include="Microsoft.Build.Utilities.$(MSBuildVersionSuffix), Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build.Tasks.$(MSBuildVersionSuffix), Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.DiaSymReader.PortablePdb"><HintPath>..\..\..\packages\Microsoft.DiaSymReader.PortablePdb.1.0.0-rc-60301\lib\portable-net45+win8\Microsoft.DiaSymReader.PortablePdb.dll</HintPath></Reference>
|
||||
<Reference Include="Microsoft.DiaSymReader"><HintPath>..\..\..\packages\Microsoft.DiaSymReader\1.0.7\lib\portable-net45+win8\Microsoft.DiaSymReader.dll</HintPath></Reference>
|
||||
<Reference Include="System.Reflection.Metadata"><HintPath>..\..\..\packages\System.Reflection.Metadata.1.3.0-beta-23816\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath></Reference>
|
||||
<Reference Include="System.Collections.Immutable"><HintPath>..\..\..\packages\System.Collections.Immutable.1.2.0-rc3-23805\lib\portable-net45+win8+wp8+wpa81</HintPath></Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj">
|
||||
<Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
|
||||
<Name>FSharp.Core</Name>
|
||||
|
@ -470,4 +514,15 @@
|
|||
</ItemGroup>
|
||||
<Import Project="$(FSharpSourcesRoot)\FSharpSource.targets" />
|
||||
<Import Project="$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin\FSharp.PowerPack.targets" />
|
||||
|
||||
<Target Name="GatherBinariesToBeSigned" AfterTargets="Localize">
|
||||
<ItemGroup>
|
||||
<BinariesToBeSigned Include="$(OutDir)$(AssemblyName).dll" />
|
||||
<BinariesToBeSigned Include="$(OutDir)localize\**\$(AssemblyName).resources.dll" />
|
||||
<FilesToSign Include="@(BinariesToBeSigned)">
|
||||
<Authenticode>Microsoft</Authenticode>
|
||||
<StrongName>StrongName</StrongName>
|
||||
</FilesToSign>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.0.1-rc2-23911",
|
||||
"NETStandard.Library": "1.5.0-rc2-23911",
|
||||
"System.Collections.Immutable":"1.2.0-rc2-23911",
|
||||
"System.Diagnostics.Process": "4.1.0-rc2-23911",
|
||||
"System.Diagnostics.TraceSource": "4.0.0-rc2-23911",
|
||||
"System.Linq.Expressions": "4.0.11-rc2-23911",
|
||||
"System.Linq.Queryable": "4.0.1-rc2-23911",
|
||||
"System.Net.Requests": "4.0.11-rc2-23911",
|
||||
"System.Reflection.Emit": "4.0.1-rc2-23911",
|
||||
"System.Reflection.Emit.ILGeneration": "4.0.1-rc2-23911",
|
||||
"System.Reflection.Metadata": "1.3.0-rc2-23911",
|
||||
"System.Reflection.TypeExtensions": "4.1.0-rc2-23911",
|
||||
"System.Runtime.InteropServices": "4.1.0-rc2-23911",
|
||||
"System.Runtime.InteropServices.PInvoke": "4.0.0-rc2-23911",
|
||||
"System.Runtime.Loader": "4.0.0-rc2-23911",
|
||||
"System.Security.Cryptography.Algorithms": "4.1.0-rc2-23911",
|
||||
"System.Security.Cryptography.Primitives": "4.0.0-rc2-23911",
|
||||
"System.Threading.Tasks.Parallel": "4.0.1-rc2-23911",
|
||||
"System.Threading.Thread": "4.0.0-rc2-23911",
|
||||
"System.Threading.ThreadPool": "4.0.10-rc2-23911",
|
||||
"Microsoft.DiaSymReader.PortablePdb": "1.0.0-rc-60301",
|
||||
"Microsoft.DiaSymReader": "1.0.7",
|
||||
},
|
||||
"runtimes": {
|
||||
"win7-x86": { },
|
||||
"win7-x64": { },
|
||||
"osx.10.10-x64": { },
|
||||
"ubuntu.14.04-x64": { }
|
||||
},
|
||||
"frameworks": {
|
||||
"dnxcore50": {
|
||||
"imports": "portable-net45+win8"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -12,14 +12,17 @@
|
|||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<AllowCrossTargeting>true</AllowCrossTargeting>
|
||||
<ReferenceVsAssemblies>true</ReferenceVsAssemblies>
|
||||
<OutputType>Library</OutputType>
|
||||
<OutputType Condition="'$(TargetFramework)' == 'coreclr'">Exe</OutputType>
|
||||
<OutputType Condition="'$(TargetFramework)' != 'coreclr'">Library</OutputType>
|
||||
<AssemblyName>FSharp.Core.Unittests</AssemblyName>
|
||||
<TargetFrameworkVersion Condition=" '$(TargetFramework)' == 'net20' ">v3.5</TargetFrameworkVersion>
|
||||
<!-- Prevent compiler from inlining calls to FSharp.Core to improve code coverage accuracy -->
|
||||
<Optimize>false</Optimize>
|
||||
<Tailcalls>false</Tailcalls>
|
||||
<TargetProfile Condition=" '$(TargetFramework)' == 'portable7' or '$(TargetFramework)' == 'portable78' or '$(TargetFramework)' == 'portable259' ">netcore</TargetProfile>
|
||||
<TargetProfile Condition=" '$(TargetFramework)' == 'portable7' or '$(TargetFramework)' == 'portable78' or '$(TargetFramework)' == 'portable259' or '$(TargetFramework)' == 'coreclr' ">netcore</TargetProfile>
|
||||
<NoWarn>$(NoWarn);217</NoWarn>
|
||||
<OutputPath Condition="'$(TargetFramework)' == 'coreclr'">$(FSharpSourcesRoot)\..\tests\testbin\$(Configuration)\coreclr\fsharp.core.unittests</OutputPath>
|
||||
<CustomOutputPath Condition="'$(TargetFramework)' == 'coreclr'">true</CustomOutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<DefineConstants Condition=" '$(TargetFramework)' == 'sl5' ">$(DefineConstants);SILVERLIGHT</DefineConstants>
|
||||
|
@ -29,7 +32,6 @@
|
|||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>3</WarningLevel>
|
||||
|
@ -37,33 +39,44 @@
|
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>3</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- need full name and SpecificVersion = true in order to convince msbuild to allow this reference when targeting portable47 -->
|
||||
<Reference Include="nunit.framework, Version=$(NUnitFullVersion), Culture=neutral, PublicKeyToken=2638cd05610744eb" Condition="'$(TargetFramework)' != 'sl5' AND '$(TargetFramework)' != 'sl3-wp'">
|
||||
<Reference Include="nunit.framework, Version=$(NUnitFullVersion), Culture=neutral, PublicKeyToken=2638cd05610744eb" Condition="'$(TargetFramework)' != 'coreclr'">
|
||||
<SpecificVersion>true</SpecificVersion>
|
||||
<Private>True</Private>
|
||||
<HintPath>$(NUnitLibDir)\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FsCheck, Version=$(FsCheckFullVersion)" Condition="'$(TargetFramework)' != 'portable47' AND '$(TargetFramework)' != 'net20'">
|
||||
<Reference Include="FsCheck, Version=$(FsCheckFullVersion)" Condition="'$(TargetFramework)' != 'portable47'">
|
||||
<SpecificVersion>true</SpecificVersion>
|
||||
<Private>True</Private>
|
||||
<HintPath Condition="'$(TargetFramework)' == 'net40'">$(FsCheckLibDir)\net45\FsCheck.dll</HintPath>
|
||||
<HintPath Condition="'$(TargetFramework)' == 'portable7'">$(FsCheckLibDir)\portable-net45+netcore45\FsCheck.dll</HintPath>
|
||||
<HintPath Condition="'$(TargetFramework)' == 'portable78'">$(FsCheckLibDir)\portable-net45+netcore45+wp8\FsCheck.dll</HintPath>
|
||||
<HintPath Condition="'$(TargetFramework)' == 'portable259'">$(FsCheckLibDir)\portable-net45+netcore45+wpa81+wp8\FsCheck.dll</HintPath>
|
||||
<HintPath Condition="'$(TargetFramework)' == 'portable259' OR '$(TargetFramework)' == 'coreclr'">$(FsCheckLibDir)\portable-net45+netcore45+wpa81+wp8\FsCheck.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NUnitFramework" Condition="'$(TargetFramework)' == 'sl5' OR '$(TargetFramework)' == 'sl3-wp'" />
|
||||
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj">
|
||||
<Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
|
||||
<Name>FSharp.Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="!$(TargetFramework.Contains('portable'))">
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'coreclr'">
|
||||
<Reference Include="nunit.framework, Version=3.0.5797.27550, Culture=neutral, PublicKeyToken=2638cd05610744eb">
|
||||
<SpecificVersion>true</SpecificVersion>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\..\..\packages\NUnit.3.0.0\lib\portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunitlite, Version=3.0.5797.27550, Culture=neutral, PublicKeyToken=2638cd05610744eb">
|
||||
<SpecificVersion>true</SpecificVersion>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\..\..\packages\NUnitLite.3.0.0\lib\portable-net45+win8+wp8+wpa81+Xamarin.Mac\nunitlite.dll</HintPath>
|
||||
</Reference>
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="(!$(TargetFramework.Contains('portable'))) and '$(TargetFramework)' != 'coreclr'">
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Numerics" Condition="'$(TargetFramework)' == 'net40'" />
|
||||
|
@ -116,8 +129,8 @@
|
|||
<Compile Include="FSharp.Core\Microsoft.FSharp.Reflection\FSharpReflection.fs" />
|
||||
<Compile Include="FSharp.Core\Microsoft.FSharp.Quotations\FSharpQuotations.fs" />
|
||||
<Compile Include="TypeForwarding.fs" />
|
||||
<Compile Include="NUnitFrameworkShims.fs" Condition="'$(TargetFramework)' == 'sl3-wp'" />
|
||||
<Compile Include="SurfaceArea.$(TargetFramework).fs" />
|
||||
<Compile Include="Program.fs" Condition="'$(TargetFramework)' == 'coreclr'" />
|
||||
<CustomCopyLocal Include="FSharp.Core.Unittests.dll.config">
|
||||
<TargetFilename>FSharp.Core.Unittests.dll.config</TargetFilename>
|
||||
</CustomCopyLocal>
|
||||
|
|
|
@ -188,7 +188,7 @@ type ListModule() =
|
|||
|
||||
Assert.AreEqual([null], List.distinct [null])
|
||||
let list = new System.Collections.Generic.List<int>()
|
||||
Assert.AreEqual([null, list], List.distinct [null, list])
|
||||
Assert.IsTrue([null, list] = List.distinct [null, list])
|
||||
|
||||
[<Test>]
|
||||
member this.distinctBy() =
|
||||
|
@ -207,7 +207,7 @@ type ListModule() =
|
|||
|
||||
Assert.AreEqual([null], List.distinctBy id [null])
|
||||
let list = new System.Collections.Generic.List<int>()
|
||||
Assert.AreEqual([null, list], List.distinctBy id [null, list])
|
||||
Assert.IsTrue([null, list] = List.distinctBy id [null, list])
|
||||
|
||||
[<Test>]
|
||||
member this.Take() =
|
||||
|
|
|
@ -574,7 +574,7 @@ type AsyncModule() =
|
|||
#if FSHARP_CORE_2_0
|
||||
// nothing
|
||||
#else
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
|
||||
//nothing
|
||||
#else
|
||||
// we are on the desktop
|
||||
|
|
|
@ -141,7 +141,7 @@ type AsyncType() =
|
|||
member this.CreateTask () =
|
||||
let s = "Hello tasks!"
|
||||
let a = async { return s }
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
|
||||
let t : Task<string> =
|
||||
#else
|
||||
use t : Task<string> =
|
||||
|
@ -155,7 +155,7 @@ type AsyncType() =
|
|||
member this.StartTask () =
|
||||
let s = "Hello tasks!"
|
||||
let a = async { return s }
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
|
||||
let t =
|
||||
#else
|
||||
use t =
|
||||
|
@ -170,7 +170,7 @@ type AsyncType() =
|
|||
let a = async {
|
||||
do raise (Exception ())
|
||||
}
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
|
||||
let t =
|
||||
#else
|
||||
use t =
|
||||
|
@ -189,7 +189,7 @@ type AsyncType() =
|
|||
let a = async {
|
||||
while true do ()
|
||||
}
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
|
||||
let t =
|
||||
#else
|
||||
use t =
|
||||
|
@ -214,7 +214,7 @@ type AsyncType() =
|
|||
}
|
||||
let cts = new CancellationTokenSource()
|
||||
let token = cts.Token
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
|
||||
let t =
|
||||
#else
|
||||
use t =
|
||||
|
@ -236,7 +236,7 @@ type AsyncType() =
|
|||
[<Test>]
|
||||
member this.TaskAsyncValue () =
|
||||
let s = "Test"
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
|
||||
let t =
|
||||
#else
|
||||
use t =
|
||||
|
@ -250,7 +250,7 @@ type AsyncType() =
|
|||
|
||||
[<Test>]
|
||||
member this.TaskAsyncValueException () =
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
|
||||
let t =
|
||||
#else
|
||||
use t =
|
||||
|
@ -269,7 +269,7 @@ type AsyncType() =
|
|||
use ewh = new ManualResetEvent(false)
|
||||
let cts = new CancellationTokenSource()
|
||||
let token = cts.Token
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
|
||||
let t : Task<unit>=
|
||||
#else
|
||||
use t : Task<unit>=
|
||||
|
@ -288,7 +288,7 @@ type AsyncType() =
|
|||
[<Test>]
|
||||
member this.NonGenericTaskAsyncValue () =
|
||||
let hasBeenCalled = ref false
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
|
||||
let t =
|
||||
#else
|
||||
use t =
|
||||
|
@ -303,7 +303,7 @@ type AsyncType() =
|
|||
|
||||
[<Test>]
|
||||
member this.NonGenericTaskAsyncValueException () =
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
|
||||
let t =
|
||||
#else
|
||||
use t =
|
||||
|
@ -322,7 +322,7 @@ type AsyncType() =
|
|||
use ewh = new ManualResetEvent(false)
|
||||
let cts = new CancellationTokenSource()
|
||||
let token = cts.Token
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE || coreclr
|
||||
let t =
|
||||
#else
|
||||
use t =
|
||||
|
|
|
@ -158,7 +158,7 @@ type FSharpValueTests() =
|
|||
member this.GetExceptionFields() =
|
||||
|
||||
// int
|
||||
Assert.AreEqual(FSharpValue.GetExceptionFields(exInt),[|1|])
|
||||
Assert.AreEqual(FSharpValue.GetExceptionFields(exInt), ([|1|] : obj []))
|
||||
|
||||
// dataless
|
||||
Assert.AreEqual(FSharpValue.GetExceptionFields(exDataless),[||])
|
||||
|
@ -257,7 +257,7 @@ type FSharpValueTests() =
|
|||
member this.GetUnionFields() =
|
||||
// single case union
|
||||
let (singlecaseinfo,singlevaluearray) = FSharpValue.GetUnionFields(singlecaseunion1,typeof<SingleCaseDiscUnion>)
|
||||
Assert.AreEqual(singlevaluearray, [|1.0;2.0;3.0|])
|
||||
Assert.AreEqual(singlevaluearray, ([|1.0;2.0;3.0|] : obj []))
|
||||
|
||||
// DiscUnionType
|
||||
let (duCaseinfo, duValueArray) = FSharpValue.GetUnionFields(discUniontypeB,typeof<DiscUnionType<int>>)
|
||||
|
@ -762,6 +762,9 @@ type FSharpTypeTests() =
|
|||
()
|
||||
|
||||
[<Test>]
|
||||
#if coreclr
|
||||
[<Ignore("Failing in coreclr")>]
|
||||
#endif
|
||||
member this.IsModule() =
|
||||
|
||||
let getasm (t : Type) = t.Assembly
|
||||
|
|
|
@ -334,7 +334,7 @@ type LanguagePrimitivesModule() =
|
|||
|
||||
// null reference
|
||||
let resultNul = LanguagePrimitives.GenericMaximum null null
|
||||
Assert.AreEqual(null, resultNul)
|
||||
Assert.IsNull(resultNul)
|
||||
|
||||
let resultNul = LanguagePrimitives.GenericMaximum null "ABCDE"
|
||||
Assert.AreEqual("ABCDE", resultNul)
|
||||
|
@ -360,13 +360,13 @@ type LanguagePrimitivesModule() =
|
|||
|
||||
// null reference
|
||||
let resultNul = LanguagePrimitives.GenericMinimum null null
|
||||
Assert.AreEqual(null, resultNul)
|
||||
Assert.IsNull(resultNul)
|
||||
|
||||
let resultNul = LanguagePrimitives.GenericMinimum null "ABC"
|
||||
Assert.AreEqual(null, resultNul)
|
||||
Assert.IsNull(resultNul)
|
||||
|
||||
let resultNul = LanguagePrimitives.GenericMinimum "ABC" null
|
||||
Assert.AreEqual(null, resultNul)
|
||||
Assert.IsNull(resultNul)
|
||||
|
||||
[<Test>]
|
||||
member this.GenericOne() =
|
||||
|
@ -425,7 +425,7 @@ type LanguagePrimitivesModule() =
|
|||
Assert.AreEqual(-100000000000000000L, resultValue)
|
||||
|
||||
let resultValue = LanguagePrimitives.ParseInt64 "0"
|
||||
Assert.AreEqual(0, resultValue)
|
||||
Assert.AreEqual(0L, resultValue)
|
||||
|
||||
CheckThrowsFormatException(fun () -> LanguagePrimitives.ParseInt64 "" |> ignore)
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ module SurfaceArea =
|
|||
|
||||
// get current fsharp.core
|
||||
let asm =
|
||||
#if portable7 || portable78 || portable259
|
||||
#if portable7 || portable78 || portable259 || coreclr
|
||||
typeof<int list>.GetTypeInfo().Assembly
|
||||
#else
|
||||
typeof<int list>.Assembly
|
||||
|
@ -87,7 +87,7 @@ module SurfaceArea =
|
|||
|
||||
// public types only
|
||||
let types =
|
||||
#if portable7 || portable78 || portable259
|
||||
#if portable7 || portable78 || portable259 || coreclr
|
||||
asm.ExportedTypes |> Seq.filter (fun ty -> let ti = ty.GetTypeInfo() in ti.IsPublic || ti.IsNestedPublic) |> Array.ofSeq
|
||||
#else
|
||||
asm.GetExportedTypes()
|
||||
|
@ -96,7 +96,7 @@ module SurfaceArea =
|
|||
// extract canonical string form for every public member of every type
|
||||
let getTypeMemberStrings (t : Type) =
|
||||
// for System.Runtime-based profiles, need to do lots of manual work
|
||||
#if portable7 || portable78 || portable259
|
||||
#if portable7 || portable78 || portable259 || coreclr
|
||||
let getMembers (t : Type) =
|
||||
let ti = t.GetTypeInfo()
|
||||
let cast (info : #MemberInfo) = (t, info :> MemberInfo)
|
||||
|
@ -135,7 +135,6 @@ module SurfaceArea =
|
|||
let logFile = sprintf "%s\\CoreUnit_%s_Xml.xml" workDir platform
|
||||
let normalize (s:string) =
|
||||
Regex.Replace(s, "(\\r\\n|\\n)+", "\r\n").Trim([|'\r';'\n'|])
|
||||
|
||||
let asm, actualNotNormalized = getActual ()
|
||||
let actual = actualNotNormalized |> normalize
|
||||
let expected = expected |> normalize
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
module Program
|
||||
|
||||
open System
|
||||
open System.Reflection
|
||||
open NUnitLite
|
||||
|
||||
type HelperType() = inherit System.Object()
|
||||
|
||||
[<EntryPoint>]
|
||||
let main argv =
|
||||
AutoRun().Execute(typeof<HelperType>.GetTypeInfo().Assembly, Console.Out, Console.In, argv)
|
|
@ -19,15 +19,3 @@ using System.Runtime.InteropServices;
|
|||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("D87CB4EC-9844-4f98-9FEC-14DB50729D65")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.0.1-rc2-23911",
|
||||
"NETStandard.Library": "1.5.0-rc2-23911",
|
||||
"System.Linq.Expressions": "4.0.11-rc2-23911",
|
||||
"System.Linq.Queryable": "4.0.1-rc2-23911",
|
||||
"System.Reflection.Emit": "4.0.1-rc2-23911",
|
||||
"System.Runtime.Loader": "4.0.0-rc2-23911",
|
||||
"System.Net.Requests": "4.0.11-rc2-23911",
|
||||
"System.Threading.Tasks.Parallel": "4.0.1-rc2-23911",
|
||||
"System.Threading.Thread": "4.0.0-rc2-23911",
|
||||
"System.Threading.ThreadPool": "4.0.10-rc2-23911",
|
||||
},
|
||||
"runtimes": {
|
||||
"win7-x86": { },
|
||||
"win7-x64": { },
|
||||
"osx.10.10-x64": { },
|
||||
"ubuntu.14.04-x64": { }
|
||||
},
|
||||
"frameworks": {
|
||||
"dnxcore50": { }
|
||||
}
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -19,11 +19,19 @@
|
|||
<OtherFlags>$(OtherFlags) --warnon:1182 --compiling-fslib --optimize --maxerrors:20 --extraoptimizationloops:1 </OtherFlags>
|
||||
<OtherFlags Condition=" '$(TargetFramework)'=='net20'">$(OtherFlags) --compiling-fslib-20:"$(SystemRoot)\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll" </OtherFlags>
|
||||
<OtherFlags Condition=" '$(TargetFramework)'=='net40'">$(OtherFlags) --compiling-fslib-40</OtherFlags>
|
||||
<OtherFlags Condition=" '$(TargetFramework)'=='coreclr'">$(OtherFlags) --targetprofile:netcore</OtherFlags>
|
||||
<OtherFlags Condition=" '$(TargetFramework)'=='portable7'">$(OtherFlags) --targetprofile:netcore</OtherFlags>
|
||||
<OtherFlags Condition=" '$(TargetFramework)'=='portable78'">$(OtherFlags) --targetprofile:netcore</OtherFlags>
|
||||
<OtherFlags Condition=" '$(TargetFramework)'=='portable259'">$(OtherFlags) --targetprofile:netcore</OtherFlags>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<FilesToLocalize Include="$(OutDir)$(AssemblyName).dll">
|
||||
<TranslationFile>$(FSharpSourcesRoot)\..\loc\lcl\{Lang}\$(AssemblyName).dll.lcl</TranslationFile>
|
||||
<LciCommentFile>$(FSharpSourcesRoot)\..\loc\lci\$(AssemblyName).dll.lci</LciCommentFile>
|
||||
<HasLceComments>false</HasLceComments>
|
||||
<InProject>false</InProject>
|
||||
</FilesToLocalize>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomAdditionalCompileInputs Include="$(FSharpSourcesRoot)\..\Proto\$(protoCLIDir)\bin\fsc-proto.exe">
|
||||
<Visible>false</Visible>
|
||||
|
@ -112,6 +120,9 @@
|
|||
<Compile Include="set.fs">
|
||||
<Link>Collections/set.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\utils\reshapedreflection.fs">
|
||||
<Link>Reflection/reshapedreflection.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="reflect.fsi">
|
||||
<Link>Reflection/reflect.fsi</Link>
|
||||
</Compile>
|
||||
|
@ -197,7 +208,7 @@
|
|||
<Link>assemblyinfo.FSharp.Core.dll.fs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'portable7'">
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'portable7' and '$(TargetFramework)' != 'coreclr'">
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Numerics" Condition="'$(TargetFramework)' == 'net40'" />
|
||||
|
@ -211,9 +222,14 @@
|
|||
'$(TargetFramework)' == 'XNA\5.0' OR
|
||||
'$(TargetFramework)' == 'sl3-wp' "/>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'coreclr'">
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- References -->
|
||||
<Import Project="$(FSharpSourcesRoot)\.nuget\NuGet.targets" Condition="Exists('$(FSharpSourcesRoot)\.nuget\NuGet.targets')" />
|
||||
<Import Project="$(FSharpSourcesRoot)\FSharpSource.targets" />
|
||||
|
||||
<!-- Hook compilation phase to do custom work -->
|
||||
|
||||
<Target Name="CopyToBuiltBin" BeforeTargets="BuiltProjectOutputGroup" AfterTargets="CoreCompile" >
|
||||
|
@ -224,4 +240,15 @@
|
|||
<Copy SourceFiles="$(IntermediateOutputPath)\FSharp.Core.sigdata" DestinationFolder="$(OutputPath)" SkipUnchangedFiles="true" />
|
||||
<Copy SourceFiles="$(IntermediateOutputPath)\FSharp.Core.optdata" DestinationFolder="$(OutputPath)" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
|
||||
<Target Name="GatherBinariesToBeSigned" AfterTargets="Localize">
|
||||
<ItemGroup>
|
||||
<BinariesToBeSigned Include="$(OutDir)$(AssemblyName).dll" />
|
||||
<BinariesToBeSigned Include="$(OutDir)localize\**\$(AssemblyName).resources.dll" />
|
||||
<FilesToSign Include="@(BinariesToBeSigned)">
|
||||
<Authenticode>Microsoft</Authenticode>
|
||||
<StrongName>StrongName</StrongName>
|
||||
</FilesToSign>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -5,7 +5,8 @@ namespace Microsoft.FSharp.Core
|
|||
module internal SR =
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
open System.Reflection
|
||||
type TypeInThisAssembly(_dummy : obj) = class end
|
||||
type private TypeInThisAssembly (_dummy:obj) = class end
|
||||
// can't use typeof here. Because intrinsics are not yet defined.
|
||||
let private resources = new System.Resources.ResourceManager("FSCore", TypeInThisAssembly(null).GetType().GetTypeInfo().Assembly)
|
||||
#else
|
||||
let private resources = new System.Resources.ResourceManager("FSCore", System.Reflection.Assembly.GetExecutingAssembly())
|
||||
|
|
|
@ -729,7 +729,7 @@ namespace Microsoft.FSharp.Control
|
|||
)
|
||||
|
||||
let startThreadWithTrampoline (trampolineHolder:TrampolineHolder) (f : unit -> FakeUnitValue) =
|
||||
#if FX_NO_THREADPOOL
|
||||
#if FX_NO_THREAD
|
||||
if not (ThreadPool.QueueUserWorkItem((waitCallbackForQueueWorkItemWithTrampoline trampolineHolder), f |> box)) then
|
||||
failwith "failed to queue user work item"
|
||||
FakeUnit
|
||||
|
@ -2040,10 +2040,10 @@ namespace Microsoft.FSharp.Control
|
|||
#if FX_ATLEAST_PORTABLE
|
||||
let invokeMeth = (typeof<Closure<'T>>).GetMethod("Invoke", BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.Instance)
|
||||
System.Delegate.CreateDelegate(typeof<'Delegate>, obj, invokeMeth) :?> 'Delegate
|
||||
#else
|
||||
#else
|
||||
System.Delegate.CreateDelegate(typeof<'Delegate>, obj, "Invoke") :?> 'Delegate
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// Start listening to events
|
||||
event.AddHandler(del)
|
||||
|
||||
|
@ -2137,7 +2137,7 @@ namespace Microsoft.FSharp.Control
|
|||
member stream.AsyncRead(buffer: byte[],?offset,?count) =
|
||||
let offset = defaultArg offset 0
|
||||
let count = defaultArg count buffer.Length
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE
|
||||
#if FX_NO_BEGINEND_READWRITE
|
||||
// use combo protectedPrimitiveWithResync + continueWith instead of AwaitTask so we can pass cancellation token to the ReadAsync task
|
||||
protectedPrimitiveWithResync (fun ({ aux = aux } as args) ->
|
||||
TaskHelpers.continueWith(stream.ReadAsync(buffer, offset, count, aux.token), args)
|
||||
|
@ -2161,7 +2161,7 @@ namespace Microsoft.FSharp.Control
|
|||
member stream.AsyncWrite(buffer:byte[], ?offset:int, ?count:int) =
|
||||
let offset = defaultArg offset 0
|
||||
let count = defaultArg count buffer.Length
|
||||
#if FSHARP_CORE_NETCORE_PORTABLE
|
||||
#if FX_NO_BEGINEND_READWRITE
|
||||
// use combo protectedPrimitiveWithResync + continueWith instead of AwaitTask so we can pass cancellation token to the WriteAsync task
|
||||
protectedPrimitiveWithResync ( fun ({ aux = aux} as args) ->
|
||||
TaskHelpers.continueWithUnit(stream.WriteAsync(buffer, offset, count, aux.token), args)
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -11,13 +11,6 @@ type PrintfFormat<'Printer,'State,'Residue,'Result,'Tuple>(value:string) =
|
|||
type Format<'Printer,'State,'Residue,'Result> = PrintfFormat<'Printer,'State,'Residue,'Result>
|
||||
type Format<'Printer,'State,'Residue,'Result,'Tuple> = PrintfFormat<'Printer,'State,'Residue,'Result,'Tuple>
|
||||
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
|
||||
open Microsoft.FSharp.Core.PrimReflectionAdapters
|
||||
open Microsoft.FSharp.Core.ReflectionAdapters
|
||||
|
||||
#endif
|
||||
|
||||
module internal PrintfImpl =
|
||||
|
||||
/// Basic idea of implementation:
|
||||
|
@ -40,15 +33,23 @@ module internal PrintfImpl =
|
|||
/// 1. creating specialized version of any part requires only one reflection call. This means that we can handle up to 5 simple format specifiers
|
||||
/// with just one reflection call
|
||||
/// 2. we can make combinable parts independent from particular printf implementation. Thus final result can be cached and shared.
|
||||
/// i.e when first calll to printf "%s %s" will trigger creation of the specialization. Subsequent calls will pick existing specialization
|
||||
/// i.e when first call to printf "%s %s" will trigger creation of the specialization. Subsequent calls will pick existing specialization
|
||||
open System
|
||||
open System.IO
|
||||
|
||||
open System.Collections.Generic
|
||||
open System.Reflection
|
||||
open Microsoft.FSharp.Core
|
||||
open Microsoft.FSharp.Core.Operators
|
||||
open Microsoft.FSharp.Collections
|
||||
open LanguagePrimitives.IntrinsicOperators
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
|
||||
open Microsoft.FSharp.Core.PrimReflectionAdapters
|
||||
open Microsoft.FSharp.Core.ReflectionAdapters
|
||||
|
||||
#endif
|
||||
|
||||
open System.IO
|
||||
|
||||
[<Flags>]
|
||||
type FormatFlags =
|
||||
|
@ -1386,4 +1387,4 @@ module Printf =
|
|||
[<CompiledName("PrintFormatLineToError")>]
|
||||
let eprintfn fmt = fprintfn System.Console.Error fmt
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.0.1-rc2-23911",
|
||||
"NETStandard.Library": "1.5.0-rc2-23911",
|
||||
"System.Linq.Expressions": "4.0.11-rc2-23911",
|
||||
"System.Linq.Queryable": "4.0.1-rc2-23911",
|
||||
"System.Reflection.TypeExtensions": "4.1.0-rc2-23911",
|
||||
"System.Net.Requests": "4.0.11-rc2-23911",
|
||||
"System.Threading.Tasks.Parallel": "4.0.1-rc2-23911",
|
||||
"System.Threading.Thread": "4.0.0-rc2-23911",
|
||||
"System.Threading.ThreadPool": "4.0.10-rc2-23911",
|
||||
},
|
||||
"runtimes": {
|
||||
"win7-x86": { },
|
||||
"win7-x64": { },
|
||||
"osx.10.10-x64": { },
|
||||
"ubuntu.14.04-x64": { }
|
||||
},
|
||||
"frameworks": {
|
||||
"dnxcore50": { }
|
||||
}
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1753,12 +1753,12 @@ module Patterns =
|
|||
match assem with
|
||||
#if FX_NO_REFLECTION_EMIT
|
||||
#else
|
||||
| :? System.Reflection.Emit.AssemblyBuilder -> []
|
||||
| a when a.FullName = "System.Reflection.Emit.AssemblyBuilder" -> []
|
||||
#endif
|
||||
| _ ->
|
||||
| null | _ ->
|
||||
let resources =
|
||||
// This raises NotSupportedException for dynamic assemblies
|
||||
try assem.GetManifestResourceNames()
|
||||
try assem.GetManifestResourceNames()
|
||||
with :? NotSupportedException -> [| |]
|
||||
[ for resourceName in resources do
|
||||
if resourceName.StartsWith(ReflectedDefinitionsResourceNameBase,StringComparison.Ordinal) &&
|
||||
|
|
|
@ -3,208 +3,15 @@
|
|||
// Reflection on F# values. Analyze an object to see if it the representation
|
||||
// of an F# value.
|
||||
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
|
||||
namespace Microsoft.FSharp.Core
|
||||
|
||||
open System
|
||||
open System.Reflection
|
||||
|
||||
open Microsoft.FSharp.Core
|
||||
open Microsoft.FSharp.Core.Operators
|
||||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators
|
||||
open Microsoft.FSharp.Collections
|
||||
open Microsoft.FSharp.Primitives.Basics
|
||||
|
||||
module ReflectionAdapters =
|
||||
|
||||
[<Flags>]
|
||||
type BindingFlags =
|
||||
| DeclaredOnly = 2
|
||||
| Instance = 4
|
||||
| Static = 8
|
||||
| Public = 16
|
||||
| NonPublic = 32
|
||||
let inline hasFlag (flag : BindingFlags) f = (f &&& flag) = flag
|
||||
let isDeclaredFlag f = hasFlag BindingFlags.DeclaredOnly f
|
||||
let isPublicFlag f = hasFlag BindingFlags.Public f
|
||||
let isStaticFlag f = hasFlag BindingFlags.Static f
|
||||
let isInstanceFlag f = hasFlag BindingFlags.Instance f
|
||||
let isNonPublicFlag f = hasFlag BindingFlags.NonPublic f
|
||||
|
||||
[<System.Flags>]
|
||||
type TypeCode =
|
||||
| Int32 = 0
|
||||
| Int64 = 1
|
||||
| Byte = 2
|
||||
| SByte = 3
|
||||
| Int16 = 4
|
||||
| UInt16 = 5
|
||||
| UInt32 = 6
|
||||
| UInt64 = 7
|
||||
| Single = 8
|
||||
| Double = 9
|
||||
| Decimal = 10
|
||||
| Other = 11
|
||||
|
||||
let isAcceptable bindingFlags isStatic isPublic =
|
||||
// 1. check if member kind (static\instance) was specified in flags
|
||||
((isStaticFlag bindingFlags && isStatic) || (isInstanceFlag bindingFlags && not isStatic)) &&
|
||||
// 2. check if member accessibility was specified in flags
|
||||
((isPublicFlag bindingFlags && isPublic) || (isNonPublicFlag bindingFlags && not isPublic))
|
||||
|
||||
let publicFlags = BindingFlags.Public ||| BindingFlags.Instance ||| BindingFlags.Static
|
||||
|
||||
let commit (results : _[]) =
|
||||
match results with
|
||||
| [||] -> null
|
||||
| [| m |] -> m
|
||||
| _ -> raise (AmbiguousMatchException())
|
||||
|
||||
let canUseAccessor (accessor : MethodInfo) nonPublic =
|
||||
box accessor <> null && (accessor.IsPublic || nonPublic)
|
||||
|
||||
open PrimReflectionAdapters
|
||||
|
||||
type System.Type with
|
||||
member this.GetNestedType (name, bindingFlags) =
|
||||
// MSDN: http://msdn.microsoft.com/en-us/library/0dcb3ad5.aspx
|
||||
// The following BindingFlags filter flags can be used to define which nested types to include in the search:
|
||||
// You must specify either BindingFlags.Public or BindingFlags.NonPublic to get a return.
|
||||
// Specify BindingFlags.Public to include public nested types in the search.
|
||||
// Specify BindingFlags.NonPublic to include non-public nested types (that is, private, internal, and protected nested types) in the search.
|
||||
// This method returns only the nested types of the current type. It does not search the base classes of the current type.
|
||||
// To find types that are nested in base classes, you must walk the inheritance hierarchy, calling GetNestedType at each level.
|
||||
let nestedTyOpt =
|
||||
this.GetTypeInfo().DeclaredNestedTypes
|
||||
|> Seq.tryFind (fun nestedTy ->
|
||||
nestedTy.Name = name && (
|
||||
(isPublicFlag bindingFlags && nestedTy.IsNestedPublic) ||
|
||||
(isNonPublicFlag bindingFlags && (nestedTy.IsNestedPrivate || nestedTy.IsNestedFamily || nestedTy.IsNestedAssembly || nestedTy.IsNestedFamORAssem || nestedTy.IsNestedFamANDAssem))
|
||||
)
|
||||
)
|
||||
|> Option.map (fun ti -> ti.AsType())
|
||||
defaultArg nestedTyOpt null
|
||||
// use different sources based on Declared flag
|
||||
member this.GetMethods(bindingFlags) =
|
||||
(if isDeclaredFlag bindingFlags then this.GetTypeInfo().DeclaredMethods else this.GetRuntimeMethods())
|
||||
|> Seq.filter (fun m -> isAcceptable bindingFlags m.IsStatic m.IsPublic)
|
||||
|> Seq.toArray
|
||||
// use different sources based on Declared flag
|
||||
member this.GetFields(bindingFlags) =
|
||||
(if isDeclaredFlag bindingFlags then this.GetTypeInfo().DeclaredFields else this.GetRuntimeFields())
|
||||
|> Seq.filter (fun f -> isAcceptable bindingFlags f.IsStatic f.IsPublic)
|
||||
|> Seq.toArray
|
||||
// use different sources based on Declared flag
|
||||
member this.GetProperties(?bindingFlags) =
|
||||
let bindingFlags = defaultArg bindingFlags publicFlags
|
||||
(if isDeclaredFlag bindingFlags then this.GetTypeInfo().DeclaredProperties else this.GetRuntimeProperties())
|
||||
|> Seq.filter (fun pi->
|
||||
let mi = if pi.GetMethod <> null then pi.GetMethod else pi.SetMethod
|
||||
assert (mi <> null)
|
||||
isAcceptable bindingFlags mi.IsStatic mi.IsPublic
|
||||
)
|
||||
|> Seq.toArray
|
||||
// use different sources based on Declared flag
|
||||
member this.GetMethod(name, ?bindingFlags) =
|
||||
let bindingFlags = defaultArg bindingFlags publicFlags
|
||||
this.GetMethods(bindingFlags)
|
||||
|> Array.filter(fun m -> m.Name = name)
|
||||
|> commit
|
||||
// use different sources based on Declared flag
|
||||
member this.GetProperty(name, bindingFlags) =
|
||||
this.GetProperties(bindingFlags)
|
||||
|> Array.filter (fun pi -> pi.Name = name)
|
||||
|> commit
|
||||
member this.IsGenericTypeDefinition = this.GetTypeInfo().IsGenericTypeDefinition
|
||||
member this.GetGenericArguments() =
|
||||
if this.IsGenericTypeDefinition then this.GetTypeInfo().GenericTypeParameters
|
||||
elif this.IsGenericType then this.GenericTypeArguments
|
||||
else [||]
|
||||
member this.BaseType = this.GetTypeInfo().BaseType
|
||||
member this.GetConstructor(parameterTypes : Type[]) =
|
||||
this.GetTypeInfo().DeclaredConstructors
|
||||
|> Seq.filter (fun ci ->
|
||||
not ci.IsStatic && //exclude type initializer
|
||||
(
|
||||
let parameters = ci.GetParameters()
|
||||
(parameters.Length = parameterTypes.Length) &&
|
||||
(parameterTypes, parameters) ||> Array.forall2 (fun ty pi -> pi.ParameterType.Equals ty)
|
||||
)
|
||||
)
|
||||
|> Seq.toArray
|
||||
|> commit
|
||||
// MSDN: returns an array of Type objects representing all the interfaces implemented or inherited by the current Type.
|
||||
member this.GetInterfaces() = this.GetTypeInfo().ImplementedInterfaces |> Seq.toArray
|
||||
member this.GetConstructors(?bindingFlags) =
|
||||
let bindingFlags = defaultArg bindingFlags publicFlags
|
||||
// type initializer will also be included in resultset
|
||||
this.GetTypeInfo().DeclaredConstructors
|
||||
|> Seq.filter (fun ci -> isAcceptable bindingFlags ci.IsStatic ci.IsPublic)
|
||||
|> Seq.toArray
|
||||
member this.GetMethods() = this.GetMethods(publicFlags)
|
||||
member this.Assembly = this.GetTypeInfo().Assembly
|
||||
member this.IsSubclassOf(otherTy : Type) = this.GetTypeInfo().IsSubclassOf(otherTy)
|
||||
member this.IsEnum = this.GetTypeInfo().IsEnum;
|
||||
member this.GetField(name, bindingFlags) =
|
||||
this.GetFields(bindingFlags)
|
||||
|> Array.filter (fun fi -> fi.Name = name)
|
||||
|> commit
|
||||
member this.GetProperty(name, propertyType, parameterTypes : Type[]) =
|
||||
this.GetProperties()
|
||||
|> Array.filter (fun pi ->
|
||||
pi.Name = name &&
|
||||
pi.PropertyType = propertyType &&
|
||||
(
|
||||
let parameters = pi.GetIndexParameters()
|
||||
(parameters.Length = parameterTypes.Length) &&
|
||||
(parameterTypes, parameters) ||> Array.forall2 (fun ty pi -> pi.ParameterType.Equals ty)
|
||||
)
|
||||
)
|
||||
|> commit
|
||||
static member GetTypeCode(ty : Type) =
|
||||
if typeof<System.Int32>.Equals ty then TypeCode.Int32
|
||||
elif typeof<System.Int64>.Equals ty then TypeCode.Int64
|
||||
elif typeof<System.Byte>.Equals ty then TypeCode.Byte
|
||||
elif ty = typeof<System.SByte> then TypeCode.SByte
|
||||
elif ty = typeof<System.Int16> then TypeCode.Int16
|
||||
elif ty = typeof<System.UInt16> then TypeCode.UInt16
|
||||
elif ty = typeof<System.UInt32> then TypeCode.UInt32
|
||||
elif ty = typeof<System.UInt64> then TypeCode.UInt64
|
||||
elif ty = typeof<System.Single> then TypeCode.Single
|
||||
elif ty = typeof<System.Double> then TypeCode.Double
|
||||
elif ty = typeof<System.Decimal> then TypeCode.Decimal
|
||||
else TypeCode.Other
|
||||
|
||||
type System.Reflection.MemberInfo with
|
||||
member this.GetCustomAttributes(attrTy, inherits) : obj[] = downcast box(CustomAttributeExtensions.GetCustomAttributes(this, attrTy, inherits) |> Seq.toArray)
|
||||
|
||||
type System.Reflection.MethodInfo with
|
||||
member this.GetCustomAttributes(inherits : bool) : obj[] = downcast box(CustomAttributeExtensions.GetCustomAttributes(this, inherits) |> Seq.toArray)
|
||||
|
||||
type System.Reflection.PropertyInfo with
|
||||
member this.GetGetMethod(nonPublic) =
|
||||
let mi = this.GetMethod
|
||||
if canUseAccessor mi nonPublic then mi
|
||||
else null
|
||||
member this.GetSetMethod(nonPublic) =
|
||||
let mi = this.SetMethod
|
||||
if canUseAccessor mi nonPublic then mi
|
||||
else null
|
||||
|
||||
type System.Reflection.Assembly with
|
||||
member this.GetTypes() =
|
||||
this.DefinedTypes
|
||||
|> Seq.map (fun ti -> ti.AsType())
|
||||
|> Seq.toArray
|
||||
|
||||
type System.Delegate with
|
||||
static member CreateDelegate(delegateType, methodInfo : MethodInfo) = methodInfo.CreateDelegate(delegateType)
|
||||
static member CreateDelegate(delegateType, obj : obj, methodInfo : MethodInfo) = methodInfo.CreateDelegate(delegateType, obj)
|
||||
|
||||
#endif
|
||||
|
||||
namespace Microsoft.FSharp.Reflection
|
||||
namespace Microsoft.FSharp.Reflection
|
||||
|
||||
module internal ReflectionUtils =
|
||||
|
||||
|
@ -236,10 +43,8 @@ module internal Impl =
|
|||
let debug = false
|
||||
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
|
||||
open PrimReflectionAdapters
|
||||
open ReflectionAdapters
|
||||
|
||||
#endif
|
||||
|
||||
let getBindingFlags allowAccess = ReflectionUtils.toBindingFlags (defaultArg allowAccess false)
|
||||
|
|
|
@ -515,84 +515,6 @@ module FSharpReflectionExtensions =
|
|||
/// <returns>True if the type check is an F# exception.</returns>
|
||||
static member IsExceptionRepresentation: exceptionType:Type * ?allowAccessToPrivateRepresentation : bool -> bool
|
||||
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
|
||||
namespace Microsoft.FSharp.Core
|
||||
|
||||
open System
|
||||
open System.Reflection
|
||||
|
||||
module internal ReflectionAdapters =
|
||||
|
||||
[<System.Flags>]
|
||||
type BindingFlags =
|
||||
| DeclaredOnly = 2
|
||||
| Instance = 4
|
||||
| Static = 8
|
||||
| Public = 16
|
||||
| NonPublic = 32
|
||||
|
||||
val isDeclaredFlag : BindingFlags -> bool
|
||||
val isPublicFlag : BindingFlags -> bool
|
||||
val isStaticFlag : BindingFlags -> bool
|
||||
val isInstanceFlag : BindingFlags -> bool
|
||||
val isNonPublicFlag : BindingFlags -> bool
|
||||
val isAcceptable : BindingFlags -> isStatic : bool -> isPublic : bool -> bool
|
||||
|
||||
[<System.Flags>]
|
||||
type TypeCode =
|
||||
| Int32 = 0
|
||||
| Int64 = 1
|
||||
| Byte = 2
|
||||
| SByte = 3
|
||||
| Int16 = 4
|
||||
| UInt16 = 5
|
||||
| UInt32 = 6
|
||||
| UInt64 = 7
|
||||
| Single = 8
|
||||
| Double = 9
|
||||
| Decimal = 10
|
||||
| Other = 11
|
||||
|
||||
type System.Type with
|
||||
member GetNestedType : name : string * bindingFlags : BindingFlags -> Type
|
||||
member GetMethods : bindingFlags : BindingFlags -> MethodInfo[]
|
||||
member GetFields : bindingFlags : BindingFlags -> FieldInfo[]
|
||||
member GetProperties : ?bindingFlags : BindingFlags -> PropertyInfo[]
|
||||
member GetMethod : name : string * ?bindingFlags : BindingFlags -> MethodInfo
|
||||
member GetProperty : name : string * bindingFlags : BindingFlags -> PropertyInfo
|
||||
member IsGenericTypeDefinition : bool
|
||||
member GetGenericArguments : unit -> Type[]
|
||||
member BaseType : Type
|
||||
member GetConstructor : parameterTypes : Type[] -> ConstructorInfo
|
||||
member GetInterfaces : unit -> Type[]
|
||||
member GetConstructors : ?bindingFlags : BindingFlags -> ConstructorInfo[]
|
||||
member GetMethods : unit -> MethodInfo[]
|
||||
member Assembly : Assembly
|
||||
member IsSubclassOf : Type -> bool
|
||||
member IsEnum : bool
|
||||
member GetField : string * BindingFlags -> FieldInfo
|
||||
member GetProperty : string * Type * Type[] -> PropertyInfo
|
||||
static member GetTypeCode : System.Type -> TypeCode
|
||||
|
||||
type System.Reflection.Assembly with
|
||||
member GetTypes : unit -> Type[]
|
||||
|
||||
type System.Reflection.MemberInfo with
|
||||
member GetCustomAttributes : attributeType : Type * inherits : bool -> obj[]
|
||||
|
||||
type System.Reflection.MethodInfo with
|
||||
member GetCustomAttributes : inherits : bool -> obj[]
|
||||
|
||||
type System.Reflection.PropertyInfo with
|
||||
member GetGetMethod : bool -> MethodInfo
|
||||
member GetSetMethod : bool -> MethodInfo
|
||||
|
||||
type System.Delegate with
|
||||
static member CreateDelegate : Type * MethodInfo -> System.Delegate
|
||||
static member CreateDelegate : Type * obj * MethodInfo -> System.Delegate
|
||||
|
||||
#endif
|
||||
|
||||
namespace Microsoft.FSharp.Reflection
|
||||
|
||||
|
|
|
@ -13,6 +13,14 @@
|
|||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FilesToLocalize Include="$(OutDir)$(AssemblyName).dll">
|
||||
<TranslationFile>$(FSharpSourcesRoot)\..\loc\lcl\{Lang}\$(AssemblyName).dll.lcl</TranslationFile>
|
||||
<LciCommentFile>$(FSharpSourcesRoot)\..\loc\lci\$(AssemblyName).dll.lci</LciCommentFile>
|
||||
<HasLceComments>false</HasLceComments>
|
||||
<InProject>false</InProject>
|
||||
</FilesToLocalize>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FsSrGen Include="$(FSharpSourcesRoot)\fsharp\FSharp.Data.TypeProviders\FSData.txt" >
|
||||
<Link>FSData.txt</Link>
|
||||
|
@ -46,6 +54,16 @@
|
|||
<Link>TypeProviders.fs</Link>
|
||||
<Visible>true</Visible>
|
||||
</Compile>
|
||||
|
||||
</ItemGroup>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="GatherBinariesToBeSigned" AfterTargets="Localize">
|
||||
<ItemGroup>
|
||||
<BinariesToBeSigned Include="$(OutDir)$(AssemblyName).dll" />
|
||||
<BinariesToBeSigned Include="$(OutDir)localize\**\$(AssemblyName).resources.dll" />
|
||||
<FilesToSign Include="@(BinariesToBeSigned)">
|
||||
<Authenticode>Microsoft</Authenticode>
|
||||
<StrongName>StrongName</StrongName>
|
||||
</FilesToSign>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
|
@ -14,12 +14,22 @@
|
|||
<DefineConstants>COMPILER;$(DefineConstants)</DefineConstants>
|
||||
<DefineConstants>COMPILED_AS_LANGUAGE_SERVICE_DLL;$(DefineConstants)</DefineConstants>
|
||||
<DefineConstants>INCLUDE_METADATA_READER;$(DefineConstants)</DefineConstants>
|
||||
<DefineConstants>NO_INLINE_IL_PARSER;$(DefineConstants)</DefineConstants>
|
||||
<DefineConstants Condition=" '$(TargetFramework)'=='coreclr'">$(DefineConstants);PREFERRED_UI_LANG</DefineConstants>
|
||||
<DefineConstants>INCLUDE_METADATA_WRITER;$(DefineConstants)</DefineConstants>
|
||||
<NoWarn>$(NoWarn);62;9;75</NoWarn>
|
||||
<ProjectGuid>{a437a6ec-5323-47c2-8f86-e2cac54ff152}</ProjectGuid>
|
||||
<AllowCrossTargeting>true</AllowCrossTargeting>
|
||||
<BaseAddress>0x06800000</BaseAddress>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<FilesToLocalize Include="$(OutDir)$(AssemblyName).dll">
|
||||
<TranslationFile>$(FSharpSourcesRoot)\..\loc\lcl\{Lang}\$(AssemblyName).dll.lcl</TranslationFile>
|
||||
<LciCommentFile>$(FSharpSourcesRoot)\..\loc\lci\$(AssemblyName).dll.lci</LciCommentFile>
|
||||
<HasLceComments>false</HasLceComments>
|
||||
<InProject>false</InProject>
|
||||
</FilesToLocalize>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FsSrGen Include="..\FSComp.txt">
|
||||
<Link>FSComp.txt</Link>
|
||||
|
@ -27,6 +37,9 @@
|
|||
<EmbeddedResource Include="..\FSStrings.resx">
|
||||
<Link>FSStrings.resx</Link>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="..\..\utils\reshapedreflection.fs">
|
||||
<Link>Reflection\reshapedreflection.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\assemblyinfo\assemblyinfo.FSharp.Compiler.dll.fs">
|
||||
<Link>assemblyinfo.FSharp.Compiler.dll.fs</Link>
|
||||
</Compile>
|
||||
|
@ -79,6 +92,12 @@
|
|||
<Compile Include="..\QueueList.fs">
|
||||
<Link>Utilities\QueueList.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ildiag.fsi">
|
||||
<Link>Utilities\ildiag.fsi</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ildiag.fs">
|
||||
<Link>Utilities\ildiag.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\illib.fs">
|
||||
<Link>Utilities\illib.fs</Link>
|
||||
</Compile>
|
||||
|
@ -106,12 +125,6 @@
|
|||
<Compile Include="..\..\absil\bytes.fs">
|
||||
<Link>Utilities\bytes.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ildiag.fsi">
|
||||
<Link>Utilities\ildiag.fsi</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ildiag.fs">
|
||||
<Link>Utilities\ildiag.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\lib.fs">
|
||||
<Link>Utilities\lib.fs</Link>
|
||||
</Compile>
|
||||
|
@ -209,6 +222,12 @@
|
|||
<Compile Include="..\..\absil\ilread.fs">
|
||||
<Link>AbsIL\ilread.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ilwritepdb.fsi">
|
||||
<Link>AbsIL/ilwritepdb.fsi</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ilwritepdb.fs">
|
||||
<Link>AbsIL/ilwritepdb.fs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\absil\ilwrite.fsi">
|
||||
<Link>AbsIL/ilwrite.fsi</Link>
|
||||
</Compile>
|
||||
|
@ -518,8 +537,12 @@
|
|||
<Reference Include="Microsoft.Build.Framework, Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build.Engine, Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build, Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build.Utilities.$(MSBuildVersionSuffix)" />
|
||||
<Reference Include="Microsoft.Build.Tasks.$(MSBuildVersionSuffix)" />
|
||||
<Reference Include="Microsoft.Build.Utilities.$(MSBuildVersionSuffix), Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.Build.Tasks.$(MSBuildVersionSuffix), Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.DiaSymReader.PortablePdb"><HintPath>..\..\..\packages\Microsoft.DiaSymReader.PortablePdb.1.0.0-rc-60301\lib\portable-net45+win8\Microsoft.DiaSymReader.PortablePdb.dll</HintPath></Reference>
|
||||
<Reference Include="Microsoft.DiaSymReader"><HintPath>..\..\..\packages\Microsoft.DiaSymReader\1.0.7\lib\portable-net45+win8\Microsoft.DiaSymReader.dll</HintPath></Reference>
|
||||
<Reference Include="System.Reflection.Metadata"><HintPath>..\..\..\packages\System.Reflection.Metadata.1.3.0-beta-23816\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath></Reference>
|
||||
<Reference Include="System.Collections.Immutable"><HintPath>..\..\..\packages\System.Collections.Immutable.1.2.0-rc3-23805\lib\portable-net45+win8+wp8+wpa81</HintPath></Reference>
|
||||
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj" >
|
||||
<Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
|
||||
<Name>FSharp.Core</Name>
|
||||
|
@ -539,4 +562,15 @@
|
|||
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
|
||||
</Copy>
|
||||
</Target>
|
||||
|
||||
<Target Name="GatherBinariesToBeSigned" AfterTargets="Localize">
|
||||
<ItemGroup>
|
||||
<BinariesToBeSigned Include="$(OutDir)$(AssemblyName).dll" />
|
||||
<BinariesToBeSigned Include="$(OutDir)localize\**\$(AssemblyName).resources.dll" />
|
||||
<FilesToSign Include="@(BinariesToBeSigned)">
|
||||
<Authenticode>Microsoft</Authenticode>
|
||||
<StrongName>StrongName</StrongName>
|
||||
</FilesToSign>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -11,16 +11,27 @@
|
|||
fsc.exe and fsi.exe only runs on x86 (emulates on ia64, x64) due to
|
||||
Win32 DLLs and memory mapping dependencies...
|
||||
-->
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<PlatformTarget Condition=" '$(TargetFramework)'!='coreclr'">x86</PlatformTarget>
|
||||
<PlatformTarget Condition=" '$(TargetFramework)'=='coreclr'">AnyCPU</PlatformTarget>
|
||||
<ProjectGuid>{C94C257C-3C0A-4858-B5D8-D746498D1F08}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<NoWarn>$(NoWarn);62</NoWarn>
|
||||
<AssemblyName>fsc</AssemblyName>
|
||||
<DefineConstants>EXTENSIONTYPING;COMPILER;$(DefineConstants)</DefineConstants>
|
||||
<DefineConstants Condition=" '$(TargetFramework)'=='coreclr'">$(DefineConstants);PREFERRED_UI_LANG</DefineConstants>
|
||||
<AllowCrossTargeting>true</AllowCrossTargeting>
|
||||
<TargetFrameworkVersion Condition="'$(TargetFramework)'=='net20'">v2.0</TargetFrameworkVersion>
|
||||
<OtherFlags>$(OtherFlags) --warnon:1182</OtherFlags>
|
||||
<OtherFlags Condition=" '$(TargetFramework)'=='coreclr'">$(OtherFlags) --targetprofile:netcore</OtherFlags>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<FilesToLocalize Include="$(OutDir)$(AssemblyName).exe">
|
||||
<TranslationFile>$(FSharpSourcesRoot)\..\loc\lcl\{Lang}\$(AssemblyName).exe.lcl</TranslationFile>
|
||||
<LciCommentFile>$(FSharpSourcesRoot)\..\loc\lci\$(AssemblyName).exe.lci</LciCommentFile>
|
||||
<HasLceComments>false</HasLceComments>
|
||||
<InProject>false</InProject>
|
||||
</FilesToLocalize>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="InternalsVisibleTo.fs" />
|
||||
<Compile Include="..\..\assemblyinfo\assemblyinfo.fsc.exe.fs">
|
||||
|
@ -33,12 +44,21 @@
|
|||
<Link>fsc.exe.config</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="..\..\windows\default.win32manifest">
|
||||
<Link>default.win32manifest</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'coreclr'">
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'coreclr'">
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Runtime.Remoting" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FSharp.Compiler\FSharp.Compiler.fsproj">
|
||||
<Project>{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}</Project>
|
||||
<Name>FSharp.Compiler</Name>
|
||||
|
@ -49,4 +69,15 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(FSharpSourcesRoot)\FSharpSource.targets" />
|
||||
|
||||
<Target Name="GatherBinariesToBeSigned" AfterTargets="Localize">
|
||||
<ItemGroup>
|
||||
<BinariesToBeSigned Include="$(OutDir)$(AssemblyName).exe" />
|
||||
<BinariesToBeSigned Include="$(OutDir)localize\**\$(AssemblyName).resources.dll" />
|
||||
<FilesToSign Include="@(BinariesToBeSigned)">
|
||||
<Authenticode>Microsoft</Authenticode>
|
||||
<StrongName>StrongName</StrongName>
|
||||
</FilesToSign>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
culture="neutral"/>
|
||||
<bindingRedirect
|
||||
oldVersion="2.0.0.0-4.4.1.0"
|
||||
newVersion="4.4.1.9055"/>
|
||||
newVersion="4.4.1.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.0.1-rc2-23911",
|
||||
"NETStandard.Library": "1.5.0-rc2-23911",
|
||||
"System.Linq.Expressions": "4.0.11-rc2-23911",
|
||||
"System.Reflection.Metadata": "1.3.0-rc2-23911",
|
||||
},
|
||||
"runtimes": {
|
||||
"win7-x86": { },
|
||||
"win7-x64": { },
|
||||
"osx.10.10-x64": { },
|
||||
"ubuntu.14.04-x64": { }
|
||||
},
|
||||
"frameworks": {
|
||||
"dnxcore50": { }
|
||||
}
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -2475,45 +2475,45 @@ and GenApp cenv cgbuf eenv (f,fty,tyargs,args,m) sequel =
|
|||
// ok, now we're ready to generate
|
||||
if isSuperInit || isSelfInit then
|
||||
CG.EmitInstrs cgbuf (pop 0) (Push [mspec.EnclosingType ]) [ mkLdarg0 ] ;
|
||||
|
||||
|
||||
GenUntupledArgsDiscardingLoneUnit cenv cgbuf eenv m vref.NumObjArgs curriedArgInfos nowArgs;
|
||||
|
||||
|
||||
// Generate laterArgs (for effects) and save
|
||||
LocalScope "callstack" cgbuf (fun scopeMarks ->
|
||||
let whereSaved,eenv =
|
||||
(eenv,laterArgs) ||> List.mapFold (fun eenv laterArg ->
|
||||
// Only save arguments that have effects
|
||||
if Optimizer.ExprHasEffect cenv.g laterArg then
|
||||
let ilTy = laterArg |> tyOfExpr cenv.g |> GenType cenv.amap m cenv.g eenv.tyenv
|
||||
let loc,eenv = AllocLocal cenv cgbuf eenv true (ilxgenGlobalNng.FreshCompilerGeneratedName ("arg",m), ilTy) scopeMarks
|
||||
GenExpr cenv cgbuf eenv SPSuppress laterArg Continue
|
||||
EmitSetLocal cgbuf loc
|
||||
Choice1Of2 (ilTy,loc),eenv
|
||||
else
|
||||
Choice2Of2 laterArg, eenv)
|
||||
let whereSaved,eenv =
|
||||
(eenv,laterArgs) ||> List.mapFold (fun eenv laterArg ->
|
||||
// Only save arguments that have effects
|
||||
if Optimizer.ExprHasEffect cenv.g laterArg then
|
||||
let ilTy = laterArg |> tyOfExpr cenv.g |> GenType cenv.amap m cenv.g eenv.tyenv
|
||||
let loc,eenv = AllocLocal cenv cgbuf eenv true (ilxgenGlobalNng.FreshCompilerGeneratedName ("arg",m), ilTy) scopeMarks
|
||||
GenExpr cenv cgbuf eenv SPSuppress laterArg Continue
|
||||
EmitSetLocal cgbuf loc
|
||||
Choice1Of2 (ilTy,loc),eenv
|
||||
else
|
||||
Choice2Of2 laterArg, eenv)
|
||||
|
||||
let nargs = mspec.FormalArgTypes.Length
|
||||
CG.EmitInstr cgbuf (pop (nargs + (if mspec.CallingConv.IsStatic || newobj then 0 else 1)))
|
||||
(if mustGenerateUnitAfterCall || isSuperInit || isSelfInit then Push0 else (Push [(GenType cenv.amap m cenv.g eenv.tyenv actualRetTy)])) callInstr;
|
||||
let nargs = mspec.FormalArgTypes.Length
|
||||
CG.EmitInstr cgbuf (pop (nargs + (if mspec.CallingConv.IsStatic || newobj then 0 else 1)))
|
||||
(if mustGenerateUnitAfterCall || isSuperInit || isSelfInit then Push0 else (Push [(GenType cenv.amap m cenv.g eenv.tyenv actualRetTy)])) callInstr;
|
||||
|
||||
// For isSuperInit, load the 'this' pointer as the pretend 'result' of the operation. It will be popped again in most cases
|
||||
if isSuperInit then CG.EmitInstrs cgbuf (pop 0) (Push [mspec.EnclosingType]) [ mkLdarg0 ] ;
|
||||
// For isSuperInit, load the 'this' pointer as the pretend 'result' of the operation. It will be popped again in most cases
|
||||
if isSuperInit then CG.EmitInstrs cgbuf (pop 0) (Push [mspec.EnclosingType]) [ mkLdarg0 ] ;
|
||||
|
||||
// When generating debug code, generate a 'nop' after a 'call' that returns 'void'
|
||||
// This is what C# does, as it allows the call location to be maintained correctly in the stack frame
|
||||
if cenv.opts.generateDebugSymbols && mustGenerateUnitAfterCall && (isTailCall = Normalcall) then
|
||||
CG.EmitInstrs cgbuf (pop 0) Push0 [ AI_nop ]
|
||||
// When generating debug code, generate a 'nop' after a 'call' that returns 'void'
|
||||
// This is what C# does, as it allows the call location to be maintained correctly in the stack frame
|
||||
if cenv.opts.generateDebugSymbols && mustGenerateUnitAfterCall && (isTailCall = Normalcall) then
|
||||
CG.EmitInstrs cgbuf (pop 0) Push0 [ AI_nop ]
|
||||
|
||||
if isNil laterArgs then
|
||||
assert isNil whereSaved
|
||||
// Generate the "unit" value if necessary
|
||||
CommitCallSequel cenv eenv m eenv.cloc cgbuf mustGenerateUnitAfterCall sequel
|
||||
else
|
||||
//printfn "%d EXTRA ARGS IN TOP APP at %s" laterArgs.Length (stringOfRange m)
|
||||
whereSaved |> List.iter (function
|
||||
| Choice1Of2 (ilTy,loc) -> EmitGetLocal cgbuf ilTy loc
|
||||
| Choice2Of2 expr -> GenExpr cenv cgbuf eenv SPSuppress expr Continue)
|
||||
GenIndirectCall cenv cgbuf eenv (actualRetTy,[],laterArgs,m) sequel)
|
||||
if isNil laterArgs then
|
||||
assert isNil whereSaved
|
||||
// Generate the "unit" value if necessary
|
||||
CommitCallSequel cenv eenv m eenv.cloc cgbuf mustGenerateUnitAfterCall sequel
|
||||
else
|
||||
//printfn "%d EXTRA ARGS IN TOP APP at %s" laterArgs.Length (stringOfRange m)
|
||||
whereSaved |> List.iter (function
|
||||
| Choice1Of2 (ilTy,loc) -> EmitGetLocal cgbuf ilTy loc
|
||||
| Choice2Of2 expr -> GenExpr cenv cgbuf eenv SPSuppress expr Continue)
|
||||
GenIndirectCall cenv cgbuf eenv (actualRetTy,[],laterArgs,m) sequel)
|
||||
|
||||
| _ -> failwith "??"
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
// Some general F# utilities for mangling / unmangling / manipulating names.
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
|
||||
/// Anything to do with special names of identifiers and other lexical rules
|
||||
module internal Microsoft.FSharp.Compiler.PrettyNaming
|
||||
open Internal.Utilities
|
||||
|
@ -15,6 +14,10 @@ module internal Microsoft.FSharp.Compiler.PrettyNaming
|
|||
open System.Collections.Generic
|
||||
open System.Collections.Concurrent
|
||||
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
open Microsoft.FSharp.Core.ReflectionAdapters
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Operator name compilation
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
|
@ -4,16 +4,18 @@ namespace Microsoft.FSharp.Compiler
|
|||
|
||||
module internal MSBuildResolver =
|
||||
|
||||
open System
|
||||
open System.IO
|
||||
open Microsoft.Build.Tasks
|
||||
open Microsoft.Build.Utilities
|
||||
open Microsoft.Build.Framework
|
||||
open Microsoft.Build.BuildEngine
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
open Microsoft.FSharp.Core.ReflectionAdapters
|
||||
#endif
|
||||
#if RESHAPED_MSBUILD
|
||||
open Microsoft.FSharp.Compiler.MsBuildAdapters
|
||||
open Microsoft.FSharp.Compiler.ToolLocationHelper
|
||||
#endif
|
||||
|
||||
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library
|
||||
|
||||
exception ResolutionFailure
|
||||
|
||||
|
||||
/// Describes the location where the reference was found.
|
||||
type ResolvedFrom =
|
||||
| AssemblyFolders
|
||||
|
@ -24,14 +26,22 @@ module internal MSBuildResolver =
|
|||
| Path of string
|
||||
| Unknown
|
||||
|
||||
/// Indicates whether the resolve should follow compile-time rules or runtime rules.
|
||||
#if FX_MSBUILDRESOLVER_RUNTIMELIKE
|
||||
type ResolutionEnvironment = CompileTimeLike | RuntimeLike | DesigntimeLike
|
||||
#else
|
||||
type ResolutionEnvironment =
|
||||
| CompileTimeLike
|
||||
| RuntimeLike
|
||||
| DesigntimeLike
|
||||
|
||||
| CompileTimeLike
|
||||
| RuntimeLike
|
||||
| DesigntimeLike
|
||||
|
||||
#endif
|
||||
open System
|
||||
open Microsoft.Build.Tasks
|
||||
open Microsoft.Build.Utilities
|
||||
open Microsoft.Build.Framework
|
||||
open Microsoft.Build.BuildEngine
|
||||
open System.IO
|
||||
|
||||
/// Information about a resolved file.
|
||||
type ResolvedFile =
|
||||
{ /// Item specification
|
||||
itemSpec:string
|
||||
|
@ -45,10 +55,10 @@ module internal MSBuildResolver =
|
|||
redist:string
|
||||
/// Round-tripped baggage string
|
||||
baggage:string
|
||||
}
|
||||
}
|
||||
|
||||
override this.ToString() = sprintf "ResolvedFile(%s)" this.itemSpec
|
||||
|
||||
|
||||
/// Reference resolution results. All paths are fully qualified.
|
||||
type ResolutionResults =
|
||||
{ /// Paths to primary references
|
||||
|
@ -68,13 +78,14 @@ module internal MSBuildResolver =
|
|||
}
|
||||
|
||||
static member Empty =
|
||||
{ resolvedFiles = [| |]
|
||||
referenceDependencyPaths = [| |]
|
||||
relatedPaths = [| |]
|
||||
referenceSatellitePaths = [| |]
|
||||
referenceScatterPaths = [| |]
|
||||
referenceCopyLocalPaths = [| |]
|
||||
suggestedBindingRedirects = [| |] }
|
||||
{ resolvedFiles = [| |]
|
||||
referenceDependencyPaths = [| |]
|
||||
relatedPaths = [| |]
|
||||
referenceSatellitePaths = [| |]
|
||||
referenceScatterPaths = [| |]
|
||||
referenceCopyLocalPaths = [| |]
|
||||
suggestedBindingRedirects = [| |]
|
||||
}
|
||||
|
||||
|
||||
/// Get the Reference Assemblies directory for the .NET Framework on Window
|
||||
|
@ -201,7 +212,7 @@ module internal MSBuildResolver =
|
|||
|
||||
let result = result |> Array.ofList
|
||||
logMessage (sprintf "Derived target framework directories for version %s are: %s" targetFrameworkVersion (String.Join(",", result)))
|
||||
result
|
||||
result
|
||||
|
||||
/// Decode the ResolvedFrom code from MSBuild.
|
||||
let DecodeResolvedFrom(resolvedFrom:string) : ResolvedFrom =
|
||||
|
@ -231,33 +242,41 @@ module internal MSBuildResolver =
|
|||
logMessage: (string -> unit),
|
||||
logWarning: (string -> string -> unit),
|
||||
logError: (string -> string -> unit)) =
|
||||
|
||||
|
||||
if Array.isEmpty references then ResolutionResults.Empty else
|
||||
|
||||
let backgroundException = ref false
|
||||
|
||||
|
||||
let protect f =
|
||||
if not !backgroundException then
|
||||
try f()
|
||||
with _ -> backgroundException := true
|
||||
|
||||
|
||||
let engine =
|
||||
{ new IBuildEngine with
|
||||
member __.BuildProjectFile(projectFileName, targetNames, globalProperties, targetOutputs) = true
|
||||
member __.LogCustomEvent(e) = protect (fun () -> logMessage e.Message)
|
||||
member __.LogErrorEvent(e) = protect (fun () -> logError e.Code e.Message)
|
||||
member __.LogMessageEvent(e) = protect (fun () -> logMessage e.Message)
|
||||
member __.LogWarningEvent(e) = protect (fun () -> logWarning e.Code e.Message)
|
||||
member __.ColumnNumberOfTaskNode = 1
|
||||
member __.LineNumberOfTaskNode = 1
|
||||
member __.ContinueOnError = true
|
||||
member __.ProjectFileOfTaskNode = "" }
|
||||
|
||||
member __.BuildProjectFile(projectFileName, targetNames, globalProperties, targetOutputs) = true
|
||||
#if RESHAPED_MSBUILD
|
||||
member __.LogCustomEvent(e) = protect (fun () -> logMessage ((e.GetPropertyValue("Message")) :?> string))
|
||||
member __.LogErrorEvent(e) = protect (fun () -> logError ((e.GetPropertyValue("Code")) :?> string) ((e.GetPropertyValue("Message")) :?> string))
|
||||
member __.LogMessageEvent(e) = protect (fun () -> logMessage ((e.GetPropertyValue("Message")) :?> string))
|
||||
member __.LogWarningEvent(e) = protect (fun () -> logWarning ((e.GetPropertyValue("Code")) :?> string) ((e.GetPropertyValue("Message")) :?> string))
|
||||
#else
|
||||
member __.LogCustomEvent(e) = protect (fun () -> logMessage e.Message)
|
||||
member __.LogErrorEvent(e) = protect (fun () -> logError e.Code e.Message)
|
||||
member __.LogMessageEvent(e) = protect (fun () -> logMessage e.Message)
|
||||
member __.LogWarningEvent(e) = protect (fun () -> logWarning e.Code e.Message)
|
||||
#endif
|
||||
member __.ColumnNumberOfTaskNode with get() = 1
|
||||
member __.LineNumberOfTaskNode with get() = 1
|
||||
member __.ContinueOnError with get() = true
|
||||
member __.ProjectFileOfTaskNode with get() = "" }
|
||||
|
||||
// Derive the target framework directory if none was supplied.
|
||||
let targetFrameworkDirectories =
|
||||
if targetFrameworkDirectories=[] then DeriveTargetFrameworkDirectories(targetFrameworkVersion, logMessage)
|
||||
else targetFrameworkDirectories |> Array.ofList
|
||||
|
||||
|
||||
|
||||
// Filter for null and zero length
|
||||
let references = references |> Array.filter(fst >> String.IsNullOrEmpty >> not)
|
||||
|
||||
|
@ -273,7 +292,7 @@ module internal MSBuildResolver =
|
|||
[| match resolutionEnvironment with
|
||||
| DesigntimeLike
|
||||
| RuntimeLike ->
|
||||
logMessage("Using scripting resolution precedence.")
|
||||
logMessage("Using scripting resolution precedence.")
|
||||
// These are search paths for runtime-like or scripting resolution. GAC searching is present.
|
||||
yield! rawFileNamePath // Quick-resolve straight to filename first
|
||||
yield! explicitIncludeDirs // From -I, #I
|
||||
|
@ -299,13 +318,17 @@ module internal MSBuildResolver =
|
|||
// use path to implementation assemblies as the last resort
|
||||
yield! GetPathToDotNetFrameworkImlpementationAssemblies targetFrameworkVersion
|
||||
|]
|
||||
|
||||
|
||||
let assemblies =
|
||||
#if RESHAPED_MSBUILD
|
||||
ignore references
|
||||
[||]
|
||||
#else
|
||||
[| for (referenceName,baggage) in references ->
|
||||
let item = new Microsoft.Build.Utilities.TaskItem(referenceName)
|
||||
item.SetMetadata("Baggage", baggage)
|
||||
item:>ITaskItem |]
|
||||
|
||||
let item = new Microsoft.Build.Utilities.TaskItem(referenceName) :> ITaskItem
|
||||
item.SetMetadata("Baggage", baggage)
|
||||
item |]
|
||||
#endif
|
||||
let rar =
|
||||
ResolveAssemblyReference(BuildEngine=engine, TargetFrameworkDirectories=targetFrameworkDirectories,
|
||||
FindRelatedFiles=false, FindDependencies=false, FindSatellites=false,
|
||||
|
@ -315,10 +338,56 @@ module internal MSBuildResolver =
|
|||
#if BUILDING_WITH_LKG
|
||||
ignore targetProcessorArchitecture
|
||||
#else
|
||||
#if FX_RESHAPED_REFLECTION
|
||||
#else
|
||||
rar.TargetedRuntimeVersion <- typeof<obj>.Assembly.ImageRuntimeVersion
|
||||
#endif
|
||||
rar.TargetProcessorArchitecture <- targetProcessorArchitecture
|
||||
rar.CopyLocalDependenciesWhenParentReferenceInGac <- true
|
||||
#endif
|
||||
rar.Assemblies <-
|
||||
#if RESHAPED_MSBUILD
|
||||
[||]
|
||||
#else
|
||||
[| for (referenceName,baggage) in references ->
|
||||
let item = new Microsoft.Build.Utilities.TaskItem(referenceName) :> ITaskItem
|
||||
item.SetMetadata("Baggage", baggage)
|
||||
item
|
||||
|]
|
||||
#endif
|
||||
let rawFileNamePath = if allowRawFileName then ["{RawFileName}"] else []
|
||||
let searchPaths =
|
||||
match resolutionEnvironment with
|
||||
| DesigntimeLike
|
||||
| RuntimeLike ->
|
||||
logMessage("Using scripting resolution precedence.")
|
||||
// These are search paths for runtime-like or scripting resolution. GAC searching is present.
|
||||
rawFileNamePath @ // Quick-resolve straight to filename first
|
||||
explicitIncludeDirs @ // From -I, #I
|
||||
[fsharpCoreExplicitDirOrFSharpBinariesDir] @ // Location of explicit reference to FSharp.Core, otherwise location of fsc.exe
|
||||
[implicitIncludeDir] @ // Usually the project directory
|
||||
["{TargetFrameworkDirectory}"] @
|
||||
[sprintf "{Registry:%s,%s,%s%s}" frameworkRegistryBase targetFrameworkVersion assemblyFoldersSuffix assemblyFoldersConditions] @
|
||||
["{AssemblyFolders}"] @
|
||||
["{GAC}"]
|
||||
| CompileTimeLike ->
|
||||
logMessage("Using compilation resolution precedence.")
|
||||
// These are search paths for compile-like resolution. GAC searching is not present.
|
||||
["{TargetFrameworkDirectory}"] @
|
||||
rawFileNamePath @ // Quick-resolve straight to filename first
|
||||
explicitIncludeDirs @ // From -I, #I
|
||||
[fsharpCoreExplicitDirOrFSharpBinariesDir] @ // Location of explicit reference to FSharp.Core, otherwise location of fsc.exe
|
||||
[implicitIncludeDir] @ // Usually the project directory
|
||||
[sprintf "{Registry:%s,%s,%s%s}" frameworkRegistryBase targetFrameworkVersion assemblyFoldersSuffix assemblyFoldersConditions] @ // Like {Registry:Software\Microsoft\.NETFramework,v2.0,AssemblyFoldersEx}
|
||||
["{AssemblyFolders}"] @
|
||||
[outputDirectory] @
|
||||
["{GAC}"] @
|
||||
// use path to implementation assemblies as the last resort
|
||||
GetPathToDotNetFrameworkImlpementationAssemblies targetFrameworkVersion
|
||||
|
||||
rar.SearchPaths <- searchPaths |> Array.ofList
|
||||
|
||||
rar.AllowedAssemblyExtensions <- [| ".dll" ; ".exe" |]
|
||||
|
||||
let succeeded = rar.Execute()
|
||||
|
||||
|
@ -342,8 +411,6 @@ module internal MSBuildResolver =
|
|||
referenceCopyLocalPaths = [| for p in rar.CopyLocalFiles -> p.ItemSpec |]
|
||||
suggestedBindingRedirects = [| for p in rar.SuggestedRedirects -> p.ItemSpec |] }
|
||||
|
||||
|
||||
|
||||
/// Perform the resolution on rooted and unrooted paths, and then combine the results.
|
||||
let Resolve(resolutionEnvironment, references, targetFrameworkVersion, targetFrameworkDirectories, targetProcessorArchitecture,
|
||||
outputDirectory, fsharpCoreExplicitDirOrFSharpBinariesDir, explicitIncludeDirs, implicitIncludeDir, frameworkRegistryBase,
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче