From b0351f1324f486664fbbaf83708f8831c2a63f9b Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Tue, 18 Dec 2018 16:04:26 -0800 Subject: [PATCH 01/24] Remove quickparse from VS.FSI (#5841) --- .../src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj | 1 - vsintegration/src/FSharp.VS.FSI/quickparse.fs | 80 ------------------- 2 files changed, 81 deletions(-) delete mode 100644 vsintegration/src/FSharp.VS.FSI/quickparse.fs diff --git a/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj b/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj index 659932a17ee..ff45634d032 100644 --- a/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj +++ b/vsintegration/src/FSharp.VS.FSI/FSharp.VS.FSI.fsproj @@ -29,7 +29,6 @@ CompilerLocationUtils.fs - diff --git a/vsintegration/src/FSharp.VS.FSI/quickparse.fs b/vsintegration/src/FSharp.VS.FSI/quickparse.fs deleted file mode 100644 index 9099134a660..00000000000 --- a/vsintegration/src/FSharp.VS.FSI/quickparse.fs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Microsoft.VisualStudio.FSharp.Interactive -open System.Globalization - -// Duplication note: -// Inlined from Language Service. -// If/when there is a common DLL this code can be shared. - -/// Methods for cheaply and innacurately parsing F# -module internal QuickParse = - /// The characters that are allowed to be in an identifier. - let private IsIdentifierPartCharacter c = - let cat = System.Char.GetUnicodeCategory(c) - ( - // Letters - cat = UnicodeCategory.UppercaseLetter - || cat = UnicodeCategory.LowercaseLetter - || cat = UnicodeCategory.TitlecaseLetter - || cat = UnicodeCategory.ModifierLetter - || cat = UnicodeCategory.OtherLetter - || cat = UnicodeCategory.LetterNumber - // Numbers - || cat = UnicodeCategory.DecimalDigitNumber - // Connectors - || cat = UnicodeCategory.ConnectorPunctuation - // Combiners - || cat = UnicodeCategory.NonSpacingMark - || cat = UnicodeCategory.SpacingCombiningMark - ) - /// Is this character a part of a long identifier - let private IsLongIdentifierPartCharacter c = - (IsIdentifierPartCharacter c) || (c='.') - /// Given a line of text and an index into the line return the - /// "island" of text that could be an identifier around index. - let GetIdentifierIsland(line:string,index)= - if index=0 && IsLongIdentifierPartCharacter line.[left] do left<-left-1 - while right Date: Tue, 18 Dec 2018 20:57:02 -0800 Subject: [PATCH 02/24] reshape the output directory to match divisional standards (#5985) --- .gitignore | 14 +- .vsts-pr.yaml | 6 +- .vsts-signed.yaml | 10 +- FSharpBuild.Directory.Build.props | 13 +- FSharpBuild.Directory.Build.targets | 36 ---- FSharpTests.Directory.Build.props | 43 ++-- Makefile | 21 +- PublishToBlob.proj | 2 +- artifacts/.gitignore | 1 - build.cmd | 197 ++++++++++++------ build/config/AssemblySignToolData.json | 76 +++---- build/config/InsertionSignToolData.json | 10 +- build/config/PackageSignToolData.json | 3 +- build/projects/Signing.proj | 4 +- build/targets/ConvertPortablePdbs.targets | 21 +- .../GenerateAssemblyAttributes.targets | 3 +- build/targets/PackageVersions.props | 2 +- fcs/Directory.Build.props | 10 +- ...FSharp.Compiler.Service.MSBuild.v12.fsproj | 1 - ...arp.Compiler.Service.ProjectCracker.fsproj | 8 +- ...Compiler.Service.ProjectCrackerTool.fsproj | 1 - .../FSharp.Compiler.Service.Tests.fsproj | 2 +- .../FSharp.Compiler.Service.fsproj | 1 - fcs/build.fsx | 6 +- fsharp.proj | 77 ++++--- init-tools.cmd | 2 +- proto.proj | 2 +- setup/Directory.Build.props | 13 +- setup/Directory.Build.targets | 1 - setup/FSharp.Setup.props | 142 ------------- setup/Localization.props | 120 +++++++++++ setup/Swix/Directory.Build.props | 6 +- setup/Swix/Directory.Build.targets | 7 + .../Files.swr | 8 +- ...crosoft.FSharp.Compiler.Resources.swixproj | 1 + .../Swix/Microsoft.FSharp.Compiler/Files.swr | 50 ++--- .../Microsoft.FSharp.Compiler.swixproj | 1 + .../Microsoft.FSharp.Dependencies/Files.swr | 16 +- .../Microsoft.FSharp.Dependencies.swixproj | 2 + setup/Swix/Microsoft.FSharp.IDE/Files.swr | 10 +- .../Microsoft.FSharp.IDE.swixproj | 2 +- .../Microsoft.FSharp.Vsix.Resources/Files.swr | 22 +- .../Microsoft.FSharp.Vsix.Resources.swixproj | 1 + .../Templates.swr | 6 +- setup/Swix/Microsoft.FSharp.vsmanproj | 18 +- setup/publish-assets.ps1 | 5 +- .../Microsoft.FSharp.NetSdk.Shim.props | 0 .../Microsoft.FSharp.NetSdk.Shim.targets | 0 ...osoft.FSharp.Overrides.NetSdk.Shim.targets | 0 .../Microsoft.FSharp.Shim.targets | 0 .../Microsoft.Portable.FSharp.Shim.targets | 0 src/buildtools/Directory.Build.props | 2 +- src/buildtools/Directory.Build.targets | 2 +- src/buildtools/buildtools.targets | 4 +- src/fsharp/Directory.Build.props | 1 + src/fsharp/Directory.Nuget.props | 1 + src/fsharp/Directory.Nuget.targets | 10 - .../FSharp.Compiler.Private.fsproj | 17 +- .../Directory.Build.targets | 4 +- .../Microsoft.FSharp.Compiler.nuspec | 44 ++-- src/fsharp/FSharp.Core/FSharp.Core.nuspec | 20 +- src/fsharp/{Fsc => fsc}/InternalsVisibleTo.fs | 0 src/fsharp/{Fsc => fsc}/app.config | 0 src/fsharp/{Fsc/Fsc.fsproj => fsc/fsc.fsproj} | 0 src/fsharp/fsi/{Fsi.fsproj => fsi.fsproj} | 2 +- .../{FsiAnyCPU.fsproj => fsiAnyCpu.fsproj} | 0 tests/.gitignore | 1 - tests/FSharp.Directory.Build.props | 6 - tests/fsharp/SDKTests/AllSdkTargetsTests.proj | 2 +- tests/fsharp/SDKTests/tests/Test.props | 6 +- tests/fsharp/SDKTests/tests/Test.targets | 2 +- tests/fsharp/Test.Directory.Build.props | 8 - tests/fsharp/single-test.fs | 16 +- tests/fsharp/test-framework.fs | 44 ++-- tests/fsharp/tests.fs | 18 +- .../Source/CodeGen/EmittedIL/CompareIL.cmd | 4 +- tests/fsharpqa/Source/run.pl | 4 +- tests/service/FscTests.fs | 2 +- verify-translations.cmd | 2 +- vsintegration/ItemTemplates/.gitignore | 2 + vsintegration/ProjectTemplates/.gitignore | 2 + vsintegration/Templates.Directory.Build.props | 6 + .../Templates.Directory.Build.targets | 17 ++ vsintegration/Vsix/Directory.Build.targets | 5 + .../VisualFSharpFull/VisualFSharpFull.csproj | 6 +- vsintegration/src/Directory.Build.props | 9 + .../FSharp.PropertiesPages.vbproj | 4 +- .../GetTypesVSUnitTests.fsproj | 3 + vsintegration/tests/Salsa/salsa.fs | 6 +- .../Tests.LanguageService.ParameterInfo.fs | 22 +- vsintegration/tests/UnitTests/Tests.Build.fs | 100 ++++++--- .../UnitTests/VisualFSharp.UnitTests.fsproj | 20 ++ 92 files changed, 761 insertions(+), 666 deletions(-) delete mode 100644 artifacts/.gitignore delete mode 100644 setup/FSharp.Setup.props create mode 100644 setup/Localization.props rename setup/{resources => shims}/Microsoft.FSharp.NetSdk.Shim.props (100%) rename setup/{resources => shims}/Microsoft.FSharp.NetSdk.Shim.targets (100%) rename setup/{resources => shims}/Microsoft.FSharp.Overrides.NetSdk.Shim.targets (100%) rename setup/{resources => shims}/Microsoft.FSharp.Shim.targets (100%) rename setup/{resources => shims}/Microsoft.Portable.FSharp.Shim.targets (100%) rename src/fsharp/{Fsc => fsc}/InternalsVisibleTo.fs (100%) rename src/fsharp/{Fsc => fsc}/app.config (100%) rename src/fsharp/{Fsc/Fsc.fsproj => fsc/fsc.fsproj} (100%) rename src/fsharp/fsi/{Fsi.fsproj => fsi.fsproj} (96%) rename src/fsharp/fsiAnyCpu/{FsiAnyCPU.fsproj => fsiAnyCpu.fsproj} (100%) delete mode 100644 tests/fsharp/Test.Directory.Build.props create mode 100644 vsintegration/ItemTemplates/.gitignore create mode 100644 vsintegration/ProjectTemplates/.gitignore create mode 100644 vsintegration/src/Directory.Build.props diff --git a/.gitignore b/.gitignore index 9ab09dfa936..28d53ff4e47 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,7 @@ -# Downloaded packages and build tools. -/lkg -/packages -/Tools +# output location +artifacts/ /tests/scripts/current -/release -/debug -/Proto # auto-generated during the build global.json @@ -88,9 +83,6 @@ lib/bootstrap/4.1/policy* obj/ bin/ aclocal.m4 -Debug -Release -Proto sign_temp .libs configure @@ -114,7 +106,6 @@ ossreadme*.txt *.cto *.vstman project.lock.json -Tools/ Backup/ tests/fsharp/core/array/dont.run.peverify tests/fsharp/core/innerpoly/dont.run.peverify @@ -123,7 +114,6 @@ times /tests/fsharpqa/testenv/bin/System.ValueTuple.dll source_link.json .vs/ -/VSRelease/net40/bin System.ValueTuple.dll tests/fsharpqa/testenv/bin/System.ValueTuple.dll */.fake diff --git a/.vsts-pr.yaml b/.vsts-pr.yaml index 37246474bf7..44c277a3943 100644 --- a/.vsts-pr.yaml +++ b/.vsts-pr.yaml @@ -17,7 +17,7 @@ jobs: - script: $(_command) $(_args) - task: PublishBuildArtifacts@1 inputs: - PathtoPublish: '$(Build.SourcesDirectory)/tests/TestResults' + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/TestResults' ArtifactName: 'Linux $(_command) $(_args)' publishLocation: Container continueOnError: true @@ -26,7 +26,7 @@ jobs: - job: Windows pool: vmImage: vs2017-win2016 - timeoutInMinutes: 90 + timeoutInMinutes: 120 strategy: maxParallel: 7 matrix: @@ -55,7 +55,7 @@ jobs: - script: $(_command) $(_args) - task: PublishBuildArtifacts@1 inputs: - PathtoPublish: '$(Build.SourcesDirectory)\tests\TestResults' + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\TestResults' ArtifactName: 'Windows $(_command) $(_args)' publishLocation: Container continueOnError: true diff --git a/.vsts-signed.yaml b/.vsts-signed.yaml index 82b5d247362..25d7642cf09 100644 --- a/.vsts-signed.yaml +++ b/.vsts-signed.yaml @@ -29,7 +29,7 @@ jobs: displayName: Publish nightly package to MyGet inputs: scriptName: 'setup\publish-assets.ps1' - arguments: '-binariesPath $(MSBuildConfiguration) -branchName $(Build.SourceBranch) -apiKey $(FSharp.MyGetApiKey)' + arguments: '-binariesPath artifacts\bin -configuration $(MSBuildConfiguration) -branchName $(Build.SourceBranch) -apiKey $(FSharp.MyGetApiKey)' condition: and(succeeded(), contains(variables['PB_PublishType'], 'myget')) # Publish packages to Azure Blob Storage @@ -44,7 +44,7 @@ jobs: - task: PublishBuildArtifacts@1 displayName: Create static drop inputs: - PathtoPublish: '$(MSBuildConfiguration)' + PathtoPublish: 'artifacts' ArtifactName: '$(Build.BuildNumber)' publishLocation: FilePath TargetPath: '$(DropRoot)\$(Build.DefinitionName)\$(Build.SourceBranchName)' @@ -58,7 +58,7 @@ jobs: inputs: SymbolsPath: '$(DropRoot)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildNumber)\Symbols' SearchPattern: '**\*.dll;**\*.exe;**\*.pdb' - SymbolsFolder: '$(Build.SourcesDirectory)\$(MSBuildConfiguration)' + SymbolsFolder: '$(Build.SourcesDirectory)\artifacts\SymStore' TreatNotIndexedAsWarning: true SymbolsProduct: '$(Build.DefinitionName)' SymbolsVersion: '$(Build.BuildNumber)' @@ -69,7 +69,7 @@ jobs: - task: ms-vseng.MicroBuildTasks.4305a8de-ba66-4d8b-b2d1-0dc4ecbbf5e8.MicroBuildUploadVstsDropFolder@1 displayName: Upload VSTS Drop inputs: - DropFolder: '$(Build.SourcesDirectory)\$(MSBuildConfiguration)\insertion' + DropFolder: '$(Build.SourcesDirectory)\artifacts\VSSetup\$(MSBuildConfiguration)\Insertion' condition: and(succeeded(), contains(variables['PB_PublishType'], 'vsts')) # Execute cleanup tasks @@ -91,6 +91,6 @@ jobs: displayName: Publish symbols to SymWeb inputs: symbolServiceURI: 'https://microsoft.artifacts.visualstudio.com/DefaultCollection' - sourcePath: '$(DropRoot)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildNumber)\Symbols' + sourcePath: '$(DropRoot)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildNumber)\SymStore' usePat: false condition: and(succeeded(), contains(variables['PB_PublishType'], 'symweb')) diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props index 81701799796..c5e4108181c 100644 --- a/FSharpBuild.Directory.Build.props +++ b/FSharpBuild.Directory.Build.props @@ -10,9 +10,16 @@ Debug $(MSBuildThisFileDirectory) $(RepoRoot)src - $(RepoRoot)Tools - $(RepoRoot)Proto\net40\bin - $(RepoRoot)Proto\coreclr\bin + $(RepoRoot)artifacts + $(ArtifactsDir)\toolset + $(ArtifactsDir)\bin + $(ArtifactsDir)\obj + $(ArtifactsDir)\packages + $(ArtifactsBinDir)\$(MSBuildProjectName) + $(ArtifactsObjDir)\$(MSBuildProjectName) + $(ArtifactsDir)\SymStore + $(ArtifactsBinDir)\fsc\Proto\net46 + $(ArtifactsBinDir)/fsc/Proto/netcoreapp2.1 4.4.0 diff --git a/FSharpBuild.Directory.Build.targets b/FSharpBuild.Directory.Build.targets index 375416e5cf3..ef7f82861c5 100644 --- a/FSharpBuild.Directory.Build.targets +++ b/FSharpBuild.Directory.Build.targets @@ -34,42 +34,6 @@ - - - - - coreclr - net40 - $(MSBuildProjectDirectory)\$(OutputPath) - $(OutputPath) - $(RepoRoot)$(Configuration)\$(TargetDotnetProfile)\bin - $(RepoRoot)$(Configuration)\$(TargetDotnetProfile)\obj - - - - - - - - - - - - - - - - diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index eb20065bec2..d9fc35fc05d 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -1,48 +1,43 @@ - - - <_FSharpCompilerPath>$(MSBuildThisFileDirectory)$(Configuration)/net40/bin - + true - $(_FSharpCompilerPath) + $(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\net46 fsc.exe - $(_FSharpCompilerPath) + $(MSBuildThisFileDirectory)artifacts\bin\fsi\$(Configuration)\net46 fsi.exe - - - <_FSharpCompilerPath>$(MSBuildThisFileDirectory)$(Configuration)/coreclr/bin - + true - $(MSBuildThisFileDirectory)Tools/dotnet20 + + $(MSBuildThisFileDirectory)artifacts\toolset\dotnet dotnet.exe dotnet - $(_FSharpCompilerPath)/fsc.exe + $(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\netcoreapp2.1\fsc.exe - $(MSBuildThisFileDirectory)Tools/dotnet20 + $(MSBuildThisFileDirectory)artifacts\toolset\dotnet dotnet.exe dotnet - $(_FSharpCompilerPath)/fsi.exe + $(MSBuildThisFileDirectory)artifacts\bin\fsi\$(Configuration)\netcoreapp2.0\fsi.exe - $(_FSharpCompilerPath)/Microsoft.FSharp.Targets - $(_FSharpCompilerPath)/Microsoft.FSharp.NetSdk.props - $(_FSharpCompilerPath)/Microsoft.FSharp.NetSdk.targets - $(_FSharpCompilerPath)/Microsoft.FSharp.Overrides.NetSdk.targets - + <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'net40'">net46 + <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'coreclr'">netstandard2.0 + <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\FSharp.Build\$(Configuration)\$(_FSharpBuildTargetFramework) + $(_FSharpBuildBinPath)\FSharp.Build.dll - - - $(MSBuildThisFileDirectory)$(Configuration)\coreclr\bin\FSharp.Build.dll - $(MSBuildThisFileDirectory)$(Configuration)\net40\bin\FSharp.Build.dll + $(_FSharpBuildBinPath)/Microsoft.FSharp.Targets + $(_FSharpBuildBinPath)/Microsoft.FSharp.NetSdk.props + $(_FSharpBuildBinPath)/Microsoft.FSharp.NetSdk.targets + $(_FSharpBuildBinPath)/Microsoft.FSharp.Overrides.NetSdk.targets - \ No newline at end of file + + diff --git a/Makefile b/Makefile index d596299cb57..e402025e0ef 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,12 @@ Configuration ?= release DotNetVersion = `cat DotnetCLIToolsVersion.txt` -DotNetExe = "$(CURDIR)/Tools/dotnet20/dotnet" +DotNetToolPath = $(CURDIR)/artifacts/toolset/dotnet +DotNetExe = "$(DotNetToolPath)/dotnet" all: proto restore build test tools: - $(CURDIR)/scripts/dotnet-install.sh --version $(DotNetVersion) --install-dir $(CURDIR)/Tools/dotnet20 + $(CURDIR)/scripts/dotnet-install.sh --version $(DotNetVersion) --install-dir "$(DotNetToolPath)" global.json: tools echo { \"sdk\": { \"version\": \"$(DotNetVersion)\" } }>global.json @@ -14,18 +15,18 @@ proto: global.json $(DotNetExe) build-server shutdown $(DotNetExe) restore src/buildtools/buildtools.proj $(DotNetExe) restore src/fsharp/FSharp.Build/FSharp.Build.fsproj - $(DotNetExe) restore src/fsharp/Fsc/Fsc.fsproj + $(DotNetExe) restore src/fsharp/fsc/fsc.fsproj $(DotNetExe) build src/buildtools/buildtools.proj -c Proto $(DotNetExe) build src/fsharp/FSharp.Build/FSharp.Build.fsproj -f netstandard2.0 -c Proto - $(DotNetExe) build src/fsharp/Fsc/Fsc.fsproj -f netcoreapp2.1 -c Proto + $(DotNetExe) build src/fsharp/fsc/fsc.fsproj -f netcoreapp2.1 -c Proto restore: global.json $(DotNetExe) restore src/fsharp/FSharp.Core/FSharp.Core.fsproj $(DotNetExe) restore src/fsharp/FSharp.Build/FSharp.Build.fsproj $(DotNetExe) restore src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj - $(DotNetExe) restore src/fsharp/Fsc/Fsc.fsproj + $(DotNetExe) restore src/fsharp/fsc/fsc.fsproj $(DotNetExe) restore src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj - $(DotNetExe) restore src/fsharp/fsi/Fsi.fsproj + $(DotNetExe) restore src/fsharp/fsi/fsi.fsproj $(DotNetExe) restore tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj $(DotNetExe) restore tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj @@ -34,9 +35,9 @@ build: proto restore $(DotNetExe) build -c $(Configuration) -f netstandard1.6 src/fsharp/FSharp.Core/FSharp.Core.fsproj $(DotNetExe) build -c $(Configuration) -f netstandard2.0 src/fsharp/FSharp.Build/FSharp.Build.fsproj $(DotNetExe) build -c $(Configuration) -f netstandard1.6 src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj - $(DotNetExe) build -c $(Configuration) -f netcoreapp2.1 src/fsharp/Fsc/Fsc.fsproj + $(DotNetExe) build -c $(Configuration) -f netcoreapp2.1 src/fsharp/fsc/fsc.fsproj $(DotNetExe) build -c $(Configuration) -f netstandard1.6 src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj - $(DotNetExe) build -c $(Configuration) -f netcoreapp2.0 src/fsharp/fsi/Fsi.fsproj + $(DotNetExe) build -c $(Configuration) -f netcoreapp2.0 src/fsharp/fsi/fsi.fsproj $(DotNetExe) build -c $(Configuration) -f netcoreapp2.0 tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj $(DotNetExe) build -c $(Configuration) -f netcoreapp2.0 tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj @@ -45,6 +46,4 @@ test: build $(DotNetExe) test -f netcoreapp2.0 -c $(Configuration) --no-restore --no-build tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj -l "trx;LogFileName=$(CURDIR)/tests/TestResults/FSharp.Build.UnitTests.coreclr.trx" clean: - rm -rf $(CURDIR)/Proto - rm -rf $(CURDIR)/debug - rm -rf $(CURDIR)/release + rm -rf $(CURDIR)/artifacts diff --git a/PublishToBlob.proj b/PublishToBlob.proj index 00bcee63359..71fbfad44ed 100644 --- a/PublishToBlob.proj +++ b/PublishToBlob.proj @@ -17,7 +17,7 @@ - + diff --git a/artifacts/.gitignore b/artifacts/.gitignore deleted file mode 100644 index 72e8ffc0db8..00000000000 --- a/artifacts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/build.cmd b/build.cmd index 504616ccab2..389679d5ba4 100644 --- a/build.cmd +++ b/build.cmd @@ -63,7 +63,7 @@ set BUILD_CORECLR=0 set BUILD_FROMSOURCE=0 set BUILD_VS=0 set BUILD_FCS=0 -set BUILD_CONFIG=release +set BUILD_CONFIG=Release set BUILD_DIAG= set BUILD_PUBLICSIGN=0 @@ -228,8 +228,8 @@ if /i "%ARG%" == "microbuild" ( set CI=1 REM redirecting TEMP directories - set TEMP=%~dp0%BUILD_CONFIG%\TEMP - set TMP=%~dp0%BUILD_CONFIG%\TEMP + set TEMP=%~dp0artifacts\tmp + set TMP=%~dp0artifacts\tmp ) if /i "%ARG%" == "nuget" ( @@ -319,11 +319,11 @@ if /i "%ARG%" == "diag" ( ) if /i "%ARG%" == "debug" ( - set BUILD_CONFIG=debug + set BUILD_CONFIG=Debug ) if /i "%ARG%" == "release" ( - set BUILD_CONFIG=release + set BUILD_CONFIG=Release ) if /i "%ARG%" == "test-sign" ( @@ -614,13 +614,13 @@ echo { "sdk": { "version": "%DOTNET_TOOLS_VERSION%" } }>global.json :: Restore the Tools directory call "%~dp0init-tools.cmd" -set _dotnetexe=%~dp0Tools\dotnet20\dotnet.exe -set path=%~dp0Tools\dotnet20\;%path% +set _dotnetexe=%~dp0artifacts\toolset\dotnet\dotnet.exe +set path=%~dp0artifacts\toolset\dotnet;%path% if not "%PB_PackageVersionPropsUrl%" == "" ( echo ----------- do dependency uptake check ----------- - set dependencyUptakeDir=%~dp0Tools\dependencyUptake + set dependencyUptakeDir=%~dp0artifacts\dependencyUptake if not exist "!dependencyUptakeDir!" mkdir "!dependencyUptakeDir!" :: download package version overrides @@ -647,19 +647,19 @@ if "%BUILD_PROTO_WITH_CORECLR_LKG%" == "1" ( ) echo ---------------- Done with package restore, starting proto ------------------------ -set logdir=%~dp0%BUILD_CONFIG%\logs +set logdir=%~dp0artifacts\log\%BUILD_CONFIG% if not exist "!logdir!" mkdir "!logdir!" rem Build Proto if "%BUILD_PROTO%" == "1" ( - rmdir /s /q Proto + rmdir /s /q artifacts/bin/fsc/Proto - echo %_msbuildexe% proto.proj /t:Restore /bl:%~dp0Proto\proto.proj.restore.binlog - %_msbuildexe% proto.proj /t:Restore /bl:%~dp0Proto\proto.proj.restore.binlog + echo %_msbuildexe% proto.proj /t:Restore /bl:%~dp0artifacts\log\Proto\proto.proj.restore.binlog + %_msbuildexe% proto.proj /t:Restore /bl:%~dp0artifacts\log\Proto\proto.proj.restore.binlog @if ERRORLEVEL 1 echo Error restoring proto failed && goto :failure - echo %_msbuildexe% proto.proj /t:Build /bl:%~dp0Proto\proto.proj.build.binlog - %_msbuildexe% proto.proj /t:Build /bl:%~dp0Proto\proto.proj.build.binlog + echo %_msbuildexe% proto.proj /t:Build /bl:%~dp0artifacts\log\Proto\proto.proj.build.binlog + %_msbuildexe% proto.proj /t:Build /bl:%~dp0artifacts\log\Proto\proto.proj.build.binlog @if ERRORLEVEL 1 echo Error building proto failed && goto :failure ) @@ -667,11 +667,11 @@ echo ---------------- Done with SDK restore, starting build -------------------- if "%BUILD_PHASE%" == "1" ( - echo %_msbuildexe% fsharp.proj /t:Restore /p:Configuration=%BUILD_CONFIG% /bl:%~dp0%BUILD_CONFIG%\fsharp.proj.restore.binlog - %_msbuildexe% fsharp.proj /t:Restore /p:Configuration=%BUILD_CONFIG% /bl:%~dp0%BUILD_CONFIG%\fsharp.proj.restore.binlog + echo %_dotnetexe% restore fsharp.proj /p:Configuration=%BUILD_CONFIG% /bl:!logdir!\fsharp.proj.restore.binlog + %_dotnetexe% restore fsharp.proj /p:Configuration=%BUILD_CONFIG% /bl:!logdir!\fsharp.proj.restore.binlog - echo %_msbuildexe% fsharp.proj /t:Build /p:Configuration=%BUILD_CONFIG% /p:BUILD_PUBLICSIGN=%BUILD_PUBLICSIGN% /bl:%~dp0%BUILD_CONFIG%\fsharp.proj.build.binlog - %_msbuildexe% fsharp.proj /t:Build /p:Configuration=%BUILD_CONFIG% /p:BUILD_PUBLICSIGN=%BUILD_PUBLICSIGN% /bl:%~dp0%BUILD_CONFIG%\fsharp.proj.build.binlog + echo %_msbuildexe% fsharp.proj /t:Build /p:Configuration=%BUILD_CONFIG% /p:BUILD_PUBLICSIGN=%BUILD_PUBLICSIGN% /bl:!logdir!\fsharp.proj.build.binlog + %_msbuildexe% fsharp.proj /t:Build /p:Configuration=%BUILD_CONFIG% /p:BUILD_PUBLICSIGN=%BUILD_PUBLICSIGN% /bl:!logdir!\fsharp.proj.build.binlog @if ERRORLEVEL 1 echo Error build failed && goto :failure ) @@ -681,8 +681,8 @@ set asmvercheckpath=%~dp0tests\fsharpqa\testenv\src\AssemblyVersionCheck if "%BUILD_NET40%" == "1" ( echo #r @"%USERPROFILE%\.nuget\packages\Newtonsoft.Json\9.0.1\lib\net45\Newtonsoft.Json.dll">%asmvercheckpath%\assemblies.fsx - echo "%~dp0%BUILD_CONFIG%\net40\bin\fsi.exe" "%asmvercheckpath%\AssemblyVersionCheck.fsx" -- "%~dp0build\config\AssemblySignToolData.json" "%~dp0%BUILD_CONFIG%" - "%~dp0%BUILD_CONFIG%\net40\bin\fsi.exe" "%asmvercheckpath%\AssemblyVersionCheck.fsx" -- "%~dp0build\config\AssemblySignToolData.json" "%~dp0%BUILD_CONFIG%" + echo "%~dp0artifacts\bin\fsi\%BUILD_CONFIG%\net46\fsi.exe" "%asmvercheckpath%\AssemblyVersionCheck.fsx" -- "%~dp0build\config\AssemblySignToolData.json" "%~dp0artifacts\bin" + "%~dp0artifacts\bin\fsi\%BUILD_CONFIG%\net46\fsi.exe" "%asmvercheckpath%\AssemblyVersionCheck.fsx" -- "%~dp0build\config\AssemblySignToolData.json" "%~dp0artifacts\bin" if ERRORLEVEL 1 echo Error verifying assembly versions and commit hashes. && goto :failure ) @@ -692,56 +692,46 @@ if not "%SIGN_TYPE%" == "" ( echo %_msbuildexe% build\projects\Signing.proj /t:Restore %_msbuildexe% build\projects\Signing.proj /t:Restore - echo %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\AssemblySignToolData.json - %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\AssemblySignToolData.json + echo %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasePath=%~dp0artifacts\bin /p:ConfigFile=%~dp0build\config\AssemblySignToolData.json + %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasePath=%~dp0artifacts\bin /p:ConfigFile=%~dp0build\config\AssemblySignToolData.json if ERRORLEVEL 1 echo Error running sign tool && goto :failure ) echo ---------------- Done with assembly signing, start package creation --------------- -echo %_msbuildexe% %msbuildflags% build-nuget-packages.proj /p:Configuration=%BUILD_CONFIG% /t:Pack /bl:%~dp0%BUILD_CONFIG%\logs\msbuild.build-nuget-packages.build.%BUILD_CONFIG%.binlog - %_msbuildexe% %msbuildflags% build-nuget-packages.proj /p:Configuration=%BUILD_CONFIG% /t:Pack /bl:%~dp0%BUILD_CONFIG%\logs\msbuild.build-nuget-packages.build.%BUILD_CONFIG%.binlog +echo %_msbuildexe% %msbuildflags% build-nuget-packages.proj /p:Configuration=%BUILD_CONFIG% /t:Pack /bl:!logdir!\msbuild.build-nuget-packages.build.%BUILD_CONFIG%.binlog + %_msbuildexe% %msbuildflags% build-nuget-packages.proj /p:Configuration=%BUILD_CONFIG% /t:Pack /bl:!logdir!\msbuild.build-nuget-packages.build.%BUILD_CONFIG%.binlog if ERRORLEVEL 1 echo Error building NuGet packages && goto :failure if not "%SIGN_TYPE%" == "" ( - echo %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\PackageSignToolData.json - %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\PackageSignToolData.json + echo %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasepath=%~dp0artifacts\packages\%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\PackageSignToolData.json + %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasepath=%~dp0artifacts\packages\%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\PackageSignToolData.json if ERRORLEVEL 1 echo Error running sign tool && goto :failure ) if "%BUILD_SETUP%" == "1" ( - echo %_msbuildexe% %msbuildflags% setup\build-insertion.proj /p:Configuration=%BUILD_CONFIG% /bl:%~dp0%BUILD_CONFIG%\logs\msbuild.build-insertion.build.%BUILD_CONFIG%.binlog - %_msbuildexe% %msbuildflags% setup\build-insertion.proj /p:Configuration=%BUILD_CONFIG% /bl:%~dp0%BUILD_CONFIG%\logs\msbuild.build-insertion.build.%BUILD_CONFIG%.binlog + echo %_msbuildexe% %msbuildflags% setup\build-insertion.proj /p:Configuration=%BUILD_CONFIG% /bl:!logdir!\msbuild.build-insertion.build.%BUILD_CONFIG%.binlog + %_msbuildexe% %msbuildflags% setup\build-insertion.proj /p:Configuration=%BUILD_CONFIG% /bl:!logdir!\msbuild.build-insertion.build.%BUILD_CONFIG%.binlog if ERRORLEVEL 1 echo Error building insertion packages && goto :failure ) if not "%SIGN_TYPE%" == "" ( - echo %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\InsertionSignToolData.json - %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:ConfigFile=%~dp0build\config\InsertionSignToolData.json + echo %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasepath=%~dp0artifacts\VSSetup\%BUILD_CONFIG%\Insertion /p:ConfigFile=%~dp0build\config\InsertionSignToolData.json + %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasePath=%~dp0artifacts\VSSetup\%BUILD_CONFIG%\Insertion /p:ConfigFile=%~dp0build\config\InsertionSignToolData.json if ERRORLEVEL 1 echo Error running sign tool && goto :failure ) echo ---------------- Done with signing, building insertion files --------------- if "%BUILD_SETUP%" == "1" ( - echo %_msbuildexe% %msbuildflags% setup\Swix\Microsoft.FSharp.vsmanproj /p:Configuration=%BUILD_CONFIG% /bl:%~dp0%BUILD_CONFIG%\logs\msbuild.setup-swix.build.%BUILD_CONFIG%.binlog - %_msbuildexe% %msbuildflags% setup\Swix\Microsoft.FSharp.vsmanproj /p:Configuration=%BUILD_CONFIG% /bl:%~dp0%BUILD_CONFIG%\logs\msbuild.setup-swix.build.%BUILD_CONFIG%.binlog + echo %_msbuildexe% %msbuildflags% setup\Swix\Microsoft.FSharp.vsmanproj /p:Configuration=%BUILD_CONFIG% /bl:!logdir!\msbuild.setup-swix.build.%BUILD_CONFIG%.binlog + %_msbuildexe% %msbuildflags% setup\Swix\Microsoft.FSharp.vsmanproj /p:Configuration=%BUILD_CONFIG% /bl:!logdir!\msbuild.setup-swix.build.%BUILD_CONFIG%.binlog if ERRORLEVEL 1 echo Error building .vsmanproj && goto :failure ) echo ---------------- Done building insertion files, starting pack/update/prepare --------------- -if "%BUILD_NET40_FSHARP_CORE%" == "1" ( - echo ---------------- start update.cmd --------------- - call src\update.cmd %BUILD_CONFIG% -ngen -) - -if "%COPY_FSCOMP_RESOURCE_FOR_BUILD_FROM_SOURCES%" == "1" ( - echo ---------------- copy fscomp resource for build from sources --------------- - copy /y src\fsharp\FSharp.Compiler.Private\obj\%BUILD_CONFIG%\net40\FSComp.* src\buildfromsource\FSharp.Compiler.Private -) - set X86_PROGRAMFILES=%ProgramFiles% if "%OSARCH%"=="AMD64" set X86_PROGRAMFILES=%ProgramFiles(x86)% @@ -787,21 +777,19 @@ if not exist "%link_exe%" ( if /I not "%single_threaded%" == "true" (set PARALLEL_ARG=-procs:%NUMBER_OF_PROCESSORS%) else set PARALLEL_ARG=-procs:0 -set FSCBINPATH=%~dp0%BUILD_CONFIG%\net40\bin -set RESULTSDIR=%~dp0tests\TestResults -if not exist "%RESULTSDIR%" (mkdir "%RESULTSDIR%") +set FSCBINPATH=%~dp0artifacts\bin\fsc\%BUILD_CONFIG%\net46 ECHO FSCBINPATH=%FSCBINPATH% -ECHO RESULTSDIR=%RESULTSDIR% ECHO link_exe=%link_exe% REM ---------------- test-net40-fsharp ----------------------- +set TESTLOGDIR=%~dp0artifacts\TestResults\%BUILD_CONFIG% if "%TEST_NET40_FSHARP_SUITE%" == "1" ( - set LOGFILE=%~dp0tests\TestResults\FSharp.Tests.FSharpSuite.net40.trx - echo "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" -o "%~dp0%BUILD_CONFIG%\net40\bin" - "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" -o "%~dp0%BUILD_CONFIG%\net40\bin" + set LOGFILE=%TESTLOGDIR%\FSharp.Tests.FSharpSuite_net46.trx + echo "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" + "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" if errorlevel 1 ( echo -------------------------------------------------------------- @@ -809,13 +797,20 @@ if "%TEST_NET40_FSHARP_SUITE%" == "1" ( echo -------------------------------------------------------------- goto :failure ) + + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) ) REM ---------------- test-fcs ----------------------- if "%TEST_FCS%" == "1" ( - set LOGFILE=%~dp0tests\TestResults\FSharp.Compiler.Service.Tests.net40.trx + set LOGFILE=%TESTLOGDIR%\FSharp.Compiler.Service.Tests_net46.trx echo "%_dotnetexe%" test "%~dp0fcs\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" "%_dotnetexe%" test "%~dp0fcs\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" @@ -826,7 +821,14 @@ if "%TEST_FCS%" == "1" ( goto :failure ) - set LOGFILE=%~dp0tests\TestResults\FSharp.Compiler.Service.Tests.coreclr.trx + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) + + set LOGFILE=%TESTLOGDIR%\FSharp.Compiler.Service.Tests_netcoreapp2.0.trx echo "%_dotnetexe%" test "%~dp0fcs\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" "%_dotnetexe%" test "%~dp0fcs\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" @@ -836,6 +838,13 @@ if "%TEST_FCS%" == "1" ( echo -------------------------------------------------------------- goto :failure ) + + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) ) REM ---------------- end2end ----------------------- @@ -871,6 +880,7 @@ if "%TEST_NET40_FSHARPQA_SUITE%" == "1" ( set perlexe=%USERPROFILE%\.nuget\packages\StrawberryPerl64\5.22.2.1\Tools\perl\bin\perl.exe if not exist !perlexe! (echo Error: perl was not downloaded from check the packages directory: !perlexe! && goto :failure ) + set RESULTSDIR=%~dp0artifacts\TestResults\%BUILD_CONFIG% set OUTPUTFILE=test-net40-fsharpqa-results.log set ERRORFILE=test-net40-fsharpqa-errors.log set FAILENV=test-net40-fsharpqa-errors @@ -881,9 +891,10 @@ if "%TEST_NET40_FSHARPQA_SUITE%" == "1" ( popd if ERRORLEVEL 1 ( - type "%RESULTSDIR%\!OUTPUTFILE!" echo ----------------------------------------------------------------- - type "%RESULTSDIR%\!ERRORFILE!" + type "!RESULTSDIR!\!OUTPUTFILE!" + echo ----------------------------------------------------------------- + type "!RESULTSDIR!\!ERRORFILE!" echo ----------------------------------------------------------------- echo Error: Running tests net40-fsharpqa failed, see logs above -- FAILED echo ----------------------------------------------------------------- @@ -895,7 +906,7 @@ REM ---------------- net40-compilerunit ----------------------- if "%TEST_NET40_COMPILERUNIT_SUITE%" == "1" ( - set LOGFILE=%~dp0tests\TestResults\FSharp.Compiler.UnitTests.net40.trx + set LOGFILE=%TESTLOGDIR%\FSharp.Compiler.UnitTests_net46.trx echo "%_dotnetexe%" test "%~dp0tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" "%_dotnetexe%" test "%~dp0tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" @@ -906,7 +917,14 @@ if "%TEST_NET40_COMPILERUNIT_SUITE%" == "1" ( goto :failure ) - set LOGFILE=%~dp0tests\TestResults\FSharp.Build.UnitTests.net40.trx + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) + + set LOGFILE=%TESTLOGDIR%\FSharp.Build.UnitTests_net46.trx echo "%_dotnetexe%" test "%~dp0tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" "%_dotnetexe%" test "%~dp0tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" @@ -916,13 +934,20 @@ if "%TEST_NET40_COMPILERUNIT_SUITE%" == "1" ( echo ----------------------------------------------------------------- goto :failure ) + + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) ) REM ---------------- net40-coreunit ----------------------- if "%TEST_NET40_COREUNIT_SUITE%" == "1" ( - set LOGFILE=%~dp0tests\TestResults\FSharp.Core.UnitTests.net40.trx + set LOGFILE=%TESTLOGDIR%\FSharp.Core.UnitTests_net46.trx echo "%_dotnetexe%" test "%~dp0tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" "%_dotnetexe%" test "%~dp0tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" @@ -932,13 +957,20 @@ if "%TEST_NET40_COREUNIT_SUITE%" == "1" ( echo ----------------------------------------------------------------- goto :failure ) + + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) ) REM ---------------- coreclr-coreunit ----------------------- if "%TEST_CORECLR_COREUNIT_SUITE%" == "1" ( - set LOGFILE=%~dp0tests\TestResults\FSharp.Build.UnitTests.coreclr.trx + set LOGFILE=%TESTLOGDIR%\FSharp.Build.UnitTests_netcoreapp2.0.trx echo "%_dotnetexe%" test "%~dp0tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" "%_dotnetexe%" test "%~dp0tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" @@ -949,7 +981,14 @@ if "%TEST_CORECLR_COREUNIT_SUITE%" == "1" ( goto :failure ) - set LOGFILE=%~dp0tests\TestResults\FSharp.Core.UnitTests.coreclr.trx + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) + + set LOGFILE=%TESTLOGDIR%\FSharp.Core.UnitTests_netcoreapp2.0.trx echo "%_dotnetexe%" test "%~dp0tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" "%_dotnetexe%" test "%~dp0tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" @@ -959,14 +998,21 @@ if "%TEST_CORECLR_COREUNIT_SUITE%" == "1" ( echo ------------------------------------------------------------------ goto :failure ) + + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) ) REM ---------------- coreclr-fsharp ----------------------- if "%TEST_CORECLR_FSHARP_SUITE%" == "1" ( - set LOGFILE=%~dp0tests\TestResults\FSharp.Tests.FSharpSuite.coreclr.trx - echo "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" -o "%~dp0%BUILD_CONFIG%\coreclr\bin" - "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" -o "%~dp0%BUILD_CONFIG%\coreclr\bin" + set LOGFILE=%TESTLOGDIR%\FSharp.Tests.FSharpSuite_netcoreapp2.0.trx + echo "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" + "%_dotnetexe%" test "%~dp0tests\fsharp\FSharp.Tests.FSharpSuite.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f netcoreapp2.0 -l "trx;LogFileName=!LOGFILE!" if errorlevel 1 ( echo ---------------------------------------------------------------- @@ -974,12 +1020,19 @@ if "%TEST_CORECLR_FSHARP_SUITE%" == "1" ( echo ---------------------------------------------------------------- goto :failure ) + + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) ) REM ---------------- vs-ideunit ----------------------- if "%TEST_VS_IDEUNIT_SUITE%" == "1" ( - set LOGFILE=%~dp0tests\TestResults\GetTypesVSUnitTests.net40.trx + set LOGFILE=%TESTLOGDIR%\GetTypesVSUnitTests_net46.trx echo "%_dotnetexe%" test "%~dp0vsintegration\tests\GetTypesVSUnitTests\GetTypesVSUnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" "%_dotnetexe%" test "%~dp0vsintegration\tests\GetTypesVSUnitTests\GetTypesVSUnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" @@ -990,15 +1043,29 @@ if "%TEST_VS_IDEUNIT_SUITE%" == "1" ( goto :failure ) - set LOGFILE=%~dp0tests\TestResults\VisualFSharp.UnitTests.net40.trx - echo "%_dotnetexe%" test "%~dp0vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" -o "%~dp0%BUILD_CONFIG%\net40\bin" - "%_dotnetexe%" test "%~dp0vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" -o "%~dp0%BUILD_CONFIG%\net40\bin" + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) + + set LOGFILE=%TESTLOGDIR%\VisualFSharp.UnitTests_net46.trx + echo "%_dotnetexe%" test "%~dp0vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" + "%_dotnetexe%" test "%~dp0vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" --no-restore --no-build -c %BUILD_CONFIG% -f net46 -l "trx;LogFileName=!LOGFILE!" if errorlevel 1 ( echo ------------------------------------------------------------ echo Error: Running tests vs-ideunit failed, see file `!LOGFILE!` echo ------------------------------------------------------------ goto :failure ) + + if not exist "!LOGFILE!" ( + echo -------------------------------------------------------- + echo Test results file !LOGFILE! not found, ensure tests ran. + echo -------------------------------------------------------- + goto :failure + ) ) goto :success diff --git a/build/config/AssemblySignToolData.json b/build/config/AssemblySignToolData.json index 6857a57f0dd..3cd0f5b61c1 100644 --- a/build/config/AssemblySignToolData.json +++ b/build/config/AssemblySignToolData.json @@ -4,55 +4,45 @@ "certificate": "Microsoft", "strongName": "StrongName", "values": [ - "net40\\bin\\FSharp.Core.dll", - "net40\\bin\\*\\FSharp.Core.resources.dll", - "net40\\bin\\FSharp.Build.dll", - "net40\\bin\\*\\FSharp.Build.resources.dll", - "net40\\bin\\FSharp.Compiler.Private.dll", - "net40\\bin\\*\\FSharp.Compiler.Private.resources.dll", - "net40\\bin\\FSharp.Compiler.Server.Shared.dll", - "net40\\bin\\FSharp.Compiler.Interactive.Settings.dll", - "net40\\bin\\*\\FSharp.Compiler.Interactive.Settings.resources.dll", - "net40\\bin\\fsc.exe", - "net40\\bin\\fsi.exe", - "net40\\bin\\fsiAnyCpu.exe", - "net40\\bin\\FSharp.VS.FSI.dll", - "net40\\bin\\*\\FSharp.VS.FSI.resources.dll", - "net40\\bin\\FSharp.LanguageService.Base.dll", - "net40\\bin\\*\\FSharp.LanguageService.Base.resources.dll", - "net40\\bin\\FSharp.LanguageService.dll", - "net40\\bin\\*\\FSharp.LanguageService.resources.dll", - "net40\\bin\\FSharp.UIResources.dll", - "net40\\bin\\*\\FSharp.UIResources.resources.dll", - "net40\\bin\\FSharp.Editor.dll", - "net40\\bin\\*\\FSharp.Editor.resources.dll", - "net40\\bin\\FSharp.ProjectSystem.Base.dll", - "net40\\bin\\*\\FSharp.ProjectSystem.Base.resources.dll", - "net40\\bin\\FSharp.ProjectSystem.PropertyPages.dll", - "net40\\bin\\*\\FSharp.ProjectSystem.PropertyPages.resources.dll", - "net40\\bin\\FSharp.ProjectSystem.FSharp.dll", - "net40\\bin\\*\\FSharp.ProjectSystem.FSharp.resources.dll", - "net40\\bin\\FSharp.PatternMatcher.dll", - "coreclr\\bin\\FSharp.Core.dll", - "coreclr\\bin\\*\\FSharp.Core.resources.dll", - "coreclr\\bin\\FSharp.Build.dll", - "coreclr\\bin\\*\\FSharp.Build.resources.dll", - "coreclr\\bin\\FSharp.Compiler.Private.dll", - "coreclr\\bin\\*\\FSharp.Compiler.Private.resources.dll", - "coreclr\\bin\\FSharp.Compiler.Interactive.Settings.dll", - "coreclr\\bin\\*\\FSharp.Compiler.Interactive.Settings.resources.dll", - "coreclr\\bin\\fsc.exe", - "coreclr\\bin\\fsi.exe" + "FSharp.Core\\*\\*\\FSharp.Core.dll", + "FSharp.Core\\*\\*\\*\\FSharp.Core.resources.dll", + "FSharp.Build\\*\\*\\FSharp.Build.dll", + "FSharp.Build\\*\\*\\*\\FSharp.Build.resources.dll", + "FSharp.Compiler.Private\\*\\*\\FSharp.Compiler.Private.dll", + "FSharp.Compiler.Private\\*\\*\\*\\FSharp.Compiler.Private.resources.dll", + "FSharp.Compiler.Server.Shared\\*\\*\\FSharp.Compiler.Server.Shared.dll", + "FSharp.Compiler.Interactive.Settings\\*\\*\\FSharp.Compiler.Interactive.Settings.dll", + "FSharp.Compiler.Interactive.Settings\\*\\*\\*\\FSharp.Compiler.Interactive.Settings.resources.dll", + "fsc\\*\\*\\fsc.exe", + "fsi\\*\\*\\fsi.exe", + "fsiAnyCpu\\*\\*\\fsiAnyCpu.exe", + "FSharp.VS.FSI\\*\\*\\FSharp.VS.FSI.dll", + "FSharp.VS.FSI\\*\\*\\*\\FSharp.VS.FSI.resources.dll", + "FSharp.LanguageService.Base\\*\\*\\FSharp.LanguageService.Base.dll", + "FSharp.LanguageService.Base\\*\\*\\*\\FSharp.LanguageService.Base.resources.dll", + "FSharp.LanguageService\\*\\*\\FSharp.LanguageService.dll", + "FSharp.LanguageService\\*\\*\\*\\FSharp.LanguageService.resources.dll", + "FSharp.UIResources\\*\\*\\FSharp.UIResources.dll", + "FSharp.UIResources\\*\\*\\*\\FSharp.UIResources.resources.dll", + "FSharp.Editor\\*\\*\\FSharp.Editor.dll", + "FSharp.Editor\\*\\*\\*\\FSharp.Editor.resources.dll", + "FSharp.ProjectSystem.Base\\*\\*\\FSharp.ProjectSystem.Base.dll", + "FSharp.ProjectSystem.Base\\*\\*\\*\\FSharp.ProjectSystem.Base.resources.dll", + "FSharp.ProjectSystem.PropertyPages\\*\\*\\FSharp.ProjectSystem.PropertyPages.dll", + "FSharp.ProjectSystem.PropertyPages\\*\\*\\*\\FSharp.ProjectSystem.PropertyPages.resources.dll", + "FSharp.ProjectSystem.FSharp\\*\\*\\FSharp.ProjectSystem.FSharp.dll", + "FSharp.ProjectSystem.FSharp\\*\\*\\*\\FSharp.ProjectSystem.FSharp.resources.dll", + "FSharp.PatternMatcher\\*\\*\\FSharp.PatternMatcher.dll" ] }, { "certificate": "VsixSHA2", "strongName": null, "values": [ - "net40\\bin\\VisualFSharpFull.vsix", - "net40\\bin\\VisualFSharpTemplate.vsix", - "insertion\\Microsoft.FSharp.Dependencies.vsix", - "insertion\\Microsoft.FSharp.VSIX.Full.Resources.*.vsix" + "VisualFSharpFull\\*\\*VisualFSharpFull.vsix", + "VisualFSharpTemplates\\*\\*\\VisualFSharpTemplate.vsix", + "..\\VSSetup\\*\\Insertion\\Microsoft.FSharp.Dependencies.vsix", + "..\\VSSetup\\*\\Insertion\\Microsoft.FSharp.VSIX.Full.Resources.*.vsix" ] } ], diff --git a/build/config/InsertionSignToolData.json b/build/config/InsertionSignToolData.json index ec8432ca9ad..d81579b12c9 100644 --- a/build/config/InsertionSignToolData.json +++ b/build/config/InsertionSignToolData.json @@ -4,11 +4,11 @@ "certificate": "VsixSHA2", "strongName": null, "values": [ - "insertion\\Microsoft.FSharp.Compiler.vsix", - "insertion\\Microsoft.FSharp.Compiler.Resources.*.vsix", - "insertion\\Microsoft.FSharp.Dependencies.vsix", - "insertion\\Microsoft.FSharp.IDE.vsix", - "insertion\\Microsoft.FSharp.SDK.vsix" + "Microsoft.FSharp.Compiler.vsix", + "Microsoft.FSharp.Compiler.Resources.*.vsix", + "Microsoft.FSharp.Dependencies.vsix", + "Microsoft.FSharp.IDE.vsix", + "Microsoft.FSharp.SDK.vsix" ] } ], diff --git a/build/config/PackageSignToolData.json b/build/config/PackageSignToolData.json index 20007f59e36..5bc74386355 100644 --- a/build/config/PackageSignToolData.json +++ b/build/config/PackageSignToolData.json @@ -4,8 +4,7 @@ "certificate": "NuGet", "strongName": null, "values": [ - "artifacts\\*.nupkg", - "artifacts\\*\\*.nupkg" + "*.nupkg" ] } ], diff --git a/build/projects/Signing.proj b/build/projects/Signing.proj index 4999fb6d085..9e981e135ec 100644 --- a/build/projects/Signing.proj +++ b/build/projects/Signing.proj @@ -3,7 +3,6 @@ net46 - $(RepoRoot)$(Configuration) $(NuGetPackageRoot)RoslynTools.SignTool\$(RoslynToolsSignToolPackageVersion)\tools\SignTool.exe -msbuildPath "$(MSBuildBinPath)\msbuild.exe" -nugetPackagesPath "$(NuGetPackageRoot.TrimEnd('\'))" -config "$(ConfigFile)" -testSign $(SignToolArgs) @@ -17,11 +16,12 @@ + - + diff --git a/build/targets/ConvertPortablePdbs.targets b/build/targets/ConvertPortablePdbs.targets index 474fe091a5d..c43042a499e 100644 --- a/build/targets/ConvertPortablePdbs.targets +++ b/build/targets/ConvertPortablePdbs.targets @@ -6,20 +6,33 @@ - $(FinalOutputPath)\ConvertedPdbs $(NuGetPackageRoot)Pdb2Pdb\$(Pdb2PdbPackageVersion)\tools\Pdb2Pdb.exe - "$(TargetPath)" /out "$(ConvertedPdbsDirectory)\$(TargetName).pdb" /srcsvrvar SRC_INDEX=public + "$(TargetPath)" /out "$(SymStoreDirectory)\$(TargetName).pdb" /srcsvrvar SRC_INDEX=public - + + + + $(TargetDir)\$(TargetName).pdb + + + + + + diff --git a/build/targets/GenerateAssemblyAttributes.targets b/build/targets/GenerateAssemblyAttributes.targets index 1be6bdb8315..7b747c9dd92 100644 --- a/build/targets/GenerateAssemblyAttributes.targets +++ b/build/targets/GenerateAssemblyAttributes.targets @@ -82,8 +82,7 @@ Inputs="$(MSBuildThisFileFullPath);$(MSBuildProjectFile)" Outputs="$(GeneratedFSharpAssemblyVersionFile)" DependsOnTargets="PrepareGenerateAssemblyFileVersion;PrepareForBuild" - BeforeTargets="CoreCompile" - Condition="'$(Configuration)' != 'Proto'"> + BeforeTargets="CoreCompile"> $(PB_RestoreSource);$(RestoreSources) - $(MSBuildThisFileDirectory)..\..\Tools\dependencyUptake\PackageVersions.props + $(MSBuildThisFileDirectory)..\..\artifacts\dependencyUptake\PackageVersions.props $([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)..\..\RoslynPackageVersion.txt').Trim()) diff --git a/fcs/Directory.Build.props b/fcs/Directory.Build.props index cdcbdd4b8b3..6535dbd2aea 100644 --- a/fcs/Directory.Build.props +++ b/fcs/Directory.Build.props @@ -4,17 +4,19 @@ $(HOME)/.nuget/packages/ $(NuGetPackageRoot)\ $(NuGetPackageRoot)/ + $(MSBuildThisFileDirectory)..\artifacts + $(ArtifactsDir)\bin + $(ArtifactsDir)\obj + $(ArtifactsBinDir)\fcs + $(ArtifactsObjDir)\fcs - $(MSBuildThisFileDirectory)..\Proto\net40\bin + $(ArtifactsBinDir)\FSharp.Build\Proto\net46 - $(ProtoOutputPath)\Microsoft.FSharp.Targets $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.props $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.targets diff --git a/fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj b/fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj index 42b99d95a05..1126a60f2b6 100644 --- a/fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj +++ b/fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj @@ -7,7 +7,6 @@ net45 true - ..\..\$(Configuration.ToLower())\fcs $(DefineConstants);CROSS_PLATFORM_COMPILER $(DefineConstants);ENABLE_MONO_SUPPORT diff --git a/fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj b/fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj index 1bf41b7bf27..c132ae80bb1 100644 --- a/fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj +++ b/fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj @@ -1,13 +1,9 @@  - - $(MSBuildProjectDirectory)\..\..\src - net45 true - ..\..\$(Configuration.ToLower())\fcs Legacy project file cracker for the F# compiler service. @@ -25,8 +21,8 @@ - - + + diff --git a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCrackerTool.fsproj b/fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCrackerTool.fsproj index 9dddb1cb616..9f690c58ea1 100644 --- a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCrackerTool.fsproj +++ b/fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCrackerTool.fsproj @@ -13,7 +13,6 @@ $(OtherFlags) --staticlink:FSharp.Core true false - ..\..\$(Configuration.ToLower())\fcs diff --git a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj index 8d09c3a26f1..abe71b6159a 100644 --- a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +++ b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj @@ -76,7 +76,7 @@ - + diff --git a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj index c5f1122386c..c5357aab06b 100644 --- a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj +++ b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj @@ -12,7 +12,6 @@ $(DefineConstants);COMPILER $(DefineConstants);ENABLE_MONO_SUPPORT $(DefineConstants);NO_STRONG_NAMES - ..\..\$(Configuration.ToLower())\fcs $(TargetFramework)\ $(TargetFramework)\ $(OtherFlags) /warnon:1182 diff --git a/fcs/build.fsx b/fcs/build.fsx index 204faa244ab..7f9f96f3574 100644 --- a/fcs/build.fsx +++ b/fcs/build.fsx @@ -13,8 +13,8 @@ open Fake.ReleaseNotesHelper #if MONO // prevent incorrect output encoding (e.g. https://github.com/fsharp/FAKE/issues/1196) System.Console.OutputEncoding <- System.Text.Encoding.UTF8 -CleanDir (__SOURCE_DIRECTORY__ + "/../tests/TestResults") -File.WriteAllText(__SOURCE_DIRECTORY__ + "/../tests/TestResults/notestsyet.txt","No tests yet") +CleanDir (__SOURCE_DIRECTORY__ + "/../artifacts/TestResults") +File.WriteAllText(__SOURCE_DIRECTORY__ + "/../artifacts/TestResults/notestsyet.txt","No tests yet") let isMono = true #else let isMono = false @@ -54,7 +54,7 @@ let runCmdIn workDir (exe:string) = Printf.ksprintf (fun (args:string) -> // The rest of the code is standard F# build script // -------------------------------------------------------------------------------------- -let releaseDir = Path.Combine(__SOURCE_DIRECTORY__, "../release/fcs") +let releaseDir = Path.Combine(__SOURCE_DIRECTORY__, "../artifacts/bin/fcs") // Read release notes & version info from RELEASE_NOTES.md let release = LoadReleaseNotes (__SOURCE_DIRECTORY__ + "/RELEASE_NOTES.md") diff --git a/fsharp.proj b/fsharp.proj index 42d2f15b16f..e695da391c9 100644 --- a/fsharp.proj +++ b/fsharp.proj @@ -41,25 +41,25 @@ - - - - - - - - - - + + + + + + + + + + - - - - - - + + + + + + @@ -70,41 +70,40 @@ - + - - - + + + - - - - + + + + - + - - - + + + - - - - + + + - + @@ -116,24 +115,20 @@ - - - - - + - + - + - + diff --git a/init-tools.cmd b/init-tools.cmd index 2c1b6d60bdb..cbdeb27afef 100644 --- a/init-tools.cmd +++ b/init-tools.cmd @@ -2,7 +2,7 @@ setlocal enabledelayedexpansion set /p DOTNET_TOOLS_VERSION=<"%~dp0DotnetCLIToolsVersion.txt" -set DOTNET_TOOLS_PATH=%~dp0Tools\dotnet20 +set DOTNET_TOOLS_PATH=%~dp0artifacts\toolset\dotnet set dotnetexe=%DOTNET_TOOLS_PATH%\dotnet.exe set sdksentinel=%DOTNET_TOOLS_PATH%\sdk-version.txt diff --git a/proto.proj b/proto.proj index 96f223470ec..c3a704496ee 100644 --- a/proto.proj +++ b/proto.proj @@ -8,7 +8,7 @@ - + diff --git a/setup/Directory.Build.props b/setup/Directory.Build.props index 64b72eafc9f..bd233e75785 100644 --- a/setup/Directory.Build.props +++ b/setup/Directory.Build.props @@ -1,12 +1,21 @@ - - + true false + $(MSBuildThisFileDirectory) + $(SetupRootFolder)resources + $(SetupRootFolder)..\artifacts\bin + $(ArtifactsDir)\VSSetup\$(Configuration) + $(ArtifactsDir)\VSSetup.obj\$(Configuration)\$(MSBuildProjectName) + $(SetupRootFolder)..\artifacts\VSSetup\$(Configuration) + $(SetupRootFolder)..\artifacts\VSSetup\$(Configuration)\Insertion + + + $(VSMajorVersion).$(VSMinorVersion).$(BUILD_BUILDNUMBER) diff --git a/setup/Directory.Build.targets b/setup/Directory.Build.targets index 0619a12001e..ccd47cc0a9a 100644 --- a/setup/Directory.Build.targets +++ b/setup/Directory.Build.targets @@ -1,4 +1,3 @@ - diff --git a/setup/FSharp.Setup.props b/setup/FSharp.Setup.props deleted file mode 100644 index 25398779040..00000000000 --- a/setup/FSharp.Setup.props +++ /dev/null @@ -1,142 +0,0 @@ - - - - - $(MSBuildThisFileDirectory) - - - - - $(VSMajorVersion).$(VSMinorVersion).$(BUILD_BUILDNUMBER) - - - - Debug - AnyCPU - - - - $(SetupRootFolder)\..\$(Configuration) - $(BinariesDir)\net40\bin\ - $(BinariesDir)\insertion - obj\$(Configuration)\ - $(BinariesDir)\setup - $(BinariesDir)\setup\$(Lang) - - - - - ENU - 1033 - 9 - en - en-US - false - - - CHT - 1028 - 31748 - zh-Hant - zh-TW - true - - - CSY - 1029 - 5 - cs - cs-CZ - true - - - DEU - 1031 - 7 - de - de-DE - true - - - FRA - 1036 - 12 - fr - fr-FR - true - - - ITA - 1040 - 16 - it - it-IT - true - - - JPN - 1041 - 17 - ja - ja-JP - true - - - KOR - 1042 - 18 - ko - ko-KR - true - - - PLK - 1045 - 21 - pl - pl-PL - true - - - PTB - 1046 - 1046 - pt-BR - pt-BR - true - - - RUS - 1049 - 25 - ru - ru-RU - true - - - TRK - 1055 - 31 - tr - tr-TR - true - - - CHS - 2052 - 4 - zh-Hans - zh-CN - true - - - ESN - 3082 - 10 - es - es-ES - true - - - - diff --git a/setup/Localization.props b/setup/Localization.props new file mode 100644 index 00000000000..37c13afcd2c --- /dev/null +++ b/setup/Localization.props @@ -0,0 +1,120 @@ + + + + + + + ENU + 1033 + 9 + en + en-US + false + + + CHT + 1028 + 31748 + zh-Hant + zh-TW + true + + + CSY + 1029 + 5 + cs + cs-CZ + true + + + DEU + 1031 + 7 + de + de-DE + true + + + FRA + 1036 + 12 + fr + fr-FR + true + + + ITA + 1040 + 16 + it + it-IT + true + + + JPN + 1041 + 17 + ja + ja-JP + true + + + KOR + 1042 + 18 + ko + ko-KR + true + + + PLK + 1045 + 21 + pl + pl-PL + true + + + PTB + 1046 + 1046 + pt-BR + pt-BR + true + + + RUS + 1049 + 25 + ru + ru-RU + true + + + TRK + 1055 + 31 + tr + tr-TR + true + + + CHS + 2052 + 4 + zh-Hans + zh-CN + true + + + ESN + 3082 + 10 + es + es-ES + true + + + + diff --git a/setup/Swix/Directory.Build.props b/setup/Swix/Directory.Build.props index 92203d4e217..f64df1d29de 100644 --- a/setup/Swix/Directory.Build.props +++ b/setup/Swix/Directory.Build.props @@ -1,14 +1,14 @@ + + Debug neutral false vsix true - $(FSharpSourcesRoot)\..\$(Configuration) - $(BinariesFolder)\insertion - $(MSBuildProjectDirectory)\obj + $(ArtifactsBinDir) diff --git a/setup/Swix/Directory.Build.targets b/setup/Swix/Directory.Build.targets index 14437118703..974c6da4f1b 100644 --- a/setup/Swix/Directory.Build.targets +++ b/setup/Swix/Directory.Build.targets @@ -1,3 +1,10 @@ + + + + $(ArtifactsDir)\VSSetup\$(Configuration)\Insertion\$(OutputName).vsix + + + diff --git a/setup/Swix/Microsoft.FSharp.Compiler.Resources/Files.swr b/setup/Swix/Microsoft.FSharp.Compiler.Resources/Files.swr index 464fdd774ee..f3f60d490b9 100644 --- a/setup/Swix/Microsoft.FSharp.Compiler.Resources/Files.swr +++ b/setup/Swix/Microsoft.FSharp.Compiler.Resources/Files.swr @@ -5,7 +5,7 @@ package name=Microsoft.FSharp.Compiler.Resources vs.package.language=$(LocaleSpecificCulture) folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharpCompiler\$(LocaleParentCulture)" - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Build.resources.dll" - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Compiler.Interactive.Settings.resources.dll" - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Compiler.Private.resources.dll" - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Core.resources.dll" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net46\$(LocaleParentCulture)\FSharp.Build.resources.dll" + file source="$(BinariesFolder)\FSharp.Compiler.Interactive.Settings\$(Configuration)\net46\$(LocaleParentCulture)\FSharp.Compiler.Interactive.Settings.resources.dll" + file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\net46\$(LocaleParentCulture)\FSharp.Compiler.Private.resources.dll" + file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\$(LocaleParentCulture)\FSharp.Core.resources.dll" diff --git a/setup/Swix/Microsoft.FSharp.Compiler.Resources/Microsoft.FSharp.Compiler.Resources.swixproj b/setup/Swix/Microsoft.FSharp.Compiler.Resources/Microsoft.FSharp.Compiler.Resources.swixproj index 166cbb2d519..ac8e74d4854 100644 --- a/setup/Swix/Microsoft.FSharp.Compiler.Resources/Microsoft.FSharp.Compiler.Resources.swixproj +++ b/setup/Swix/Microsoft.FSharp.Compiler.Resources/Microsoft.FSharp.Compiler.Resources.swixproj @@ -10,6 +10,7 @@ $(PackagePreprocessorDefinitions);BinariesFolder=$(BinariesFolder) + $(PackagePreprocessorDefinitions);Configuration=$(Configuration) $(PackagePreprocessorDefinitions);FSharpPackageVersion=$(FSharpPackageVersion) $(PackagePreprocessorDefinitions);LocaleParentCulture=$(LocaleParentCulture) $(PackagePreprocessorDefinitions);LocaleSpecificCulture=$(LocaleSpecificCulture) diff --git a/setup/Swix/Microsoft.FSharp.Compiler/Files.swr b/setup/Swix/Microsoft.FSharp.Compiler/Files.swr index 58129a51ee0..b56667d2465 100644 --- a/setup/Swix/Microsoft.FSharp.Compiler/Files.swr +++ b/setup/Swix/Microsoft.FSharp.Compiler/Files.swr @@ -5,35 +5,35 @@ package name=Microsoft.FSharp.Compiler folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharp" - file source=$(BinariesFolder)\net40\bin\fsc.exe vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 vs.file.ngenApplication="[installDir]\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe" - file source="$(BinariesFolder)\net40\bin\fsc.exe.config" + file source=$(BinariesFolder)\fsc\$(Configuration)\net46\fsc.exe vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 vs.file.ngenApplication="[installDir]\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsc.exe" + file source="$(BinariesFolder)\fsc\$(Configuration)\net46\fsc.exe.config" - file source=$(BinariesFolder)\net40\bin\fsi.exe vs.file.ngen=yes vs.file.ngenArchitecture=X86 vs.file.ngenPriority=2 vs.file.ngenApplication="[installDir]\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsi.exe" - file source="$(BinariesFolder)\net40\bin\fsi.exe.config" + file source=$(BinariesFolder)\fsi\$(Configuration)\net46\fsi.exe vs.file.ngen=yes vs.file.ngenArchitecture=X86 vs.file.ngenPriority=2 vs.file.ngenApplication="[installDir]\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsi.exe" + file source="$(BinariesFolder)\fsi\$(Configuration)\net46\fsi.exe.config" - file source="$(BinariesFolder)\net40\bin\fsiAnyCpu.exe" vs.file.ngen=yes vs.file.ngenArchitecture=X64 vs.file.ngenPriority=2 vs.file.ngenApplication="[installDir]\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsiAnyCpu.exe" - file source="$(BinariesFolder)\net40\bin\fsiAnyCpu.exe.config" + file source="$(BinariesFolder)\fsiAnyCpu\$(Configuration)\net46\fsiAnyCpu.exe" vs.file.ngen=yes vs.file.ngenArchitecture=X64 vs.file.ngenPriority=2 vs.file.ngenApplication="[installDir]\Common7\IDE\CommonExtensions\Microsoft\FSharp\fsiAnyCpu.exe" + file source="$(BinariesFolder)\fsiAnyCpu\$(Configuration)\net46\fsiAnyCpu.exe.config" - file source="$(BinariesFolder)\net40\bin\FSharp.Compiler.Interactive.Settings.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 - file source="$(BinariesFolder)\net40\bin\FSharp.Compiler.Private.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 - file source="$(BinariesFolder)\net40\bin\FSharp.Compiler.Server.Shared.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 + file source="$(BinariesFolder)\FSharp.Compiler.Interactive.Settings\$(Configuration)\net46\FSharp.Compiler.Interactive.Settings.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 + file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\net46\FSharp.Compiler.Private.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 + file source="$(BinariesFolder)\FSharp.Compiler.Server.Shared\$(Configuration)\net46\FSharp.Compiler.Server.Shared.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 - file source="$(BinariesFolder)\net40\bin\FSharp.Core.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 - file source="$(BinariesFolder)\net40\bin\FSharp.Core.optdata" - file source="$(BinariesFolder)\net40\bin\FSharp.Core.sigdata" + file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 + file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.optdata" + file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.sigdata" - file source="$(BinariesFolder)\net40\bin\FSharp.Build.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net46\FSharp.Build.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2 file source="$(PackagesFolder)\Microsoft.VisualFSharp.Type.Providers.Redist\$(MicrosoftVisualFSharpTypeProvidersRedistPackageVersion)\content\4.3.0.0\FSharp.Data.TypeProviders.dll" - file source="$(BinariesFolder)\net40\bin\Microsoft.Build.dll" - file source="$(BinariesFolder)\net40\bin\Microsoft.Build.Framework.dll" - file source="$(BinariesFolder)\net40\bin\Microsoft.Build.Tasks.Core.dll" - file source="$(BinariesFolder)\net40\bin\Microsoft.Build.Utilities.Core.dll" - file source="$(BinariesFolder)\net40\bin\Microsoft.Portable.FSharp.Targets" - file source="$(BinariesFolder)\net40\bin\System.Collections.Immutable.dll" - file source="$(BinariesFolder)\net40\bin\System.Reflection.Metadata.dll" - file source="$(BinariesFolder)\net40\bin\System.ValueTuple.dll" - file source="$(BinariesFolder)\net40\bin\Microsoft.FSharp.NetSdk.props" - file source="$(BinariesFolder)\net40\bin\Microsoft.FSharp.NetSdk.targets" - file source="$(BinariesFolder)\net40\bin\Microsoft.FSharp.Overrides.NetSdk.targets" - file source="$(BinariesFolder)\net40\bin\Microsoft.FSharp.Targets" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net46\Microsoft.Build.dll" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net46\Microsoft.Build.Framework.dll" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net46\Microsoft.Build.Tasks.Core.dll" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net46\Microsoft.Build.Utilities.Core.dll" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net46\Microsoft.Portable.FSharp.Targets" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net46\System.Collections.Immutable.dll" + file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\net46\System.Reflection.Metadata.dll" + file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\net46\System.ValueTuple.dll" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net46\Microsoft.FSharp.NetSdk.props" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net46\Microsoft.FSharp.NetSdk.targets" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net46\Microsoft.FSharp.Overrides.NetSdk.targets" + file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\net46\Microsoft.FSharp.Targets" diff --git a/setup/Swix/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.swixproj b/setup/Swix/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.swixproj index 955da213a71..f256dd46779 100644 --- a/setup/Swix/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.swixproj +++ b/setup/Swix/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.swixproj @@ -10,6 +10,7 @@ $(PackagePreprocessorDefinitions);BinariesFolder=$(BinariesFolder) + $(PackagePreprocessorDefinitions);Configuration=$(Configuration) $(PackagePreprocessorDefinitions);PackagesFolder=$(NuGetPackageRoot) $(PackagePreprocessorDefinitions);FSharpTreeRoot=$(FSharpTreeRoot) $(PackagePreprocessorDefinitions);FSharpPackageVersion=$(FSharpPackageVersion) diff --git a/setup/Swix/Microsoft.FSharp.Dependencies/Files.swr b/setup/Swix/Microsoft.FSharp.Dependencies/Files.swr index 6ded7ba325f..c1ec9568099 100644 --- a/setup/Swix/Microsoft.FSharp.Dependencies/Files.swr +++ b/setup/Swix/Microsoft.FSharp.Dependencies/Files.swr @@ -4,16 +4,16 @@ package name=Microsoft.FSharp.Dependencies version=$(FSharpPackageVersion) folder "InstallDir:MSBuild\Microsoft\VisualStudio\v$(VSGeneralVersion)\FSharp" - file "Microsoft.FSharp.targets" source="$(BinariesFolder)\setup\$(TargetFramework)\resources\Microsoft.FSharp.Shim.targets" - file "Microsoft.Portable.FSharp.targets" source="$(BinariesFolder)\setup\$(TargetFramework)\resources\Microsoft.Portable.FSharp.Shim.targets" - file "Microsoft.FSharp.NetSdk.targets" source="$(BinariesFolder)\setup\$(TargetFramework)\resources\Microsoft.FSharp.NetSdk.Shim.targets" - file "Microsoft.FSharp.Overrides.NetSdk.targets" source="$(BinariesFolder)\setup\$(TargetFramework)\resources\Microsoft.FSharp.Overrides.NetSdk.Shim.targets" - file "Microsoft.FSharp.NetSdk.props" source="$(BinariesFolder)\setup\$(TargetFramework)\resources\Microsoft.FSharp.NetSdk.Shim.props" + file "Microsoft.FSharp.targets" source="$(SetupShimsDir)\Microsoft.FSharp.Shim.targets" + file "Microsoft.Portable.FSharp.targets" source="$(SetupShimsDir)\Microsoft.Portable.FSharp.Shim.targets" + file "Microsoft.FSharp.NetSdk.targets" source="$(SetupShimsDir)\Microsoft.FSharp.NetSdk.Shim.targets" + file "Microsoft.FSharp.Overrides.NetSdk.targets" source="$(SetupShimsDir)\Microsoft.FSharp.Overrides.NetSdk.Shim.targets" + file "Microsoft.FSharp.NetSdk.props" source="$(SetupShimsDir)\Microsoft.FSharp.NetSdk.Shim.props" folder "InstallDir:Common7\IDE\PublicAssemblies" - file source="$(BinariesFolder)\net40\bin\FSharp.Core.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\FSharp.Core.optdata" - file source="$(BinariesFolder)\net40\bin\FSharp.Core.sigdata" + file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.optdata" + file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.sigdata" folder "InstallDir:Common7\Tools\VsDevCmd\Ext" file source="fsharp.bat" diff --git a/setup/Swix/Microsoft.FSharp.Dependencies/Microsoft.FSharp.Dependencies.swixproj b/setup/Swix/Microsoft.FSharp.Dependencies/Microsoft.FSharp.Dependencies.swixproj index dd1452bbefc..e30eaaf0fe1 100644 --- a/setup/Swix/Microsoft.FSharp.Dependencies/Microsoft.FSharp.Dependencies.swixproj +++ b/setup/Swix/Microsoft.FSharp.Dependencies/Microsoft.FSharp.Dependencies.swixproj @@ -10,7 +10,9 @@ $(PackagePreprocessorDefinitions);BinariesFolder=$(BinariesFolder) + $(PackagePreprocessorDefinitions);Configuration=$(Configuration) $(PackagePreprocessorDefinitions);FSharpPackageVersion=$(FSharpPackageVersion) + $(PackagePreprocessorDefinitions);SetupShimsDir=$(MSBuildThisFileDirectory)..\..\shims $(PackagePreprocessorDefinitions);TargetFramework=$(TargetFramework) $(PackagePreprocessorDefinitions);VSGeneralVersion=$(VSGeneralVersion) diff --git a/setup/Swix/Microsoft.FSharp.IDE/Files.swr b/setup/Swix/Microsoft.FSharp.IDE/Files.swr index 0d47c502090..2e0ee2bcf3b 100644 --- a/setup/Swix/Microsoft.FSharp.IDE/Files.swr +++ b/setup/Swix/Microsoft.FSharp.IDE/Files.swr @@ -4,10 +4,10 @@ package name=Microsoft.FSharp.IDE version=$(FSharpPackageVersion) folder "InstallDir:Common7\IDE\NewScriptItems" - file source="$(BinariesFolder)\setup\$(TargetFramework)\resources\NewFileDialog\Script\NewFSharpScriptItems.vsdir" - file source="$(BinariesFolder)\setup\$(TargetFramework)\resources\NewFileDialog\Script\Script.fsx" + file source="$(SetupResourcesDir)\NewFileDialog\Script\NewFSharpScriptItems.vsdir" + file source="$(SetupResourcesDir)\NewFileDialog\Script\Script.fsx" folder "InstallDir:Common7\IDE\NewFileItems" - file source="$(BinariesFolder)\setup\$(TargetFramework)\resources\NewFileDialog\General\NewFSharpFileItems.vsdir" - file source="$(BinariesFolder)\setup\$(TargetFramework)\resources\NewFileDialog\General\File.fs" - file source="$(BinariesFolder)\setup\$(TargetFramework)\resources\NewFileDialog\General\Script.fsx" + file source="$(SetupResourcesDir)\NewFileDialog\General\NewFSharpFileItems.vsdir" + file source="$(SetupResourcesDir)\NewFileDialog\General\File.fs" + file source="$(SetupResourcesDir)\NewFileDialog\General\Script.fsx" diff --git a/setup/Swix/Microsoft.FSharp.IDE/Microsoft.FSharp.IDE.swixproj b/setup/Swix/Microsoft.FSharp.IDE/Microsoft.FSharp.IDE.swixproj index b26924e23c2..223a7262fcb 100644 --- a/setup/Swix/Microsoft.FSharp.IDE/Microsoft.FSharp.IDE.swixproj +++ b/setup/Swix/Microsoft.FSharp.IDE/Microsoft.FSharp.IDE.swixproj @@ -9,8 +9,8 @@ - $(PackagePreprocessorDefinitions);BinariesFolder=$(BinariesFolder) $(PackagePreprocessorDefinitions);FSharpPackageVersion=$(FSharpPackageVersion) + $(PackagePreprocessorDefinitions);SetupResourcesDir=$(MSBuildThisFileDirectory)..\..\resources $(PackagePreprocessorDefinitions);TargetFramework=$(TargetFramework) diff --git a/setup/Swix/Microsoft.FSharp.Vsix.Resources/Files.swr b/setup/Swix/Microsoft.FSharp.Vsix.Resources/Files.swr index a8c5becc80e..f3b95d49900 100644 --- a/setup/Swix/Microsoft.FSharp.Vsix.Resources/Files.swr +++ b/setup/Swix/Microsoft.FSharp.Vsix.Resources/Files.swr @@ -5,16 +5,16 @@ package name=Microsoft.FSharp.VSIX.Full.Resources vs.package.language=$(LocaleSpecificCulture) folder "InstallDir:Common7\IDE\PublicAssemblies\$(LocaleParentCulture)" - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Core.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\$(LocaleParentCulture)\FSharp.Core.resources.dll" vs.file.ngen=yes folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharp\$(LocaleParentCulture)" - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Compiler.Private.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Core.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.Editor.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.LanguageService.Base.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.LanguageService.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.ProjectSystem.Base.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.ProjectSystem.FSharp.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.ProjectSystem.PropertyPages.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.UIResources.resources.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\net40\bin\$(LocaleParentCulture)\FSharp.VS.FSI.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\net46\$(LocaleParentCulture)\FSharp.Compiler.Private.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\$(LocaleParentCulture)\FSharp.Core.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.Editor\$(Configuration)\net46\$(LocaleParentCulture)\FSharp.Editor.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.LanguageService.Base\$(Configuration)\net46\$(LocaleParentCulture)\FSharp.LanguageService.Base.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.LanguageService\$(Configuration)\net46\$(LocaleParentCulture)\FSharp.LanguageService.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\ProjectSystem.Base\$(Configuration)\net46\$(LocaleParentCulture)\FSharp.ProjectSystem.Base.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\ProjectSystem\$(Configuration)\net46\$(LocaleParentCulture)\FSharp.ProjectSystem.FSharp.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.PropertiesPages\$(Configuration)\net46\$(LocaleParentCulture)\FSharp.ProjectSystem.PropertyPages.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.UIResources\$(Configuration)\net46\$(LocaleParentCulture)\FSharp.UIResources.resources.dll" vs.file.ngen=yes + file source="$(BinariesFolder)\FSharp.VS.FSI\$(Configuration)\net46\$(LocaleParentCulture)\FSharp.VS.FSI.resources.dll" vs.file.ngen=yes diff --git a/setup/Swix/Microsoft.FSharp.Vsix.Resources/Microsoft.FSharp.Vsix.Resources.swixproj b/setup/Swix/Microsoft.FSharp.Vsix.Resources/Microsoft.FSharp.Vsix.Resources.swixproj index fd39c147b4c..d8952b40fe7 100644 --- a/setup/Swix/Microsoft.FSharp.Vsix.Resources/Microsoft.FSharp.Vsix.Resources.swixproj +++ b/setup/Swix/Microsoft.FSharp.Vsix.Resources/Microsoft.FSharp.Vsix.Resources.swixproj @@ -9,6 +9,7 @@ + $(PackagePreprocessorDefinitions);Configuration=$(Configuration) $(PackagePreprocessorDefinitions);BinariesFolder=$(BinariesFolder) $(PackagePreprocessorDefinitions);FSharpPackageVersion=$(FSharpPackageVersion) $(PackagePreprocessorDefinitions);LocaleCode=$(LocaleCode) diff --git a/setup/Swix/Microsoft.FSharp.Vsix.Resources/Templates.swr b/setup/Swix/Microsoft.FSharp.Vsix.Resources/Templates.swr index 770d904e226..5de89f0cadd 100644 --- a/setup/Swix/Microsoft.FSharp.Vsix.Resources/Templates.swr +++ b/setup/Swix/Microsoft.FSharp.Vsix.Resources/Templates.swr @@ -6,8 +6,8 @@ package name=Microsoft.FSharp.VSIX.Full.Resources folder "InstallDir:Common7\IDE\ProjectTemplates\FSharp\$(LocaleId)" folder "ConsoleApplication" - file source="$(BinariesFolder)\net40\bin\ProjectTemplates\FSharp\$(LocaleParentId)\ConsoleApplication.zip" + file source="$(BinariesFolder)\ConsoleProject\$(Configuration)\$(LocaleParentId)\ConsoleApplication.zip" folder "Library" - file source="$(BinariesFolder)\net40\bin\ProjectTemplates\FSharp\$(LocaleParentId)\Library.zip" + file source="$(BinariesFolder)\LibraryProject\$(Configuration)\$(LocaleParentId)\Library.zip" folder "Tutorial" - file source="$(BinariesFolder)\net40\bin\ProjectTemplates\FSharp\$(LocaleParentId)\Tutorial.zip" + file source="$(BinariesFolder)\TutorialProject\$(Configuration)\$(LocaleParentId)\Tutorial.zip" diff --git a/setup/Swix/Microsoft.FSharp.vsmanproj b/setup/Swix/Microsoft.FSharp.vsmanproj index d2b0388c272..ec9461e1137 100644 --- a/setup/Swix/Microsoft.FSharp.vsmanproj +++ b/setup/Swix/Microsoft.FSharp.vsmanproj @@ -6,7 +6,7 @@ true true - $(OutputPath) + $(OutputPath)\Insertion $(FSharpPackageVersion) @@ -23,17 +23,17 @@ - - + + - + - - + + - - - + + + diff --git a/setup/publish-assets.ps1 b/setup/publish-assets.ps1 index 29604698b4c..bfa905bbad9 100644 --- a/setup/publish-assets.ps1 +++ b/setup/publish-assets.ps1 @@ -16,7 +16,8 @@ The API key used to authenticate with MyGet. Param( [string]$binariesPath = $null, [string]$branchName = $null, - [string]$apiKey = $null + [string]$apiKey = $null, + [string]$configuration = $null ) Set-StrictMode -Version 2.0 @@ -40,7 +41,7 @@ try { } $branchName = $branchName.Replace("/", "_") # can't have slashes in the branch name - $vsix = Join-Path $binariesPath "net40\bin\VisualFSharpFull.vsix" + $vsix = Join-Path $binariesPath "VisualFSharpFull\$configuration\net46\VisualFSharpFull.vsix" Write-Host " Uploading '$vsix' to '$requestUrl'." diff --git a/setup/resources/Microsoft.FSharp.NetSdk.Shim.props b/setup/shims/Microsoft.FSharp.NetSdk.Shim.props similarity index 100% rename from setup/resources/Microsoft.FSharp.NetSdk.Shim.props rename to setup/shims/Microsoft.FSharp.NetSdk.Shim.props diff --git a/setup/resources/Microsoft.FSharp.NetSdk.Shim.targets b/setup/shims/Microsoft.FSharp.NetSdk.Shim.targets similarity index 100% rename from setup/resources/Microsoft.FSharp.NetSdk.Shim.targets rename to setup/shims/Microsoft.FSharp.NetSdk.Shim.targets diff --git a/setup/resources/Microsoft.FSharp.Overrides.NetSdk.Shim.targets b/setup/shims/Microsoft.FSharp.Overrides.NetSdk.Shim.targets similarity index 100% rename from setup/resources/Microsoft.FSharp.Overrides.NetSdk.Shim.targets rename to setup/shims/Microsoft.FSharp.Overrides.NetSdk.Shim.targets diff --git a/setup/resources/Microsoft.FSharp.Shim.targets b/setup/shims/Microsoft.FSharp.Shim.targets similarity index 100% rename from setup/resources/Microsoft.FSharp.Shim.targets rename to setup/shims/Microsoft.FSharp.Shim.targets diff --git a/setup/resources/Microsoft.Portable.FSharp.Shim.targets b/setup/shims/Microsoft.Portable.FSharp.Shim.targets similarity index 100% rename from setup/resources/Microsoft.Portable.FSharp.Shim.targets rename to setup/shims/Microsoft.Portable.FSharp.Shim.targets diff --git a/src/buildtools/Directory.Build.props b/src/buildtools/Directory.Build.props index bb5b23d29d0..12d9ad073ec 100644 --- a/src/buildtools/Directory.Build.props +++ b/src/buildtools/Directory.Build.props @@ -1,3 +1,3 @@ - + diff --git a/src/buildtools/Directory.Build.targets b/src/buildtools/Directory.Build.targets index bb5b23d29d0..14437118703 100644 --- a/src/buildtools/Directory.Build.targets +++ b/src/buildtools/Directory.Build.targets @@ -1,3 +1,3 @@ - + diff --git a/src/buildtools/buildtools.targets b/src/buildtools/buildtools.targets index 9285a376e88..9b00e18cf72 100644 --- a/src/buildtools/buildtools.targets +++ b/src/buildtools/buildtools.targets @@ -15,7 +15,7 @@ BeforeTargets="CoreCompile"> - $(MSBuildThisFileDirectory)fslex\bin\Proto\netcoreapp2.0\fslex.dll + $(ArtifactsBinDir)\fslex\Proto\netcoreapp2.0\fslex.dll @@ -38,7 +38,7 @@ BeforeTargets="CoreCompile"> - $(MSBuildThisFileDirectory)fsyacc\bin\Proto\netcoreapp2.0\fsyacc.dll + $(ArtifactsBinDir)\fsyacc\Proto\netcoreapp2.0\fsyacc.dll diff --git a/src/fsharp/Directory.Build.props b/src/fsharp/Directory.Build.props index 57c8aa24ba7..151415117e4 100644 --- a/src/fsharp/Directory.Build.props +++ b/src/fsharp/Directory.Build.props @@ -6,6 +6,7 @@ true true false + $(ArtifactsPackagesDir)\$(Configuration) diff --git a/src/fsharp/Directory.Nuget.props b/src/fsharp/Directory.Nuget.props index 97266b7c79d..6521936cfe3 100644 --- a/src/fsharp/Directory.Nuget.props +++ b/src/fsharp/Directory.Nuget.props @@ -20,6 +20,7 @@ tags=$(PackageTags); githeadsha=$(NormalizedGitHeadSha); configuration=$(Configuration); + artifactsbindir=$(ArtifactsBinDir); diff --git a/src/fsharp/Directory.Nuget.targets b/src/fsharp/Directory.Nuget.targets index f3ae171dc38..e30b155faad 100644 --- a/src/fsharp/Directory.Nuget.targets +++ b/src/fsharp/Directory.Nuget.targets @@ -8,14 +8,4 @@ - - - - - - - - - diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index 97d17b10972..46e8888f03b 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -21,14 +21,17 @@ + + $(BaseOutputPath)\$(Configuration)\$(TargetFramework) + - - - - - - - + + + + + + + diff --git a/src/fsharp/FSharp.Compiler.nuget/Directory.Build.targets b/src/fsharp/FSharp.Compiler.nuget/Directory.Build.targets index a20d4be41e6..7d885b518db 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Directory.Build.targets +++ b/src/fsharp/FSharp.Compiler.nuget/Directory.Build.targets @@ -4,8 +4,8 @@ - - + + diff --git a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec index ac76a4a2403..87ef49f5521 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec +++ b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec @@ -54,30 +54,30 @@ this approach gives a very small deployment. Which is kind of necessary. --> - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - + + + + diff --git a/src/fsharp/FSharp.Core/FSharp.Core.nuspec b/src/fsharp/FSharp.Core/FSharp.Core.nuspec index 21b484cb8ab..443388a8278 100644 --- a/src/fsharp/FSharp.Core/FSharp.Core.nuspec +++ b/src/fsharp/FSharp.Core/FSharp.Core.nuspec @@ -56,18 +56,18 @@ - - - - + + + + - - - - + + + + - - + + diff --git a/src/fsharp/Fsc/InternalsVisibleTo.fs b/src/fsharp/fsc/InternalsVisibleTo.fs similarity index 100% rename from src/fsharp/Fsc/InternalsVisibleTo.fs rename to src/fsharp/fsc/InternalsVisibleTo.fs diff --git a/src/fsharp/Fsc/app.config b/src/fsharp/fsc/app.config similarity index 100% rename from src/fsharp/Fsc/app.config rename to src/fsharp/fsc/app.config diff --git a/src/fsharp/Fsc/Fsc.fsproj b/src/fsharp/fsc/fsc.fsproj similarity index 100% rename from src/fsharp/Fsc/Fsc.fsproj rename to src/fsharp/fsc/fsc.fsproj diff --git a/src/fsharp/fsi/Fsi.fsproj b/src/fsharp/fsi/fsi.fsproj similarity index 96% rename from src/fsharp/fsi/Fsi.fsproj rename to src/fsharp/fsi/fsi.fsproj index 9fbc4dc1331..6a4b7df15d5 100644 --- a/src/fsharp/fsi/Fsi.fsproj +++ b/src/fsharp/fsi/fsi.fsproj @@ -28,10 +28,10 @@ + - diff --git a/src/fsharp/fsiAnyCpu/FsiAnyCPU.fsproj b/src/fsharp/fsiAnyCpu/fsiAnyCpu.fsproj similarity index 100% rename from src/fsharp/fsiAnyCpu/FsiAnyCPU.fsproj rename to src/fsharp/fsiAnyCpu/fsiAnyCpu.fsproj diff --git a/tests/.gitignore b/tests/.gitignore index 2de72583ada..bf970a32fde 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,6 +1,5 @@ FSharp_* net40-fsharpqa-suite-* CoreUnit_* -TestResults *.il dont.run.peverify \ No newline at end of file diff --git a/tests/FSharp.Directory.Build.props b/tests/FSharp.Directory.Build.props index 19257808542..bb8eac309b1 100644 --- a/tests/FSharp.Directory.Build.props +++ b/tests/FSharp.Directory.Build.props @@ -1,9 +1,3 @@ - - - - - - diff --git a/tests/fsharp/SDKTests/AllSdkTargetsTests.proj b/tests/fsharp/SDKTests/AllSdkTargetsTests.proj index 857e3efd636..9da3a21fea1 100644 --- a/tests/fsharp/SDKTests/AllSdkTargetsTests.proj +++ b/tests/fsharp/SDKTests/AllSdkTargetsTests.proj @@ -1,7 +1,7 @@ - release + Release diff --git a/tests/fsharp/SDKTests/tests/Test.props b/tests/fsharp/SDKTests/tests/Test.props index fdfc314758e..b4665ec5749 100644 --- a/tests/fsharp/SDKTests/tests/Test.props +++ b/tests/fsharp/SDKTests/tests/Test.props @@ -6,14 +6,14 @@ <_TargetFrameworkVersionWithoutV Condition="'$(_TargetFrameworkVersionWithoutV)' == ''">4.6 .NETFramework - release - $(MSBuildThisFileDirectory)..\..\..\..\$(Configuration)\net40\bin + Release + $(MSBuildThisFileDirectory)..\..\..\..\artifacts\bin\FSharp.Build\$(Configuration)\net46 AnyCPU $(MSBuildThisFileDirectory) - + diff --git a/tests/fsharp/SDKTests/tests/Test.targets b/tests/fsharp/SDKTests/tests/Test.targets index 5526c118403..6f1638051d8 100644 --- a/tests/fsharp/SDKTests/tests/Test.targets +++ b/tests/fsharp/SDKTests/tests/Test.targets @@ -1,6 +1,6 @@ - + diff --git a/tests/fsharp/Test.Directory.Build.props b/tests/fsharp/Test.Directory.Build.props deleted file mode 100644 index 6603d10e659..00000000000 --- a/tests/fsharp/Test.Directory.Build.props +++ /dev/null @@ -1,8 +0,0 @@ - - - $(CompilerTestPath)\Microsoft.FSharp.Targets - $(CompilerTestPath)\Microsoft.FSharp.NetSdk.props - $(CompilerTestPath)\Microsoft.FSharp.NetSdk.targets - $(CompilerTestPath)\Microsoft.FSharp.Overrides.NetSdk.targets - - diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index 4e221bed17c..14a79c360d2 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -62,10 +62,10 @@ type ProjectConfiguration = { let replaceTokens tag (replacement:string) (template:string) = template.Replace(tag, replacement) -let generateProps testCompilerVersion= +let generateProps testCompilerVersion = let template = @" - release + Release $(TESTCOMPILERVERSION) @@ -96,13 +96,13 @@ let generateProjectArtifacts (pc:ProjectConfiguration) targetFramework = let condition = if addCondition then " Condition=\"Exists('" + fileName + "')\"" else "" match compileItem with | CompileItem.Compile -> - "\n " + "\n " | CompileItem.Reference -> - "\n " + "\n " | CompileItem.UseSource -> - "\n " + "\n " | CompileItem.LoadSource -> - "\n " + "\n " sources |> List.map(fun src -> computeInclude src) @@ -215,7 +215,7 @@ let singleTestBuildAndRunCore cfg copyFiles p = let projectBody = generateProjectArtifacts pc targetFramework emitFile projectFileName projectBody use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) - exec { cfg with Directory = directory } cfg.DotNet20Exe (sprintf "run -f %s" targetFramework) + exec { cfg with Directory = directory } cfg.DotNetExe (sprintf "run -f %s" targetFramework) testOkFile.CheckExists() executeFsc compilerType targetFramework else @@ -225,7 +225,7 @@ let singleTestBuildAndRunCore cfg copyFiles p = let projectBody = generateProjectArtifacts pc targetFramework emitFile projectFileName projectBody use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) - exec { cfg with Directory = directory } cfg.DotNet20Exe "build /t:RunFSharpScript" + exec { cfg with Directory = directory } cfg.DotNetExe "build /t:RunFSharpScript" testOkFile.CheckExists() executeFsi compilerType targetFramework result <- true diff --git a/tests/fsharp/test-framework.fs b/tests/fsharp/test-framework.fs index e00fc7111e7..85bc6319f19 100644 --- a/tests/fsharp/test-framework.fs +++ b/tests/fsharp/test-framework.fs @@ -122,19 +122,19 @@ type TestConfig = BUILD_CONFIG : string FSC : string fsc_flags : string - BinPath : string FSCOREDLLPATH : string FSI : string #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS FSIANYCPU : string #endif FSI_FOR_SCRIPTS : string + FSharpBuild : string + FSharpCompilerInteractiveSettings : string fsi_flags : string ILDASM : string PEVERIFY : string Directory: string DotNetExe: string - DotNet20Exe: string DefaultPlatform: string} @@ -157,11 +157,21 @@ let config configurationName envVars = let SCRIPT_ROOT = __SOURCE_DIRECTORY__ let packagesDir = Environment.GetEnvironmentVariable("USERPROFILE") ++ ".nuget" ++ "packages" #if NET46 - let architecture = "net40" + let fscArchitecture = "net46" + let fsiArchitecture = "net46" + let fsharpCoreArchitecture = "net45" + let fsharpBuildArchitecture = "net46" + let fsharpCompilerInteractiveSettingsArchitecture = "net46" #else - let architecture = "coreclr" + let fscArchitecture = "netcoreapp2.1" + let fsiArchitecture = "netcoreapp2.0" + let fsharpCoreArchitecture = "netstandard1.6" + let fsharpBuildArchitecture = "netstandard2.0" + let fsharpCompilerInteractiveSettingsArchitecture = "netstandard1.6" #endif - let BINPATH = SCRIPT_ROOT ++ ".." ++ ".." ++ configurationName ++ architecture ++ "bin" + let repoRoot = SCRIPT_ROOT ++ ".." ++ ".." + let artifactsPath = repoRoot ++ "artifacts" + let artifactsBinPath = artifactsPath ++ "bin" let csc_flags = "/nologo" let fsc_flags = "-r:System.Core.dll --nowarn:20 --define:COMPILED" let fsi_flags = "-r:System.Core.dll --nowarn:20 --define:INTERACTIVE --maxerrors:1 --abortonerror" @@ -170,20 +180,20 @@ let config configurationName envVars = let CSC = requireFile (packagesDir ++ "Microsoft.Net.Compilers" ++ "2.7.0" ++ "tools" ++ "csc.exe") let ILDASM = requireFile (packagesDir ++ ("runtime.win-" + architectureMoniker + ".Microsoft.NETCore.ILDAsm") ++ "2.0.3" ++ "runtimes" ++ ("win-" + architectureMoniker) ++ "native" ++ "ildasm.exe") let coreclrdll = requireFile (packagesDir ++ ("runtime.win-" + architectureMoniker + ".Microsoft.NETCore.Runtime.CoreCLR") ++ "2.0.3" ++ "runtimes" ++ ("win-" + architectureMoniker) ++ "native" ++ "coreclr.dll") - let PEVERIFY = requireFile (SCRIPT_ROOT ++ ".." ++ "fsharpqa" ++ "testenv" ++ "src" ++ "PEVerify" ++ "bin" ++ configurationName ++ "net46" ++ "PEVerify.exe") - let FSI_FOR_SCRIPTS = BINPATH ++ "fsi.exe" - let toolsDir = SCRIPT_ROOT ++ ".." ++ ".." ++ "Tools" - let dotNetExe = toolsDir ++ "dotnetcli" ++ "dotnet.exe" - let dotNet20Exe = toolsDir ++ "dotnet20" ++ "dotnet.exe" + let PEVERIFY = requireFile (artifactsBinPath ++ "PEVerify" ++ configurationName ++ "net46" ++ "PEVerify.exe") + let FSI_FOR_SCRIPTS = artifactsBinPath ++ "fsi" ++ configurationName ++ fsiArchitecture ++ "fsi.exe" + let FSharpBuild = requireFile (artifactsBinPath ++ "FSharp.Build" ++ configurationName ++ fsharpBuildArchitecture ++ "FSharp.Build.dll") + let FSharpCompilerInteractiveSettings = requireFile (artifactsBinPath ++ "FSharp.Compiler.Interactive.Settings" ++ configurationName ++ fsharpCompilerInteractiveSettingsArchitecture ++ "FSharp.Compiler.Interactive.Settings.dll") + let dotNetExe = artifactsPath ++ "toolset" ++ "dotnet" ++ "dotnet.exe" // ildasm requires coreclr.dll to run which has already been restored to the packages directory File.Copy(coreclrdll, Path.GetDirectoryName(ILDASM) ++ "coreclr.dll", overwrite=true) - let FSI = requireFile (BINPATH ++ "fsi.exe") + let FSI = requireFile (FSI_FOR_SCRIPTS) #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS - let FSIANYCPU = requireFile (BINPATH ++ "fsiAnyCpu.exe") + let FSIANYCPU = requireFile (artifactsBinPath ++ "fsiAnyCpu" ++ configurationName ++ "net46" ++ "fsiAnyCpu.exe") #endif - let FSC = requireFile (BINPATH ++ "fsc.exe") - let FSCOREDLLPATH = requireFile (BINPATH ++ "FSharp.Core.dll") + let FSC = requireFile (artifactsBinPath ++ "fsc" ++ configurationName ++ fscArchitecture ++ "fsc.exe") + let FSCOREDLLPATH = requireFile (artifactsBinPath ++ "FSharp.Core" ++ configurationName ++ fsharpCoreArchitecture ++ "FSharp.Core.dll") let defaultPlatform = match Is64BitOperatingSystem with @@ -193,7 +203,6 @@ let config configurationName envVars = | false -> "win7-x86" { EnvironmentVariables = envVars - BinPath = BINPATH |> Commands.pathAddBackslash FSCOREDLLPATH = FSCOREDLLPATH ILDASM = ILDASM PEVERIFY = PEVERIFY @@ -205,12 +214,13 @@ let config configurationName envVars = FSIANYCPU = FSIANYCPU #endif FSI_FOR_SCRIPTS = FSI_FOR_SCRIPTS + FSharpBuild = FSharpBuild + FSharpCompilerInteractiveSettings = FSharpCompilerInteractiveSettings csc_flags = csc_flags fsc_flags = fsc_flags fsi_flags = fsi_flags Directory="" DotNetExe = dotNetExe - DotNet20Exe = dotNet20Exe DefaultPlatform = defaultPlatform } let logConfig (cfg: TestConfig) = @@ -222,7 +232,6 @@ let logConfig (cfg: TestConfig) = log "csc_flags =%s" cfg.csc_flags log "FSC =%s" cfg.FSC log "fsc_flags =%s" cfg.fsc_flags - log "BINPATH =%s" cfg.BinPath log "FSCOREDLLPATH =%s" cfg.FSCOREDLLPATH log "FSI =%s" cfg.FSI #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS @@ -452,6 +461,7 @@ let rm cfg x = Commands.rm cfg.Directory x let rmdir cfg x = Commands.rmdir cfg.Directory x let mkdir cfg = Commands.mkdir_p cfg.Directory let copy_y cfg f = Commands.copy_y cfg.Directory f >> checkResult +let copySystemValueTuple cfg = copy_y cfg (getDirectoryName(cfg.FSC) ++ "System.ValueTuple.dll") ("." ++ "System.ValueTuple.dll") let diff normalize path1 path2 = let result = System.Text.StringBuilder() diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index d18197ee20d..7f5804ea1f2 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -326,7 +326,7 @@ module CoreTests = fsc cfg "%s -a -o:lib.dll" cfg.fsc_flags ["lib.fs"] - copy_y cfg (cfg.BinPath ++ "System.ValueTuple.dll") ("." ++ "System.ValueTuple.dll") + copySystemValueTuple cfg peverify cfg "lib.dll" fsc cfg "%s -r:lib.dll" cfg.fsc_flags ["test.fsx"] @@ -479,7 +479,7 @@ module CoreTests = fsc cfg "%s -a -o:lib.dll -g" cfg.fsc_flags ["lib.fs"] - copy_y cfg (cfg.BinPath ++ "System.ValueTuple.dll") ("." ++ "System.ValueTuple.dll") + copySystemValueTuple cfg peverify cfg "lib.dll" @@ -789,7 +789,7 @@ module CoreTests = fsc cfg "%s -o:test.exe -r cslib.dll -g" cfg.fsc_flags ["test.fsx"] - copy_y cfg (cfg.BinPath ++ "System.ValueTuple.dll") ("." ++ "System.ValueTuple.dll") + copySystemValueTuple cfg peverify cfg "test.exe" @@ -1072,7 +1072,7 @@ module CoreTests = echo "Test 6=================================================" - fscAppend cfg stdoutPath stderrPath "--nologo -r FSharp.Compiler.Interactive.Settings" ["usesfsi.fsx"] + fscAppend cfg stdoutPath stderrPath "--nologo -r \"%s\"" cfg.FSharpCompilerInteractiveSettings ["usesfsi.fsx"] echo "Test 7=================================================" @@ -1632,13 +1632,13 @@ module CoreTests = let verify () = let cfg = testConfig "core/verify" - peverifyWithArgs cfg "/nologo" (cfg.BinPath ++ "FSharp.Build.dll") + peverifyWithArgs cfg "/nologo" (cfg.FSharpBuild) - // peverifyWithArgs cfg "/nologo /MD" (cfg.BinPath ++ "FSharp.Compiler.dll") + // peverifyWithArgs cfg "/nologo /MD" (getDirectoryName(cfg.FSC) ++ "FSharp.Compiler.dll") - peverifyWithArgs cfg "/nologo" (cfg.BinPath ++ "fsi.exe") + peverifyWithArgs cfg "/nologo" (cfg.FSI) - peverifyWithArgs cfg "/nologo" (cfg.BinPath ++ "FSharp.Compiler.Interactive.Settings.dll") + peverifyWithArgs cfg "/nologo" (cfg.FSharpCompilerInteractiveSettings) fsc cfg "%s -o:xmlverify.exe -g" cfg.fsc_flags ["xmlverify.fs"] @@ -1957,7 +1957,7 @@ module TypecheckTests = let ``sigs pos27`` () = let cfg = testConfig "typecheck/sigs" fsc cfg "%s --target:exe -o:pos27.exe" cfg.fsc_flags ["pos27.fs"] - copy_y cfg (cfg.BinPath ++ "System.ValueTuple.dll") ("." ++ "System.ValueTuple.dll") + copySystemValueTuple cfg peverify cfg "pos27.exe" [] diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd index da8260013c7..1786d4bc552 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd @@ -3,7 +3,7 @@ REM == %1 --> assembly ildasm /TEXT /LINENUM /NOBAR "%~nx1" >"%~n1.il" IF NOT ERRORLEVEL 0 exit 1 -echo ..\..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il" -..\..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il" +echo %~dp0..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il" + %~dp0..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il" exit /b %ERRORLEVEL% diff --git a/tests/fsharpqa/Source/run.pl b/tests/fsharpqa/Source/run.pl index c999def6387..d9c3de8c3de 100644 --- a/tests/fsharpqa/Source/run.pl +++ b/tests/fsharpqa/Source/run.pl @@ -265,12 +265,12 @@ my $PEVERIFY = $ENV{PEVERIFY}; unless(defined($PEVERIFY)) { my $scriptPath = dirname(__FILE__); - $PEVERIFY = "$scriptPath\\..\\testenv\\src\\PEVerify\\bin\\Release\\net46\\PEVerify.exe"; + $PEVERIFY = "$scriptPath\\..\\..\\..\\artifacts\\bin\\PEVerify\\Release\\net46\\PEVerify.exe"; if (-e $PEVERIFY) { $ENV{PEVERIFY} = $PEVERIFY; } else { - $ENV{PEVERIFY} = "$scriptPath\\..\\testenv\\src\\PEVerify\\bin\\Debug\\net46\\PEVerify.exe"; + $ENV{PEVERIFY} = "$scriptPath\\..\\..\\..\\artifacts\\bin\\PEVerify\\Debug\\net46\\PEVerify.exe"; } } diff --git a/tests/service/FscTests.fs b/tests/service/FscTests.fs index 82914dbdbae..553f5e468b0 100644 --- a/tests/service/FscTests.fs +++ b/tests/service/FscTests.fs @@ -48,7 +48,7 @@ type PEVerifier () = Some ("pedump", "--verify all") else let peverifyPath configuration = - Path.Combine(__SOURCE_DIRECTORY__, "..", "fsharpqa", "testenv", "src", "PEVerify", "bin", configuration, "net46", "PEVerify.exe") + Path.Combine(__SOURCE_DIRECTORY__, "..", "..", "artifacts", "bin", "PEVerify", configuration, "net46", "PEVerify.exe") let peverify = if File.Exists(peverifyPath "Debug") then peverifyPath "Debug" else peverifyPath "Release" diff --git a/verify-translations.cmd b/verify-translations.cmd index 6717de0f778..2580890c6fb 100644 --- a/verify-translations.cmd +++ b/verify-translations.cmd @@ -1,3 +1,3 @@ @echo off -%~dp0release\net40\bin\fsi.exe %~dp0src\scripts\VerifyAllTranslations.fsx -- %~dp0 +%~dp0artifacts\bin\fsi\Release\net46\fsi.exe %~dp0src\scripts\VerifyAllTranslations.fsx -- %~dp0 diff --git a/vsintegration/ItemTemplates/.gitignore b/vsintegration/ItemTemplates/.gitignore new file mode 100644 index 00000000000..cd42ee34e87 --- /dev/null +++ b/vsintegration/ItemTemplates/.gitignore @@ -0,0 +1,2 @@ +bin/ +obj/ diff --git a/vsintegration/ProjectTemplates/.gitignore b/vsintegration/ProjectTemplates/.gitignore new file mode 100644 index 00000000000..cd42ee34e87 --- /dev/null +++ b/vsintegration/ProjectTemplates/.gitignore @@ -0,0 +1,2 @@ +bin/ +obj/ diff --git a/vsintegration/Templates.Directory.Build.props b/vsintegration/Templates.Directory.Build.props index 9be1daa15b8..c6a5cea2009 100644 --- a/vsintegration/Templates.Directory.Build.props +++ b/vsintegration/Templates.Directory.Build.props @@ -2,6 +2,12 @@ + + + + + + net46 v4.6 diff --git a/vsintegration/Templates.Directory.Build.targets b/vsintegration/Templates.Directory.Build.targets index 84513c489fc..4d8df139274 100644 --- a/vsintegration/Templates.Directory.Build.targets +++ b/vsintegration/Templates.Directory.Build.targets @@ -11,4 +11,21 @@ + + + + + $(OutputPath)$(TemplateCategory)\FSharp + $(MSBuildProjectDirectory)\$(TemplatesRootPath) + + + + + + + + + + diff --git a/vsintegration/Vsix/Directory.Build.targets b/vsintegration/Vsix/Directory.Build.targets index fa37bc2cd13..677cf0afc9d 100644 --- a/vsintegration/Vsix/Directory.Build.targets +++ b/vsintegration/Vsix/Directory.Build.targets @@ -2,6 +2,11 @@ + + $(ArtifactsDir)\VSSetup\$(Configuration) + $(ArtifactsDir)\VSSetup.obj\$(Configuration)\Microsoft.FSharp\ + + False diff --git a/vsintegration/Vsix/VisualFSharpFull/VisualFSharpFull.csproj b/vsintegration/Vsix/VisualFSharpFull/VisualFSharpFull.csproj index 54b61728a7f..95a623bfa12 100644 --- a/vsintegration/Vsix/VisualFSharpFull/VisualFSharpFull.csproj +++ b/vsintegration/Vsix/VisualFSharpFull/VisualFSharpFull.csproj @@ -85,7 +85,7 @@ True TargetFramework=net45 - + {8B3E283D-B5FE-4055-9D80-7E3A32F3967B} FsiAnyCPU BuiltProjectOutputGroup%3bGetCopyToOutputDirectoryItems%3b @@ -97,7 +97,7 @@ True TargetFramework=net46 - + {D0E98C0D-490B-4C61-9329-0862F6E87645} Fsi BuiltProjectOutputGroup%3bGetCopyToOutputDirectoryItems%3b @@ -109,7 +109,7 @@ True TargetFramework=net46 - + {C94C257C-3C0A-4858-B5D8-D746498D1F08} fsc BuiltProjectOutputGroup%3bGetCopyToOutputDirectoryItems%3b diff --git a/vsintegration/src/Directory.Build.props b/vsintegration/src/Directory.Build.props new file mode 100644 index 00000000000..1ad6fb80ecd --- /dev/null +++ b/vsintegration/src/Directory.Build.props @@ -0,0 +1,9 @@ + + + + + + false + + + diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.PropertiesPages.vbproj b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.PropertiesPages.vbproj index 8e8042c83a0..a04064212fd 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.PropertiesPages.vbproj +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/FSharp.PropertiesPages.vbproj @@ -4,8 +4,7 @@ Debug - net40 - $(FSharpSourcesRoot)\..\$(Configuration)\$(TargetDotnetProfile)\bin + $(ArtifactsBinDir)\$(MSBuildProjectName)\$(Configuration)\$(TargetFramework) AnyCPU 9.0.21022 2.0 @@ -24,6 +23,7 @@ false 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036 40026;42105;42107;42353 + win v4.6 diff --git a/vsintegration/tests/GetTypesVSUnitTests/GetTypesVSUnitTests.fsproj b/vsintegration/tests/GetTypesVSUnitTests/GetTypesVSUnitTests.fsproj index 1167ad2577c..68470cf046d 100644 --- a/vsintegration/tests/GetTypesVSUnitTests/GetTypesVSUnitTests.fsproj +++ b/vsintegration/tests/GetTypesVSUnitTests/GetTypesVSUnitTests.fsproj @@ -10,6 +10,8 @@ false true true + true + true @@ -19,6 +21,7 @@ + diff --git a/vsintegration/tests/Salsa/salsa.fs b/vsintegration/tests/Salsa/salsa.fs index 8a86f834180..9314dbf3662 100644 --- a/vsintegration/tests/Salsa/salsa.fs +++ b/vsintegration/tests/Salsa/salsa.fs @@ -43,13 +43,13 @@ module internal Salsa = { new System.IDisposable with member this.Dispose() = actuallyBuild <- true } member th.Results = capturedFlags, capturedSources - member th.Compile(compile:System.Converter, flags:string[], sources:string[]) = + member th.Compile(compile:System.Func, flags:string[], sources:string[]) = capturedFlags <- flags capturedSources <- sources if actuallyBuild then - compile.Invoke(0) + compile.Invoke() else - 0 + 0 interface ITaskHost type BuildResult = { diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs index 9339aaa02a8..06b42d32efc 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs @@ -433,19 +433,15 @@ type UsingMSBuild() = | [] -> System.String.Format((*Mark*) | x :: xs -> f xs""" // Note, 3 of these 8 are only available on .NET 4.6.1. On .NET 4.5 only 5 overloads are returned. - let expected45 = [["format"; "arg0"]; //Net4.5 - ["format"; "args"]; //Net4.5 - ["provider"; "format"; "args"]; //Net4.5 - ["format"; "arg0"; "arg1"]; //Net4.5 - ["format"; "arg0"; "arg1"; "arg2"]] //Net4.5 - let expected461 = [["provider"; "format"; "arg0"]; //Net4.6.1 - ["provider"; "format"; "arg0"; "arg1"]; //Net4.6.1 - ["provider"; "format"; "arg0"; "arg1"; "arg2"]] //Net4.6.1 - - let expected = - if Environment.Version.CompareTo(v461) >= 0 then - List.concat [expected45;expected461] - else expected45 + let expected = [["format"; "arg0"]; //Net4.5 + ["format"; "args"]; //Net4.5 + ["provider"; "format"; "args"]; //Net4.5 + ["format"; "arg0"; "arg1"]; //Net4.5 + ["format"; "arg0"; "arg1"; "arg2"]; //Net4.5 + ["provider"; "format"; "arg0"]; //Net4.6.1 + ["provider"; "format"; "arg0"; "arg1"]; //Net4.6.1 + ["provider"; "format"; "arg0"; "arg1"; "arg2"]] //Net4.6.1 + this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark*)", expected) (* --- Parameter Info Systematic Tests ------------------------------------------------- *) diff --git a/vsintegration/tests/UnitTests/Tests.Build.fs b/vsintegration/tests/UnitTests/Tests.Build.fs index ecdf69f5cf3..b1b7228a16f 100644 --- a/vsintegration/tests/UnitTests/Tests.Build.fs +++ b/vsintegration/tests/UnitTests/Tests.Build.fs @@ -40,8 +40,8 @@ type MyLogger(f : string -> unit) = type FauxHostObject() = let mutable myFlags : string[] = null let mutable mySources : string[] = null - member x.Compile(compile:System.Converter, flags:string[], sources:string[]) = - myFlags <- flags + member x.Compile(compile:System.Func, flags:string[], sources:string[]) = + myFlags <- flags mySources <- sources 0 member x.Flags = myFlags @@ -77,7 +77,7 @@ type Build() = let p = tool.InternalGenerateFullPathToTool() Assert.Fail("should not succeed") with e -> - e.Message.AssertMatchesPattern("ToolPath is unknown; specify the path to fsc.exe as the ToolPath property.") + e.Message.AssertMatchesPattern("ToolPath is unknown; specify the path to the tool.") [] member public this.TestCodePage() = @@ -92,7 +92,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -107,7 +108,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -122,7 +124,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -139,7 +142,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -154,7 +158,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -168,7 +173,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -183,7 +189,8 @@ type Build() = "--warnaserror-:52,109" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -198,7 +205,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -213,7 +221,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -228,7 +237,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -243,7 +253,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -258,7 +269,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -272,7 +284,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -287,7 +300,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -302,6 +316,7 @@ type Build() = "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine + "--yadda" + Environment.NewLine + "yadda" + Environment.NewLine) cmd @@ -318,7 +333,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -333,7 +349,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -348,7 +365,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -363,7 +381,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -379,7 +398,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -395,7 +415,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) cmd + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] member public this.TestReferencePathWithSpaces() = @@ -410,7 +431,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -425,7 +447,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -442,6 +465,7 @@ type Build() = "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine + src + Environment.NewLine + src + Environment.NewLine) cmd @@ -459,7 +483,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -474,7 +499,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -489,7 +515,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -503,7 +530,8 @@ type Build() = "--utf8output" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -517,7 +545,8 @@ type Build() = "--win32res:foo.res" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -531,7 +560,8 @@ type Build() = "--win32manifest:foo.manifest" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -544,7 +574,8 @@ type Build() = "--warnaserror:76" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + - "--highentropyva+" + Environment.NewLine) + "--highentropyva+" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -558,7 +589,8 @@ type Build() = "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + "--subsystemversion:6.02" + Environment.NewLine + - "--highentropyva-" + Environment.NewLine) + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine) cmd [] @@ -627,6 +659,7 @@ type Build() = "--flaterrors" + Environment.NewLine + "--subsystemversion:4.0" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + + "--nocopyfsharpcore" + Environment.NewLine + "--yadda:yadda" + Environment.NewLine + "--other:internal quote" + Environment.NewLine + "blah" + Environment.NewLine + @@ -670,6 +703,7 @@ type Build() = "--flaterrors" "--subsystemversion:4.0" "--highentropyva-" + "--nocopyfsharpcore" "--yadda:yadda" "--other:internal quote" // note stripped internal quotes "blah" |] diff --git a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj index 27b6d0224e3..310ebf78089 100644 --- a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj +++ b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj @@ -13,6 +13,8 @@ true true false + true + true @@ -160,6 +162,7 @@ + @@ -172,6 +175,23 @@ + + + + + + + + + + + + + + + + + From c6250eb035149a4972e271ed40d3336f647b5cc7 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Fri, 21 Dec 2018 12:21:39 -0800 Subject: [PATCH 03/24] [WIP] Fix signing (#6046) * fix assembly path for signing * don't unconditionally deploy the templates VSIX on build * ensure insertion manifest is written to the correct location * correct package version --- build.cmd | 8 +-- build/config/AssemblySignToolData.json | 66 +++++++++---------- build/targets/AssemblyVersions.props | 2 +- setup/Swix/Microsoft.FSharp.vsmanproj | 3 +- .../VisualFSharpTemplates.csproj | 1 - 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/build.cmd b/build.cmd index 389679d5ba4..274f0447da2 100644 --- a/build.cmd +++ b/build.cmd @@ -681,8 +681,8 @@ set asmvercheckpath=%~dp0tests\fsharpqa\testenv\src\AssemblyVersionCheck if "%BUILD_NET40%" == "1" ( echo #r @"%USERPROFILE%\.nuget\packages\Newtonsoft.Json\9.0.1\lib\net45\Newtonsoft.Json.dll">%asmvercheckpath%\assemblies.fsx - echo "%~dp0artifacts\bin\fsi\%BUILD_CONFIG%\net46\fsi.exe" "%asmvercheckpath%\AssemblyVersionCheck.fsx" -- "%~dp0build\config\AssemblySignToolData.json" "%~dp0artifacts\bin" - "%~dp0artifacts\bin\fsi\%BUILD_CONFIG%\net46\fsi.exe" "%asmvercheckpath%\AssemblyVersionCheck.fsx" -- "%~dp0build\config\AssemblySignToolData.json" "%~dp0artifacts\bin" + echo "%~dp0artifacts\bin\fsi\%BUILD_CONFIG%\net46\fsi.exe" "%asmvercheckpath%\AssemblyVersionCheck.fsx" -- "%~dp0build\config\AssemblySignToolData.json" "%~dp0artifacts" + "%~dp0artifacts\bin\fsi\%BUILD_CONFIG%\net46\fsi.exe" "%asmvercheckpath%\AssemblyVersionCheck.fsx" -- "%~dp0build\config\AssemblySignToolData.json" "%~dp0artifacts" if ERRORLEVEL 1 echo Error verifying assembly versions and commit hashes. && goto :failure ) @@ -692,8 +692,8 @@ if not "%SIGN_TYPE%" == "" ( echo %_msbuildexe% build\projects\Signing.proj /t:Restore %_msbuildexe% build\projects\Signing.proj /t:Restore - echo %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasePath=%~dp0artifacts\bin /p:ConfigFile=%~dp0build\config\AssemblySignToolData.json - %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasePath=%~dp0artifacts\bin /p:ConfigFile=%~dp0build\config\AssemblySignToolData.json + echo %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasePath=%~dp0artifacts /p:ConfigFile=%~dp0build\config\AssemblySignToolData.json + %_msbuildexe% build\projects\Signing.proj /t:DoSigning /p:SignType=%SIGN_TYPE% /p:Configuration=%BUILD_CONFIG% /p:BinaryBasePath=%~dp0artifacts /p:ConfigFile=%~dp0build\config\AssemblySignToolData.json if ERRORLEVEL 1 echo Error running sign tool && goto :failure ) diff --git a/build/config/AssemblySignToolData.json b/build/config/AssemblySignToolData.json index 3cd0f5b61c1..55163cb5b14 100644 --- a/build/config/AssemblySignToolData.json +++ b/build/config/AssemblySignToolData.json @@ -4,45 +4,45 @@ "certificate": "Microsoft", "strongName": "StrongName", "values": [ - "FSharp.Core\\*\\*\\FSharp.Core.dll", - "FSharp.Core\\*\\*\\*\\FSharp.Core.resources.dll", - "FSharp.Build\\*\\*\\FSharp.Build.dll", - "FSharp.Build\\*\\*\\*\\FSharp.Build.resources.dll", - "FSharp.Compiler.Private\\*\\*\\FSharp.Compiler.Private.dll", - "FSharp.Compiler.Private\\*\\*\\*\\FSharp.Compiler.Private.resources.dll", - "FSharp.Compiler.Server.Shared\\*\\*\\FSharp.Compiler.Server.Shared.dll", - "FSharp.Compiler.Interactive.Settings\\*\\*\\FSharp.Compiler.Interactive.Settings.dll", - "FSharp.Compiler.Interactive.Settings\\*\\*\\*\\FSharp.Compiler.Interactive.Settings.resources.dll", - "fsc\\*\\*\\fsc.exe", - "fsi\\*\\*\\fsi.exe", - "fsiAnyCpu\\*\\*\\fsiAnyCpu.exe", - "FSharp.VS.FSI\\*\\*\\FSharp.VS.FSI.dll", - "FSharp.VS.FSI\\*\\*\\*\\FSharp.VS.FSI.resources.dll", - "FSharp.LanguageService.Base\\*\\*\\FSharp.LanguageService.Base.dll", - "FSharp.LanguageService.Base\\*\\*\\*\\FSharp.LanguageService.Base.resources.dll", - "FSharp.LanguageService\\*\\*\\FSharp.LanguageService.dll", - "FSharp.LanguageService\\*\\*\\*\\FSharp.LanguageService.resources.dll", - "FSharp.UIResources\\*\\*\\FSharp.UIResources.dll", - "FSharp.UIResources\\*\\*\\*\\FSharp.UIResources.resources.dll", - "FSharp.Editor\\*\\*\\FSharp.Editor.dll", - "FSharp.Editor\\*\\*\\*\\FSharp.Editor.resources.dll", - "FSharp.ProjectSystem.Base\\*\\*\\FSharp.ProjectSystem.Base.dll", - "FSharp.ProjectSystem.Base\\*\\*\\*\\FSharp.ProjectSystem.Base.resources.dll", - "FSharp.ProjectSystem.PropertyPages\\*\\*\\FSharp.ProjectSystem.PropertyPages.dll", - "FSharp.ProjectSystem.PropertyPages\\*\\*\\*\\FSharp.ProjectSystem.PropertyPages.resources.dll", - "FSharp.ProjectSystem.FSharp\\*\\*\\FSharp.ProjectSystem.FSharp.dll", - "FSharp.ProjectSystem.FSharp\\*\\*\\*\\FSharp.ProjectSystem.FSharp.resources.dll", - "FSharp.PatternMatcher\\*\\*\\FSharp.PatternMatcher.dll" + "bin\\FSharp.Core\\*\\*\\FSharp.Core.dll", + "bin\\FSharp.Core\\*\\*\\*\\FSharp.Core.resources.dll", + "bin\\FSharp.Build\\*\\*\\FSharp.Build.dll", + "bin\\FSharp.Build\\*\\*\\*\\FSharp.Build.resources.dll", + "bin\\FSharp.Compiler.Private\\*\\*\\FSharp.Compiler.Private.dll", + "bin\\FSharp.Compiler.Private\\*\\*\\*\\FSharp.Compiler.Private.resources.dll", + "bin\\FSharp.Compiler.Server.Shared\\*\\*\\FSharp.Compiler.Server.Shared.dll", + "bin\\FSharp.Compiler.Interactive.Settings\\*\\*\\FSharp.Compiler.Interactive.Settings.dll", + "bin\\FSharp.Compiler.Interactive.Settings\\*\\*\\*\\FSharp.Compiler.Interactive.Settings.resources.dll", + "bin\\fsc\\*\\*\\fsc.exe", + "bin\\fsi\\*\\*\\fsi.exe", + "bin\\fsiAnyCpu\\*\\*\\fsiAnyCpu.exe", + "bin\\FSharp.VS.FSI\\*\\*\\FSharp.VS.FSI.dll", + "bin\\FSharp.VS.FSI\\*\\*\\*\\FSharp.VS.FSI.resources.dll", + "bin\\FSharp.LanguageService.Base\\*\\*\\FSharp.LanguageService.Base.dll", + "bin\\FSharp.LanguageService.Base\\*\\*\\*\\FSharp.LanguageService.Base.resources.dll", + "bin\\FSharp.LanguageService\\*\\*\\FSharp.LanguageService.dll", + "bin\\FSharp.LanguageService\\*\\*\\*\\FSharp.LanguageService.resources.dll", + "bin\\FSharp.UIResources\\*\\*\\FSharp.UIResources.dll", + "bin\\FSharp.UIResources\\*\\*\\*\\FSharp.UIResources.resources.dll", + "bin\\FSharp.Editor\\*\\*\\FSharp.Editor.dll", + "bin\\FSharp.Editor\\*\\*\\*\\FSharp.Editor.resources.dll", + "bin\\FSharp.PatternMatcher\\*\\*\\FSharp.PatternMatcher.dll", + "bin\\FSharp.PropertiesPages\\*\\*\\FSharp.ProjectSystem.PropertyPages.dll", + "bin\\FSharp.PropertiesPages\\*\\*\\*\\FSharp.ProjectSystem.PropertyPages.resources.dll", + "bin\\ProjectSystem\\*\\*\\FSharp.ProjectSystem.FSharp.dll", + "bin\\ProjectSystem\\*\\*\\*\\FSharp.ProjectSystem.FSharp.resources.dll", + "bin\\ProjectSystem.Base\\*\\*\\FSharp.ProjectSystem.Base.dll", + "bin\\ProjectSystem.Base\\*\\*\\*\\FSharp.ProjectSystem.Base.resources.dll" ] }, { "certificate": "VsixSHA2", "strongName": null, "values": [ - "VisualFSharpFull\\*\\*VisualFSharpFull.vsix", - "VisualFSharpTemplates\\*\\*\\VisualFSharpTemplate.vsix", - "..\\VSSetup\\*\\Insertion\\Microsoft.FSharp.Dependencies.vsix", - "..\\VSSetup\\*\\Insertion\\Microsoft.FSharp.VSIX.Full.Resources.*.vsix" + "bin\\VisualFSharpFull\\*\\*VisualFSharpFull.vsix", + "bin\\VisualFSharpTemplates\\*\\*\\VisualFSharpTemplate.vsix", + "VSSetup\\*\\Insertion\\Microsoft.FSharp.Dependencies.vsix", + "VSSetup\\*\\Insertion\\Microsoft.FSharp.VSIX.Full.Resources.*.vsix" ] } ], diff --git a/build/targets/AssemblyVersions.props b/build/targets/AssemblyVersions.props index 5ad08a25fb4..362c26a94a6 100644 --- a/build/targets/AssemblyVersions.props +++ b/build/targets/AssemblyVersions.props @@ -30,7 +30,7 @@ $(FSPackageVersion).0 15 - 8 + 9 $(VSMajorVersion).0 $(VSMajorVersion).$(VSMinorVersion).0.0 diff --git a/setup/Swix/Microsoft.FSharp.vsmanproj b/setup/Swix/Microsoft.FSharp.vsmanproj index ec9461e1137..6e6f7d4e7e9 100644 --- a/setup/Swix/Microsoft.FSharp.vsmanproj +++ b/setup/Swix/Microsoft.FSharp.vsmanproj @@ -6,7 +6,8 @@ true true - $(OutputPath)\Insertion + $(ArtifactsDir)\VSSetup\$(Configuration)\Insertion + $(OutputPath) $(FSharpPackageVersion) diff --git a/vsintegration/Vsix/VisualFSharpTemplates/VisualFSharpTemplates.csproj b/vsintegration/Vsix/VisualFSharpTemplates/VisualFSharpTemplates.csproj index 0267329af35..110fc964e1c 100644 --- a/vsintegration/Vsix/VisualFSharpTemplates/VisualFSharpTemplates.csproj +++ b/vsintegration/Vsix/VisualFSharpTemplates/VisualFSharpTemplates.csproj @@ -6,7 +6,6 @@ VisualFSharpTemplate Library Microsoft\FSharpTemplates - true From 6bed7c483195efb5882f633c59759e93dbd02c8d Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Fri, 21 Dec 2018 14:34:10 -0800 Subject: [PATCH 04/24] Improve workflows (#6040) * Improve workflow * back to 32bit msbuild * move out nugets, change targets in makefile * Detect framework * Done * feedback --- FSharpBuild.Directory.Build.targets | 1 + FSharpTests.Directory.Build.props | 2 +- Makefile | 6 +-- build.cmd | 15 ++++-- build/targets/NGenOrCrossGen.targets | 36 +++++++++++++ fsharp.proj | 52 +++++++++++++++---- proto.proj | 10 +++- .../Microsoft.FSharp.Compiler.nuspec | 4 +- src/fsharp/fsc/fsc.fsproj | 1 + src/fsharp/fsi/fsi.fsproj | 5 +- tests/fsharp/test-framework.fs | 2 +- 11 files changed, 108 insertions(+), 26 deletions(-) create mode 100644 build/targets/NGenOrCrossGen.targets diff --git a/FSharpBuild.Directory.Build.targets b/FSharpBuild.Directory.Build.targets index ef7f82861c5..fa39d7498fd 100644 --- a/FSharpBuild.Directory.Build.targets +++ b/FSharpBuild.Directory.Build.targets @@ -34,6 +34,7 @@ + diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index d9fc35fc05d..46e9b6fb369 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -23,7 +23,7 @@ $(MSBuildThisFileDirectory)artifacts\toolset\dotnet dotnet.exe dotnet - $(MSBuildThisFileDirectory)artifacts\bin\fsi\$(Configuration)\netcoreapp2.0\fsi.exe + $(MSBuildThisFileDirectory)artifacts\bin\fsi\$(Configuration)\netcoreapp2.1\fsi.exe diff --git a/Makefile b/Makefile index e402025e0ef..14a5b0a8c07 100644 --- a/Makefile +++ b/Makefile @@ -37,13 +37,13 @@ build: proto restore $(DotNetExe) build -c $(Configuration) -f netstandard1.6 src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj $(DotNetExe) build -c $(Configuration) -f netcoreapp2.1 src/fsharp/fsc/fsc.fsproj $(DotNetExe) build -c $(Configuration) -f netstandard1.6 src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj - $(DotNetExe) build -c $(Configuration) -f netcoreapp2.0 src/fsharp/fsi/fsi.fsproj + $(DotNetExe) build -c $(Configuration) -f netcoreapp2.1 src/fsharp/fsi/fsi.fsproj $(DotNetExe) build -c $(Configuration) -f netcoreapp2.0 tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj $(DotNetExe) build -c $(Configuration) -f netcoreapp2.0 tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj test: build - $(DotNetExe) test -f netcoreapp2.0 -c $(Configuration) --no-restore --no-build tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj -l "trx;LogFileName=$(CURDIR)/tests/TestResults/FSharp.Core.UnitTests.coreclr.trx" - $(DotNetExe) test -f netcoreapp2.0 -c $(Configuration) --no-restore --no-build tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj -l "trx;LogFileName=$(CURDIR)/tests/TestResults/FSharp.Build.UnitTests.coreclr.trx" + $(DotNetExe) test -f netcoreapp2.1 -c $(Configuration) --no-restore --no-build tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj -l "trx;LogFileName=$(CURDIR)/tests/TestResults/FSharp.Core.UnitTests.coreclr.trx" + $(DotNetExe) test -f netcoreapp2.1 -c $(Configuration) --no-restore --no-build tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj -l "trx;LogFileName=$(CURDIR)/tests/TestResults/FSharp.Build.UnitTests.coreclr.trx" clean: rm -rf $(CURDIR)/artifacts diff --git a/build.cmd b/build.cmd index 274f0447da2..34a78774041 100644 --- a/build.cmd +++ b/build.cmd @@ -1,6 +1,5 @@ rem Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. @if "%_echo%"=="" echo off - setlocal enableDelayedExpansion :ARGUMENTS_VALIDATION @@ -66,6 +65,7 @@ set BUILD_FCS=0 set BUILD_CONFIG=Release set BUILD_DIAG= set BUILD_PUBLICSIGN=0 +set BUILD_FSHARP_PROJ=1 set TEST_NET40_COMPILERUNIT_SUITE=0 set TEST_NET40_COREUNIT_SUITE=0 @@ -464,10 +464,15 @@ if /i "%TEST_NET40_FSHARP_SUITE" == "1" ( ) rem Decide if Proto need building -if NOT EXIST Proto\net40\bin\fsc.exe ( +if NOT EXIST "%~dp0artifacts\bin\fsc\Proto\net46\fsc.exe" ( set BUILD_PROTO=1 ) +rem decide if FSharp.Proj needs building +if "%BUILD_NET40%"=="0" if "%BUILD_NET40_FSHARP_CORE%"=="0" if "%BUILD_CORECLR%"=="0" if "%BUILD_VS%"=="0" if "%BUILD_FCS%"=="0" if "%TEST_NET40_COMPILERUNIT_SUITE%"=="0" if "%TEST_NET40_COREUNIT_SUITE%"=="0" if "%TEST_NET40_FSHARP_SUITE%"=="0" if "%TEST_NET40_FSHARPQA_SUITE%"=="0" if "%TEST_CORECLR_COREUNIT_SUITE%"=="0" if "%TEST_CORECLR_FSHARP_SUITE%"=="0" if "%TEST_VS_IDEUNIT_SUITE%"=="0" if "%TEST_FCS%"=="0" if "%TEST_END_2_END%"=="0" if "%COPY_FSCOMP_RESOURCE_FOR_BUILD_FROM_SOURCES%"=="0" ( + set BUILD_FSHARP_PROJ=0 +) + rem rem This stops the dotnet cli from hunting around and rem finding the highest possible dotnet sdk version to use. @@ -483,7 +488,6 @@ echo BUILD_PROTO_WITH_CORECLR_LKG=%BUILD_PROTO_WITH_CORECLR_LKG% echo BUILD_NET40=%BUILD_NET40% echo BUILD_NET40_FSHARP_CORE=%BUILD_NET40_FSHARP_CORE% echo BUILD_CORECLR=%BUILD_CORECLR% -echo BUILD_FROMSOURCE=%BUILD_FROMSOURCE% echo BUILD_VS=%BUILD_VS% echo BUILD_FCS=%BUILD_FCS% echo BUILD_SETUP=%BUILD_SETUP% @@ -491,6 +495,8 @@ echo BUILD_NUGET=%BUILD_NUGET% echo BUILD_CONFIG=%BUILD_CONFIG% echo BUILD_PUBLICSIGN=%BUILD_PUBLICSIGN% echo BUILD_MICROBUILD=%BUILD_MICROBUILD% +echo BUILD_FROMSOURCE=%BUILD_FROMSOURCE% +echo BUILD_FSHARP_PROJ=%BUILD_FSHARP_PROJ% echo. echo PB_SKIPTESTS=%PB_SKIPTESTS% echo PB_RESTORESOURCE=%PB_RESTORESOURCE% @@ -665,7 +671,7 @@ if "%BUILD_PROTO%" == "1" ( echo ---------------- Done with SDK restore, starting build ------------------------ -if "%BUILD_PHASE%" == "1" ( +if "%BUILD_PHASE%" == "1" if "%BUILD_FSHARP_PROJ%" == "1" ( echo %_dotnetexe% restore fsharp.proj /p:Configuration=%BUILD_CONFIG% /bl:!logdir!\fsharp.proj.restore.binlog %_dotnetexe% restore fsharp.proj /p:Configuration=%BUILD_CONFIG% /bl:!logdir!\fsharp.proj.restore.binlog @@ -1072,6 +1078,7 @@ goto :success REM ------ exit ------------------------------------- :failure endlocal +@echo exit /b 1 :success diff --git a/build/targets/NGenOrCrossGen.targets b/build/targets/NGenOrCrossGen.targets new file mode 100644 index 00000000000..33dcaa3a63a --- /dev/null +++ b/build/targets/NGenOrCrossGen.targets @@ -0,0 +1,36 @@ + + + + + $(windir)\Microsoft.NET\Framework64\v4.0.30319\ngen.exe + $(windir)\Microsoft.NET\Framework\v4.0.30319\ngen.exe + + + + + + + + + + + + + + + + true + false + + + + diff --git a/fsharp.proj b/fsharp.proj index e695da391c9..59436e5a2e7 100644 --- a/fsharp.proj +++ b/fsharp.proj @@ -36,21 +36,50 @@ true + + + true + true + + - - - - - - - - - - - + + TargetFramework=netstandard1.6 + TargetFramework=net45 + + + TargetFramework=netstandard2.0 + TargetFramework=net46 + + + TargetFramework=netstandard1.6 + TargetFramework=net46 + + + TargetFramework=net46 + + + TargetFramework=netstandard1.6 + TargetFramework=net46 + + + TargetFramework=netcoreapp2.1 + TargetFramework=net46 + + + TargetFramework=netcoreapp2.1 + TargetFramework=net46 + + + TargetFramework=net46 + @@ -70,6 +99,7 @@ + diff --git a/proto.proj b/proto.proj index c3a704496ee..0974580af5a 100644 --- a/proto.proj +++ b/proto.proj @@ -7,8 +7,14 @@ - - + + TargetFramework=net46 + TargetFramework=netcoreapp2.1 + + + TargetFramework=net46 + TargetFramework=netcoreapp2.1 + diff --git a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec index 87ef49f5521..f10712a641e 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec +++ b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec @@ -55,14 +55,14 @@ --> - + - + diff --git a/src/fsharp/fsc/fsc.fsproj b/src/fsharp/fsc/fsc.fsproj index 4bc9770e9e0..40f56a0627e 100644 --- a/src/fsharp/fsc/fsc.fsproj +++ b/src/fsharp/fsc/fsc.fsproj @@ -12,6 +12,7 @@ $(OtherFlags) --maxerrors:20 --extraoptimizationloops:1 true true + true diff --git a/src/fsharp/fsi/fsi.fsproj b/src/fsharp/fsi/fsi.fsproj index 6a4b7df15d5..5dbcac7557e 100644 --- a/src/fsharp/fsi/fsi.fsproj +++ b/src/fsharp/fsi/fsi.fsproj @@ -4,7 +4,7 @@ Exe - net46;netcoreapp2.0 + net46;netcoreapp2.1 .exe fsi $(NoWarn);45;55;62;75;1204 @@ -13,6 +13,7 @@ fsi.res true true + true @@ -45,7 +46,7 @@ - + diff --git a/tests/fsharp/test-framework.fs b/tests/fsharp/test-framework.fs index 85bc6319f19..85d462ffe47 100644 --- a/tests/fsharp/test-framework.fs +++ b/tests/fsharp/test-framework.fs @@ -164,7 +164,7 @@ let config configurationName envVars = let fsharpCompilerInteractiveSettingsArchitecture = "net46" #else let fscArchitecture = "netcoreapp2.1" - let fsiArchitecture = "netcoreapp2.0" + let fsiArchitecture = "netcoreapp2.1" let fsharpCoreArchitecture = "netstandard1.6" let fsharpBuildArchitecture = "netstandard2.0" let fsharpCompilerInteractiveSettingsArchitecture = "netstandard1.6" From 062d6f5bca450bd79931da64954c18d2785c38d9 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Fri, 21 Dec 2018 14:34:34 -0800 Subject: [PATCH 05/24] Fix: 5655 by removing FSharp.Core from VS/PublicAssembliesDirectory (#6039) --- setup/Swix/Microsoft.FSharp.Dependencies/Files.swr | 5 ----- 1 file changed, 5 deletions(-) diff --git a/setup/Swix/Microsoft.FSharp.Dependencies/Files.swr b/setup/Swix/Microsoft.FSharp.Dependencies/Files.swr index c1ec9568099..f927497e193 100644 --- a/setup/Swix/Microsoft.FSharp.Dependencies/Files.swr +++ b/setup/Swix/Microsoft.FSharp.Dependencies/Files.swr @@ -10,10 +10,5 @@ folder "InstallDir:MSBuild\Microsoft\VisualStudio\v$(VSGeneralVersion)\FSharp" file "Microsoft.FSharp.Overrides.NetSdk.targets" source="$(SetupShimsDir)\Microsoft.FSharp.Overrides.NetSdk.Shim.targets" file "Microsoft.FSharp.NetSdk.props" source="$(SetupShimsDir)\Microsoft.FSharp.NetSdk.Shim.props" -folder "InstallDir:Common7\IDE\PublicAssemblies" - file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.dll" vs.file.ngen=yes - file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.optdata" - file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.sigdata" - folder "InstallDir:Common7\Tools\VsDevCmd\Ext" file source="fsharp.bat" From e2902ee22c9b19832b2ceaf5c4f231ce1ce5d813 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Sat, 22 Dec 2018 03:41:23 +0300 Subject: [PATCH 06/24] Replace isModule with ModuleOrNamespaceKind in SynModuleOrNamespace (#6027) * Replace isModule with ModuleOrNamespaceKind in SymModuleOrNamespace * Fix structure tests * Review fixes --- src/fsharp/CompileOps.fs | 48 ++++--- src/fsharp/TypeChecker.fs | 8 +- src/fsharp/ast.fs | 22 ++- src/fsharp/fsi/fsi.fs | 2 +- src/fsharp/pars.fsy | 8 +- src/fsharp/service/ServiceAssemblyContent.fs | 3 +- src/fsharp/service/ServiceNavigation.fs | 14 +- src/fsharp/service/ServiceStructure.fs | 12 +- tests/service/StructureTests.fs | 138 ++++++++++--------- 9 files changed, 140 insertions(+), 115 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 2fb57789b81..1f98512bee8 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -3384,14 +3384,14 @@ let ComputeQualifiedNameOfFileFromUniquePath (m, p: string list) = QualifiedName let QualFileNameOfSpecs filename specs = match specs with - | [SynModuleOrNamespaceSig(modname, _, true, _, _, _, _, m)] -> QualFileNameOfModuleName m filename modname - | [SynModuleOrNamespaceSig(_, _, false, _, _, _, _, m)] -> QualFileNameOfFilename m filename + | [SynModuleOrNamespaceSig(modname, _, kind, _, _, _, _, m)] when kind.IsModule -> QualFileNameOfModuleName m filename modname + | [SynModuleOrNamespaceSig(_, _, kind, _, _, _, _, m)] when not kind.IsModule -> QualFileNameOfFilename m filename | _ -> QualFileNameOfFilename (mkRange filename pos0 pos0) filename let QualFileNameOfImpls filename specs = match specs with - | [SynModuleOrNamespace(modname, _, true, _, _, _, _, m)] -> QualFileNameOfModuleName m filename modname - | [SynModuleOrNamespace(_, _, false, _, _, _, _, m)] -> QualFileNameOfFilename m filename + | [SynModuleOrNamespace(modname, _, kind, _, _, _, _, m)] when kind.IsModule -> QualFileNameOfModuleName m filename modname + | [SynModuleOrNamespace(_, _, kind, _, _, _, _, m)] when not kind.IsModule -> QualFileNameOfFilename m filename | _ -> QualFileNameOfFilename (mkRange filename pos0 pos0) filename let PrepandPathToQualFileName x (QualifiedNameOfFile(q)) = ComputeQualifiedNameOfFileFromUniquePath (q.idRange, pathOfLid x@[q.idText]) @@ -3420,13 +3420,14 @@ let ComputeAnonModuleName check defaultNamespace filename (m: range) = let PostParseModuleImpl (_i, defaultNamespace, isLastCompiland, filename, impl) = match impl with - | ParsedImplFileFragment.NamedModule(SynModuleOrNamespace(lid, isRec, isModule, decls, xmlDoc, attribs, access, m)) -> + | ParsedImplFileFragment.NamedModule(SynModuleOrNamespace(lid, isRec, kind, decls, xmlDoc, attribs, access, m)) -> let lid = match lid with - | [id] when isModule && id.idText = MangledGlobalName -> error(Error(FSComp.SR.buildInvalidModuleOrNamespaceName(), id.idRange)) + | [id] when kind.IsModule && id.idText = MangledGlobalName -> + error(Error(FSComp.SR.buildInvalidModuleOrNamespaceName(), id.idRange)) | id :: rest when id.idText = MangledGlobalName -> rest | _ -> lid - SynModuleOrNamespace(lid, isRec, isModule, decls, xmlDoc, attribs, access, m) + SynModuleOrNamespace(lid, isRec, kind, decls, xmlDoc, attribs, access, m) | ParsedImplFileFragment.AnonModule (defs, m)-> let isLast, isExe = isLastCompiland @@ -3437,24 +3438,26 @@ let PostParseModuleImpl (_i, defaultNamespace, isLastCompiland, filename, impl) | _ -> errorR(Error(FSComp.SR.buildMultiFileRequiresNamespaceOrModule(), trimRangeToLine m)) let modname = ComputeAnonModuleName (not (isNil defs)) defaultNamespace filename (trimRangeToLine m) - SynModuleOrNamespace(modname, false, true, defs, PreXmlDoc.Empty, [], None, m) + SynModuleOrNamespace(modname, false, AnonModule, defs, PreXmlDoc.Empty, [], None, m) - | ParsedImplFileFragment.NamespaceFragment (lid, a, b, c, d, e, m)-> - let lid = + | ParsedImplFileFragment.NamespaceFragment (lid, a, kind, c, d, e, m)-> + let lid, kind = match lid with - | id :: rest when id.idText = MangledGlobalName -> rest - | _ -> lid - SynModuleOrNamespace(lid, a, b, c, d, e, None, m) + | id :: rest when id.idText = MangledGlobalName -> + rest, if List.isEmpty rest then GlobalNamespace else kind + | _ -> lid, kind + SynModuleOrNamespace(lid, a, kind, c, d, e, None, m) let PostParseModuleSpec (_i, defaultNamespace, isLastCompiland, filename, intf) = match intf with - | ParsedSigFileFragment.NamedModule(SynModuleOrNamespaceSig(lid, isRec, isModule, decls, xmlDoc, attribs, access, m)) -> + | ParsedSigFileFragment.NamedModule(SynModuleOrNamespaceSig(lid, isRec, kind, decls, xmlDoc, attribs, access, m)) -> let lid = match lid with - | [id] when isModule && id.idText = MangledGlobalName -> error(Error(FSComp.SR.buildInvalidModuleOrNamespaceName(), id.idRange)) + | [id] when kind.IsModule && id.idText = MangledGlobalName -> + error(Error(FSComp.SR.buildInvalidModuleOrNamespaceName(), id.idRange)) | id :: rest when id.idText = MangledGlobalName -> rest | _ -> lid - SynModuleOrNamespaceSig(lid, isRec, isModule, decls, xmlDoc, attribs, access, m) + SynModuleOrNamespaceSig(lid, isRec, NamedModule, decls, xmlDoc, attribs, access, m) | ParsedSigFileFragment.AnonModule (defs, m) -> let isLast, isExe = isLastCompiland @@ -3465,14 +3468,15 @@ let PostParseModuleSpec (_i, defaultNamespace, isLastCompiland, filename, intf) | _ -> errorR(Error(FSComp.SR.buildMultiFileRequiresNamespaceOrModule(), m)) let modname = ComputeAnonModuleName (not (isNil defs)) defaultNamespace filename (trimRangeToLine m) - SynModuleOrNamespaceSig(modname, false, true, defs, PreXmlDoc.Empty, [], None, m) + SynModuleOrNamespaceSig(modname, false, AnonModule, defs, PreXmlDoc.Empty, [], None, m) - | ParsedSigFileFragment.NamespaceFragment (lid, a, b, c, d, e, m)-> - let lid = + | ParsedSigFileFragment.NamespaceFragment (lid, a, kind, c, d, e, m)-> + let lid, kind = match lid with - | id :: rest when id.idText = MangledGlobalName -> rest - | _ -> lid - SynModuleOrNamespaceSig(lid, a, b, c, d, e, None, m) + | id :: rest when id.idText = MangledGlobalName -> + rest, if List.isEmpty rest then GlobalNamespace else kind + | _ -> lid, kind + SynModuleOrNamespaceSig(lid, a, kind, c, d, e, None, m) diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 495e0d4c470..c55cd9e63b4 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -16713,7 +16713,7 @@ let rec TcSignatureElementNonMutRec cenv parent typeNames endm (env: TcEnv) synS return env - | SynModuleSigDecl.NamespaceFragment (SynModuleOrNamespaceSig(longId, isRec, isModule, defs, xml, attribs, vis, m)) -> + | SynModuleSigDecl.NamespaceFragment (SynModuleOrNamespaceSig(longId, isRec, kind, defs, xml, attribs, vis, m)) -> do for id in longId do CheckNamespaceModuleOrTypeName cenv.g id @@ -16725,7 +16725,7 @@ let rec TcSignatureElementNonMutRec cenv parent typeNames endm (env: TcEnv) synS // namespace [rec] A.B // module M = ... let enclosingNamespacePath, defs = - if isModule then + if kind.IsModule then let nsp, modName = List.frontAndBack longId let modDecl = [SynModuleSigDecl.NestedModule(ComponentInfo(attribs, [], [], [modName], xml, false, vis, m), false, defs, m)] nsp, modDecl @@ -17022,7 +17022,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv:cenv) parent typeNames scopem return ((fun modDefs -> modDefn :: modDefs), topAttrsNew), env, envAtEnd - | SynModuleDecl.NamespaceFragment(SynModuleOrNamespace(longId, isRec, isModule, defs, xml, attribs, vis, m)) -> + | SynModuleDecl.NamespaceFragment(SynModuleOrNamespace(longId, isRec, kind, defs, xml, attribs, vis, m)) -> if !progress then dprintn ("Typecheck implementation " + textOfLid longId) let endm = m.EndRange @@ -17037,7 +17037,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv:cenv) parent typeNames scopem // namespace [rec] A.B // module M = ... let enclosingNamespacePath, defs = - if isModule then + if kind.IsModule then let nsp, modName = List.frontAndBack longId let modDecl = [SynModuleDecl.NestedModule(ComponentInfo(attribs, [], [], [modName], xml, false, vis, m), false, defs, true, m)] nsp, modDecl diff --git a/src/fsharp/ast.fs b/src/fsharp/ast.fs index f7fbbdd6491..43b7aab87d1 100644 --- a/src/fsharp/ast.fs +++ b/src/fsharp/ast.fs @@ -1462,11 +1462,23 @@ and and SynModuleSigDecls = SynModuleSigDecl list -/// SynModuleOrNamespace(lid,isRec,isModule,decls,xmlDoc,attribs,SynAccess,m) +and + [] + SynModuleOrNamespaceKind = + | NamedModule + | AnonModule + | DeclaredNamespace + | GlobalNamespace + + member x.IsModule = + match x with + | NamedModule | AnonModule -> true + | _ -> false + and [] SynModuleOrNamespace = - | SynModuleOrNamespace of longId:LongIdent * isRecursive:bool * isModule:bool * decls:SynModuleDecls * xmlDoc:PreXmlDoc * attribs:SynAttributes * accessibility:SynAccess option * range:range + | SynModuleOrNamespace of longId:LongIdent * isRecursive:bool * kind:SynModuleOrNamespaceKind * decls:SynModuleDecls * xmlDoc:PreXmlDoc * attribs:SynAttributes * accessibility:SynAccess option * range:range member this.Range = match this with | SynModuleOrNamespace (range=m) -> m @@ -1474,7 +1486,7 @@ and and [] SynModuleOrNamespaceSig = - | SynModuleOrNamespaceSig of longId:LongIdent * isRecursive:bool * isModule:bool * SynModuleSigDecls * xmlDoc:PreXmlDoc * attribs:SynAttributes * accessibility:SynAccess option * range:range + | SynModuleOrNamespaceSig of longId:LongIdent * isRecursive:bool * kind:SynModuleOrNamespaceKind * SynModuleSigDecls * xmlDoc:PreXmlDoc * attribs:SynAttributes * accessibility:SynAccess option * range:range and [] ParsedHashDirective = @@ -1484,13 +1496,13 @@ and [] type ParsedImplFileFragment = | AnonModule of SynModuleDecls * range:range | NamedModule of SynModuleOrNamespace - | NamespaceFragment of longId:LongIdent * bool * bool * SynModuleDecls * xmlDoc:PreXmlDoc * SynAttributes * range:range + | NamespaceFragment of longId:LongIdent * bool * SynModuleOrNamespaceKind * SynModuleDecls * xmlDoc:PreXmlDoc * SynAttributes * range:range [] type ParsedSigFileFragment = | AnonModule of SynModuleSigDecls * range:range | NamedModule of SynModuleOrNamespaceSig - | NamespaceFragment of longId:LongIdent * bool * bool * SynModuleSigDecls * xmlDoc:PreXmlDoc * SynAttributes * range:range + | NamespaceFragment of longId:LongIdent * bool * SynModuleOrNamespaceKind * SynModuleSigDecls * xmlDoc:PreXmlDoc * SynAttributes * range:range [] type ParsedFsiInteraction = diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index b2df5102032..8190be40784 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -1154,7 +1154,7 @@ type internal FsiDynamicCompiler let i = nextFragmentId() let prefix = mkFragmentPath i let prefixPath = pathOfLid prefix - let impl = SynModuleOrNamespace(prefix,(*isRec*)false, (* isModule: *) true,defs,PreXmlDoc.Empty,[],None,rangeStdin) + let impl = SynModuleOrNamespace(prefix,(*isRec*)false, NamedModule,defs,PreXmlDoc.Empty,[],None,rangeStdin) let input = ParsedInput.ImplFile(ParsedImplFileInput(filename,true, ComputeQualifiedNameOfFileFromUniquePath (rangeStdin,prefixPath),[],[],[impl],(true (* isLastCompiland *), false (* isExe *)) )) let istate,tcEnvAtEndOfLastInput,declaredImpls = ProcessInputs (ctok, errorLogger, istate, [input], showTypes, true, isInteractiveItExpr, prefix) let tcState = istate.tcState diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index 9e75787d29f..25c8ce10a8c 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -675,14 +675,14 @@ fileModuleSpec: (fun (isRec2,path,_) -> if not (isNil path) then errorR(Error(FSComp.SR.parsNamespaceOrModuleNotBoth(),m2)) let lid = path@path2 - ParsedSigFileFragment.NamedModule(SynModuleOrNamespaceSig(lid, (isRec || isRec2), true, $4, xml,$1,vis,m))) } + ParsedSigFileFragment.NamedModule(SynModuleOrNamespaceSig(lid, (isRec || isRec2), NamedModule, $4, xml,$1,vis,m))) } | moduleSpfnsPossiblyEmptyBlock { let m = (rhs parseState 1) (fun (isRec, path, xml) -> match path with | [] -> ParsedSigFileFragment.AnonModule($1, m) - | _ -> ParsedSigFileFragment.NamespaceFragment(path, isRec, false, $1, xml,[],m)) } + | _ -> ParsedSigFileFragment.NamespaceFragment(path, isRec, DeclaredNamespace, $1, xml,[],m)) } moduleSpfnsPossiblyEmptyBlock: @@ -1097,14 +1097,14 @@ fileModuleImpl: (fun (isRec, path, _) -> if not (isNil path) then errorR(Error(FSComp.SR.parsNamespaceOrModuleNotBoth(),m2)) let lid = path@path2 - ParsedImplFileFragment.NamedModule(SynModuleOrNamespace(lid, (isRec || isRec2), true, $4, xml,$1,vis,m))) } + ParsedImplFileFragment.NamedModule(SynModuleOrNamespace(lid, (isRec || isRec2), NamedModule, $4, xml,$1,vis,m))) } | moduleDefnsOrExprPossiblyEmptyOrBlock { let m = (rhs parseState 1) (fun (isRec, path, xml) -> match path with | [] -> ParsedImplFileFragment.AnonModule($1,m) - | _ -> ParsedImplFileFragment.NamespaceFragment(path, isRec, false, $1, xml,[],m)) } + | _ -> ParsedImplFileFragment.NamespaceFragment(path, isRec, DeclaredNamespace, $1, xml,[],m)) } /* A collection/block of definitions or expressions making up a module or namespace, possibly empty */ diff --git a/src/fsharp/service/ServiceAssemblyContent.fs b/src/fsharp/service/ServiceAssemblyContent.fs index b85396c26e7..663ed82a941 100644 --- a/src/fsharp/service/ServiceAssemblyContent.fs +++ b/src/fsharp/service/ServiceAssemblyContent.fs @@ -914,8 +914,9 @@ module ParsedInput = let rec walkImplFileInput (ParsedImplFileInput(modules = moduleOrNamespaceList)) = List.iter (walkSynModuleOrNamespace []) moduleOrNamespaceList - and walkSynModuleOrNamespace (parent: LongIdent) (SynModuleOrNamespace(ident, _, isModule, decls, _, _, _, range)) = + and walkSynModuleOrNamespace (parent: LongIdent) (SynModuleOrNamespace(ident, _, kind, decls, _, _, _, range)) = if range.EndLine >= currentLine then + let isModule = kind.IsModule match isModule, parent, ident with | false, _, _ -> ns := Some (longIdentToIdents ident) // top level module with "inlined" namespace like Ns1.Ns2.TopModule diff --git a/src/fsharp/service/ServiceNavigation.fs b/src/fsharp/service/ServiceNavigation.fs index 24d83f532bd..e0e1feb1b32 100755 --- a/src/fsharp/service/ServiceNavigation.fs +++ b/src/fsharp/service/ServiceNavigation.fs @@ -270,7 +270,7 @@ module NavigationImpl = let items = // Show base name for this module only if it's not the root one let singleTopLevel = (modules.Length = 1) - modules |> List.collect (fun (SynModuleOrNamespace(id, _isRec, isModule, decls, _, _, access, m)) -> + modules |> List.collect (fun (SynModuleOrNamespace(id, _isRec, kind, decls, _, _, access, m)) -> let baseName = if (not singleTopLevel) then textOfLid id else "" // Find let bindings (for the right dropdown) let nested = processNestedDeclarations(decls) @@ -283,7 +283,7 @@ module NavigationImpl = | _ -> let decl = FSharpNavigationDeclarationItem.Create - (textOfLid id, (if isModule then ModuleFileDecl else NamespaceDecl), + (textOfLid id, (if kind.IsModule then ModuleFileDecl else NamespaceDecl), FSharpGlyph.Module, m, unionRangesChecked (rangeOfDecls nested) (moduleRange (rangeOfLid id) other), singleTopLevel, FSharpEnclosingEntityKind.Module, false, access), (addItemName(textOfLid id)), nested @@ -410,7 +410,7 @@ module NavigationImpl = let items = // Show base name for this module only if it's not the root one let singleTopLevel = (modules.Length = 1) - modules |> List.collect (fun (SynModuleOrNamespaceSig(id, _isRec, isModule, decls, _, _, access, m)) -> + modules |> List.collect (fun (SynModuleOrNamespaceSig(id, _isRec, kind, decls, _, _, access, m)) -> let baseName = if (not singleTopLevel) then textOfLid id else "" // Find let bindings (for the right dropdown) let nested = processNestedSigDeclarations(decls) @@ -420,7 +420,7 @@ module NavigationImpl = // Create explicitly - it can be 'single top level' thing that is hidden let decl = FSharpNavigationDeclarationItem.Create - (textOfLid id, (if isModule then ModuleFileDecl else NamespaceDecl), + (textOfLid id, (if kind.IsModule then ModuleFileDecl else NamespaceDecl), FSharpGlyph.Module, m, unionRangesChecked (rangeOfDecls nested) (moduleRange (rangeOfLid id) other), singleTopLevel, FSharpEnclosingEntityKind.Module, false, access), (addItemName(textOfLid id)), nested @@ -574,7 +574,8 @@ module NavigateTo = for item in moduleOrNamespaceList do walkSynModuleOrNamespaceSig item { Type = ContainerType.File; Name = fileName } - and walkSynModuleOrNamespaceSig (SynModuleOrNamespaceSig(lid, _, isModule, decls, _, _, _, _)) container = + and walkSynModuleOrNamespaceSig (SynModuleOrNamespaceSig(lid, _, kind, decls, _, _, _, _)) container = + let isModule = kind.IsModule if isModule then addModule lid true container let container = @@ -631,7 +632,8 @@ module NavigateTo = for item in moduleOrNamespaceList do walkSynModuleOrNamespace item container - and walkSynModuleOrNamespace(SynModuleOrNamespace(lid, _, isModule, decls, _, _, _, _)) container = + and walkSynModuleOrNamespace(SynModuleOrNamespace(lid, _, kind, decls, _, _, _, _)) container = + let isModule = kind.IsModule if isModule then addModule lid false container let container = diff --git a/src/fsharp/service/ServiceStructure.fs b/src/fsharp/service/ServiceStructure.fs index f225c87b6d0..a89afd44c54 100644 --- a/src/fsharp/service/ServiceStructure.fs +++ b/src/fsharp/service/ServiceStructure.fs @@ -610,14 +610,14 @@ module Structure = parseAttributes attrs | _ -> () - let parseModuleOrNamespace isScript (SynModuleOrNamespace (longId,_,isModule,decls,_,attribs,_,r)) = + let parseModuleOrNamespace (SynModuleOrNamespace (longId,_,kind,decls,_,attribs,_,r)) = parseAttributes attribs let idRange = longIdentRange longId let fullrange = Range.startToEnd idRange r let collapse = Range.endToEnd idRange r // do not return range for top level implicit module in scripts - if isModule && not isScript then + if kind = NamedModule then rcheck Scope.Module Collapse.Below fullrange collapse collectHashDirectives decls @@ -833,14 +833,14 @@ module Structure = List.iter parseModuleSigDeclaration decls | _ -> () - let parseModuleOrNamespaceSigs (SynModuleOrNamespaceSig(longId,_,isModule,decls,_,attribs,_,r)) = + let parseModuleOrNamespaceSigs (SynModuleOrNamespaceSig(longId,_,kind,decls,_,attribs,_,r)) = parseAttributes attribs let rangeEnd = lastModuleSigDeclRangeElse r decls let idrange = longIdentRange longId let fullrange = Range.startToEnd idrange rangeEnd let collapse = Range.endToEnd idrange rangeEnd - if isModule then + if kind.IsModule then rcheck Scope.Module Collapse.Below fullrange collapse collectSigHashDirectives decls @@ -848,8 +848,8 @@ module Structure = List.iter parseModuleSigDeclaration decls match parsedInput with - | ParsedInput.ImplFile (ParsedImplFileInput (modules = modules; isScript = isScript)) -> - modules |> List.iter (parseModuleOrNamespace isScript) + | ParsedInput.ImplFile (ParsedImplFileInput (modules = modules)) -> + modules |> List.iter parseModuleOrNamespace getCommentRanges sourceLines | ParsedInput.SigFile (ParsedSigFileInput (modules = moduleSigs)) -> List.iter parseModuleOrNamespaceSigs moduleSigs diff --git a/tests/service/StructureTests.fs b/tests/service/StructureTests.fs index d87c3c18e78..83f518f276f 100644 --- a/tests/service/StructureTests.fs +++ b/tests/service/StructureTests.fs @@ -60,7 +60,7 @@ let (=>) (source: string) (expectedRanges: (Range * Range) list) = reraise() [] -let ``empty file``() = "" => [ (1, 0, 2, 0), (1, 0, 2, 0) ] +let ``empty file``() = "" => [] [] let ``nested module``() = @@ -68,8 +68,7 @@ let ``nested module``() = module MyModule = () """ - => [ (1, 0, 4, 0), (1, 0, 4, 0) - (2, 0, 3, 6), (2, 15, 3, 6) ] + => [ (2, 0, 3, 6), (2, 15, 3, 6) ] [] let ``module with multiline function``() = @@ -78,8 +77,7 @@ module MyModule = let foo() = foo() """ - => [ (1, 0, 5, 0), (1, 0, 5, 0) - (2, 0, 4, 13), (2, 15, 4, 13) + => [ (2, 0, 4, 13), (2, 15, 4, 13) (3, 4, 4, 13), (3, 13, 4, 13) (3, 8, 4, 13), (3, 13, 4, 13) ] @@ -91,8 +89,7 @@ type Color = | Green | Blue """ - => [ (1, 0, 6, 0), (1, 0, 6, 0) - (2, 5, 5, 10), (2, 11, 5, 10) + => [ (2, 5, 5, 10), (2, 11, 5, 10) (3, 4, 5, 10), (3, 4, 5, 10) ] [] @@ -107,8 +104,7 @@ type Color = member __.Dispose() = (docEventListener :> IDisposable).Dispose() """ - => [ (1, 0, 10, 0), (1, 0, 10, 0) - (2, 5, 9, 55), (2, 11, 9, 55) + => [ (2, 5, 9, 55), (2, 11, 9, 55) (3, 4, 5, 10), (3, 4, 5, 10) (7, 4, 9, 55), (7, 25, 9, 55) (8, 15, 9, 55), (8, 27, 9, 55) @@ -128,8 +124,7 @@ type Color = (docEventListener :> IDisposable).Dispose() """ => - [ (1, 0, 11, 0), (1, 0, 11, 0) - (2, 5, 10, 55), (2, 11, 10, 55) + [ (2, 5, 10, 55), (2, 11, 10, 55) (3, 4, 4, 14), (3, 4, 4, 14) (3, 6, 4, 13), (3, 6, 4, 13) (8, 4, 10, 55), (8, 25, 10, 55) @@ -147,8 +142,7 @@ type Color() = // 2 foo() () // 8 """ - => [ (1, 0, 9, 0), (1, 0, 9, 0) - (2, 5, 8, 10), (2, 11, 8, 10) + => [ (2, 5, 8, 10), (2, 11, 8, 10) (3, 8, 4, 10), (3, 13, 4, 10) (6, 4, 8, 10), (6, 6, 8, 10) ] @@ -182,8 +176,7 @@ module MyModule = // 2 member __.Dispose() = (docEventListener :> IDisposable).Dispose() """ - => [ (1, 0, 28, 0), (1, 0, 28, 0) - (2, 0, 27, 63), (2, 15, 27, 63) + => [ (2, 0, 27, 63), (2, 15, 27, 63) (4, 4, 5, 10), (4, 13, 5, 10) (4, 8, 5, 10), (4, 13, 5, 10) (7, 9, 15, 59), (7, 15, 15, 59) @@ -228,8 +221,7 @@ open H open G open H """ - => [ (1, 0, 26, 6), (1, 0, 26, 6) - (2, 5, 3, 6), (2, 5, 3, 6) + => [ (2, 5, 3, 6), (2, 5, 3, 6) (5, 0, 19, 17), (5, 8, 19, 17) (8, 9, 9, 10), (8, 9, 9, 10) (11, 4, 14, 17), (11, 12, 14, 17) @@ -263,8 +255,7 @@ let x = 1 "c" #r "d" """ - => [ (1, 0, 23, 6), (1, 0, 23, 6) - (2, 3, 8, 6), (2, 3, 8, 6) + => [ (2, 3, 8, 6), (2, 3, 8, 6) (11, 3, 23, 6), (11, 3, 23, 6) ] [] @@ -277,8 +268,7 @@ let f x = // 2 () // 6 x // 7 """ - => [ (1, 0, 8, 0), (1, 0, 8, 0) - (2, 0, 7, 5), (2, 7, 7, 5) + => [ (2, 0, 7, 5), (2, 7, 7, 5) (2, 4, 7, 5), (2, 7, 7, 5) (3, 8, 6, 10), (3, 11, 6, 10) (4, 12, 5, 14), (4, 13, 5, 14) ] @@ -296,8 +286,7 @@ match None with // 2 let x = () // 9 () // 10 """ - => [ (1, 0, 11, 0), (1, 0, 11, 0) - (2, 0, 10, 10), (2, 15, 10, 10) + => [ (2, 0, 10, 10), (2, 15, 10, 10) (6, 4, 10, 10), (5, 6, 10, 10) (6, 4, 10, 10), (6, 19, 10, 10) (9, 8, 10, 10), (8, 10, 10, 10) ] @@ -317,8 +306,7 @@ async { // 2 () // 11 } // 12 """ - => [ (1, 0, 12, 1), (1, 0, 12, 1) - (2, 0, 12, 1), (2, 7, 12, 0) + => [ (2, 0, 12, 1), (2, 7, 12, 0) (3, 4, 11, 14), (3, 37, 11, 14) (7, 8, 11, 14), (6, 10, 11, 14) (7, 8, 11, 14), (7, 23, 11, 14) @@ -335,8 +323,7 @@ seq { // 2 yield () } // 7 } // 8 """ - => [ (1, 0, 8, 1), (1, 0, 8, 1) - (2, 0, 8, 1), (2, 5, 8, 0) + => [ (2, 0, 8, 1), (2, 5, 8, 0) (4, 8, 5, 10), (4, 11, 5, 10) (6, 4, 7, 18), (6, 4, 7, 18) (6, 11, 7, 18), (6, 16, 7, 17) ] @@ -348,8 +335,7 @@ let _ = [ 1; 2 3 ] """ - => [ (1, 0, 5, 0), (1, 0, 5, 0) - (2, 0, 4, 9), (2, 5, 4, 9) + => [ (2, 0, 4, 9), (2, 5, 4, 9) (2, 4, 4, 9), (2, 5, 4, 9) (3, 4, 4, 9), (3, 5, 4, 8) ] @@ -360,8 +346,7 @@ let _ = { new System.IDisposable with member __.Dispose() = () } """ - => [ (1, 0, 5, 0), (1, 0, 5, 0) - (2, 0, 4, 34), (2, 5, 4, 34) + => [ (2, 0, 4, 34), (2, 5, 4, 34) (2, 4, 4, 34), (2, 5, 4, 34) (3, 4, 4, 34), (3, 28, 4, 34) ] @@ -376,8 +361,7 @@ with _ -> // 5 () // 7 () // 8 """ - => [ (1, 0, 9, 0), (1, 0, 9, 0) - (2, 0, 5, 0), (2, 3, 5, 0) + => [ (2, 0, 5, 0), (2, 3, 5, 0) (2, 0, 8, 6), (2, 3, 8, 6) (3, 8, 4, 10), (3, 11, 4, 10) (5, 0, 8, 6), (5, 4, 8, 6) @@ -395,8 +379,7 @@ finally // 5 () // 7 () // 8 """ - => [ (1, 0, 9, 0), (1, 0, 9, 0) - (2, 0, 8, 6), (2, 3, 8, 6) + => [ (2, 0, 8, 6), (2, 3, 8, 6) (3, 8, 4, 10), (3, 11, 4, 10) (5, 0, 8, 6), (5, 7, 8, 6) (6, 8, 7, 10), (6, 11, 7, 10) ] @@ -413,8 +396,7 @@ else () () """ - => [ (1, 0, 10, 0), (1, 0, 10, 0) - (2, 0, 9, 6), (2, 7, 9, 6) + => [ (2, 0, 9, 6), (2, 7, 9, 6) (2, 8, 5, 6), (2, 12, 5, 6) (3, 8, 4, 10), (3, 11, 4, 10) (7, 8, 8, 10), (7, 11, 8, 10) ] @@ -426,8 +408,7 @@ let ``code quotation``() = "code" @> """ - => [ (1, 0, 4, 10), (1, 0, 4, 10) - (2, 0, 4, 10), (2, 2, 4, 8) ] + => [ (2, 0, 4, 10), (2, 2, 4, 8) ] [] let ``raw code quotation``() = @@ -436,8 +417,7 @@ let ``raw code quotation``() = "code" @@> """ - => [ (1, 0, 4, 11), (1, 0, 4, 11) - (2, 0, 4, 11), (2, 3, 4, 8) ] + => [ (2, 0, 4, 11), (2, 3, 4, 8) ] [] let ``match lambda aka function``() = @@ -446,8 +426,7 @@ function | 0 -> () () """ - => [ (1, 0, 5, 0), (1, 0, 5, 0) - (2, 0, 4, 10), (2, 8, 4, 10) + => [ (2, 0, 4, 10), (2, 8, 4, 10) (3, 8, 4, 10), (3, 3, 4, 10) ] [] @@ -458,8 +437,7 @@ let matchwith num = | 0 -> () () """ - => [ (1, 0, 6, 0), (1, 0, 6, 0) - (2, 0, 5, 13), (2, 17, 5, 13) + => [ (2, 0, 5, 13), (2, 17, 5, 13) (2, 4, 5, 13), (2, 17, 5, 13) (3, 4, 5, 13), (3, 18, 5, 13) (4, 11, 5, 13), (4, 7, 5, 13) ] @@ -471,8 +449,7 @@ for x = 100 downto 10 do () () """ - => [ (1, 0, 5, 0), (1, 0, 5, 0) - (2, 0, 4, 6), (2, 0, 4, 6) ] + => [ (2, 0, 4, 6), (2, 0, 4, 6) ] [] let ``for each``() = @@ -481,8 +458,7 @@ for x in 0 .. 100 -> () () """ - => [ (1, 0, 5, 0), (1, 0, 5, 0) - (2, 0, 4, 14), (2, 0, 4, 14) + => [ (2, 0, 4, 14), (2, 0, 4, 14) (2, 18, 4, 14), (2, 18, 4, 14) ] [] @@ -492,8 +468,7 @@ let ``tuple``() = , 322 , 123123 ) """ - => [ (1, 0, 4, 10), (1, 0, 4, 10) - (2, 2, 4, 8), (2, 2, 4, 8) ] + => [ (2, 2, 4, 8), (2, 2, 4, 8) ] [] let ``do!``() = @@ -502,8 +477,7 @@ do! printfn "allo" printfn "allo" """ - => [(1, 0, 5, 0), (1, 0, 5, 0) - (2, 0, 4, 18), (2, 3, 4, 18)] + => [ (2, 0, 4, 18), (2, 3, 4, 18) ] [] let ``cexpr yield yield!``() = @@ -517,11 +491,10 @@ cexpr{ } } """ - => [(1, 0, 9, 5), (1, 0, 9, 5) - (2, 0, 9, 5), (2, 6, 9, 4) - (3, 4, 8, 17), (3, 4, 8, 17) - (4, 8, 8, 17), (4, 14, 8, 16) - (5, 20, 7, 26), (5, 20, 7, 26)] + => [ (2, 0, 9, 5), (2, 6, 9, 4) + (3, 4, 8, 17), (3, 4, 8, 17) + (4, 8, 8, 17), (4, 14, 8, 16) + (5, 20, 7, 26), (5, 20, 7, 26) ] [] let ``XML doc comments``() = @@ -539,8 +512,7 @@ module M = /// Single line comment let f x = x """ - => [ (1, 0, 14, 0), (1, 0, 14, 0) - (2, 0, 3, 10), (2, 0, 3, 10) + => [ (2, 0, 3, 10), (2, 0, 3, 10) (4, 0, 13, 15), (4, 8, 13, 15) (5, 4, 6, 14), (5, 4, 6, 14) (7, 9, 11, 19), (7, 11, 11, 19) @@ -562,8 +534,7 @@ module M = // Single line comment let f x = x """ - => [ (1, 0, 14, 0), (1, 0, 14, 0) - (2, 0, 3, 9), (2, 0, 3, 9) + => [ (2, 0, 3, 9), (2, 0, 3, 9) (4, 0, 13, 15), (4, 8, 13, 15) (5, 4, 6, 13), (5, 4, 6, 13) (7, 9, 11, 19), (7, 11, 11, 19) @@ -582,8 +553,7 @@ let ``XML doc and regular comments in one block``() = /// Line 8 /// Line 9 """ - => [ (1, 0, 11, 0), (1, 0, 11, 0) - (2, 0, 3, 9), (2, 0, 3, 9) + => [ (2, 0, 3, 9), (2, 0, 3, 9) (4, 0, 5, 10), (4, 0, 5, 10) (7, 0, 10, 10), (7, 0, 10, 10) ] @@ -596,9 +566,45 @@ module M = 'c', 1) """ - => [ (1, 0, 7, 0), (1, 0, 7, 0) - (2, 0, 6, 14), (2, 8, 6, 14) + => [ (2, 0, 6, 14), (2, 8, 6, 14) (3, 4, 6, 14), (3, 9, 6, 14) (3, 8, 6, 14), (3, 9, 6, 14) (4, 8, 6, 14), (4, 25, 6, 14) (5, 12, 6, 13), (5, 12, 6, 13) ] + +[] +let ``Top level module`` () = + """ +module TopLevelModule + +module Nested = + let x = 123 +""" + => [ (2, 7, 5, 15), (2, 21, 5, 15) + (4, 0, 5, 15), (4, 13, 5, 15) ] + +[] +let ``Top level namespace`` () = + """ +namespace TopLevelNamespace.Another + +module Nested = + let x = 123 +""" + => [ (4, 0, 5, 15), (4, 13, 5, 15) ] + +[] +let ``Multiple namespaces`` () = + """ +namespace TopLevelNamespace.Another + +module Nested = + let x = 123 + +namespace AnotherTopLevel.Nested + +module NestedModule = + let x = 123 +""" + => [ (4, 0, 5, 15), (4, 13, 5, 15) + (9, 0, 10, 15), (9, 19, 10, 15) ] From 9b55eccd1bc83ed123c5ae08c577be5646861830 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Sat, 22 Dec 2018 05:50:15 +0300 Subject: [PATCH 07/24] Dive into types in type test expressions in AST visitor traverse (#5951) * Dive into types in type test expressions in AST visitor * Add test * Update VisualFSharp test * Update fsproj * Cleanup test --- .../FSharp.Compiler.Service.Tests.fsproj | 6 +++++ src/fsharp/service/ServiceParseTreeWalk.fs | 9 ++++--- tests/service/Common.fs | 17 ++++++------ tests/service/InteractiveCheckerTests.fs | 6 +---- tests/service/ServiceUntypedParseTests.fs | 14 +++++----- tests/service/StructureTests.fs | 26 ++++++++----------- tests/service/TreeVisitorTests.fs | 22 ++++++++++++++++ .../UnitTests/VisualFSharp.UnitTests.fsproj | 3 +++ 8 files changed, 64 insertions(+), 39 deletions(-) create mode 100644 tests/service/TreeVisitorTests.fs diff --git a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj index abe71b6159a..9c3eb687c20 100644 --- a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +++ b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj @@ -66,6 +66,12 @@ TokenizerTests.fs + + ServiceUntypedParseTests.fs + + + TreeVisitorTests.fs + Program.fs diff --git a/src/fsharp/service/ServiceParseTreeWalk.fs b/src/fsharp/service/ServiceParseTreeWalk.fs index 660528e03ee..14e08c9b2de 100755 --- a/src/fsharp/service/ServiceParseTreeWalk.fs +++ b/src/fsharp/service/ServiceParseTreeWalk.fs @@ -456,9 +456,12 @@ module public AstTraversal = dive synExpr2 synExpr2.Range traverseSynExpr dive synExpr3 synExpr3.Range traverseSynExpr] |> pick expr - | SynExpr.TypeTest(synExpr, _synType, _range) -> traverseSynExpr synExpr - | SynExpr.Upcast(synExpr, _synType, _range) -> traverseSynExpr synExpr - | SynExpr.Downcast(synExpr, _synType, _range) -> traverseSynExpr synExpr + | SynExpr.TypeTest(synExpr, synType, _range) + | SynExpr.Upcast(synExpr, synType, _range) + | SynExpr.Downcast(synExpr, synType, _range) -> + [dive synExpr synExpr.Range traverseSynExpr + dive synType synType.Range traverseSynType] + |> pick expr | SynExpr.InferredUpcast(synExpr, _range) -> traverseSynExpr synExpr | SynExpr.InferredDowncast(synExpr, _range) -> traverseSynExpr synExpr | SynExpr.Null(_range) -> None diff --git a/tests/service/Common.fs b/tests/service/Common.fs index 07c2484e70a..6999e97a2b2 100644 --- a/tests/service/Common.fs +++ b/tests/service/Common.fs @@ -195,17 +195,18 @@ let parseAndCheckScript (file, input) = | FSharpCheckFileAnswer.Succeeded(res) -> parseResult, res | res -> failwithf "Parsing did not finish... (%A)" res -let parseSourceCode (name: string, code: string) = - let location = Path.Combine(Path.GetTempPath(),"test"+string(hash (name, code))) - try Directory.CreateDirectory(location) |> ignore with _ -> () +let parseSource (source: string) = + let location = Path.GetTempFileName() + let filePath = Path.Combine(location, ".fs") + let dllPath = Path.Combine(location, ".dll") - let projPath = Path.Combine(location, name + ".fsproj") - let filePath = Path.Combine(location, name + ".fs") - let dllPath = Path.Combine(location, name + ".dll") let args = mkProjectCommandLineArgs(dllPath, [filePath]) let options, errors = checker.GetParsingOptionsFromCommandLineArgs(List.ofArray args) - let parseResults = checker.ParseFile(filePath, code, options) |> Async.RunSynchronously - parseResults.ParseTree + let parseResults = checker.ParseFile(filePath, source, options) |> Async.RunSynchronously + + match parseResults.ParseTree with + | Some parseTree -> parseTree + | None -> failwithf "Expected there to be a parse tree for source:\n%s" source /// Extract range info let tups (m:Range.range) = (m.StartLine, m.StartColumn), (m.EndLine, m.EndColumn) diff --git a/tests/service/InteractiveCheckerTests.fs b/tests/service/InteractiveCheckerTests.fs index fba9adcb639..136505b6dd2 100644 --- a/tests/service/InteractiveCheckerTests.fs +++ b/tests/service/InteractiveCheckerTests.fs @@ -54,11 +54,7 @@ let internal identsAndRanges (input: Ast.ParsedInput) = | Ast.ParsedInput.SigFile _ -> [] let internal parseAndExtractRanges code = - let file = "Test" - let result = parseSourceCode (file, code) - match result with - | Some tree -> tree |> identsAndRanges - | None -> failwith "fail to parse..." + parseSource code |> identsAndRanges let input = """ diff --git a/tests/service/ServiceUntypedParseTests.fs b/tests/service/ServiceUntypedParseTests.fs index d47acf69de2..ccda4f5bac4 100644 --- a/tests/service/ServiceUntypedParseTests.fs +++ b/tests/service/ServiceUntypedParseTests.fs @@ -40,14 +40,12 @@ let private (=>) (source: string) (expected: CompletionContext option) = match markerPos with | None -> failwithf "Marker '%s' was not found in the source code" Marker | Some markerPos -> - match parseSourceCode("C:\\test.fs", source) with - | None -> failwith "No parse tree" - | Some parseTree -> - let actual = UntypedParseImpl.TryGetCompletionContext(markerPos, parseTree, lines.[Line.toZ markerPos.Line]) - try Assert.AreEqual(expected, actual) - with e -> - printfn "ParseTree: %A" parseTree - reraise() + let parseTree = parseSource source + let actual = UntypedParseImpl.TryGetCompletionContext(markerPos, parseTree, lines.[Line.toZ markerPos.Line]) + try Assert.AreEqual(expected, actual) + with e -> + printfn "ParseTree: %A" parseTree + reraise() module AttributeCompletion = [] diff --git a/tests/service/StructureTests.fs b/tests/service/StructureTests.fs index 83f518f276f..c98027c4ca0 100644 --- a/tests/service/StructureTests.fs +++ b/tests/service/StructureTests.fs @@ -40,23 +40,19 @@ let (=>) (source: string) (expectedRanges: (Range * Range) list) = let getRange (r: range) = (r.StartLine, r.StartColumn, r.EndLine, r.EndColumn) - let ast = parseSourceCode(fileName, source) - + let tree = parseSource source try - match ast with - | Some tree -> - let actual = - Structure.getOutliningRanges lines tree - |> Seq.filter (fun sr -> sr.Range.StartLine <> sr.Range.EndLine) - |> Seq.map (fun sr -> getRange sr.Range, getRange sr.CollapseRange) - |> Seq.sort - |> List.ofSeq - let expected = List.sort expectedRanges - if actual <> expected then - failwithf "Expected %s, but was %s" (formatList expected) (formatList actual) - | None -> failwithf "Expected there to be a parse tree for source:\n%s" source + let actual = + Structure.getOutliningRanges lines tree + |> Seq.filter (fun sr -> sr.Range.StartLine <> sr.Range.EndLine) + |> Seq.map (fun sr -> getRange sr.Range, getRange sr.CollapseRange) + |> Seq.sort + |> List.ofSeq + let expected = List.sort expectedRanges + if actual <> expected then + failwithf "Expected %s, but was %s" (formatList expected) (formatList actual) with _ -> - printfn "AST:\n%+A" ast + printfn "AST:\n%+A" tree reraise() [] diff --git a/tests/service/TreeVisitorTests.fs b/tests/service/TreeVisitorTests.fs new file mode 100644 index 00000000000..e81d140011e --- /dev/null +++ b/tests/service/TreeVisitorTests.fs @@ -0,0 +1,22 @@ +module Tests.Service.TreeVisitorTests + +open FSharp.Compiler.Service.Tests.Common +open Microsoft.FSharp.Compiler.Range +open Microsoft.FSharp.Compiler.SourceCodeServices.AstTraversal +open NUnit.Framework + +[] +let ``Visit type test`` () = + let visitor = + { new AstVisitorBase<_>() with + member x.VisitExpr(_, _, defaultTraverse, expr) = defaultTraverse expr + member x.VisitType(_, _) = Some () } + + let source = "123 :? int" + let parseTree = parseSource source + + Traverse(mkPos 1 11, parseTree, visitor) + |> Option.defaultWith (fun _ -> failwith "Did not visit type") + + Traverse(mkPos 1 3, parseTree, visitor) + |> Option.iter (fun _ -> failwith "Should not visit type") diff --git a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj index 310ebf78089..398eab56a43 100644 --- a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj +++ b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj @@ -109,6 +109,9 @@ CompilerService\UnusedOpensTests.fs + + CompilerService\TreeVisitorTests.fs + Roslyn\SyntacticColorizationServiceTests.fs From 4566e648e7357e3de5895fa0345e573b96257083 Mon Sep 17 00:00:00 2001 From: Avi Avni Date: Fri, 11 Jan 2019 19:17:41 +0200 Subject: [PATCH 08/24] remove allocations from jaro (#6050) * remove allocations from jaro * improve perforamce * fix build * remove string concat allocations from FilterPredictions * fix build * move to struct tuple and remove the concat completely * undo --- src/fsharp/ErrorResolutionHints.fs | 3 +- src/utils/EditDistance.fs | 64 ++++++++++++++++++------------ 2 files changed, 40 insertions(+), 27 deletions(-) diff --git a/src/fsharp/ErrorResolutionHints.fs b/src/fsharp/ErrorResolutionHints.fs index e674adb6f46..20bcb13fd21 100644 --- a/src/fsharp/ErrorResolutionHints.fs +++ b/src/fsharp/ErrorResolutionHints.fs @@ -43,6 +43,7 @@ let FilterPredictions (idText:string) (suggestionF:ErrorLogger.Suggestions) = name |> Seq.forall (fun c -> c <> ' ') if allSuggestions.Contains idText then [] else // some other parsing error occurred + let dotIdText = "." + idText allSuggestions |> Seq.choose (fun suggestion -> // Because beginning a name with _ is used both to indicate an unused @@ -53,7 +54,7 @@ let FilterPredictions (idText:string) (suggestionF:ErrorLogger.Suggestions) = let suggestion:string = demangle suggestion let suggestedText = suggestion.ToUpperInvariant() let similarity = EditDistance.JaroWinklerDistance uppercaseText suggestedText - if similarity >= highConfidenceThreshold || suggestion.EndsWithOrdinal("." + idText) then + if similarity >= highConfidenceThreshold || suggestion.EndsWithOrdinal(dotIdText) then Some(similarity, suggestion) elif similarity < minThresholdForSuggestions && suggestedText.Length > minStringLengthForThreshold then None diff --git a/src/utils/EditDistance.fs b/src/utils/EditDistance.fs index 6beac0c408f..503662400ff 100644 --- a/src/utils/EditDistance.fs +++ b/src/utils/EditDistance.fs @@ -23,33 +23,45 @@ let jaro (s1: string) (s2: string) = let matchRadius = let minLen = Math.Min(s1.Length, s2.Length) minLen / 2 + minLen % 2 - - // An inner function which recursively finds the number - // of matched characters within the radius. - let commonChars (chars1: string) (chars2: string) = - let result = ResizeArray(chars1.Length) - for i = 0 to chars1.Length - 1 do - let c = chars1.[i] - if existsInWin c chars2 i matchRadius then - result.Add c - result - - // The sets of common characters and their lengths as floats - let c1 = commonChars s1 s2 - let c2 = commonChars s2 s1 - let c1length = float c1.Count - let c2length = float c2.Count - + + let rec nextChar (s1:string) (s2:string) i c = + if i < s1.Length then + let c = s1.[i] + if not (existsInWin c s2 i matchRadius) then + nextChar s1 s2 (i + 1) c + else + struct (i, c) + else + struct (i, c) + + // The sets of common characters and their lengths as floats // The number of transpositions within the sets of common characters. - let transpositions = - let mutable mismatches = 0.0 - for i = 0 to (Math.Min(c1.Count, c2.Count)) - 1 do - if c1.[i] <> c2.[i] then - mismatches <- mismatches + 1.0 - - // If one common string is longer than the other - // each additional char counts as half a transposition - (mismatches + abs (c1length - c2length)) / 2.0 + let struct (transpositions, c1length, c2length) = + let rec loop i j mismatches c1length c2length = + if i < s1.Length && j < s2.Length then + let struct (ti, ci) = nextChar s1 s2 i ' ' + let struct (tj, cj) = nextChar s2 s1 j ' ' + if ci <> cj then + loop (ti + 1) (tj + 1) (mismatches + 1) (c1length + 1) (c2length + 1) + else + loop (ti + 1) (tj + 1) mismatches (c1length + 1) (c2length + 1) + else struct (i, j, mismatches, c1length, c2length) + + let struct (i, j, mismatches, c1length, c2length) = loop 0 0 0 0 0 + + let rec loop (s1:string) (s2:string) i length = + if i < s1.Length - 1 then + let c = s1.[i] + if existsInWin c s2 i matchRadius then + loop s1 s2 (i + 1) (length + 1) + else + loop s1 s2 (i + 1) length + else + length + let c1length = loop s1 s2 i c1length |> float + let c2length = loop s2 s1 j c2length |> float + + struct ((float mismatches + abs (c1length - c2length)) / 2.0, c1length, c2length) let tLength = Math.Max(c1length, c2length) From 0a72fe28e0252c6aa13b87dc8115111b93a53aa8 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 11 Jan 2019 21:19:32 +0000 Subject: [PATCH 09/24] take tailcalls in debug mode (#6079) --- fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj | 2 +- .../FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj | 1 + src/fsharp/FSharp.Core/FSharp.Core.fsproj | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj index c5357aab06b..55a43730801 100644 --- a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj +++ b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj @@ -17,7 +17,7 @@ $(OtherFlags) /warnon:1182 $(OtherFlags) --times $(NoWarn);44;62;69;65;54;61;75;62;9;2003;NU5125 - true + true true true diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index 46e8888f03b..2a38e3d10d1 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -13,6 +13,7 @@ $(OtherFlags) --warnon:1182 --maxerrors:20 --extraoptimizationloops:1 true true + true diff --git a/src/fsharp/FSharp.Core/FSharp.Core.fsproj b/src/fsharp/FSharp.Core/FSharp.Core.fsproj index ce9fa915f91..6ddda3f2e7e 100644 --- a/src/fsharp/FSharp.Core/FSharp.Core.fsproj +++ b/src/fsharp/FSharp.Core/FSharp.Core.fsproj @@ -14,6 +14,7 @@ $(DefineConstants);FSHARP_CORE BUILDING_WITH_LKG;$(DefineConstants) $(OtherFlags) --warnon:1182 --compiling-fslib --compiling-fslib-40 --maxerrors:20 --extraoptimizationloops:1 + true From 23c626d7e836bec49c34af70dd970413ea4b6dcd Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Fri, 11 Jan 2019 16:12:56 -0800 Subject: [PATCH 10/24] Build a compiler dll with out a prerelease tag (#6082) --- build-nuget-packages.proj | 1 + build.cmd | 3 +-- fsharp.proj | 8 +++++++- src/fsharp/FSharp.Compiler.nuget/Directory.Build.props | 2 -- src/fsharp/FSharp.Compiler.nuget/Directory.Build.targets | 5 +++++ .../Microsoft.FSharp.Compiler.Prerelease.csproj | 8 ++++++++ .../Microsoft.FSharp.Compiler.csproj | 1 + .../FSharp.Compiler.nuget/Testing.FSharp.Compiler.csproj | 1 + 8 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.Prerelease.csproj diff --git a/build-nuget-packages.proj b/build-nuget-packages.proj index 37a64ed6535..8b279bd8a19 100644 --- a/build-nuget-packages.proj +++ b/build-nuget-packages.proj @@ -3,6 +3,7 @@ + diff --git a/build.cmd b/build.cmd index 34a78774041..a29dd5de7a3 100644 --- a/build.cmd +++ b/build.cmd @@ -162,7 +162,6 @@ if /i "%ARG%" == "net40" ( if /i "%ARG%" == "coreclr" ( set _autoselect=0 - set BUILD_PROTO_WITH_CORECLR_LKG=1 set BUILD_CORECLR=1 set BUILD_FROMSOURCE=1 ) @@ -237,7 +236,7 @@ if /i "%ARG%" == "nuget" ( set BUILD_PROTO=1 set BUILD_NET40_FSHARP_CORE=1 - set BUILD_PROTO_WITH_CORECLR_LKG=1 + set BUILD_NET40=1 set BUILD_CORECLR=1 set BUILD_NUGET=1 ) diff --git a/fsharp.proj b/fsharp.proj index 59436e5a2e7..92b37d547ee 100644 --- a/fsharp.proj +++ b/fsharp.proj @@ -11,6 +11,7 @@ false false false + false false false @@ -25,6 +26,7 @@ true true true + true true true @@ -98,8 +100,12 @@ - + + + + + diff --git a/src/fsharp/FSharp.Compiler.nuget/Directory.Build.props b/src/fsharp/FSharp.Compiler.nuget/Directory.Build.props index 68113d9e9ca..8093275dba0 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Directory.Build.props +++ b/src/fsharp/FSharp.Compiler.nuget/Directory.Build.props @@ -6,8 +6,6 @@ netcoreapp2.1 Microsoft.FSharp.Compiler.nuspec - -rtm-$(NuGetPackageVersionSuffix) - $(FSPackageVersion)$(PreReleaseSuffix) diff --git a/src/fsharp/FSharp.Compiler.nuget/Directory.Build.targets b/src/fsharp/FSharp.Compiler.nuget/Directory.Build.targets index 7d885b518db..2721c93a906 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Directory.Build.targets +++ b/src/fsharp/FSharp.Compiler.nuget/Directory.Build.targets @@ -1,5 +1,10 @@ + + -rtm-$(NuGetPackageVersionSuffix) + $(FSPackageVersion)$(PreReleaseSuffix) + + diff --git a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.Prerelease.csproj b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.Prerelease.csproj new file mode 100644 index 00000000000..692e5aba1b2 --- /dev/null +++ b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.Prerelease.csproj @@ -0,0 +1,8 @@ + + + + Microsoft.FSharp.Compiler + true + + + diff --git a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.csproj b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.csproj index eef53d7dc4e..abb19e418fe 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.csproj +++ b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.csproj @@ -2,6 +2,7 @@ Microsoft.FSharp.Compiler + false diff --git a/src/fsharp/FSharp.Compiler.nuget/Testing.FSharp.Compiler.csproj b/src/fsharp/FSharp.Compiler.nuget/Testing.FSharp.Compiler.csproj index 44a831fed38..aaee9c73942 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Testing.FSharp.Compiler.csproj +++ b/src/fsharp/FSharp.Compiler.nuget/Testing.FSharp.Compiler.csproj @@ -2,6 +2,7 @@ Testing.FSharp.Compiler + true From 631401a1cc7c487a6b27486242ac7df3e77bd495 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Fri, 11 Jan 2019 16:13:36 -0800 Subject: [PATCH 11/24] Do not get the absolute value of Map's hash code (#6072) Fixes #6068, where you could cause a `System.OverFlowException` by using a key and value that leads to calling `abs` on `Int32.MinValue`. This is invalid on .NET. The fix is to not call `abs`, since there's really no reason to make a hash code always positive. --- src/fsharp/FSharp.Core/map.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsharp/FSharp.Core/map.fs b/src/fsharp/FSharp.Core/map.fs index 8efc49a1a41..7ef250a0ee9 100644 --- a/src/fsharp/FSharp.Core/map.fs +++ b/src/fsharp/FSharp.Core/map.fs @@ -558,7 +558,7 @@ namespace Microsoft.FSharp.Collections for (KeyValue(x,y)) in this do res <- combineHash res (hash x) res <- combineHash res (Unchecked.hash y) - abs res + res override this.Equals(that) = match that with @@ -744,4 +744,4 @@ namespace Microsoft.FSharp.Collections let empty<'Key,'Value when 'Key : comparison> = Map<'Key,'Value>.Empty [] - let count (table:Map<_,_>) = table.Count \ No newline at end of file + let count (table:Map<_,_>) = table.Count From 03e8aa59d3a4a9d43a563b498d290d48583d4c01 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Mon, 14 Jan 2019 19:09:31 +0000 Subject: [PATCH 12/24] Update DEVGUIDE.md (#6091) --- DEVGUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEVGUIDE.md b/DEVGUIDE.md index b1b0d00cbf5..27a962341b6 100644 --- a/DEVGUIDE.md +++ b/DEVGUIDE.md @@ -237,7 +237,7 @@ If you change error messages you may need to update FSComp.fs in `src\buildfroms To do this, build the non-buildfromsource version of FSharp.Compiler.Private (src\fsharp\FSharp.Compiler.Private) then check its obj\ directory for `FSComp.fs` and manually copy that into the buildfromsource directory. .\build net40 - copy /y src\fsharp\FSharp.Compiler.Private\obj\release\net40\FSComp.* src\buildfromsource\FSharp.Compiler.Private\ + copy /y artifacts\obj\FSharp.Compiler.Private\Release\net46\FSComp.* src\buildfromsource\FSharp.Compiler.Private\ If your changes involve modifying the list of language keywords in any way, (e.g. when implementing a new keyword), the XLF localization files need to be synced with the corresponding resx files. This can be done automatically by running From eb75fcc5a4b451b8250709e282a9be84c9ae92e5 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Mon, 14 Jan 2019 19:48:25 +0000 Subject: [PATCH 13/24] Fix de-duplication of module names (#6086) * possible fix for signature issue * fix de-duplication --- src/fsharp/CompileOps.fs | 51 ++++---- src/fsharp/CompileOps.fsi | 7 +- src/fsharp/TypeChecker.fs | 4 +- src/fsharp/fsc.fs | 10 +- src/fsharp/range.fs | 2 +- src/fsharp/service/IncrementalBuild.fs | 158 +++++++++++++----------- src/fsharp/service/IncrementalBuild.fsi | 5 +- src/fsharp/service/service.fs | 13 +- 8 files changed, 136 insertions(+), 114 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 1f98512bee8..6fa771ab959 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -3520,34 +3520,37 @@ let PostParseModuleSpecs (defaultNamespace, filename, isLastCompiland, ParsedSig ParsedInput.SigFile(ParsedSigFileInput(filename, qualName, scopedPragmas, hashDirectives, specs)) +type ModuleNamesDict = Map> + /// Checks if a module name is already given and deduplicates the name if needed. -let DeduplicateModuleName (moduleNamesDict:IDictionary>) (paths: Set) path (qualifiedNameOfFile: QualifiedNameOfFile) = - let count = if paths.Contains path then paths.Count else paths.Count + 1 - moduleNamesDict.[qualifiedNameOfFile.Text] <- Set.add path paths - let id = qualifiedNameOfFile.Id - if count = 1 then qualifiedNameOfFile else QualifiedNameOfFile(Ident(id.idText + "___" + count.ToString(), id.idRange)) +let DeduplicateModuleName (moduleNamesDict:ModuleNamesDict) fileName (qualNameOfFile: QualifiedNameOfFile) = + let path = Path.GetDirectoryName fileName + let path = if FileSystem.IsPathRootedShim path then try FileSystem.GetFullPathShim path with _ -> path else path + match moduleNamesDict.TryGetValue qualNameOfFile.Text with + | true, paths -> + if paths.ContainsKey path then + paths.[path], moduleNamesDict + else + let count = paths.Count + 1 + let id = qualNameOfFile.Id + let qualNameOfFileT = if count = 1 then qualNameOfFile else QualifiedNameOfFile(Ident(id.idText + "___" + count.ToString(), id.idRange)) + let moduleNamesDictT = moduleNamesDict.Add(qualNameOfFile.Text, paths.Add(path, qualNameOfFileT)) + qualNameOfFileT, moduleNamesDictT + | _ -> + let moduleNamesDictT = moduleNamesDict.Add(qualNameOfFile.Text, Map.empty.Add(path, qualNameOfFile)) + qualNameOfFile, moduleNamesDictT /// Checks if a ParsedInput is using a module name that was already given and deduplicates the name if needed. -let DeduplicateParsedInputModuleName (moduleNamesDict:IDictionary>) input = +let DeduplicateParsedInputModuleName (moduleNamesDict: ModuleNamesDict) input = match input with - | ParsedInput.ImplFile (ParsedImplFileInput.ParsedImplFileInput(fileName, isScript, qualifiedNameOfFile, scopedPragmas, hashDirectives, modules, (isLastCompiland, isExe))) -> - let path = Path.GetDirectoryName fileName - match moduleNamesDict.TryGetValue qualifiedNameOfFile.Text with - | true, paths -> - let qualifiedNameOfFile = DeduplicateModuleName moduleNamesDict paths path qualifiedNameOfFile - ParsedInput.ImplFile(ParsedImplFileInput.ParsedImplFileInput(fileName, isScript, qualifiedNameOfFile, scopedPragmas, hashDirectives, modules, (isLastCompiland, isExe))) - | _ -> - moduleNamesDict.[qualifiedNameOfFile.Text] <- Set.singleton path - input - | ParsedInput.SigFile (ParsedSigFileInput.ParsedSigFileInput(fileName, qualifiedNameOfFile, scopedPragmas, hashDirectives, modules)) -> - let path = Path.GetDirectoryName fileName - match moduleNamesDict.TryGetValue qualifiedNameOfFile.Text with - | true, paths -> - let qualifiedNameOfFile = DeduplicateModuleName moduleNamesDict paths path qualifiedNameOfFile - ParsedInput.SigFile (ParsedSigFileInput.ParsedSigFileInput(fileName, qualifiedNameOfFile, scopedPragmas, hashDirectives, modules)) - | _ -> - moduleNamesDict.[qualifiedNameOfFile.Text] <- Set.singleton path - input + | ParsedInput.ImplFile (ParsedImplFileInput.ParsedImplFileInput(fileName, isScript, qualNameOfFile, scopedPragmas, hashDirectives, modules, (isLastCompiland, isExe))) -> + let qualNameOfFileT, moduleNamesDictT = DeduplicateModuleName moduleNamesDict fileName qualNameOfFile + let inputT = ParsedInput.ImplFile(ParsedImplFileInput.ParsedImplFileInput(fileName, isScript, qualNameOfFileT, scopedPragmas, hashDirectives, modules, (isLastCompiland, isExe))) + inputT, moduleNamesDictT + | ParsedInput.SigFile (ParsedSigFileInput.ParsedSigFileInput(fileName, qualNameOfFile, scopedPragmas, hashDirectives, modules)) -> + let qualNameOfFileT, moduleNamesDictT = DeduplicateModuleName moduleNamesDict fileName qualNameOfFile + let inputT = ParsedInput.SigFile (ParsedSigFileInput.ParsedSigFileInput(fileName, qualNameOfFileT, scopedPragmas, hashDirectives, modules)) + inputT, moduleNamesDictT let ParseInput (lexer, errorLogger:ErrorLogger, lexbuf:UnicodeLexing.Lexbuf, defaultNamespace, filename, isLastCompiland) = // The assert below is almost ok, but it fires in two cases: diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index eb371fa5927..897f772633d 100755 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -59,12 +59,13 @@ val ComputeQualifiedNameOfFileFromUniquePath: range * string list -> Ast.Qualifi val PrependPathToInput: Ast.Ident list -> Ast.ParsedInput -> Ast.ParsedInput -/// Checks if a module name is already given and deduplicates the name if needed. -val DeduplicateModuleName: IDictionary> -> Set -> string -> Ast.QualifiedNameOfFile -> Ast.QualifiedNameOfFile +/// State used to de-deuplicate module names along a list of file names +type ModuleNamesDict = Map> /// Checks if a ParsedInput is using a module name that was already given and deduplicates the name if needed. -val DeduplicateParsedInputModuleName: IDictionary> -> Ast.ParsedInput -> Ast.ParsedInput +val DeduplicateParsedInputModuleName: ModuleNamesDict -> Ast.ParsedInput -> Ast.ParsedInput * ModuleNamesDict +/// Parse a single input (A signature file or implementation file) val ParseInput: (UnicodeLexing.Lexbuf -> Parser.token) * ErrorLogger * UnicodeLexing.Lexbuf * string option * string * isLastCompiland:(bool * bool) -> Ast.ParsedInput //---------------------------------------------------------------------------- diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index c55cd9e63b4..a78405bfb6e 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -10060,7 +10060,7 @@ and TcMethodApplication | CallerLineNumber, _ when typeEquiv cenv.g currCalledArgTy cenv.g.int_ty -> emptyPreBinder, Expr.Const(Const.Int32(mMethExpr.StartLine), mMethExpr, currCalledArgTy) | CallerFilePath, _ when typeEquiv cenv.g currCalledArgTy cenv.g.string_ty -> - emptyPreBinder, Expr.Const(Const.String(System.IO.Path.GetFullPath(mMethExpr.FileName)), mMethExpr, currCalledArgTy) + emptyPreBinder, Expr.Const(Const.String(FileSystem.GetFullPathShim(mMethExpr.FileName)), mMethExpr, currCalledArgTy) | CallerMemberName, Some(callerName) when (typeEquiv cenv.g currCalledArgTy cenv.g.string_ty) -> emptyPreBinder, Expr.Const(Const.String(callerName), mMethExpr, currCalledArgTy) | _ -> @@ -10099,7 +10099,7 @@ and TcMethodApplication let lineExpr = Expr.Const(Const.Int32(mMethExpr.StartLine), mMethExpr, calledNonOptTy) emptyPreBinder, mkUnionCaseExpr(mkSomeCase cenv.g, [calledNonOptTy], [lineExpr], mMethExpr) | CallerFilePath, _ when typeEquiv cenv.g calledNonOptTy cenv.g.string_ty -> - let filePathExpr = Expr.Const(Const.String(System.IO.Path.GetFullPath(mMethExpr.FileName)), mMethExpr, calledNonOptTy) + let filePathExpr = Expr.Const(Const.String(FileSystem.GetFullPathShim(mMethExpr.FileName)), mMethExpr, calledNonOptTy) emptyPreBinder, mkUnionCaseExpr(mkSomeCase cenv.g, [calledNonOptTy], [filePathExpr], mMethExpr) | CallerMemberName, Some(callerName) when typeEquiv cenv.g calledNonOptTy cenv.g.string_ty -> let memberNameExpr = Expr.Const(Const.String(callerName), mMethExpr, calledNonOptTy) diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index b19c3b280ab..f3117e16e86 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -1773,11 +1773,9 @@ let main0(ctok, argv, legacyReferenceResolver, bannerAlreadyPrinted, reduceMemor errorRecoveryNoRange e exiter.Exit 1 - let inputs = - // Deduplicate module names - let moduleNamesDict = ConcurrentDictionary>() - inputs - |> List.map (fun (input,x) -> DeduplicateParsedInputModuleName moduleNamesDict input,x) + let inputs, _ = + (Map.empty, inputs) + ||> List.mapFold (fun state (input,x) -> let inputT, stateT = DeduplicateParsedInputModuleName state input in (inputT,x), stateT) if tcConfig.parseOnly then exiter.Exit 0 if not tcConfig.continueAfterParseFailure then @@ -2036,7 +2034,7 @@ let main4 dynamicAssemblyCreator (Args (ctok, tcConfig, tcImports: TcImports, t DoesNotRequireCompilerThreadTokenAndCouldPossiblyBeMadeConcurrent ctok - let pdbfile = pdbfile |> Option.map (tcConfig.MakePathAbsolute >> Path.GetFullPath) + let pdbfile = pdbfile |> Option.map (tcConfig.MakePathAbsolute >> FileSystem.GetFullPathShim) let normalizeAssemblyRefs (aref:ILAssemblyRef) = match tcImports.TryFindDllInfo (ctok, Range.rangeStartup, aref.Name, lookupOnly=false) with diff --git a/src/fsharp/range.fs b/src/fsharp/range.fs index 7f31e032a9f..b68de583d97 100755 --- a/src/fsharp/range.fs +++ b/src/fsharp/range.fs @@ -197,7 +197,7 @@ type range(code1:int64, code2: int64) = let mkRange f b e = // remove relative parts from full path - let normalizedFilePath = if Path.IsPathRooted f then try Path.GetFullPath f with _ -> f else f + let normalizedFilePath = if FileSystem.IsPathRootedShim f then try FileSystem.GetFullPathShim f with _ -> f else f range (fileIndexOfFile normalizedFilePath, b, e) let mkFileIndexRange fi b e = range (fi, b, e) diff --git a/src/fsharp/service/IncrementalBuild.fs b/src/fsharp/service/IncrementalBuild.fs index 37c4b16bf21..f5d0141b32e 100755 --- a/src/fsharp/service/IncrementalBuild.fs +++ b/src/fsharp/service/IncrementalBuild.fs @@ -55,15 +55,16 @@ module internal IncrementalBuild = /// Get the Id for the given ScalarBuildRule. member x.Id = match x with - | ScalarInput(id, _) ->id - | ScalarDemultiplex(id, _, _, _) ->id - | ScalarMap(id, _, _, _) ->id + | ScalarInput(id, _) -> id + | ScalarDemultiplex(id, _, _, _) -> id + | ScalarMap(id, _, _, _) -> id + /// Get the Name for the givenScalarExpr. member x.Name = match x with - | ScalarInput(_, n) ->n - | ScalarDemultiplex(_, n, _, _) ->n - | ScalarMap(_, n, _, _) ->n + | ScalarInput(_, n) -> n + | ScalarDemultiplex(_, n, _, _) -> n + | ScalarMap(_, n, _, _) -> n /// A build rule with a vector of outputs and VectorBuildRule = @@ -1034,6 +1035,7 @@ type TypeCheckAccumulator = /// Accumulated 'open' declarations, last file first tcOpenDeclarationsRev: OpenDeclaration[] list + topAttribs:TopAttribs option /// Result of checking most recent file, if any @@ -1043,6 +1045,9 @@ type TypeCheckAccumulator = tcDependencyFiles: string list + /// Disambiguation table for module names + tcModuleNamesDict: ModuleNamesDict + /// Accumulated errors, last file first tcErrorsRev:(PhasedDiagnostic * FSharpErrorSeverity)[] list } @@ -1125,10 +1130,17 @@ type PartialCheckResults = /// Kept in a stack so that each incremental update shares storage with previous files TcOpenDeclarationsRev: OpenDeclaration[] list + /// Disambiguation table for module names + ModuleNamesDict: ModuleNamesDict + TcDependencyFiles: string list + TopAttribs: TopAttribs option + TimeStamp: DateTime + LatestImplementationFile: TypedImplFile option + LastestCcuSigForFile: ModuleOrNamespaceType option } member x.TcErrors = Array.concat (List.rev x.TcErrorsRev) @@ -1146,6 +1158,7 @@ type PartialCheckResults = TcOpenDeclarationsRev = tcAcc.tcOpenDeclarationsRev TcDependencyFiles = tcAcc.tcDependencyFiles TopAttribs = tcAcc.topAttribs + ModuleNamesDict = tcAcc.tcModuleNamesDict TimeStamp = timestamp LatestImplementationFile = tcAcc.latestImplFile LastestCcuSigForFile = tcAcc.latestCcuSigForFile } @@ -1175,7 +1188,9 @@ type RawFSharpAssemblyDataBackedByLanguageService (tcConfig, tcGlobals, tcState: yield (ccuName, (fun () -> r.GetBytes())) ] let autoOpenAttrs = topAttrs.assemblyAttrs |> List.choose (List.singleton >> TryFindFSharpStringAttribute tcGlobals tcGlobals.attrib_AutoOpenAttribute) + let ivtAttrs = topAttrs.assemblyAttrs |> List.choose (List.singleton >> TryFindFSharpStringAttribute tcGlobals tcGlobals.attrib_InternalsVisibleToAttribute) + interface IRawFSharpAssemblyData with member __.GetAutoOpenAttributes(_ilg) = autoOpenAttrs member __.GetInternalsVisibleToAttributes(_ilg) = ivtAttrs @@ -1246,6 +1261,7 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput let assertNotDisposed() = if disposed then System.Diagnostics.Debug.Assert(false, "IncrementalBuild object has already been disposed!") + let mutable referenceCount = 0 //---------------------------------------------------- @@ -1258,14 +1274,9 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput assertNotDisposed() cache.GetFileTimeStamp filename - // Deduplicate module names - let moduleNamesDict = ConcurrentDictionary>() - /// This is a build task function that gets placed into the build rules as the computation for a VectorMap /// - /// Parse the given files and return the given inputs. This function is expected to be - /// able to be called with a subset of sourceFiles and return the corresponding subset of - /// parsed inputs. + /// Parse the given file and return the given input. let ParseTask ctok (sourceRange:range, filename:string, isLastCompiland) = assertNotDisposed() DoesNotRequireCompilerThreadTokenAndCouldPossiblyBeMadeConcurrent ctok @@ -1278,9 +1289,8 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput IncrementalBuilderEventTesting.MRU.Add(IncrementalBuilderEventTesting.IBEParsed filename) let input = ParseOneInputFile(tcConfig, lexResourceManager, [], filename , isLastCompiland, errorLogger, (*retryLocked*)true) fileParsed.Trigger (filename) - let result = Option.map (DeduplicateParsedInputModuleName moduleNamesDict) input - result, sourceRange, filename, errorLogger.GetErrors () + input, sourceRange, filename, errorLogger.GetErrors () with exn -> let msg = sprintf "unexpected failure in IncrementalFSharpBuild.Parse\nerror = %s" (exn.ToString()) System.Diagnostics.Debug.Assert(false, msg) @@ -1357,7 +1367,8 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput latestImplFile=None latestCcuSigForFile=None tcDependencyFiles=basicDependencies - tcErrorsRev = [ initialErrors ] } + tcErrorsRev = [ initialErrors ] + tcModuleNamesDict = Map.empty } return tcAcc } /// This is a build task function that gets placed into the build rules as the computation for a Vector.ScanLeft @@ -1378,6 +1389,8 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput let sink = TcResultsSinkImpl(tcAcc.tcGlobals) let hadParseErrors = not (Array.isEmpty parseErrors) + let input, moduleNamesDict = DeduplicateParsedInputModuleName tcAcc.tcModuleNamesDict input + let! (tcEnvAtEndOfFile, topAttribs, implFile, ccuSigForFile), tcState = TypeCheckOneInputEventually ((fun () -> hadParseErrors || errorLogger.ErrorCount > 0), @@ -1406,6 +1419,7 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput tcSymbolUsesRev=tcSymbolUses :: tcAcc.tcSymbolUsesRev tcOpenDeclarationsRev = sink.GetOpenDeclarations() :: tcAcc.tcOpenDeclarationsRev tcErrorsRev = newErrors :: tcAcc.tcErrorsRev + tcModuleNamesDict = moduleNamesDict tcDependencyFiles = filename :: tcAcc.tcDependencyFiles } } @@ -1448,55 +1462,55 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput TypeCheckMultipleInputsFinish (results, finalAcc.tcState) let ilAssemRef, tcAssemblyDataOpt, tcAssemblyExprOpt = - try - // TypeCheckClosedInputSetFinish fills in tcState.Ccu but in incremental scenarios we don't want this, - // so we make this temporary here - let oldContents = tcState.Ccu.Deref.Contents - try - let tcState, tcAssemblyExpr = TypeCheckClosedInputSetFinish (mimpls, tcState) - - // Compute the identity of the generated assembly based on attributes, options etc. - // Some of this is duplicated from fsc.fs - let ilAssemRef = - let publicKey = - try - let signingInfo = Driver.ValidateKeySigningAttributes (tcConfig, tcGlobals, topAttrs) - match Driver.GetStrongNameSigner signingInfo with - | None -> None - | Some s -> Some (PublicKey.KeyAsToken(s.PublicKey)) - with e -> - errorRecoveryNoRange e - None - let locale = TryFindFSharpStringAttribute tcGlobals (tcGlobals.FindSysAttrib "System.Reflection.AssemblyCultureAttribute") topAttrs.assemblyAttrs - let assemVerFromAttrib = - TryFindFSharpStringAttribute tcGlobals (tcGlobals.FindSysAttrib "System.Reflection.AssemblyVersionAttribute") topAttrs.assemblyAttrs - |> Option.bind (fun v -> try Some (parseILVersion v) with _ -> None) - let ver = - match assemVerFromAttrib with - | None -> tcConfig.version.GetVersionInfo(tcConfig.implicitIncludeDir) - | Some v -> v - ILAssemblyRef.Create(assemblyName, None, publicKey, false, Some ver, locale) - - let tcAssemblyDataOpt = + try + // TypeCheckClosedInputSetFinish fills in tcState.Ccu but in incremental scenarios we don't want this, + // so we make this temporary here + let oldContents = tcState.Ccu.Deref.Contents try - // Assemblies containing type provider components can not successfully be used via cross-assembly references. - // We return 'None' for the assembly portion of the cross-assembly reference - let hasTypeProviderAssemblyAttrib = - topAttrs.assemblyAttrs |> List.exists (fun (Attrib(tcref, _, _, _, _, _, _)) -> tcref.CompiledRepresentationForNamedType.BasicQualifiedName = typeof.FullName) - if tcState.CreatesGeneratedProvidedTypes || hasTypeProviderAssemblyAttrib then - None - else - Some (RawFSharpAssemblyDataBackedByLanguageService (tcConfig, tcGlobals, tcState, outfile, topAttrs, assemblyName, ilAssemRef) :> IRawFSharpAssemblyData) - - with e -> - errorRecoveryNoRange e - None - ilAssemRef, tcAssemblyDataOpt, Some tcAssemblyExpr - finally - tcState.Ccu.Deref.Contents <- oldContents - with e -> - errorRecoveryNoRange e - mkSimpleAssemblyRef assemblyName, None, None + let tcState, tcAssemblyExpr = TypeCheckClosedInputSetFinish (mimpls, tcState) + + // Compute the identity of the generated assembly based on attributes, options etc. + // Some of this is duplicated from fsc.fs + let ilAssemRef = + let publicKey = + try + let signingInfo = Driver.ValidateKeySigningAttributes (tcConfig, tcGlobals, topAttrs) + match Driver.GetStrongNameSigner signingInfo with + | None -> None + | Some s -> Some (PublicKey.KeyAsToken(s.PublicKey)) + with e -> + errorRecoveryNoRange e + None + let locale = TryFindFSharpStringAttribute tcGlobals (tcGlobals.FindSysAttrib "System.Reflection.AssemblyCultureAttribute") topAttrs.assemblyAttrs + let assemVerFromAttrib = + TryFindFSharpStringAttribute tcGlobals (tcGlobals.FindSysAttrib "System.Reflection.AssemblyVersionAttribute") topAttrs.assemblyAttrs + |> Option.bind (fun v -> try Some (parseILVersion v) with _ -> None) + let ver = + match assemVerFromAttrib with + | None -> tcConfig.version.GetVersionInfo(tcConfig.implicitIncludeDir) + | Some v -> v + ILAssemblyRef.Create(assemblyName, None, publicKey, false, Some ver, locale) + + let tcAssemblyDataOpt = + try + // Assemblies containing type provider components can not successfully be used via cross-assembly references. + // We return 'None' for the assembly portion of the cross-assembly reference + let hasTypeProviderAssemblyAttrib = + topAttrs.assemblyAttrs |> List.exists (fun (Attrib(tcref, _, _, _, _, _, _)) -> tcref.CompiledRepresentationForNamedType.BasicQualifiedName = typeof.FullName) + if tcState.CreatesGeneratedProvidedTypes || hasTypeProviderAssemblyAttrib then + None + else + Some (RawFSharpAssemblyDataBackedByLanguageService (tcConfig, tcGlobals, tcState, outfile, topAttrs, assemblyName, ilAssemRef) :> IRawFSharpAssemblyData) + + with e -> + errorRecoveryNoRange e + None + ilAssemRef, tcAssemblyDataOpt, Some tcAssemblyExpr + finally + tcState.Ccu.Deref.Contents <- oldContents + with e -> + errorRecoveryNoRange e + mkSimpleAssemblyRef assemblyName, None, None let finalAccWithErrors = { finalAcc with @@ -1561,9 +1575,9 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput member this.IncrementUsageCount() = assertNotDisposed() System.Threading.Interlocked.Increment(&referenceCount) |> ignore - { new System.IDisposable with member x.Dispose() = this.DecrementUsageCount() } + { new System.IDisposable with member __.Dispose() = this.DecrementUsageCount() } - member this.DecrementUsageCount() = + member __.DecrementUsageCount() = assertNotDisposed() let currentValue = System.Threading.Interlocked.Decrement(&referenceCount) if currentValue = 0 then @@ -1573,11 +1587,17 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput member __.IsAlive = referenceCount > 0 member __.TcConfig = tcConfig + member __.FileParsed = fileParsed.Publish + member __.BeforeFileChecked = beforeFileChecked.Publish + member __.FileChecked = fileChecked.Publish + member __.ProjectChecked = projectChecked.Publish + member __.ImportedCcusInvalidated = importsInvalidated.Publish + member __.AllDependenciesDeprecated = allDependencies #if !NO_EXTENSIONTYPING @@ -1622,7 +1642,7 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput | (*first file*) 0 -> IncrementalBuild.IsReady cache (Target(initialTcAccNode, None)) partialBuild | _ -> IncrementalBuild.IsReady cache (Target(tcStatesNode, Some (slotOfFile-1))) partialBuild - member builder.GetCheckResultsBeforeSlotInProject (ctok: CompilationThreadToken, slotOfFile) = + member __.GetCheckResultsBeforeSlotInProject (ctok: CompilationThreadToken, slotOfFile) = cancellable { let cache = TimeStampCache(defaultTimeStamp) let! result = @@ -1652,9 +1672,6 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput member builder.GetCheckResultsAfterLastFileInProject (ctok: CompilationThreadToken) = builder.GetCheckResultsBeforeSlotInProject(ctok, builder.GetSlotsCount()) - member builder.DeduplicateParsedInputModuleNameInProject (input) = - DeduplicateParsedInputModuleName moduleNamesDict input - member __.GetCheckResultsAndImplementationsForProject(ctok: CompilationThreadToken) = cancellable { let cache = TimeStampCache(defaultTimeStamp) @@ -1861,10 +1878,11 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput return builderOpt, diagnostics } + static member KeepBuilderAlive (builderOpt: IncrementalBuilder option) = match builderOpt with | Some builder -> builder.IncrementUsageCount() | None -> { new System.IDisposable with member __.Dispose() = () } - member builder.IsBeingKeptAliveApartFromCacheEntry = (referenceCount >= 2) + member __.IsBeingKeptAliveApartFromCacheEntry = (referenceCount >= 2) diff --git a/src/fsharp/service/IncrementalBuild.fsi b/src/fsharp/service/IncrementalBuild.fsi index b6b64a7ffd0..29c7a03a454 100755 --- a/src/fsharp/service/IncrementalBuild.fsi +++ b/src/fsharp/service/IncrementalBuild.fsi @@ -55,6 +55,9 @@ type internal PartialCheckResults = /// Represents open declarations TcOpenDeclarationsRev: OpenDeclaration[] list + /// Disambiguation table for module names + ModuleNamesDict: ModuleNamesDict + TcDependencyFiles: string list /// Represents the collected attributes to apply to the module of assuembly generates @@ -151,8 +154,6 @@ type internal IncrementalBuilder = // TODO: make this an Eventually (which can be scheduled) or an Async (which can be cancelled) member GetCheckResultsAndImplementationsForProject : CompilationThreadToken -> Cancellable - member DeduplicateParsedInputModuleNameInProject: Ast.ParsedInput -> Ast.ParsedInput - /// Get the logical time stamp that is associated with the output of the project if it were gully built immediately member GetLogicalTimeStampForProject: TimeStampCache * CompilationThreadToken -> DateTime diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index d8eb7442b4a..f4694cdfaf5 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -1624,6 +1624,7 @@ module internal Parser = tcGlobals: TcGlobals, tcImports: TcImports, tcState: TcState, + moduleNamesDict: ModuleNamesDict, loadClosure: LoadClosure option, // These are the errors and warnings seen by the background compiler for the entire antecedent backgroundDiagnostics: (PhasedDiagnostic * FSharpErrorSeverity)[], @@ -1727,6 +1728,9 @@ module internal Parser = async { try let checkForErrors() = (parseResults.ParseHadErrors || errHandler.ErrorCount > 0) + + let parsedMainInput, _moduleNamesDict = DeduplicateParsedInputModuleName moduleNamesDict parsedMainInput + // Typecheck is potentially a long running operation. We chop it up here with an Eventually continuation and, at each slice, give a chance // for the client to claim the result as obsolete and have the typecheck abort. @@ -2605,7 +2609,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC let loadClosure = scriptClosureCacheLock.AcquireLock (fun ltok -> scriptClosureCache.TryGet (ltok, options)) let! tcErrors, tcFileResult = Parser.CheckOneFile(parseResults, source, fileName, options.ProjectFileName, tcPrior.TcConfig, tcPrior.TcGlobals, tcPrior.TcImports, - tcPrior.TcState, loadClosure, tcPrior.TcErrors, reactorOps, (fun () -> builder.IsAlive), textSnapshotInfo, userOpName) + tcPrior.TcState, tcPrior.ModuleNamesDict, loadClosure, tcPrior.TcErrors, reactorOps, (fun () -> builder.IsAlive), textSnapshotInfo, userOpName) let parsingOptions = FSharpParsingOptions.FromTcConfig(tcPrior.TcConfig, Array.ofList builder.SourceFiles, options.UseScriptResolutionRules) let checkAnswer = MakeCheckFileAnswer(fileName, tcFileResult, options, builder, Array.ofList tcPrior.TcDependencyFiles, creationErrors, parseResults.Errors, tcErrors) bc.RecordTypeCheckFileInProjectResults(fileName, options, parsingOptions, parseResults, fileVersion, tcPrior.TimeStamp, Some checkAnswer, source) @@ -2686,9 +2690,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC | _ -> Trace.TraceInformation("FCS: {0}.{1} ({2})", userOpName, "CheckFileInProject.CacheMiss", filename) let! tcPrior = execWithReactorAsync <| fun ctok -> builder.GetCheckResultsBeforeFileInProject (ctok, filename) - let parseTreeOpt = parseResults.ParseTree |> Option.map builder.DeduplicateParsedInputModuleNameInProject - let parseResultsAterDeDuplication = FSharpParseFileResults(parseResults.Errors, parseTreeOpt, parseResults.ParseHadErrors, parseResults.DependencyFiles) - let! checkAnswer = bc.CheckOneFileImpl(parseResultsAterDeDuplication, source, filename, options, textSnapshotInfo, fileVersion, builder, tcPrior, creationErrors, userOpName) + let! checkAnswer = bc.CheckOneFileImpl(parseResults, source, filename, options, textSnapshotInfo, fileVersion, builder, tcPrior, creationErrors, userOpName) return checkAnswer finally bc.ImplicitlyStartCheckProjectInBackground(options, userOpName) @@ -2731,7 +2733,6 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC // Do the parsing. let parsingOptions = FSharpParsingOptions.FromTcConfig(builder.TcConfig, Array.ofList (builder.SourceFiles), options.UseScriptResolutionRules) let parseErrors, parseTreeOpt, anyErrors = Parser.parseFile (source, filename, parsingOptions, userOpName) - let parseTreeOpt = parseTreeOpt |> Option.map builder.DeduplicateParsedInputModuleNameInProject let parseResults = FSharpParseFileResults(parseErrors, parseTreeOpt, anyErrors, builder.AllDependenciesDeprecated) let! checkResults = bc.CheckOneFileImpl(parseResults, source, filename, options, textSnapshotInfo, fileVersion, builder, tcPrior, creationErrors, userOpName) @@ -3331,7 +3332,7 @@ type FsiInteractiveChecker(legacyReferenceResolver, reactorOps: IReactorOperatio CompileOptions.ParseCompilerOptions (ignore, fsiCompilerOptions, [ ]) let loadClosure = LoadClosure.ComputeClosureOfScriptText(ctok, legacyReferenceResolver, defaultFSharpBinariesDir, filename, source, CodeContext.Editing, tcConfig.useSimpleResolution, tcConfig.useFsiAuxLib, new Lexhelp.LexResourceManager(), applyCompilerOptions, assumeDotNetFramework, tryGetMetadataSnapshot=(fun _ -> None), reduceMemoryUsage=reduceMemoryUsage) - let! tcErrors, tcFileResult = Parser.CheckOneFile(parseResults, source, filename, "project", tcConfig, tcGlobals, tcImports, tcState, Some loadClosure, backgroundDiagnostics, reactorOps, (fun () -> true), None, userOpName) + let! tcErrors, tcFileResult = Parser.CheckOneFile(parseResults, source, filename, "project", tcConfig, tcGlobals, tcImports, tcState, Map.empty, Some loadClosure, backgroundDiagnostics, reactorOps, (fun () -> true), None, userOpName) return match tcFileResult with From 4753edd9e8f1653b91567efa3d883bf8e9da876d Mon Sep 17 00:00:00 2001 From: Don Syme Date: Mon, 14 Jan 2019 21:04:53 +0000 Subject: [PATCH 14/24] potential fix for 5932 (#6070) * poss fix * poss fix * Update range.fs * Update range.fs * fix build * docs and limit fix * Update src/fsharp/range.fs Co-Authored-By: dsyme * Update range.fs --- src/fsharp/range.fs | 150 +++++++++++++++++++++++++++-------- src/fsharp/range.fsi | 87 ++++++++++++++++++-- tests/service/EditorTests.fs | 6 ++ 3 files changed, 204 insertions(+), 39 deletions(-) diff --git a/src/fsharp/range.fs b/src/fsharp/range.fs index b68de583d97..4e97edc2b37 100755 --- a/src/fsharp/range.fs +++ b/src/fsharp/range.fs @@ -5,7 +5,6 @@ module Microsoft.FSharp.Compiler.Range open System open System.IO -open System.Collections.Generic open System.Collections.Concurrent open Microsoft.FSharp.Core.Printf open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library @@ -16,17 +15,20 @@ type FileIndex = int32 [] let columnBitCount = 20 + [] let lineBitCount = 31 let posBitCount = lineBitCount + columnBitCount -let _ = assert (posBitCount <= 64) + let posColumnMask = mask64 0 columnBitCount + let lineColumnMask = mask64 columnBitCount lineBitCount [] [] type pos(code:int64) = + new (l, c) = let l = max 0 l let c = max 0 c @@ -35,63 +37,80 @@ type pos(code:int64) = pos p member p.Line = int32 (uint64 code >>> columnBitCount) + member p.Column = int32 (code &&& posColumnMask) member r.Encoding = code + static member EncodingSize = posBitCount + static member Decode (code:int64) : pos = pos code + override p.Equals(obj) = match obj with :? pos as p2 -> code = p2.Encoding | _ -> false + override p.GetHashCode() = hash code + override p.ToString() = sprintf "(%d,%d)" p.Line p.Column [] let fileIndexBitCount = 24 + [] let startColumnBitCount = columnBitCount // 20 + [] let endColumnBitCount = columnBitCount // 20 [] let startLineBitCount = lineBitCount // 31 + [] let heightBitCount = 27 + [] let isSyntheticBitCount = 1 -#if DEBUG -let _ = assert (fileIndexBitCount + startColumnBitCount + endColumnBitCount <= 64) -let _ = assert (startLineBitCount + heightBitCount + isSyntheticBitCount <= 64) -#endif - + [] let fileIndexShift = 0 + [] let startColumnShift = 24 + [] let endColumnShift = 44 [] let startLineShift = 0 + [] let heightShift = 31 + [] let isSyntheticShift = 58 - [] let fileIndexMask = 0b0000000000000000000000000000000000000000111111111111111111111111L + [] let startColumnMask = 0b0000000000000000000011111111111111111111000000000000000000000000L + [] let endColumnMask = 0b1111111111111111111100000000000000000000000000000000000000000000L [] let startLineMask = 0b0000000000000000000000000000000001111111111111111111111111111111L + [] let heightMask = 0b0000001111111111111111111111111110000000000000000000000000000000L + [] let isSyntheticMask = 0b0000010000000000000000000000000000000000000000000000000000000000L #if DEBUG +let _ = assert (posBitCount <= 64) +let _ = assert (fileIndexBitCount + startColumnBitCount + endColumnBitCount <= 64) +let _ = assert (startLineBitCount + heightBitCount + isSyntheticBitCount <= 64) + let _ = assert (startColumnShift = fileIndexShift + fileIndexBitCount) let _ = assert (endColumnShift = startColumnShift + startColumnBitCount) @@ -106,24 +125,64 @@ let _ = assert (endColumnMask = mask64 endColumnShift endColumnBitCount) let _ = assert (isSyntheticMask = mask64 isSyntheticShift isSyntheticBitCount) #endif -// This is just a standard unique-index table +/// Removes relative parts from any full paths +let normalizeFilePath (filePath: string) = + try + if FileSystem.IsPathRootedShim filePath then + FileSystem.GetFullPathShim filePath + else + filePath + with _ -> filePath + +/// A unique-index table for file names. type FileIndexTable() = let indexToFileTable = new ResizeArray<_>(11) let fileToIndexTable = new ConcurrentDictionary() - member t.FileToIndex f = - let mutable res = 0 - let ok = fileToIndexTable.TryGetValue(f, &res) - if ok then res - else + + // Note: we should likely adjust this code to always normalize. However some testing (and possibly some + // product behaviour) appears to be sensitive to error messages reporting un-normalized file names. + // Currently all names going through 'mkRange' get normalized, while this going through just 'fileIndexOfFile' + // do not. Also any file names which are not put into ranges at all are non-normalized. + // + // TO move forward we should eventually introduce a new type NormalizedFileName that tracks this invariant. + member t.FileToIndex normalize filePath = + match fileToIndexTable.TryGetValue(filePath) with + | true, idx -> idx + | _ -> + + // Try again looking for a normalized entry. + let normalizedFilePath = if normalize then normalizeFilePath filePath else filePath + match fileToIndexTable.TryGetValue(normalizedFilePath) with + | true, idx -> + // Record the non-normalized entry if necessary + if filePath <> normalizedFilePath then + lock fileToIndexTable (fun () -> + fileToIndexTable.[filePath] <- idx) + + // Return the index + idx + + | _ -> lock fileToIndexTable (fun () -> - let n = indexToFileTable.Count in - indexToFileTable.Add(f) - fileToIndexTable.[f] <- n - n) + // Get the new index + let idx = indexToFileTable.Count + + // Record the normalized entry + indexToFileTable.Add normalizedFilePath + fileToIndexTable.[normalizedFilePath] <- idx + + // Record the non-normalized entry if necessary + if filePath <> normalizedFilePath then + fileToIndexTable.[filePath] <- idx + + // Return the index + idx) member t.IndexToFile n = - (if n < 0 then failwithf "fileOfFileIndex: negative argument: n = %d\n" n) - (if n >= indexToFileTable.Count then failwithf "fileOfFileIndex: invalid argument: n = %d\n" n) + if n < 0 then + failwithf "fileOfFileIndex: negative argument: n = %d\n" n + if n >= indexToFileTable.Count then + failwithf "fileOfFileIndex: invalid argument: n = %d\n" n indexToFileTable.[n] let maxFileIndex = pown32 fileIndexBitCount @@ -133,8 +192,11 @@ let maxFileIndex = pown32 fileIndexBitCount let fileIndexTable = new FileIndexTable() // If we exceed the maximum number of files we'll start to report incorrect file names -let fileIndexOfFile f = fileIndexTable.FileToIndex(f) % maxFileIndex -let fileOfFileIndex n = fileIndexTable.IndexToFile(n) +let fileIndexOfFileAux normalize f = fileIndexTable.FileToIndex normalize f % maxFileIndex + +let fileIndexOfFile filePath = fileIndexOfFileAux false filePath + +let fileOfFileIndex idx = fileIndexTable.IndexToFile idx let mkPos l c = pos (l, c) @@ -158,19 +220,31 @@ type range(code1:int64, code2: int64) = new (fidx, b:pos, e:pos) = range(fidx, b.Line, b.Column, e.Line, e.Column) member r.StartLine = int32((code2 &&& startLineMask) >>> startLineShift) + member r.StartColumn = int32((code1 &&& startColumnMask) >>> startColumnShift) + member r.EndLine = int32((code2 &&& heightMask) >>> heightShift) + r.StartLine + member r.EndColumn = int32((code1 &&& endColumnMask) >>> endColumnShift) + member r.IsSynthetic = int32((code2 &&& isSyntheticMask) >>> isSyntheticShift) <> 0 + member r.Start = pos (r.StartLine, r.StartColumn) + member r.End = pos (r.EndLine, r.EndColumn) + member r.FileIndex = int32(code1 &&& fileIndexMask) + member m.StartRange = range (m.FileIndex, m.Start, m.Start) + member m.EndRange = range (m.FileIndex, m.End, m.End) + member r.FileName = fileOfFileIndex r.FileIndex + member r.MakeSynthetic() = range(code1, code2 ||| isSyntheticMask) member r.Code1 = code1 + member r.Code2 = code2 #if DEBUG @@ -195,30 +269,28 @@ type range(code1:int64, code2: int64) = override r.ToString() = sprintf "%s (%d,%d--%d,%d) IsSynthetic=%b" r.FileName r.StartLine r.StartColumn r.EndLine r.EndColumn r.IsSynthetic -let mkRange f b e = - // remove relative parts from full path - let normalizedFilePath = if FileSystem.IsPathRootedShim f then try FileSystem.GetFullPathShim f with _ -> f else f - range (fileIndexOfFile normalizedFilePath, b, e) +let mkRange filePath startPos endPos = range (fileIndexOfFileAux true filePath, startPos, endPos) -let mkFileIndexRange fi b e = range (fi, b, e) +let mkFileIndexRange fileIndex startPos endPos = range (fileIndex, startPos, endPos) -(* end representation, start derived ops *) - let posOrder = Order.orderOn (fun (p:pos) -> p.Line, p.Column) (Pair.order (Int32.order, Int32.order)) -(* rangeOrder: not a total order, but enough to sort on ranges *) + +/// rangeOrder: not a total order, but enough to sort on ranges let rangeOrder = Order.orderOn (fun (r:range) -> r.FileName, r.Start) (Pair.order (String.order, posOrder)) let outputPos (os:TextWriter) (m:pos) = fprintf os "(%d,%d)" m.Line m.Column + let outputRange (os:TextWriter) (m:range) = fprintf os "%s%a-%a" m.FileName outputPos m.Start outputPos m.End -let boutputPos os (m:pos) = bprintf os "(%d,%d)" m.Line m.Column -let boutputRange os (m:range) = bprintf os "%s%a-%a" m.FileName boutputPos m.Start boutputPos m.End let posGt (p1:pos) (p2:pos) = (p1.Line > p2.Line || (p1.Line = p2.Line && p1.Column > p2.Column)) + let posEq (p1:pos) (p2:pos) = (p1.Line = p2.Line && p1.Column = p2.Column) + let posGeq p1 p2 = posEq p1 p2 || posGt p1 p2 + let posLt p1 p2 = posGt p2 p1 -// This is deliberately written in an allocation-free way, i.e. m1.Start, m1.End etc. are not called +/// This is deliberately written in an allocation-free way, i.e. m1.Start, m1.End etc. are not called let unionRanges (m1:range) (m2:range) = if m1.FileIndex <> m2.FileIndex then m2 else let b = @@ -242,9 +314,13 @@ let rangeBeforePos (m1:range) p = posGeq p m1.End let rangeN filename line = mkRange filename (mkPos line 0) (mkPos line 0) + let pos0 = mkPos 1 0 + let range0 = rangeN "unknown" 1 + let rangeStartup = rangeN "startup" 1 + let rangeCmdArgs = rangeN "commandLineArgs" 0 let trimRangeToLine (r:range) = @@ -258,6 +334,7 @@ let trimRangeToLine (r:range) = (* For Diagnostics *) let stringOfPos (pos:pos) = sprintf "(%d,%d)" pos.Line pos.Column + let stringOfRange (r:range) = sprintf "%s%s-%s" r.FileName (stringOfPos r.Start) (stringOfPos r.End) #if CHECK_LINE0_TYPES // turn on to check that we correctly transform zero-based line counts to one-based line counts @@ -272,17 +349,22 @@ type Pos01 = Line0 * int type Range01 = Pos01 * Pos01 module Line = + // Visual Studio uses line counts starting at 0, F# uses them starting at 1 let fromZ (line:Line0) = int line+1 + let toZ (line:int) : Line0 = LanguagePrimitives.Int32WithMeasure(line - 1) module Pos = + let fromZ (line:Line0) idx = mkPos (Line.fromZ line) idx - let toZ (p:pos) = (Line.toZ p.Line, p.Column) + let toZ (p:pos) = (Line.toZ p.Line, p.Column) module Range = + let toZ (m:range) = Pos.toZ m.Start, Pos.toZ m.End + let toFileZ (m:range) = m.FileName, toZ m diff --git a/src/fsharp/range.fsi b/src/fsharp/range.fsi index 5b3ea1e24d7..d4ef8be800f 100755 --- a/src/fsharp/range.fsi +++ b/src/fsharp/range.fsi @@ -10,44 +10,86 @@ open Microsoft.FSharp.Compiler.AbstractIL.Internal open Microsoft.FSharp.Compiler -(* we keep a global tables of filenames that we can reference by integers *) +/// An index into a global tables of filenames type FileIndex = int32 -val fileIndexOfFile : string -> FileIndex + +/// Convert a file path to an index +val fileIndexOfFile : filePath: string -> FileIndex + +/// Convert an index into a file path val fileOfFileIndex : FileIndex -> string +/// Represents a position in a file [] type pos = + + /// The line number for the position member Line : int + + /// The column number for the position member Column : int + /// The encoding of the position as a 64-bit integer member Encoding : int64 + + /// Decode a position fro a 64-bit integer static member Decode : int64 -> pos + /// The maximum number of bits needed to store an encoded position static member EncodingSize : int /// Create a position for the given line and column val mkPos : line:int -> column:int -> pos +/// Ordering on positions val posOrder : IComparer +/// Represents a range within a known file [] type range = + + /// The start line of the range member StartLine : int + + /// The start column of the range member StartColumn : int + + /// The line number for the end position of the range member EndLine : int + + /// The column number for the end position of the range member EndColumn : int + + /// The start position of the range member Start : pos + + /// The end position of the range member End : pos + + /// The empty range that is located at the start position of the range member StartRange: range + + /// The empty range that is located at the end position of the range member EndRange: range + + /// The file index for the range member FileIndex : int + + /// The file name for the file of the range member FileName : string + /// Synthetic marks ranges which are produced by intermediate compilation phases. This /// bit signifies that the range covers something that should not be visible to language /// service operations like dot-completion. member IsSynthetic : bool + + /// Convert a range to be synthetic member MakeSynthetic : unit -> range + + /// Convert a range to string member ToShortString : unit -> string + + /// The range where all values are zero static member Zero : range /// This view of range marks uses file indexes explicitly @@ -56,34 +98,61 @@ val mkFileIndexRange : FileIndex -> pos -> pos -> range /// This view hides the use of file indexes and just uses filenames val mkRange : string -> pos -> pos -> range +/// Reduce a range so it only covers a line val trimRangeToLine : range -> range /// not a total order, but enough to sort on ranges val rangeOrder : IComparer +/// Output a position val outputPos : System.IO.TextWriter -> pos -> unit + +/// Output a range val outputRange : System.IO.TextWriter -> range -> unit -val boutputPos : StringBuilder -> pos -> unit -val boutputRange : StringBuilder -> range -> unit +/// Compare positions for less-than val posLt : pos -> pos -> bool + +/// Compare positions for greater-than val posGt : pos -> pos -> bool + +/// Compare positions for equality val posEq : pos -> pos -> bool + +/// Compare positions for greater-than-or-equal-to val posGeq : pos -> pos -> bool +/// Union two ranges, taking their first occurring start position and last occurring end position val unionRanges : range -> range -> range + +/// Test to see if one range contains another range val rangeContainsRange : range -> range -> bool + +/// Test to see if a range contains a position val rangeContainsPos : range -> pos -> bool + +/// Test to see if a range occurs fully before a position val rangeBeforePos : range -> pos -> bool +/// Make a dummy range for a file val rangeN : string -> int -> range + +/// The zero position val pos0 : pos + +/// The zero range val range0 : range + +/// A range associated with a dummy file called "startup" val rangeStartup : range + +/// A range associated with a dummy file for the command line arguments val rangeCmdArgs : range -(* For diagnostics *) +/// Convert a position to a string val stringOfPos : pos -> string + +/// Convert a range to a string val stringOfRange : range -> string /// Represents a line number when using zero-based line counting (used by Visual Studio) @@ -98,22 +167,30 @@ type Line0 = int /// Represents a position using zero-based line counting (used by Visual Studio) type Pos01 = Line0 * int + /// Represents a range using zero-based line counting (used by Visual Studio) type Range01 = Pos01 * Pos01 module Line = + /// Convert a line number from zero-based line counting (used by Visual Studio) to one-based line counting (used internally in the F# compiler and in F# error messages) val fromZ : Line0 -> int + /// Convert a line number from one-based line counting (used internally in the F# compiler and in F# error messages) to zero-based line counting (used by Visual Studio) val toZ : int -> Line0 module Pos = + /// Convert a position from zero-based line counting (used by Visual Studio) to one-based line counting (used internally in the F# compiler and in F# error messages) val fromZ : line:Line0 -> column:int -> pos + /// Convert a position from one-based line counting (used internally in the F# compiler and in F# error messages) to zero-based line counting (used by Visual Studio) val toZ : pos -> Pos01 module Range = + /// Convert a range from one-based line counting (used internally in the F# compiler and in F# error messages) to zero-based line counting (used by Visual Studio) val toZ : range -> Range01 + + /// Convert a range from one-based line counting (used internally in the F# compiler and in F# error messages) to zero-based line counting (used by Visual Studio) val toFileZ : range -> string * Range01 diff --git a/tests/service/EditorTests.fs b/tests/service/EditorTests.fs index 6579a72cc1b..81e66a7c20c 100644 --- a/tests/service/EditorTests.fs +++ b/tests/service/EditorTests.fs @@ -63,6 +63,12 @@ let ``Intro test`` () = let identToken = FSharpTokenTag.IDENT // let projectOptions = checker.GetProjectOptionsFromScript(file, input) |> Async.RunSynchronously + // So we check that the messages are the same + for msg in typeCheckResults.Errors do + printfn "Got an error, hopefully with the right text: %A" msg + + printfn "typeCheckResults.Errors.Length = %d" typeCheckResults.Errors.Length + // We only expect one reported error. However, // on Unix, using filenames like /home/user/Test.fsx gives a second copy of all parse errors due to the // way the load closure for scripts is generated. So this returns two identical errors From 642e9e060dbb2249ff98071bc2dda3a87256f402 Mon Sep 17 00:00:00 2001 From: Jakub Majocha Date: Tue, 15 Jan 2019 00:41:50 +0100 Subject: [PATCH 15/24] Update DEVGUIDE.md (#6095) Correct paths to vsix --- DEVGUIDE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DEVGUIDE.md b/DEVGUIDE.md index 27a962341b6..f7a8531cd2d 100644 --- a/DEVGUIDE.md +++ b/DEVGUIDE.md @@ -167,12 +167,12 @@ components installed in that VS installation. You can revert this step by disab For **Debug**, uninstall then reinstall: VSIXInstaller.exe /u:"VisualFSharp" - VSIXInstaller.exe debug\net40\bin\VisualFSharpFull.vsix + VSIXInstaller.exe artifacts\bin\VisualFSharpFull\Debug\net46\VisualFSharpFull.vsix For **Release**, uninstall then reinstall: VSIXInstaller.exe /u:"VisualFSharp" - VSIXInstaller.exe release\net40\bin\VisualFSharpFull.vsix + VSIXInstaller.exe artifacts\bin\VisualFSharpFull\Release\net46\VisualFSharpFull.vsix Restart Visual Studio, it should now be running your freshly-built Visual F# IDE Tools with updated F# Interactive. From 9630c0bcf5154710a11d1288a403f33f59ac41bc Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Tue, 15 Jan 2019 10:50:44 -0800 Subject: [PATCH 16/24] Fix build for FsiAnyCPU (#6100) --- src/fsharp/fsiAnyCpu/fsiAnyCpu.fsproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fsharp/fsiAnyCpu/fsiAnyCpu.fsproj b/src/fsharp/fsiAnyCpu/fsiAnyCpu.fsproj index cd767c1dfe2..200bd6d40a3 100644 --- a/src/fsharp/fsiAnyCpu/fsiAnyCpu.fsproj +++ b/src/fsharp/fsiAnyCpu/fsiAnyCpu.fsproj @@ -29,6 +29,7 @@ + From fde0e550bc1bb26941b06bc41f5334093f8fde15 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Tue, 15 Jan 2019 17:42:30 -0800 Subject: [PATCH 17/24] Ensure end-2-end tests run (#6106) --- .../BasicProvider/TestBasicProvider.cmd | 32 ++++++++++++------- .../ComboProvider/TestComboProvider.cmd | 32 ++++++++++++------- 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd b/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd index 7d8475c39c3..5967d1f29ff 100644 --- a/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd +++ b/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd @@ -16,17 +16,20 @@ rem Test it with both desktop and coreclr compilers rem if not '%NUGET_PACKAGES%' == '' rd %NUGET_PACKAGES%\BasicProvider /s /q +taskkill /F /IM dotnet.exe -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +taskkill /F /IM dotnet.exe + +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure rem @@ -34,17 +37,22 @@ rem Build typeprovider package with coreclr compiler rem Test it with both desktop and coreclr compilers rem if not '%NUGET_PACKAGES%' == '' rd %NUGET_PACKAGES%\BasicProvider /s /q +taskkill /F /IM dotnet.exe -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -@echo%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +taskkill /F /IM dotnet.exe + +@echo%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +taskkill /F /IM dotnet.exe + +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure :success diff --git a/tests/EndToEndBuildTests/ComboProvider/TestComboProvider.cmd b/tests/EndToEndBuildTests/ComboProvider/TestComboProvider.cmd index ccd8c4d2e3b..031d09b926c 100644 --- a/tests/EndToEndBuildTests/ComboProvider/TestComboProvider.cmd +++ b/tests/EndToEndBuildTests/ComboProvider/TestComboProvider.cmd @@ -15,17 +15,20 @@ rem Test it with both desktop and coreclr compilers rem if not '%NUGET_PACKAGES%' == '' rd %NUGET_PACKAGES%\ComboProvider /s /q +taskkill /F /IM dotnet.exe -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 @if ERRORLEVEL 1 echo Error: ComboProvider failed && goto :failure -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 @if ERRORLEVEL 1 echo Error: ComboProvider failed && goto :failure -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +taskkill /F /IM dotnet.exe + +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr @if ERRORLEVEL 1 echo Error: ComboProviderProvider failed && goto :failure rem @@ -33,17 +36,22 @@ rem Build typeprovider package with coreclr compiler rem Test it with both desktop and coreclr compilers rem if not '%NUGET_PACKAGES%' == '' rd %NUGET_PACKAGES%\ComboProvider /s /q +taskkill /F /IM dotnet.exe -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr @if ERRORLEVEL 1 echo Error: ComboProviderProvider failed && goto :failure -@echo%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +taskkill /F /IM dotnet.exe + +@echo%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -@echo %__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\tools\dotnet20\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +taskkill /F /IM dotnet.exe + +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr @if ERRORLEVEL 1 echo Error: ComboProvider failed && goto :failure :success From 056141a37adfa3a67661100eecb330c68011921a Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 16 Jan 2019 20:49:34 +0300 Subject: [PATCH 18/24] Add isRecursive field name to SynModuleDecl.Let (#6115) --- src/fsharp/ast.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/ast.fs b/src/fsharp/ast.fs index 43b7aab87d1..22b960d18c6 100644 --- a/src/fsharp/ast.fs +++ b/src/fsharp/ast.fs @@ -1409,7 +1409,7 @@ and SynModuleDecl = | ModuleAbbrev of ident:Ident * longId:LongIdent * range:range | NestedModule of SynComponentInfo * isRecursive:bool * SynModuleDecls * bool * range:range - | Let of bool * SynBinding list * range:range + | Let of isRecursive:bool * SynBinding list * range:range | DoExpr of SequencePointInfoForBinding * SynExpr * range:range | Types of SynTypeDefn list * range:range | Exception of SynExceptionDefn * range:range From 2b2a641b99afc4853884e133eb2be69fc3673b7f Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Wed, 16 Jan 2019 10:02:09 -0800 Subject: [PATCH 19/24] -nr=false works better (#6113) --- .../BasicProvider/TestBasicProvider.cmd | 31 +++++++------------ .../ComboProvider/TestComboProvider.cmd | 31 +++++++------------ 2 files changed, 24 insertions(+), 38 deletions(-) diff --git a/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd b/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd index 5967d1f29ff..56af32e144b 100644 --- a/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd +++ b/tests/EndToEndBuildTests/BasicProvider/TestBasicProvider.cmd @@ -18,18 +18,16 @@ rem if not '%NUGET_PACKAGES%' == '' rd %NUGET_PACKAGES%\BasicProvider /s /q taskkill /F /IM dotnet.exe -@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 -nr=false @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -taskkill /F /IM dotnet.exe - -@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure rem @@ -37,22 +35,17 @@ rem Build typeprovider package with coreclr compiler rem Test it with both desktop and coreclr compilers rem if not '%NUGET_PACKAGES%' == '' rd %NUGET_PACKAGES%\BasicProvider /s /q -taskkill /F /IM dotnet.exe -@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack BasicProvider\BasicProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr -nr=false @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -taskkill /F /IM dotnet.exe - -@echo%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +@echo%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -taskkill /F /IM dotnet.exe - -@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test BasicProvider.Tests\BasicProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure :success diff --git a/tests/EndToEndBuildTests/ComboProvider/TestComboProvider.cmd b/tests/EndToEndBuildTests/ComboProvider/TestComboProvider.cmd index 031d09b926c..74035032e29 100644 --- a/tests/EndToEndBuildTests/ComboProvider/TestComboProvider.cmd +++ b/tests/EndToEndBuildTests/ComboProvider/TestComboProvider.cmd @@ -17,18 +17,16 @@ rem if not '%NUGET_PACKAGES%' == '' rd %NUGET_PACKAGES%\ComboProvider /s /q taskkill /F /IM dotnet.exe -@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=net40 -nr=false @if ERRORLEVEL 1 echo Error: ComboProvider failed && goto :failure -@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false @if ERRORLEVEL 1 echo Error: ComboProvider failed && goto :failure -taskkill /F /IM dotnet.exe - -@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false @if ERRORLEVEL 1 echo Error: ComboProviderProvider failed && goto :failure rem @@ -36,22 +34,17 @@ rem Build typeprovider package with coreclr compiler rem Test it with both desktop and coreclr compilers rem if not '%NUGET_PACKAGES%' == '' rd %NUGET_PACKAGES%\ComboProvider /s /q -taskkill /F /IM dotnet.exe -@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe pack ComboProvider\ComboProvider\ComboProvider.fsproj -o %~dp0artifacts -c release -v minimal -p:FSharpTestCompilerVersion=coreclr -nr=false @if ERRORLEVEL 1 echo Error: ComboProviderProvider failed && goto :failure -taskkill /F /IM dotnet.exe - -@echo%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 +@echo%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=net461 -p:FSharpTestCompilerVersion=net40 -nr=false @if ERRORLEVEL 1 echo Error: TestBasicProvider failed && goto :failure -taskkill /F /IM dotnet.exe - -@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr +@echo %__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false +%__scriptpath%..\..\..\artifacts\toolset\dotnet\dotnet.exe test ComboProvider\ComboProvider.Tests\ComboProvider.Tests.fsproj -c release -v minimal -p:TestTargetFramework=netcoreapp2.0 -p:FSharpTestCompilerVersion=coreclr -nr=false @if ERRORLEVEL 1 echo Error: ComboProvider failed && goto :failure :success From 0bea66adc2b9596c946a5723a7afef0c3a1f95c1 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 16 Jan 2019 21:13:56 +0300 Subject: [PATCH 20/24] Always emit conditional attributes in FCS (#6004) * Always emit conditional attributes in FCS (fixes #3890) * Add test * Cleanup test * Add internal compiler switch, emit conditional method calls * Update test * Make noConditionalErasure lowercase --- src/fsharp/CompileOps.fs | 15 +++++++++++++-- src/fsharp/CompileOps.fsi | 3 +++ src/fsharp/CompileOptions.fs | 9 +++++---- src/fsharp/TypeChecker.fs | 13 ++++++------- src/fsharp/TypeChecker.fsi | 4 ++-- tests/service/Symbols.fs | 25 ++++++++++++++++++++++++- 6 files changed, 53 insertions(+), 16 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 6fa771ab959..830a08bf2f4 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2356,6 +2356,8 @@ type TcConfigBuilder = mutable tryGetMetadataSnapshot : ILReaderTryGetMetadataSnapshot mutable internalTestSpanStackReferring : bool + + mutable noConditionalErasure : bool } static member Initial = @@ -2493,6 +2495,7 @@ type TcConfigBuilder = shadowCopyReferences = false tryGetMetadataSnapshot = (fun _ -> None) internalTestSpanStackReferring = false + noConditionalErasure = false } static member CreateNew(legacyReferenceResolver, defaultFSharpBinariesDir, reduceMemoryUsage, implicitIncludeDir, @@ -2954,6 +2957,8 @@ type TcConfig private (data : TcConfigBuilder, validate:bool) = member x.shadowCopyReferences = data.shadowCopyReferences member x.tryGetMetadataSnapshot = data.tryGetMetadataSnapshot member x.internalTestSpanStackReferring = data.internalTestSpanStackReferring + member x.noConditionalErasure = data.noConditionalErasure + static member Create(builder, validate) = use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Parameter TcConfig(builder, validate) @@ -5447,9 +5452,12 @@ let TypeCheckOneInputEventually (checkForErrors, tcConfig:TcConfig, tcImports:Tc if Zset.contains qualNameOfFile tcState.tcsRootImpls then errorR(Error(FSComp.SR.buildImplementationAlreadyGivenDetail(qualNameOfFile.Text), m)) + let conditionalDefines = + if tcConfig.noConditionalErasure then None else Some (tcConfig.conditionalCompilationDefines) + // Typecheck the signature file let! (tcEnv, sigFileType, createsGeneratedProvidedTypes) = - TypeCheckOneSigFile (tcGlobals, tcState.tcsNiceNameGen, amap, tcState.tcsCcu, checkForErrors, tcConfig.conditionalCompilationDefines, tcSink, tcConfig.internalTestSpanStackReferring) tcState.tcsTcSigEnv file + TypeCheckOneSigFile (tcGlobals, tcState.tcsNiceNameGen, amap, tcState.tcsCcu, checkForErrors, conditionalDefines, tcSink, tcConfig.internalTestSpanStackReferring) tcState.tcsTcSigEnv file let rootSigs = Zmap.add qualNameOfFile sigFileType tcState.tcsRootSigs @@ -5484,9 +5492,12 @@ let TypeCheckOneInputEventually (checkForErrors, tcConfig:TcConfig, tcImports:Tc let tcImplEnv = tcState.tcsTcImplEnv + let conditionalDefines = + if tcConfig.noConditionalErasure then None else Some (tcConfig.conditionalCompilationDefines) + // Typecheck the implementation file let! topAttrs, implFile, _implFileHiddenType, tcEnvAtEnd, createsGeneratedProvidedTypes = - TypeCheckOneImplFile (tcGlobals, tcState.tcsNiceNameGen, amap, tcState.tcsCcu, checkForErrors, tcConfig.conditionalCompilationDefines, tcSink, tcConfig.internalTestSpanStackReferring) tcImplEnv rootSigOpt file + TypeCheckOneImplFile (tcGlobals, tcState.tcsNiceNameGen, amap, tcState.tcsCcu, checkForErrors, conditionalDefines, tcSink, tcConfig.internalTestSpanStackReferring) tcImplEnv rootSigOpt file let hadSig = rootSigOpt.IsSome let implFileSigType = SigTypeOfImplFile implFile diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 897f772633d..9ee74ee9930 100755 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -367,6 +367,9 @@ type TcConfigBuilder = /// if true - 'let mutable x = Span.Empty', the value 'x' is a stack referring span. Used for internal testing purposes only until we get true stack spans. mutable internalTestSpanStackReferring : bool + + /// Prevent erasure of conditional attributes and methods so tooling is able analyse them. + mutable noConditionalErasure: bool } static member Initial: TcConfigBuilder diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index 6ae18644dea..344c0e1412a 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -848,8 +848,8 @@ let testFlag tcConfigB = | str -> warning(Error(FSComp.SR.optsUnknownArgumentToTheTestSwitch(str),rangeCmdArgs))), None, None) -// not shown in fsc.exe help, no warning on use, motivation is for use from VS -let vsSpecificFlags (tcConfigB: TcConfigBuilder) = +// Not shown in fsc.exe help, no warning on use, motivation is for use from tooling. +let editorSpecificFlags (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 CompilerOption("LCID", tagInt, OptionInt ignore, None, None) @@ -857,7 +857,8 @@ let vsSpecificFlags (tcConfigB: TcConfigBuilder) = CompilerOption("sqmsessionguid", tagNone, OptionString ignore, None, None) CompilerOption("gccerrors", tagNone, OptionUnit (fun () -> tcConfigB.errorStyle <- ErrorStyle.GccErrors), None, None) CompilerOption("exename", tagNone, OptionString (fun s -> tcConfigB.exename <- Some(s)), None, None) - CompilerOption("maxerrors", tagInt, OptionInt (fun n -> tcConfigB.maxErrors <- n), None, None) ] + CompilerOption("maxerrors", tagInt, OptionInt (fun n -> tcConfigB.maxErrors <- n), None, None) + CompilerOption("noconditionalerasure", tagNone, OptionUnit (fun () -> tcConfigB.noConditionalErasure <- true), None, None) ] let internalFlags (tcConfigB:TcConfigBuilder) = [ @@ -896,7 +897,7 @@ let internalFlags (tcConfigB:TcConfigBuilder) = CompilerOption("alwayscallvirt",tagNone,OptionSwitch(callVirtSwitch tcConfigB),Some(InternalCommandLineOption("alwayscallvirt",rangeCmdArgs)), None) CompilerOption("nodebugdata",tagNone, OptionUnit (fun () -> tcConfigB.noDebugData<-true),Some(InternalCommandLineOption("--nodebugdata",rangeCmdArgs)), None) testFlag tcConfigB ] @ - vsSpecificFlags tcConfigB @ + editorSpecificFlags tcConfigB @ [ CompilerOption("jit", tagNone, OptionSwitch (jitoptimizeSwitch tcConfigB), Some(InternalCommandLineOption("jit", rangeCmdArgs)), None) CompilerOption("localoptimize", tagNone, OptionSwitch(localoptimizeSwitch tcConfigB),Some(InternalCommandLineOption("localoptimize", rangeCmdArgs)), None) CompilerOption("splitting", tagNone, OptionSwitch(splittingSwitch tcConfigB),Some(InternalCommandLineOption("splitting", rangeCmdArgs)), None) diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index a78405bfb6e..d9bdb7e52e3 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -504,8 +504,8 @@ type cenv = /// Used to resolve names nameResolver: NameResolver - /// The set of active conditional defines - conditionalDefines: string list + /// The set of active conditional defines. The value is None when conditional erasure is disabled in tooling. + conditionalDefines: string list option isInternalTestSpanStackReferring: bool } @@ -3004,8 +3004,8 @@ let BuildPossiblyConditionalMethodCall cenv env isMutable m isProp minfo valUseF let conditionalCallDefineOpt = TryFindMethInfoStringAttribute cenv.g m cenv.g.attrib_ConditionalAttribute minfo - match conditionalCallDefineOpt with - | Some d when not (List.contains d cenv.conditionalDefines) -> + match conditionalCallDefineOpt, cenv.conditionalDefines with + | Some d, Some defines when not (List.contains d defines) -> // Methods marked with 'Conditional' must return 'unit' UnifyTypes cenv env m cenv.g.unit_ty (minfo.GetFSharpReturnTy(cenv.amap, m, minst)) @@ -10828,11 +10828,10 @@ and TcAttribute canFail cenv (env: TcEnv) attrTgt (synAttr: SynAttribute) = let conditionalCallDefineOpt = TryFindTyconRefStringAttribute cenv.g mAttr cenv.g.attrib_ConditionalAttribute tcref - match conditionalCallDefineOpt with - | Some d when not (List.contains d cenv.conditionalDefines) -> + match conditionalCallDefineOpt, cenv.conditionalDefines with + | Some d, Some defines when not (List.contains d defines) -> [], false | _ -> - // REVIEW: take notice of inherited? let validOn, _inherited = let validOnDefault = 0x7fff diff --git a/src/fsharp/TypeChecker.fsi b/src/fsharp/TypeChecker.fsi index 3f84e1992fc..aae09544998 100644 --- a/src/fsharp/TypeChecker.fsi +++ b/src/fsharp/TypeChecker.fsi @@ -39,14 +39,14 @@ val EmptyTopAttrs : TopAttribs val CombineTopAttrs : TopAttribs -> TopAttribs -> TopAttribs val TypeCheckOneImplFile : - TcGlobals * NiceNameGenerator * ImportMap * CcuThunk * (unit -> bool) * ConditionalDefines * NameResolution.TcResultsSink * bool + TcGlobals * NiceNameGenerator * ImportMap * CcuThunk * (unit -> bool) * ConditionalDefines option * NameResolution.TcResultsSink * bool -> TcEnv -> Tast.ModuleOrNamespaceType option -> ParsedImplFileInput -> Eventually val TypeCheckOneSigFile : - TcGlobals * NiceNameGenerator * ImportMap * CcuThunk * (unit -> bool) * ConditionalDefines * NameResolution.TcResultsSink * bool + TcGlobals * NiceNameGenerator * ImportMap * CcuThunk * (unit -> bool) * ConditionalDefines option * NameResolution.TcResultsSink * bool -> TcEnv -> ParsedSigFileInput -> Eventually diff --git a/tests/service/Symbols.fs b/tests/service/Symbols.fs index 8b5749f0546..da2a7795577 100644 --- a/tests/service/Symbols.fs +++ b/tests/service/Symbols.fs @@ -100,4 +100,27 @@ module Mod2 = mod1val1.XmlDocSig |> shouldEqual "P:Mod1.val1" mod2func2.XmlDocSig |> shouldEqual "M:Mod1.Mod2.func2" - \ No newline at end of file + +module Attributes = + [] + let ``Emit conditional attributes`` () = + let source = """ +open System +open System.Diagnostics + +[] +type FooAttribute() = + inherit Attribute() + +[] +let x = 123 +""" + let fileName, options = mkTestFileAndOptions source [| "--noconditionalerasure" |] + let _, checkResults = parseAndCheckFile fileName source options + + checkResults.GetAllUsesOfAllSymbolsInFile() + |> Async.RunSynchronously + |> Array.tryFind (fun su -> su.Symbol.DisplayName = "x") + |> Option.orElseWith (fun _ -> failwith "Could not get symbol") + |> Option.map (fun su -> su.Symbol :?> FSharpMemberOrFunctionOrValue) + |> Option.iter (fun symbol -> symbol.Attributes.Count |> shouldEqual 1) From 75849745ab2c089dec0a596ebbf2f02c7d5763a6 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Thu, 17 Jan 2019 17:21:15 -0600 Subject: [PATCH 21/24] TcSymbolUseData cleanup per #6084 (#6089) * chunkify TcSymbolUseData * move LOH size out to a constant * do chunking and mapping together to reduce allocations * clarify comment around GC impacts * add comment informing others of the potential for LOH allocations --- src/absil/illib.fs | 49 ++++++++++++++++++++++++++++++++++- src/fsharp/NameResolution.fs | 21 ++++++++++----- src/fsharp/NameResolution.fsi | 4 +-- src/fsharp/service/service.fs | 6 +++-- 4 files changed, 68 insertions(+), 12 deletions(-) diff --git a/src/absil/illib.fs b/src/absil/illib.fs index 69b0030f910..44261606387 100644 --- a/src/absil/illib.fs +++ b/src/absil/illib.fs @@ -41,6 +41,10 @@ let inline isNonNull x = not (isNull x) let inline nonNull msg x = if isNull x then failwith ("null: " + msg) else x let inline (===) x y = LanguagePrimitives.PhysicalEquality x y +/// Per the docs the threshold for the Large Object Heap is 85000 bytes: https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/large-object-heap#how-an-object-ends-up-on-the-large-object-heap-and-how-gc-handles-them +/// We set the limit to slightly under that to allow for some 'slop' +let LOH_SIZE_THRESHOLD_BYTES = 84_900 + //--------------------------------------------------------------------- // Library: ReportTime //--------------------------------------------------------------------- @@ -91,7 +95,7 @@ module Order = let toFunction (pxOrder: IComparer<'U>) x y = pxOrder.Compare(x,y) //------------------------------------------------------------------------- -// Library: arrays,lists,options +// Library: arrays,lists,options,resizearrays //------------------------------------------------------------------------- module Array = @@ -432,6 +436,49 @@ module List = let existsSquared f xss = xss |> List.exists (fun xs -> xs |> List.exists (fun x -> f x)) let mapiFoldSquared f z xss = mapFoldSquared f z (xss |> mapiSquared (fun i j x -> (i,j,x))) +module ResizeArray = + + /// Split a ResizeArray into an array of smaller chunks. + /// This requires `items/chunkSize` Array copies of length `chunkSize` if `items/chunkSize % 0 = 0`, + /// otherwise `items/chunkSize + 1` Array copies. + let chunkBySize chunkSize f (items: ResizeArray<'t>) = + // we could use Seq.chunkBySize here, but that would involve many enumerator.MoveNext() calls that we can sidestep with a bit of math + let itemCount = items.Count + if itemCount = 0 + then [||] + else + let chunksCount = + match itemCount / chunkSize with + | n when itemCount % chunkSize = 0 -> n + | n -> n + 1 // any remainder means we need an additional chunk to store it + + [| for index in 0..chunksCount-1 do + let startIndex = index * chunkSize + let takeCount = min (itemCount - startIndex) chunkSize + + let holder = Array.zeroCreate takeCount + // we take a bounds-check hit here on each access. + // other alternatives here include + // * iterating across an IEnumerator (incurs MoveNext penalty) + // * doing a block copy using `List.CopyTo(index, array, index, count)` (requires more copies to do the mapping) + // none are significantly better. + for i in 0 .. takeCount - 1 do + holder.[i] <- f items.[i] + yield holder |] + + /// Split a large ResizeArray into a series of array chunks that are each under the Large Object Heap limit. + /// This is done to help prevent a stop-the-world collection of the single large array, instead allowing for a greater + /// probability of smaller collections. Stop-the-world is still possible, just less likely. + let mapToSmallArrayChunks f (inp: ResizeArray<'t>) = + let itemSizeBytes = sizeof<'t> + // rounding down here is good because it ensures we don't go over + let maxArrayItemCount = LOH_SIZE_THRESHOLD_BYTES / itemSizeBytes + + /// chunk the provided input into arrays that are smaller than the LOH limit + /// in order to prevent long-term storage of those values + chunkBySize maxArrayItemCount f inp + + /// Because FSharp.Compiler.Service is a library that will target FSharp.Core 4.5.2 for the forseeable future, /// we need to stick these functions in this module rather than using the module functions for ValueOption /// that come after FSharp.Core 4.5.2. diff --git a/src/fsharp/NameResolution.fs b/src/fsharp/NameResolution.fs index 43c15418490..9434740d314 100644 --- a/src/fsharp/NameResolution.fs +++ b/src/fsharp/NameResolution.fs @@ -1212,7 +1212,7 @@ let GetNestedTypesOfType (ad, ncenv:NameResolver, optFilter, staticResInfo, chec //------------------------------------------------------------------------- /// Represents the kind of the occurrence when reporting a name in name resolution -[] +[] type ItemOccurence = /// This is a binding / declaration of the item | Binding @@ -1496,17 +1496,24 @@ type TcSymbolUseData = /// This is a memory-critical data structure - allocations of this data structure and its immediate contents /// is one of the highest memory long-lived data structures in typical uses of IDEs. Not many of these objects /// are allocated (one per file), but they are large because the allUsesOfAllSymbols array is large. -type TcSymbolUses(g, capturedNameResolutions : ResizeArray, formatSpecifierLocations: (range * int)[]) = - +type TcSymbolUses(g, capturedNameResolutions : ResizeArray, formatSpecifierLocations: (range * int)[]) = + // Make sure we only capture the information we really need to report symbol uses - let allUsesOfSymbols = [| for cnr in capturedNameResolutions -> { Item=cnr.Item; ItemOccurence=cnr.ItemOccurence; DisplayEnv=cnr.DisplayEnv; Range=cnr.Range } |] + let allUsesOfSymbols = + capturedNameResolutions + |> ResizeArray.mapToSmallArrayChunks (fun cnr -> { Item=cnr.Item; ItemOccurence=cnr.ItemOccurence; DisplayEnv=cnr.DisplayEnv; Range=cnr.Range }) + let capturedNameResolutions = () do ignore capturedNameResolutions // don't capture this! member this.GetUsesOfSymbol(item) = - [| for symbolUse in allUsesOfSymbols do - if protectAssemblyExploration false (fun () -> ItemsAreEffectivelyEqual g item symbolUse.Item) then - yield symbolUse |] + // This member returns what is potentially a very large array, which may approach the size constraints of the Large Object Heap. + // This is unlikely in practice, though, because we filter down the set of all symbol uses to those specifically for the given `item`. + // Consequently we have a much lesser chance of ending up with an array large enough to be promoted to the LOH. + [| for symbolUseChunk in allUsesOfSymbols do + for symbolUse in symbolUseChunk do + if protectAssemblyExploration false (fun () -> ItemsAreEffectivelyEqual g item symbolUse.Item) then + yield symbolUse |] member this.AllUsesOfSymbols = allUsesOfSymbols diff --git a/src/fsharp/NameResolution.fsi b/src/fsharp/NameResolution.fsi index 10fe03ff0b1..a302e22ef17 100755 --- a/src/fsharp/NameResolution.fsi +++ b/src/fsharp/NameResolution.fsi @@ -240,7 +240,7 @@ type TypeNameResolutionInfo = static member ResolveToTypeRefs : TypeNameResolutionStaticArgsInfo -> TypeNameResolutionInfo /// Represents the kind of the occurrence when reporting a name in name resolution -[] +[] type internal ItemOccurence = | Binding | Use @@ -319,7 +319,7 @@ type internal TcSymbolUses = member GetUsesOfSymbol : Item -> TcSymbolUseData[] /// All the uses of all items within the file - member AllUsesOfSymbols : TcSymbolUseData[] + member AllUsesOfSymbols : TcSymbolUseData[][] /// Get the locations of all the printf format specifiers in the file member GetFormatSpecifierLocationsAndArity : unit -> (range * int)[] diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index f4694cdfaf5..7fbc49c1f39 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -1917,7 +1917,8 @@ type FSharpCheckProjectResults(projectFileName:string, tcConfigOption, keepAssem let cenv = SymbolEnv(tcGlobals, thisCcu, Some ccuSig, tcImports) [| for r in tcSymbolUses do - for symbolUse in r.AllUsesOfSymbols do + for symbolUseChunk in r.AllUsesOfSymbols do + for symbolUse in symbolUseChunk do if symbolUse.ItemOccurence <> ItemOccurence.RelatedText then let symbol = FSharpSymbol.Create(cenv, symbolUse.Item) yield FSharpSymbolUse(tcGlobals, symbolUse.DisplayEnv, symbol, symbolUse.ItemOccurence, symbolUse.Range) |] @@ -2111,7 +2112,8 @@ type FSharpCheckFileResults(filename: string, errors: FSharpErrorInfo[], scopeOp (fun () -> [| |]) (fun scope -> let cenv = scope.SymbolEnv - [| for symbolUse in scope.ScopeSymbolUses.AllUsesOfSymbols do + [| for symbolUseChunk in scope.ScopeSymbolUses.AllUsesOfSymbols do + for symbolUse in symbolUseChunk do if symbolUse.ItemOccurence <> ItemOccurence.RelatedText then let symbol = FSharpSymbol.Create(cenv, symbolUse.Item) yield FSharpSymbolUse(scope.TcGlobals, symbolUse.DisplayEnv, symbol, symbolUse.ItemOccurence, symbolUse.Range) |]) From 12e4d2aa1f04f0042ded75432e275c8375282bca Mon Sep 17 00:00:00 2001 From: Don Syme Date: Mon, 21 Jan 2019 16:24:26 +0000 Subject: [PATCH 22/24] add some docs (#6138) * add some docs * more docs * more docs * more docs/spacing * more docs/spacing * more docs/spacing --- src/fsharp/IlxGen.fs | 2 +- src/fsharp/Optimizer.fs | 12 +- src/fsharp/SignatureConformance.fs | 4 +- src/fsharp/TastOps.fs | 84 +- src/fsharp/TastOps.fsi | 1168 +++++++++++++++++++++------- src/fsharp/TypeChecker.fs | 2 +- 6 files changed, 957 insertions(+), 315 deletions(-) diff --git a/src/fsharp/IlxGen.fs b/src/fsharp/IlxGen.fs index 9bd796db143..d027afabeb5 100644 --- a/src/fsharp/IlxGen.fs +++ b/src/fsharp/IlxGen.fs @@ -764,7 +764,7 @@ let StorageForVal m v eenv = try eenv.valsInScope.[v] with :? KeyNotFoundException -> assert false - errorR(Error(FSComp.SR.ilUndefinedValue(showL(vspecAtBindL v)),m)) + errorR(Error(FSComp.SR.ilUndefinedValue(showL(valAtBindL v)),m)) notlazy (Arg 668(* random value for post-hoc diagnostic analysis on generated tree *) ) v.Force() diff --git a/src/fsharp/Optimizer.fs b/src/fsharp/Optimizer.fs index b97e6b7da7a..5e345822675 100644 --- a/src/fsharp/Optimizer.fs +++ b/src/fsharp/Optimizer.fs @@ -976,11 +976,11 @@ let AbstractLazyModulInfoByHiding isAssemblyBoundary mhi = // Under those checks, the further hidden* checks may be subsumed (meaning, not required anymore). let hiddenTycon, hiddenTyconRepr, hiddenVal, hiddenRecdField, hiddenUnionCase = - Zset.memberOf mhi.mhiTycons, - Zset.memberOf mhi.mhiTyconReprs, - Zset.memberOf mhi.mhiVals, - Zset.memberOf mhi.mhiRecdFields, - Zset.memberOf mhi.mhiUnionCases + Zset.memberOf mhi.HiddenTycons, + Zset.memberOf mhi.HiddenTyconReprs, + Zset.memberOf mhi.HiddenVals, + Zset.memberOf mhi.HiddenRecdFields, + Zset.memberOf mhi.HiddenUnionCases let rec abstractExprInfo ivalue = match ivalue with @@ -3229,7 +3229,7 @@ and OptimizeModuleExpr cenv env x = not (ValueIsUsedOrHasEffect cenv (fun () -> fvs.FreeLocals) (bind, binfo)) && // Check the thing is hidden by the signature (if any) - hidden.mhiVals.Contains bind.Var && + hidden.HiddenVals.Contains bind.Var && // Check the thing is not compiled as a static field or property, since reflected definitions and other reflective stuff might need it not (IsCompiledAsStaticProperty cenv.g bind.Var)) diff --git a/src/fsharp/SignatureConformance.fs b/src/fsharp/SignatureConformance.fs index ed5c04da71f..ac0c23e9709 100644 --- a/src/fsharp/SignatureConformance.fs +++ b/src/fsharp/SignatureConformance.fs @@ -37,8 +37,8 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = // Used when checking attributes. let sigToImplRemap = let remap = Remap.Empty - let remap = (remapInfo.mrpiEntities,remap) ||> List.foldBack (fun (implTcref ,signTcref) acc -> addTyconRefRemap signTcref implTcref acc) - let remap = (remapInfo.mrpiVals ,remap) ||> List.foldBack (fun (implValRef,signValRef) acc -> addValRemap signValRef.Deref implValRef.Deref acc) + let remap = (remapInfo.RepackagedEntities,remap) ||> List.foldBack (fun (implTcref ,signTcref) acc -> addTyconRefRemap signTcref implTcref acc) + let remap = (remapInfo.RepackagedVals ,remap) ||> List.foldBack (fun (implValRef,signValRef) acc -> addValRemap signValRef.Deref implValRef.Deref acc) remap // For all attributable elements (types, modules, exceptions, record fields, unions, parameters, generic type parameters) diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 19414aa5f5b..23242b1aff6 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -3442,7 +3442,7 @@ module DebugPrint = begin let rec MemberL (v:Val) (membInfo:ValMemberInfo) = (aboveListL [ wordL(tagText "compiled_name! = ") ^^ wordL (tagText v.CompiledName) ; wordL(tagText "membInfo-slotsig! = ") ^^ listL slotSigL membInfo.ImplementedSlotSigs ]) - and vspecAtBindL v = + and valAtBindL v = let vL = valL v in let mutL = (if v.IsMutable then wordL(tagText "mutable") ++ vL else vL) mutL --- (aboveListL (List.concat [[wordL(tagText ":") ^^ typeL v.Type]; @@ -3512,7 +3512,7 @@ module DebugPrint = begin then emptyL else let iimplsLs = iimpls |> List.map (fun (ty, _, _) -> wordL(tagText "interface") --- typeL ty) - let adhocLs = adhoc |> List.map (fun vref -> vspecAtBindL vref.Deref) + let adhocLs = adhoc |> List.map (fun vref -> valAtBindL vref.Deref) (wordL(tagText "with") @@-- aboveListL (iimplsLs @ adhocLs)) @@ wordL(tagText "end") let layoutUnionCaseArgTypes argtys = sepListL (wordL(tagText "*")) (List.map typeL argtys) @@ -3559,7 +3559,7 @@ module DebugPrint = begin let vsprs = tycon.MembersOfFSharpTyconSorted |> List.filter (fun v -> v.IsDispatchSlot) - |> List.map (fun vref -> vspecAtBindL vref.Deref) + |> List.map (fun vref -> valAtBindL vref.Deref) let vals = tycon.TrueFieldsAsList |> List.map (fun f -> (if f.IsStatic then wordL(tagText "static") else emptyL) ^^ wordL(tagText "val") ^^ layoutRecdField f) let alldecls = inherits @ vsprs @ vals let emptyMeasure = match tycon.TypeOrMeasureKind with TyparKind.Measure -> isNil alldecls | _ -> false @@ -3590,7 +3590,7 @@ module DebugPrint = begin //-------------------------------------------------------------------------- and bindingL (TBind(v, repr, _)) = - vspecAtBindL v --- (wordL(tagText "=") ^^ exprL repr) + valAtBindL v --- (wordL(tagText "=") ^^ exprL repr) and exprL expr = exprWrapL false expr and atomL expr = exprWrapL true expr // true means bracket if needed to be atomic expr @@ -3628,11 +3628,11 @@ module DebugPrint = begin | ThenDoSeq -> "; (*ThenDo*)" ((exprL x0 ^^ rightL (tagText flag)) @@ exprL x1) |> wrap | Expr.Lambda(_, _, baseValOpt, argvs, body, _, _) -> - let formalsL = spaceListL (List.map vspecAtBindL argvs) in + let formalsL = spaceListL (List.map valAtBindL argvs) in let bindingL = match baseValOpt with | None -> wordL(tagText "lam") ^^ formalsL ^^ rightL(tagText ".") - | Some basev -> wordL(tagText "lam") ^^ (leftL(tagText "base=") ^^ vspecAtBindL basev) --- formalsL ^^ rightL(tagText ".") in + | Some basev -> wordL(tagText "lam") ^^ (leftL(tagText "base=") ^^ valAtBindL basev) --- formalsL ^^ rightL(tagText ".") in (bindingL ++ exprL body) |> wrap | Expr.TyLambda(_, argtyvs, body, _, _) -> ((wordL(tagText "LAM") ^^ spaceListL (List.map typarL argtyvs) ^^ rightL(tagText ".")) ++ exprL body) |> wrap @@ -3727,7 +3727,7 @@ module DebugPrint = begin | Expr.Obj (_lambdaId, ty, basev, ccall, overrides, iimpls, _) -> wordL(tagText "OBJ:") ^^ aboveListL [typeL ty; exprL ccall; - optionL vspecAtBindL basev; + optionL valAtBindL basev; aboveListL (List.map overrideL overrides); aboveListL (List.map iimplL iimpls)] @@ -3812,7 +3812,7 @@ module DebugPrint = begin and tmethodL (TObjExprMethod(TSlotSig(nm, _, _, _, _, _), _, tps, vs, e, _)) = (wordL(tagText "TObjExprMethod") --- (wordL (tagText nm)) ^^ wordL(tagText "=")) -- (wordL(tagText "METH-LAM") --- angleBracketListL (List.map typarL tps) ^^ rightL(tagText ".")) --- - (wordL(tagText "meth-lam") --- tupleL (List.map (List.map vspecAtBindL >> tupleL) vs) ^^ rightL(tagText ".")) --- + (wordL(tagText "meth-lam") --- tupleL (List.map (List.map valAtBindL >> tupleL) vs) ^^ rightL(tagText ".")) --- (atomL e) and overrideL tmeth = wordL(tagText "with") ^^ tmethodL tmeth and iimplL (ty, tmeths) = wordL(tagText "impl") ^^ aboveListL (typeL ty :: List.map tmethodL tmeths) @@ -3850,33 +3850,33 @@ let SigTypeOfImplFile (TImplFile(_, _, mexpr, _, _, _)) = mexpr.Type //-------------------------------------------------------------------------- type SignatureRepackageInfo = - { mrpiVals : (ValRef * ValRef) list; - mrpiEntities: (TyconRef * TyconRef) list } + { RepackagedVals : (ValRef * ValRef) list; + RepackagedEntities: (TyconRef * TyconRef) list } - member remapInfo.ImplToSigMapping = { TypeEquivEnv.Empty with EquivTycons = TyconRefMap.OfList remapInfo.mrpiEntities } - static member Empty = { mrpiVals = []; mrpiEntities= [] } + member remapInfo.ImplToSigMapping = { TypeEquivEnv.Empty with EquivTycons = TyconRefMap.OfList remapInfo.RepackagedEntities } + static member Empty = { RepackagedVals = []; RepackagedEntities= [] } type SignatureHidingInfo = - { mhiTycons : Zset; - mhiTyconReprs : Zset; - mhiVals : Zset; - mhiRecdFields : Zset; - mhiUnionCases : Zset } + { HiddenTycons : Zset; + HiddenTyconReprs : Zset; + HiddenVals : Zset; + HiddenRecdFields : Zset; + HiddenUnionCases : Zset } static member Empty = - { mhiTycons = Zset.empty tyconOrder; - mhiTyconReprs = Zset.empty tyconOrder; - mhiVals = Zset.empty valOrder; - mhiRecdFields = Zset.empty recdFieldRefOrder; - mhiUnionCases = Zset.empty unionCaseRefOrder } + { HiddenTycons = Zset.empty tyconOrder; + HiddenTyconReprs = Zset.empty tyconOrder; + HiddenVals = Zset.empty valOrder; + HiddenRecdFields = Zset.empty recdFieldRefOrder; + HiddenUnionCases = Zset.empty unionCaseRefOrder } let addValRemap v v' tmenv = { tmenv with valRemap= tmenv.valRemap.Add v (mkLocalValRef v') } let mkRepackageRemapping mrpi = - { valRemap = ValMap.OfList (mrpi.mrpiVals |> List.map (fun (vref, x) -> vref.Deref, x)); + { valRemap = ValMap.OfList (mrpi.RepackagedVals |> List.map (fun (vref, x) -> vref.Deref, x)); tpinst = emptyTyparInst; - tyconRefRemap = TyconRefMap.OfList mrpi.mrpiEntities + tyconRefRemap = TyconRefMap.OfList mrpi.RepackagedEntities removeTraitSolutions = false } //-------------------------------------------------------------------------- @@ -3888,18 +3888,18 @@ let accEntityRemap (msigty:ModuleOrNamespaceType) (entity:Entity) (mrpi, mhi) = match sigtyconOpt with | None -> // The type constructor is not present in the signature. Hence it is hidden. - let mhi = { mhi with mhiTycons = Zset.add entity mhi.mhiTycons } + let mhi = { mhi with HiddenTycons = Zset.add entity mhi.HiddenTycons } (mrpi, mhi) | Some sigtycon -> // The type constructor is in the signature. Hence record the repackage entry let sigtcref = mkLocalTyconRef sigtycon let tcref = mkLocalTyconRef entity - let mrpi = { mrpi with mrpiEntities = ((tcref, sigtcref) :: mrpi.mrpiEntities) } + let mrpi = { mrpi with RepackagedEntities = ((tcref, sigtcref) :: mrpi.RepackagedEntities) } // OK, now look for hidden things let mhi = if (match entity.TypeReprInfo with TNoRepr -> false | _ -> true) && (match sigtycon.TypeReprInfo with TNoRepr -> true | _ -> false) then // The type representation is absent in the signature, hence it is hidden - { mhi with mhiTyconReprs = Zset.add entity mhi.mhiTyconReprs } + { mhi with HiddenTyconReprs = Zset.add entity mhi.HiddenTyconReprs } else // The type representation is present in the signature. // Find the fields that have been hidden or which were non-public anyway. @@ -3912,7 +3912,7 @@ let accEntityRemap (msigty:ModuleOrNamespaceType) (entity:Entity) (mrpi, mhi) = | _ -> // The field is not in the signature. Hence it is regarded as hidden. let rfref = tcref.MakeNestedRecdFieldRef rfield - { mhi with mhiRecdFields = Zset.add rfref mhi.mhiRecdFields }) + { mhi with HiddenRecdFields = Zset.add rfref mhi.HiddenRecdFields }) entity.AllFieldsArray |> List.foldBack (fun (ucase:UnionCase) mhi -> match sigtycon.GetUnionCaseByName ucase.DisplayName with @@ -3922,7 +3922,7 @@ let accEntityRemap (msigty:ModuleOrNamespaceType) (entity:Entity) (mrpi, mhi) = | _ -> // The constructor is not in the signature. Hence it is regarded as hidden. let ucref = tcref.MakeNestedUnionCaseRef ucase - { mhi with mhiUnionCases = Zset.add ucref mhi.mhiUnionCases }) + { mhi with HiddenUnionCases = Zset.add ucref mhi.HiddenUnionCases }) (entity.UnionCasesAsList) (mrpi, mhi) @@ -3931,13 +3931,13 @@ let accSubEntityRemap (msigty:ModuleOrNamespaceType) (entity:Entity) (mrpi, mhi) match sigtyconOpt with | None -> // The type constructor is not present in the signature. Hence it is hidden. - let mhi = { mhi with mhiTycons = Zset.add entity mhi.mhiTycons } + let mhi = { mhi with HiddenTycons = Zset.add entity mhi.HiddenTycons } (mrpi, mhi) | Some sigtycon -> // The type constructor is in the signature. Hence record the repackage entry let sigtcref = mkLocalTyconRef sigtycon let tcref = mkLocalTyconRef entity - let mrpi = { mrpi with mrpiEntities = ((tcref, sigtcref) :: mrpi.mrpiEntities) } + let mrpi = { mrpi with RepackagedEntities = ((tcref, sigtcref) :: mrpi.RepackagedEntities) } (mrpi, mhi) let valLinkageAEquiv g aenv (v1:Val) (v2:Val) = @@ -3955,11 +3955,11 @@ let accValRemap g aenv (msigty:ModuleOrNamespaceType) (implVal:Val) (mrpi, mhi) match sigValOpt with | None -> if verbose then dprintf "accValRemap, hide = %s#%d\n" implVal.LogicalName implVal.Stamp - let mhi = { mhi with mhiVals = Zset.add implVal mhi.mhiVals } + let mhi = { mhi with HiddenVals = Zset.add implVal mhi.HiddenVals } (mrpi, mhi) | Some (sigVal:Val) -> // The value is in the signature. Add the repackage entry. - let mrpi = { mrpi with mrpiVals = (vref, mkLocalValRef sigVal) :: mrpi.mrpiVals } + let mrpi = { mrpi with RepackagedVals = (vref, mkLocalValRef sigVal) :: mrpi.RepackagedVals } (mrpi, mhi) let getCorrespondingSigTy nm (msigty:ModuleOrNamespaceType) = @@ -4053,9 +4053,9 @@ let ComputeRemappingFromImplementationToSignature g mdef msigty = let accTyconHidingInfoAtAssemblyBoundary (tycon:Tycon) mhi = if not (canAccessFromEverywhere tycon.Accessibility) then // The type constructor is not public, hence hidden at the assembly boundary. - { mhi with mhiTycons = Zset.add tycon mhi.mhiTycons } + { mhi with HiddenTycons = Zset.add tycon mhi.HiddenTycons } elif not (canAccessFromEverywhere tycon.TypeReprAccessibility) then - { mhi with mhiTyconReprs = Zset.add tycon mhi.mhiTyconReprs } + { mhi with HiddenTyconReprs = Zset.add tycon mhi.HiddenTyconReprs } else mhi |> Array.foldBack @@ -4063,7 +4063,7 @@ let accTyconHidingInfoAtAssemblyBoundary (tycon:Tycon) mhi = if not (canAccessFromEverywhere rfield.Accessibility) then let tcref = mkLocalTyconRef tycon let rfref = tcref.MakeNestedRecdFieldRef rfield - { mhi with mhiRecdFields = Zset.add rfref mhi.mhiRecdFields } + { mhi with HiddenRecdFields = Zset.add rfref mhi.HiddenRecdFields } else mhi) tycon.AllFieldsArray |> List.foldBack @@ -4071,7 +4071,7 @@ let accTyconHidingInfoAtAssemblyBoundary (tycon:Tycon) mhi = if not (canAccessFromEverywhere ucase.Accessibility) then let tcref = mkLocalTyconRef tycon let ucref = tcref.MakeNestedUnionCaseRef ucase - { mhi with mhiUnionCases = Zset.add ucref mhi.mhiUnionCases } + { mhi with HiddenUnionCases = Zset.add ucref mhi.HiddenUnionCases } else mhi) (tycon.UnionCasesAsList) @@ -4086,7 +4086,7 @@ let accValHidingInfoAtAssemblyBoundary (vspec:Val) mhi = // anything that's not a module or member binding gets assembly visibility not vspec.IsMemberOrModuleBinding then // The value is not public, hence hidden at the assembly boundary. - { mhi with mhiVals = Zset.add vspec mhi.mhiVals } + { mhi with HiddenVals = Zset.add vspec mhi.HiddenVals } else mhi @@ -4121,10 +4121,10 @@ let IsHidden setF accessF remapF debugF = if verbose then dprintf "IsHidden, #mrmi = %d, %s = %b\n" mrmi.Length (showL (debugF x)) res; res -let IsHiddenTycon mrmi x = IsHidden (fun mhi -> mhi.mhiTycons) (fun tc -> tc.Accessibility) (fun rpi x -> (remapTyconRef rpi.tyconRefRemap (mkLocalTyconRef x)).Deref) DebugPrint.tyconL mrmi x -let IsHiddenTyconRepr mrmi x = IsHidden (fun mhi -> mhi.mhiTyconReprs) (fun v -> v.TypeReprAccessibility) (fun rpi x -> (remapTyconRef rpi.tyconRefRemap (mkLocalTyconRef x)).Deref) DebugPrint.tyconL mrmi x -let IsHiddenVal mrmi x = IsHidden (fun mhi -> mhi.mhiVals) (fun v -> v.Accessibility) (fun rpi x -> (remapValRef rpi (mkLocalValRef x)).Deref) DebugPrint.valL mrmi x -let IsHiddenRecdField mrmi x = IsHidden (fun mhi -> mhi.mhiRecdFields) (fun rfref -> rfref.RecdField.Accessibility) (fun rpi x -> remapRecdFieldRef rpi.tyconRefRemap x) DebugPrint.recdFieldRefL mrmi x +let IsHiddenTycon mrmi x = IsHidden (fun mhi -> mhi.HiddenTycons) (fun tc -> tc.Accessibility) (fun rpi x -> (remapTyconRef rpi.tyconRefRemap (mkLocalTyconRef x)).Deref) DebugPrint.tyconL mrmi x +let IsHiddenTyconRepr mrmi x = IsHidden (fun mhi -> mhi.HiddenTyconReprs) (fun v -> v.TypeReprAccessibility) (fun rpi x -> (remapTyconRef rpi.tyconRefRemap (mkLocalTyconRef x)).Deref) DebugPrint.tyconL mrmi x +let IsHiddenVal mrmi x = IsHidden (fun mhi -> mhi.HiddenVals) (fun v -> v.Accessibility) (fun rpi x -> (remapValRef rpi (mkLocalValRef x)).Deref) DebugPrint.valL mrmi x +let IsHiddenRecdField mrmi x = IsHidden (fun mhi -> mhi.HiddenRecdFields) (fun rfref -> rfref.RecdField.Accessibility) (fun rpi x -> remapRecdFieldRef rpi.tyconRefRemap x) DebugPrint.recdFieldRefL mrmi x //-------------------------------------------------------------------------- diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index 0731970c195..badacfda0ea 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -3,26 +3,18 @@ /// Defines derived expression manipulation and construction functions. module internal Microsoft.FSharp.Compiler.Tastops -open System.Text open System.Collections.Generic open Internal.Utilities open Microsoft.FSharp.Compiler.AbstractIL open Microsoft.FSharp.Compiler.AbstractIL.IL open Microsoft.FSharp.Compiler.AbstractIL.Internal -open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library open Microsoft.FSharp.Compiler open Microsoft.FSharp.Compiler.Range open Microsoft.FSharp.Compiler.Rational open Microsoft.FSharp.Compiler.Ast -open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Tast open Microsoft.FSharp.Compiler.TcGlobals open Microsoft.FSharp.Compiler.Layout -open Microsoft.FSharp.Compiler.Lib - -#if !NO_EXTENSIONTYPING -open Microsoft.FSharp.Compiler.ExtensionTyping -#endif //------------------------------------------------------------------------- // Type equivalence @@ -42,10 +34,6 @@ val measureEquiv : TcGlobals -> Measure -> Measure -> bool /// Reduce a type to its more anonical form subject to an erasure flag, inference equations and abbreviations val stripTyEqnsWrtErasure: Erasure -> TcGlobals -> TType -> TType -//------------------------------------------------------------------------- -// Build common types -//------------------------------------------------------------------------- - /// Build a function type val mkFunTy : TType -> TType -> TType @@ -77,139 +65,232 @@ val stripExpr : Expr -> Expr /// Get the values for a set of bindings val valsOfBinds : Bindings -> Vals -val (|ExprValWithPossibleTypeInst|_|) : Expr -> (ValRef * ValUseFlag * TType list * range) option -//------------------------------------------------------------------------- -// Build decision trees imperatively -//------------------------------------------------------------------------- +/// Look for a use of an F# value, possibly including application of a generic thing to a set of type arguments +val (|ExprValWithPossibleTypeInst|_|) : Expr -> (ValRef * ValUseFlag * TType list * range) option +/// Build decision trees imperatively type MatchBuilder = + + /// Create a new builder new : SequencePointInfoForBinding * range -> MatchBuilder + + /// Add a new destination target member AddTarget : DecisionTreeTarget -> int + + /// Add a new destination target that is an expression result member AddResultTarget : Expr * SequencePointInfoForTarget -> DecisionTree + + /// Finish the targets member CloseTargets : unit -> DecisionTreeTarget list - member Close : DecisionTree * range * TType -> Expr -//------------------------------------------------------------------------- -// Make some special decision graphs -//------------------------------------------------------------------------- + /// Build the overall expression + member Close : DecisionTree * range * TType -> Expr +/// Add an if-then-else boolean conditional node into a decision tree val mkBoolSwitch : range -> Expr -> DecisionTree -> DecisionTree -> DecisionTree + +/// Build a conditional expression val primMkCond : SequencePointInfoForBinding -> SequencePointInfoForTarget -> SequencePointInfoForTarget -> range -> TType -> Expr -> Expr -> Expr -> Expr + +/// Build a conditional expression val mkCond : SequencePointInfoForBinding -> SequencePointInfoForTarget -> range -> TType -> Expr -> Expr -> Expr -> Expr + +/// Build a conditional expression that checks for non-nullness val mkNonNullCond : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -val mkIfThen : TcGlobals -> range -> Expr -> Expr -> Expr -//------------------------------------------------------------------------- -// Generate new locals -//------------------------------------------------------------------------- +/// Build an if-then statement +val mkIfThen : TcGlobals -> range -> Expr -> Expr -> Expr +/// Build an expression corresponding to the use of a value /// Note: try to use exprForValRef or the expression returned from mkLocal instead of this. val exprForVal : range -> Val -> Expr + +/// Build an expression corresponding to the use of a reference to a value val exprForValRef : range -> ValRef -> Expr -/// Return the local and an expression to reference it +/// Make a new local value and build an expression to reference it val mkLocal : range -> string -> TType -> Val * Expr + +/// Make a new compiler-generated local value and build an expression to reference it val mkCompGenLocal : range -> string -> TType -> Val * Expr + +/// Make a new mutable compiler-generated local value and build an expression to reference it val mkMutableCompGenLocal : range -> string -> TType -> Val * Expr -val mkCompGenLocalAndInvisbleBind : TcGlobals -> string -> range -> Expr -> Val * Expr * Binding -//------------------------------------------------------------------------- -// Make lambdas -//------------------------------------------------------------------------- +/// Make a new mutable compiler-generated local value, 'let' bind it to an expression +/// 'invisibly' (no sequence point etc.), and build an expression to reference it +val mkCompGenLocalAndInvisbleBind : TcGlobals -> string -> range -> Expr -> Val * Expr * Binding +/// Build a lambda expression taking multiple values val mkMultiLambda : range -> Val list -> Expr * TType -> Expr + +/// Rebuild a lambda during an expression tree traversal val rebuildLambda : range -> Val option -> Val option -> Val list -> Expr * TType -> Expr + +/// Build a lambda expression taking a single value val mkLambda : range -> Val -> Expr * TType -> Expr + +/// Build a generic lambda expression (type abstraction) val mkTypeLambda : range -> Typars -> Expr * TType -> Expr + +/// Build an object expression val mkObjExpr : TType * Val option * Expr * ObjExprMethod list * (TType * ObjExprMethod list) list * Range.range -> Expr + +/// Build an type-chose expression, indicating that a local free choice of a type variable val mkTypeChoose : range -> Typars -> Expr -> Expr + +/// Build an iterated (curried) lambda expression val mkLambdas : range -> Typars -> Val list -> Expr * TType -> Expr + +/// Build an iterated (tupled+curried) lambda expression val mkMultiLambdasCore : range -> Val list list -> Expr * TType -> Expr * TType + +/// Build an iterated generic (type abstraction + tupled+curried) lambda expression val mkMultiLambdas : range -> Typars -> Val list list -> Expr * TType -> Expr + +/// Build a lambda expression that corresponds to the implementation of a member val mkMemberLambdas : range -> Typars -> Val option -> Val option -> Val list list -> Expr * TType -> Expr +/// Build a 'while' loop expression val mkWhile : TcGlobals -> SequencePointInfoForWhileLoop * SpecialWhileLoopMarker * Expr * Expr * range -> Expr + +/// Build a 'for' loop expression val mkFor : TcGlobals -> SequencePointInfoForForLoop * Val * Expr * ForLoopStyle * Expr * Expr * range -> Expr + +/// Build a 'try/with' expression val mkTryWith : TcGlobals -> Expr * (* filter val *) Val * (* filter expr *) Expr * (* handler val *) Val * (* handler expr *) Expr * range * TType * SequencePointInfoForTry * SequencePointInfoForWith -> Expr -val mkTryFinally: TcGlobals -> Expr * Expr * range * TType * SequencePointInfoForTry * SequencePointInfoForFinally -> Expr -//------------------------------------------------------------------------- -// Make let/letrec -//------------------------------------------------------------------------- - +/// Build a 'try/finally' expression +val mkTryFinally: TcGlobals -> Expr * Expr * range * TType * SequencePointInfoForTry * SequencePointInfoForFinally -> Expr -// Generate a user-level let-bindings +/// Build a user-level value binding val mkBind : SequencePointInfoForBinding -> Val -> Expr -> Binding + +/// Build a user-level let-binding val mkLetBind : range -> Binding -> Expr -> Expr + +/// Build a user-level value sequence of let bindings val mkLetsBind : range -> Binding list -> Expr -> Expr + +/// Build a user-level value sequence of let bindings val mkLetsFromBindings : range -> Bindings -> Expr -> Expr + +/// Build a user-level let expression val mkLet : SequencePointInfoForBinding -> range -> Val -> Expr -> Expr -> Expr + +/// Make a binding that binds a function value to a lambda taking multiple arguments val mkMultiLambdaBind : Val -> SequencePointInfoForBinding -> range -> Typars -> Val list list -> Expr * TType -> Binding // Compiler generated bindings may involve a user variable. // Compiler generated bindings may give rise to a sequence point if they are part of // an SPAlways expression. Compiler generated bindings can arise from for example, inlining. val mkCompGenBind : Val -> Expr -> Binding + +/// Make a set of bindings that bind compiler generated values to corresponding expressions. +/// Compiler-generated bindings do not give rise to a sequence point in debugging. val mkCompGenBinds : Val list -> Exprs -> Bindings + +/// Make a let-expression that locally binds a compiler-generated value to an expression. +/// Compiler-generated bindings do not give rise to a sequence point in debugging. val mkCompGenLet : range -> Val -> Expr -> Expr -> Expr + +/// Make a let-expression that locally binds a compiler-generated value to an expression, where the expression +/// is returned by the given continuation. Compiler-generated bindings do not give rise to a sequence point in debugging. val mkCompGenLetIn: range -> string -> TType -> Expr -> (Val * Expr -> Expr) -> Expr -// Invisible bindings are never given a sequence point and should never have side effects +/// Make a let-expression that locally binds a value to an expression in an "invisible" way. +/// Invisible bindings are not given a sequence point and should not have side effects. val mkInvisibleLet : range -> Val -> Expr -> Expr -> Expr + +/// Make a binding that binds a value to an expression in an "invisible" way. +/// Invisible bindings are not given a sequence point and should not have side effects. val mkInvisibleBind : Val -> Expr -> Binding + +/// Make a set of bindings that bind values to expressions in an "invisible" way. +/// Invisible bindings are not given a sequence point and should not have side effects. val mkInvisibleBinds : Vals -> Exprs -> Bindings + +/// Make a let-rec expression that locally binds values to expressions where self-reference back to the values is possible. val mkLetRecBinds : range -> Bindings -> Expr -> Expr -//------------------------------------------------------------------------- -// Generalization/inference helpers -//------------------------------------------------------------------------- - /// TypeScheme (generalizedTypars, tauTy) /// /// generalizedTypars -- the truly generalized type parameters /// tauTy -- the body of the generalized type. A 'tau' type is one with its type parameters stripped off. type TypeScheme = TypeScheme of Typars * TType +/// Make the right-hand side of a generalized binding, incorporating the generalized generic parameters from the type +/// scheme into the right-hand side as type generalizations. val mkGenericBindRhs : TcGlobals -> range -> Typars -> TypeScheme -> Expr -> Expr -val isBeingGeneralized : Typar -> TypeScheme -> bool -//------------------------------------------------------------------------- -// Make lazy and/or -//------------------------------------------------------------------------- +/// Test if the type parameter is one of those being generalized by a type scheme. +val isBeingGeneralized : Typar -> TypeScheme -> bool +/// Make the expression corresponding to 'expr1 && expr2' val mkLazyAnd : TcGlobals -> range -> Expr -> Expr -> Expr + +/// Make the expression corresponding to 'expr1 || expr2' val mkLazyOr : TcGlobals -> range -> Expr -> Expr -> Expr + +/// Make a byref type val mkByrefTy : TcGlobals -> TType -> TType + +/// Make a byref type with a in/out kind inference parameter val mkByrefTyWithInference : TcGlobals -> TType -> TType -> TType + +/// Make a in-byref type with a in kind parameter val mkInByrefTy : TcGlobals -> TType -> TType -val mkOutByrefTy : TcGlobals -> TType -> TType -//------------------------------------------------------------------------- -// Make construction operations -//------------------------------------------------------------------------- +/// Make an out-byref type with an out kind parameter +val mkOutByrefTy : TcGlobals -> TType -> TType +/// Make an expression that constructs a union case, e.g. 'Some(expr)' val mkUnionCaseExpr : UnionCaseRef * TypeInst * Exprs * range -> Expr + +/// Make an expression that constructs an exception value val mkExnExpr : TyconRef * Exprs * range -> Expr + +/// Make an expression that is IL assembly code val mkAsmExpr : ILInstr list * TypeInst * Exprs * TTypes * range -> Expr + +/// Make an expression that coerces one expression to another type val mkCoerceExpr : Expr * TType * range * TType -> Expr -val mkReraise : range -> TType -> Expr -val mkReraiseLibCall : TcGlobals -> TType -> range -> Expr +/// Make an expression that re-raises an exception +val mkReraise : range -> TType -> Expr -//------------------------------------------------------------------------- -// Make projection operations -//------------------------------------------------------------------------- +/// Make an expression that re-raises an exception via a library call +val mkReraiseLibCall : TcGlobals -> TType -> range -> Expr +/// Make an expression that gets an item from a tuple val mkTupleFieldGet : TcGlobals -> TupInfo * Expr * TypeInst * int * range -> Expr + +/// Make an expression that gets an item from an anonymous record val mkAnonRecdFieldGet : TcGlobals -> AnonRecdTypeInfo * Expr * TypeInst * int * range -> Expr + +/// Make an expression that gets an item from an anonymous record (via the address of the value if it is a struct) val mkAnonRecdFieldGetViaExprAddr : AnonRecdTypeInfo * Expr * TypeInst * int * range -> Expr + +/// Make an expression that gets an instance field from a record or class (via the address of the value if it is a struct) val mkRecdFieldGetViaExprAddr : Expr * RecdFieldRef * TypeInst * range -> Expr + +/// Make an expression that gets the address of an instance field from a record or class (via the address of the value if it is a struct) val mkRecdFieldGetAddrViaExprAddr : readonly: bool * Expr * RecdFieldRef * TypeInst * range -> Expr + +/// Make an expression that gets a static field from a record or class val mkStaticRecdFieldGet : RecdFieldRef * TypeInst * range -> Expr + +/// Make an expression that sets a static field in a record or class val mkStaticRecdFieldSet : RecdFieldRef * TypeInst * Expr * range -> Expr + +/// Make an expression that gets the address of a static field in a record or class val mkStaticRecdFieldGetAddr : readonly: bool * RecdFieldRef * TypeInst * range -> Expr + +/// Make an expression that sets an instance the field of a record or class (via the address of the value if it is a struct) val mkRecdFieldSetViaExprAddr : Expr * RecdFieldRef * TypeInst * Expr * range -> Expr + +/// Make an expression that gets the tag of a union value (via the address of the value if it is a struct) val mkUnionCaseTagGetViaExprAddr : Expr * TyconRef * TypeInst * range -> Expr /// Make a 'TOp.UnionCaseProof' expression, which proves a union value is over a particular case (used only for ref-unions, not struct-unions) @@ -238,9 +319,13 @@ val mkUnionCaseFieldSet : Expr * UnionCaseRef * TypeInst * int * E /// Like mkUnionCaseFieldGetUnprovenViaExprAddr, but for struct-unions, the input should be a copy of the expression. val mkUnionCaseFieldGetUnproven : TcGlobals -> Expr * UnionCaseRef * TypeInst * int * range -> Expr +/// Make an expression that gets an instance field from an F# exception value val mkExnCaseFieldGet : Expr * TyconRef * int * range -> Expr + +/// Make an expression that sets an instance field in an F# exception value val mkExnCaseFieldSet : Expr * TyconRef * int * Expr * range -> Expr +/// Make an expression that gets the address of an element in an array val mkArrayElemAddress : TcGlobals -> readonly: bool * ILReadonly * bool * ILArrayShape * TType * Expr list * range -> Expr //------------------------------------------------------------------------- @@ -272,49 +357,60 @@ val mkGetTupleItemN : TcGlobals -> range -> int -> ILType -> bool -> Expr -> TTy /// Evaluate the TupInfo to work out if it is a struct or a ref. Currently this is very simple /// but TupInfo may later be used carry variables that infer structness. val evalTupInfoIsStruct : TupInfo -> bool + +/// Evaluate the AnonRecdTypeInfo to work out if it is a struct or a ref. val evalAnonInfoIsStruct : AnonRecdTypeInfo -> bool /// If it is a tuple type, ensure it's outermost type is a .NET tuple type, otherwise leave unchanged val convertToTypeWithMetadataIfPossible : TcGlobals -> TType -> TType - -//------------------------------------------------------------------------- -// Take the address of an expression, or force it into a mutable local. Any allocated -// mutable local may need to be kept alive over a larger expression, hence we return -// a wrapping function that wraps "let mutable loc = Expr in ..." around a larger -// expression. -//------------------------------------------------------------------------- - +/// An exception representing a warning for a defensive copy of an immutable struct exception DefensiveCopyWarning of string * range + type Mutates = AddressOfOp | DefinitelyMutates | PossiblyMutates | NeverMutates + +/// Helper to take the address of an expression val mkExprAddrOfExprAux : TcGlobals -> bool -> bool -> Mutates -> Expr -> ValRef option -> range -> (Val * Expr) option * Expr * bool * bool -val mkExprAddrOfExpr : TcGlobals -> bool -> bool -> Mutates -> Expr -> ValRef option -> range -> (Expr -> Expr) * Expr * bool * bool -//------------------------------------------------------------------------- -// Tables keyed on values and/or type parameters -//------------------------------------------------------------------------- +/// Take the address of an expression, or force it into a mutable local. Any allocated +/// mutable local may need to be kept alive over a larger expression, hence we return +/// a wrapping function that wraps "let mutable loc = Expr in ..." around a larger +/// expression. +val mkExprAddrOfExpr : TcGlobals -> bool -> bool -> Mutates -> Expr -> ValRef option -> range -> (Expr -> Expr) * Expr * bool * bool /// Maps Val to T, based on stamps [] type ValMap<'T> = + member Contents : StampMap<'T> + member Item : Val -> 'T with get + member TryFind : Val -> 'T option + member ContainsVal : Val -> bool + member Add : Val -> 'T -> ValMap<'T> + member Remove : Val -> ValMap<'T> + member IsEmpty : bool + static member Empty : ValMap<'T> + static member OfList : (Val * 'T) list -> ValMap<'T> /// Mutable data structure mapping Val's to T based on stamp keys [] type ValHash<'T> = + member Values : seq<'T> + member TryFind : Val -> 'T option + member Add : Val * 'T -> unit - static member Create : unit -> ValHash<'T> + static member Create : unit -> ValHash<'T> /// Maps Val's to list of T based on stamp keys [] @@ -332,97 +428,126 @@ type ValMultiMap<'T> = static member Empty : ValMultiMap<'T> +/// Maps type parameters to entries based on stamp keys [] -/// Maps Typar to T based on stamp keys type TyparMap<'T> = + /// Get the entry for the given type parameter member Item : Typar -> 'T with get + /// Determine is the map contains an entry for the given type parameter member ContainsKey : Typar -> bool + /// Try to find the entry for the given type parameter member TryFind : Typar -> 'T option + /// Make a new map, containing a new entry for the given type parameter member Add : Typar * 'T -> TyparMap<'T> + /// The empty map static member Empty : TyparMap<'T> -[] /// Maps TyconRef to T based on stamp keys +[] type TyconRefMap<'T> = + /// Get the entry for the given type definition member Item : TyconRef -> 'T with get + /// Try to find the entry for the given type definition member TryFind : TyconRef -> 'T option + /// Determine is the map contains an entry for the given type definition member ContainsKey : TyconRef -> bool + /// Make a new map, containing a new entry for the given type definition member Add : TyconRef -> 'T -> TyconRefMap<'T> + /// Remove the entry for the given type definition, if any member Remove : TyconRef -> TyconRefMap<'T> + /// Determine if the map is empty member IsEmpty : bool + /// The empty map static member Empty : TyconRefMap<'T> + /// Make a new map, containing entries for the given type definitions static member OfList : (TyconRef * 'T) list -> TyconRefMap<'T> /// Maps TyconRef to list of T based on stamp keys [] type TyconRefMultiMap<'T> = + /// Fetch the entries for the given type definition member Find : TyconRef -> 'T list + /// Make a new map, containing a new entry for the given type definition member Add : TyconRef * 'T -> TyconRefMultiMap<'T> + /// The empty map static member Empty : TyconRefMultiMap<'T> + /// Make a new map, containing a entries for the given type definitions static member OfList : (TyconRef * 'T) list -> TyconRefMultiMap<'T> -//------------------------------------------------------------------------- -// Orderings on Tycon, Val, RecdFieldRef, Typar -//------------------------------------------------------------------------- +/// An ordering for value definitions, based on stamp +val valOrder: IComparer -val valOrder : IComparer -val tyconOrder : IComparer -val recdFieldRefOrder : IComparer -val typarOrder : IComparer +/// An ordering for type definitions, based on stamp +val tyconOrder: IComparer -//------------------------------------------------------------------------- -// Equality on Tycon and Val -//------------------------------------------------------------------------- +/// An ordering for record fields, based on stamp +val recdFieldRefOrder: IComparer +/// An ordering for type parameters, based on stamp +val typarOrder: IComparer + +/// Equality for type definition references val tyconRefEq : TcGlobals -> TyconRef -> TyconRef -> bool + +/// Equality for value references val valRefEq : TcGlobals -> ValRef -> ValRef -> bool //------------------------------------------------------------------------- // Operations on types: substitution //------------------------------------------------------------------------- +/// Represents an instantiation where types replace type parameters type TyparInst = (Typar * TType) list +/// Represents an instantiation where type definition references replace other type definition references type TyconRefRemap = TyconRefMap + +/// Represents an instantiation where value references replace other value references type ValRemap = ValMap +/// Represents a combination of substitutions/instantiations where things replace other things during remapping [] type Remap = - { tpinst : TyparInst; - valRemap: ValRemap; - tyconRefRemap : TyconRefRemap; + { tpinst : TyparInst + valRemap: ValRemap + tyconRefRemap : TyconRefRemap removeTraitSolutions: bool } static member Empty : Remap val addTyconRefRemap : TyconRef -> TyconRef -> Remap -> Remap -val addValRemap : Val -> Val -> Remap -> Remap +val addValRemap : Val -> Val -> Remap -> Remap val mkTyparInst : Typars -> TTypes -> TyparInst + val mkTyconRefInst : TyconRef -> TypeInst -> TyparInst + val emptyTyparInst : TyparInst val instType : TyparInst -> TType -> TType + val instTypes : TyparInst -> TypeInst -> TypeInst + val instTyparConstraints : TyparInst -> TyparConstraint list -> TyparConstraint list + val instTrait : TyparInst -> TraitConstraintInfo -> TraitConstraintInfo //------------------------------------------------------------------------- @@ -430,8 +555,11 @@ val instTrait : TyparInst -> TraitConstraintInfo -> TraitConstraint //------------------------------------------------------------------------- val generalizeTypars : Typars -> TypeInst + val generalizeTyconRef : TyconRef -> TTypes * TType + val generalizedTyconRef : TyconRef -> TType + val mkTyparToTyparRenaming : Typars -> Typars -> TyparInst * TTypes //------------------------------------------------------------------------- @@ -439,12 +567,16 @@ val mkTyparToTyparRenaming : Typars -> Typars -> TyparInst * TTypes //------------------------------------------------------------------------- val reduceTyconRefAbbrev : TyconRef -> TypeInst -> TType + val reduceTyconRefMeasureableOrProvided : TcGlobals -> TyconRef -> TypeInst -> TType + val reduceTyconRefAbbrevMeasureable : TyconRef -> Measure /// set bool to 'true' to allow shortcutting of type parameter equation chains during stripping val stripTyEqnsA : TcGlobals -> bool -> TType -> TType + val stripTyEqns : TcGlobals -> TType -> TType + val stripTyEqnsAndMeasureEqns : TcGlobals -> TType -> TType val tryNormalizeMeasureInType : TcGlobals -> TType -> TType @@ -455,7 +587,9 @@ val tryNormalizeMeasureInType : TcGlobals -> TType -> TType /// See through F# exception abbreviations val stripExnEqns : TyconRef -> Tycon + val recdFieldsOfExnDefRef : TyconRef -> RecdField list + val recdFieldTysOfExnDefRef : TyconRef -> TType list //------------------------------------------------------------------------- @@ -464,63 +598,102 @@ val recdFieldTysOfExnDefRef : TyconRef -> TType list //------------------------------------------------------------------------- val destForallTy : TcGlobals -> TType -> Typars * TType + val destFunTy : TcGlobals -> TType -> TType * TType + val destAnyTupleTy : TcGlobals -> TType -> TupInfo * TTypes + val destRefTupleTy : TcGlobals -> TType -> TTypes + val destStructTupleTy : TcGlobals -> TType -> TTypes + val destTyparTy : TcGlobals -> TType -> Typar + val destAnyParTy : TcGlobals -> TType -> Typar + val destMeasureTy : TcGlobals -> TType -> Measure + val tryDestForallTy : TcGlobals -> TType -> Typars * TType val isFunTy : TcGlobals -> TType -> bool + val isForallTy : TcGlobals -> TType -> bool + val isAnyTupleTy : TcGlobals -> TType -> bool + val isRefTupleTy : TcGlobals -> TType -> bool + val isStructTupleTy : TcGlobals -> TType -> bool + val isStructAnonRecdTy : TcGlobals -> TType -> bool + val isAnonRecdTy : TcGlobals -> TType -> bool + val isUnionTy : TcGlobals -> TType -> bool + val isReprHiddenTy : TcGlobals -> TType -> bool + val isFSharpObjModelTy : TcGlobals -> TType -> bool + val isRecdTy : TcGlobals -> TType -> bool + val isFSharpStructOrEnumTy : TcGlobals -> TType -> bool + val isFSharpEnumTy : TcGlobals -> TType -> bool + val isTyparTy : TcGlobals -> TType -> bool + val isAnyParTy : TcGlobals -> TType -> bool + val tryAnyParTy : TcGlobals -> TType -> ValueOption + val tryAnyParTyOption : TcGlobals -> TType -> Typar option + val isMeasureTy : TcGlobals -> TType -> bool val mkAppTy : TyconRef -> TypeInst -> TType val mkProvenUnionCaseTy : UnionCaseRef -> TypeInst -> TType + val isProvenUnionCaseTy : TType -> bool val isAppTy : TcGlobals -> TType -> bool + val tryAppTy : TcGlobals -> TType -> ValueOption + val destAppTy : TcGlobals -> TType -> TyconRef * TypeInst + val tcrefOfAppTy : TcGlobals -> TType -> TyconRef + val tryDestAppTy : TcGlobals -> TType -> ValueOption + val tryDestTyparTy : TcGlobals -> TType -> ValueOption + val tryDestFunTy : TcGlobals -> TType -> ValueOption<(TType * TType)> + val tryDestAnonRecdTy : TcGlobals -> TType -> ValueOption + val argsOfAppTy : TcGlobals -> TType -> TypeInst + val mkInstForAppTy : TcGlobals -> TType -> TyparInst /// Try to get a TyconRef for a type without erasing type abbreviations val tryNiceEntityRefOfTy : TType -> ValueOption -val tryNiceEntityRefOfTyOption : TType -> TyconRef option +val tryNiceEntityRefOfTyOption : TType -> TyconRef option val domainOfFunTy : TcGlobals -> TType -> TType + val rangeOfFunTy : TcGlobals -> TType -> TType + val stripFunTy : TcGlobals -> TType -> TType list * TType + val stripFunTyN : TcGlobals -> int -> TType -> TType list * TType val applyForallTy : TcGlobals -> TType -> TypeInst -> TType val tryDestAnyTupleTy : TcGlobals -> TType -> TupInfo * TType list + val tryDestRefTupleTy : TcGlobals -> TType -> TType list //------------------------------------------------------------------------- @@ -535,7 +708,9 @@ val actualTysOfUnionCaseFields : TyparInst -> UnionCaseRef -> TType list val actualTysOfInstanceRecdFields : TyparInst -> TyconRef -> TType list val actualTyOfRecdField : TyparInst -> RecdField -> TType + val actualTyOfRecdFieldRef : RecdFieldRef -> TypeInst -> TType + val actualTyOfRecdFieldForTycon : Tycon -> TypeInst -> RecdField -> TType //------------------------------------------------------------------------- @@ -545,14 +720,21 @@ val actualTyOfRecdFieldForTycon : Tycon -> TypeInst -> RecdField -> TType //------------------------------------------------------------------------- type UncurriedArgInfos = (TType * ArgReprInfo) list + type CurriedArgInfos = UncurriedArgInfos list val destTopForallTy : TcGlobals -> ValReprInfo -> TType -> Typars * TType + val GetTopTauTypeInFSharpForm : TcGlobals -> ArgReprInfo list list -> TType -> range -> CurriedArgInfos * TType + val GetTopValTypeInFSharpForm : TcGlobals -> ValReprInfo -> TType -> range -> Typars * CurriedArgInfos * TType * ArgReprInfo + val IsCompiledAsStaticProperty : TcGlobals -> Val -> bool + val IsCompiledAsStaticPropertyWithField : TcGlobals -> Val -> bool + val GetTopValTypeInCompiledForm : TcGlobals -> ValReprInfo -> TType -> range -> Typars * CurriedArgInfos * TType option * ArgReprInfo + val GetFSharpViewOfReturnType : TcGlobals -> TType option -> TType val NormalizeDeclaredTyparsForEquiRecursiveInference : TcGlobals -> Typars -> Typars @@ -568,40 +750,58 @@ val applyTys : TcGlobals -> TType -> TType list * 'T list -> TType //------------------------------------------------------------------------- val emptyFreeTypars : FreeTypars + val unionFreeTypars : FreeTypars -> FreeTypars -> FreeTypars val emptyFreeTycons : FreeTycons + val unionFreeTycons : FreeTycons -> FreeTycons -> FreeTycons val emptyFreeTyvars : FreeTyvars + val isEmptyFreeTyvars : FreeTyvars -> bool + val unionFreeTyvars : FreeTyvars -> FreeTyvars -> FreeTyvars val emptyFreeLocals : FreeLocals + val unionFreeLocals : FreeLocals -> FreeLocals -> FreeLocals type FreeVarOptions val CollectLocalsNoCaching : FreeVarOptions + val CollectTyparsNoCaching : FreeVarOptions + val CollectTyparsAndLocalsNoCaching : FreeVarOptions + val CollectTyparsAndLocals : FreeVarOptions + val CollectLocals : FreeVarOptions + val CollectTypars : FreeVarOptions + val CollectAllNoCaching : FreeVarOptions + val CollectAll : FreeVarOptions val accFreeInTypes : FreeVarOptions -> TType list -> FreeTyvars -> FreeTyvars + val accFreeInType : FreeVarOptions -> TType -> FreeTyvars -> FreeTyvars + val accFreeInTypars : FreeVarOptions -> Typars -> FreeTyvars -> FreeTyvars val freeInType : FreeVarOptions -> TType -> FreeTyvars + val freeInTypes : FreeVarOptions -> TType list -> FreeTyvars + val freeInVal : FreeVarOptions -> Val -> FreeTyvars // This one puts free variables in canonical left-to-right order. val freeInTypeLeftToRight : TcGlobals -> bool -> TType -> Typars + val freeInTypesLeftToRight : TcGlobals -> bool -> TType list -> Typars + val freeInTypesLeftToRightSkippingConstraints : TcGlobals -> TType list -> Typars val freeInModuleTy: ModuleOrNamespaceType -> FreeTyvars @@ -614,25 +814,39 @@ val isDimensionless : TcGlobals -> TType -> bool [] type TypeEquivEnv = - { EquivTypars: TyparMap; + { EquivTypars: TyparMap EquivTycons: TyconRefRemap } static member Empty : TypeEquivEnv + member BindEquivTypars : Typars -> Typars -> TypeEquivEnv + static member FromTyparInst : TyparInst -> TypeEquivEnv + static member FromEquivTypars : Typars -> Typars -> TypeEquivEnv val traitsAEquivAux : Erasure -> TcGlobals -> TypeEquivEnv -> TraitConstraintInfo -> TraitConstraintInfo -> bool + val traitsAEquiv : TcGlobals -> TypeEquivEnv -> TraitConstraintInfo -> TraitConstraintInfo -> bool + val typarConstraintsAEquivAux : Erasure -> TcGlobals -> TypeEquivEnv -> TyparConstraint -> TyparConstraint -> bool + val typarConstraintsAEquiv : TcGlobals -> TypeEquivEnv -> TyparConstraint -> TyparConstraint -> bool + val typarsAEquiv : TcGlobals -> TypeEquivEnv -> Typars -> Typars -> bool + val typeAEquivAux : Erasure -> TcGlobals -> TypeEquivEnv -> TType -> TType -> bool + val typeAEquiv : TcGlobals -> TypeEquivEnv -> TType -> TType -> bool + val returnTypesAEquivAux : Erasure -> TcGlobals -> TypeEquivEnv -> TType option -> TType option -> bool + val returnTypesAEquiv : TcGlobals -> TypeEquivEnv -> TType option -> TType option -> bool + val tcrefAEquiv : TcGlobals -> TypeEquivEnv -> TyconRef -> TyconRef -> bool + val valLinkageAEquiv : TcGlobals -> TypeEquivEnv -> Val -> Val -> bool + val anonInfoEquiv : AnonRecdTypeInfo -> AnonRecdTypeInfo -> bool //------------------------------------------------------------------------- @@ -650,11 +864,17 @@ val getErasedTypes : TcGlobals -> TType -> TType list //------------------------------------------------------------------------- val MeasurePower : Measure -> int -> Measure + val ListMeasureVarOccsWithNonZeroExponents : Measure -> (Typar * Rational) list + val ListMeasureConOccsWithNonZeroExponents : TcGlobals -> bool -> Measure -> (TyconRef * Rational) list + val ProdMeasures : Measure list -> Measure + val MeasureVarExponent : Typar -> Measure -> Rational + val MeasureExprConExponent : TcGlobals -> bool -> TyconRef -> Measure -> Rational + val normalizeMeasure : TcGlobals -> Measure -> Measure @@ -663,19 +883,26 @@ val normalizeMeasure : TcGlobals -> Measure -> Measure //------------------------------------------------------------------------- val GetTypeOfMemberInFSharpForm : TcGlobals -> ValRef -> Typars * CurriedArgInfos * TType * ArgReprInfo + val GetTypeOfMemberInMemberForm : TcGlobals -> ValRef -> Typars * CurriedArgInfos * TType option * ArgReprInfo + val GetTypeOfIntrinsicMemberInCompiledForm : TcGlobals -> ValRef -> Typars * CurriedArgInfos * TType option * ArgReprInfo + val GetMemberTypeInMemberForm : TcGlobals -> MemberFlags -> ValReprInfo -> TType -> range -> Typars * CurriedArgInfos * TType option * ArgReprInfo /// Returns (parentTypars,memberParentTypars,memberMethodTypars,memberToParentInst,tinst) val PartitionValTyparsForApparentEnclosingType : TcGlobals -> Val -> (Typars * Typars * Typars * TyparInst * TType list) option + /// Returns (parentTypars,memberParentTypars,memberMethodTypars,memberToParentInst,tinst) val PartitionValTypars : TcGlobals -> Val -> (Typars * Typars * Typars * TyparInst * TType list) option + /// Returns (parentTypars,memberParentTypars,memberMethodTypars,memberToParentInst,tinst) val PartitionValRefTypars : TcGlobals -> ValRef -> (Typars * Typars * Typars * TyparInst * TType list) option val ReturnTypeOfPropertyVal : TcGlobals -> Val -> TType + val ArgInfosOfPropertyVal : TcGlobals -> Val -> UncurriedArgInfos + val ArgInfosOfMember: TcGlobals -> ValRef -> CurriedArgInfos val GetMemberCallInfo : TcGlobals -> ValRef * ValUseFlag -> int * bool * bool * bool * bool * bool * bool * bool @@ -686,68 +913,95 @@ val GetMemberCallInfo : TcGlobals -> ValRef * ValUseFlag -> int * bool * bool * type TyparConstraintsWithTypars = (Typar * TyparConstraint) list - module PrettyTypes = + val NeedsPrettyTyparName : Typar -> bool + val NewPrettyTypars : TyparInst -> Typars -> string list -> Typars * TyparInst + val PrettyTyparNames : (Typar -> bool) -> string list -> Typars -> string list + val PrettifyType : TcGlobals -> TType -> TType * TyparConstraintsWithTypars + val PrettifyInstAndTyparsAndType : TcGlobals -> TyparInst * Typars * TType -> (TyparInst * Typars * TType) * TyparConstraintsWithTypars + val PrettifyTypePair : TcGlobals -> TType * TType -> (TType * TType) * TyparConstraintsWithTypars + val PrettifyTypes : TcGlobals -> TTypes -> TTypes * TyparConstraintsWithTypars + val PrettifyInst : TcGlobals -> TyparInst -> TyparInst * TyparConstraintsWithTypars + val PrettifyInstAndType : TcGlobals -> TyparInst * TType -> (TyparInst * TType) * TyparConstraintsWithTypars + val PrettifyInstAndTypes : TcGlobals -> TyparInst * TTypes -> (TyparInst * TTypes) * TyparConstraintsWithTypars + val PrettifyInstAndSig : TcGlobals -> TyparInst * TTypes * TType -> (TyparInst * TTypes * TType) * TyparConstraintsWithTypars + val PrettifyCurriedTypes : TcGlobals -> TType list list -> TType list list * TyparConstraintsWithTypars + val PrettifyCurriedSigTypes : TcGlobals -> TType list list * TType -> (TType list list * TType) * TyparConstraintsWithTypars + val PrettifyInstAndUncurriedSig : TcGlobals -> TyparInst * UncurriedArgInfos * TType -> (TyparInst * UncurriedArgInfos * TType) * TyparConstraintsWithTypars + val PrettifyInstAndCurriedSig : TcGlobals -> TyparInst * TTypes * CurriedArgInfos * TType -> (TyparInst * TTypes * CurriedArgInfos * TType) * TyparConstraintsWithTypars [] type DisplayEnv = - { includeStaticParametersInTypeNames : bool; - openTopPathsSorted: Lazy; - openTopPathsRaw: string list list; - shortTypeNames: bool; - suppressNestedTypes: bool; - maxMembers : int option; - showObsoleteMembers: bool; - showHiddenMembers: bool; - showTyparBinding: bool; - showImperativeTyparAnnotations: bool; - suppressInlineKeyword:bool; - suppressMutableKeyword:bool; - showMemberContainers: bool; - shortConstraints:bool; - useColonForReturnType:bool; - showAttributes: bool; - showOverrides:bool; - showConstraintTyparAnnotations:bool; - abbreviateAdditionalConstraints: bool; + { includeStaticParametersInTypeNames : bool + openTopPathsSorted: Lazy + openTopPathsRaw: string list list + shortTypeNames: bool + suppressNestedTypes: bool + maxMembers : int option + showObsoleteMembers: bool + showHiddenMembers: bool + showTyparBinding: bool + showImperativeTyparAnnotations: bool + suppressInlineKeyword:bool + suppressMutableKeyword:bool + showMemberContainers: bool + shortConstraints:bool + useColonForReturnType:bool + showAttributes: bool + showOverrides:bool + showConstraintTyparAnnotations:bool + abbreviateAdditionalConstraints: bool showTyparDefaultConstraints: bool g: TcGlobals contextAccessibility: Accessibility generatedValueLayout:(Val -> layout option) } + member SetOpenPaths: string list list -> DisplayEnv + static member Empty: TcGlobals -> DisplayEnv member AddAccessibility : Accessibility -> DisplayEnv + member AddOpenPath : string list -> DisplayEnv + member AddOpenModuleOrNamespace : ModuleOrNamespaceRef -> DisplayEnv val tagEntityRefName: xref: EntityRef -> name: string -> StructuredFormat.TaggedText /// Return the full text for an item as we want it displayed to the user as a fully qualified entity val fullDisplayTextOfModRef : ModuleOrNamespaceRef -> string + val fullDisplayTextOfParentOfModRef : ModuleOrNamespaceRef -> ValueOption + val fullDisplayTextOfValRef : ValRef -> string + val fullDisplayTextOfValRefAsLayout : ValRef -> StructuredFormat.Layout + val fullDisplayTextOfTyconRef : TyconRef -> string + val fullDisplayTextOfTyconRefAsLayout : TyconRef -> StructuredFormat.Layout + val fullDisplayTextOfExnRef : TyconRef -> string + val fullDisplayTextOfExnRefAsLayout : TyconRef -> StructuredFormat.Layout + val fullDisplayTextOfUnionCaseRef : UnionCaseRef -> string + val fullDisplayTextOfRecdFieldRef : RecdFieldRef -> string val ticksAndArgCountTextOfTyconRef : TyconRef -> string @@ -758,22 +1012,23 @@ val qualifiedMangledNameOfTyconRef : TyconRef -> string -> string val trimPathByDisplayEnv : DisplayEnv -> string list -> string val prefixOfStaticReq : TyparStaticReq -> string + val prefixOfRigidTypar : Typar -> string /// Utilities used in simplifying types for visual presentation module SimplifyTypes = + type TypeSimplificationInfo = - { singletons : Typar Zset; - inplaceConstraints : Zmap; - postfixConstraints : TyparConstraintsWithTypars; } + { singletons : Typar Zset + inplaceConstraints : Zmap + postfixConstraints : TyparConstraintsWithTypars } + val typeSimplificationInfo0 : TypeSimplificationInfo - val CollectInfo : bool -> TType list -> TyparConstraintsWithTypars -> TypeSimplificationInfo -//------------------------------------------------------------------------- -// -//------------------------------------------------------------------------- + val CollectInfo : bool -> TType list -> TyparConstraintsWithTypars -> TypeSimplificationInfo val superOfTycon : TcGlobals -> Tycon -> TType + val abstractSlotValsOfTycons : Tycon list -> Val list //------------------------------------------------------------------------- @@ -781,11 +1036,15 @@ val abstractSlotValsOfTycons : Tycon list -> Val list //------------------------------------------------------------------------- val emptyFreeVars : FreeVars + val unionFreeVars : FreeVars -> FreeVars -> FreeVars val accFreeInTargets : FreeVarOptions -> DecisionTreeTarget array -> FreeVars -> FreeVars + val accFreeInExprs : FreeVarOptions -> Exprs -> FreeVars -> FreeVars + val accFreeInSwitchCases : FreeVarOptions -> DecisionTreeCase list -> DecisionTree option -> FreeVars -> FreeVars + val accFreeInDecisionTree : FreeVarOptions -> DecisionTree -> FreeVars -> FreeVars /// Get the free variables in a module definition. @@ -797,277 +1056,382 @@ val freeInExpr : FreeVarOptions -> Expr -> FreeVars /// Get the free variables in the right hand side of a binding. val freeInBindingRhs : FreeVarOptions -> Binding -> FreeVars +/// Check if a set of free type variables are all public val freeTyvarsAllPublic : FreeTyvars -> bool -val freeVarsAllPublic : FreeVars -> bool -//------------------------------------------------------------------------- -// Mark/range/position information from expressions -//------------------------------------------------------------------------- +/// Check if a set of free variables are all public +val freeVarsAllPublic : FreeVars -> bool +/// Get the mark/range/position information from an expression type Expr with member Range : range -//------------------------------------------------------------------------- -// type-of operations on the expression tree -//------------------------------------------------------------------------- - +/// Compute the type of an expression from the expression itself val tyOfExpr : TcGlobals -> Expr -> TType -//------------------------------------------------------------------------- -// Top expressions to implement top types -//------------------------------------------------------------------------- - +/// A flag to govern whether arity inference should be type-directed or syntax-directed when +/// inferring an arity from a lambda expression. [] -type AllowTypeDirectedDetupling = Yes | No +type AllowTypeDirectedDetupling = + | Yes + | No +/// Given a (curried) lambda expression, pull off its arguments val stripTopLambda : Expr * TType -> Typars * Val list list * Expr * TType + +/// Given a lambda expression, extract the ValReprInfo for its arguments and other details val InferArityOfExpr : TcGlobals -> AllowTypeDirectedDetupling -> TType -> Attribs list list -> Attribs -> Expr -> ValReprInfo + +/// Given a lambda binding, extract the ValReprInfo for its arguments and other details val InferArityOfExprBinding : TcGlobals -> AllowTypeDirectedDetupling -> Val -> Expr -> ValReprInfo -//------------------------------------------------------------------------- -// Copy expressions and types -//------------------------------------------------------------------------- - +/// Mutate a value to indicate it should be considered a local rather than a module-bound definition // REVIEW: this mutation should not be needed val setValHasNoArity : Val -> Val +/// Indicate what should happen to value definitions when copying expressions type ValCopyFlag = | CloneAll | CloneAllAndMarkExprValsAsCompilerGenerated - // OnlyCloneExprVals is a nasty setting to reuse the cloning logic in a mode where all - // Tycon and "module/member" Val objects keep their identity, but the Val objects for all Expr bindings - // are cloned. This is used to 'fixup' the TAST created by tlr.fs - // - // This is a fragile mode of use. It's not really clear why TLR needs to create a "bad" expression tree that - // reuses Val objects as multiple value bindings, and its been the cause of several subtle bugs. + + /// OnlyCloneExprVals is a nasty setting to reuse the cloning logic in a mode where all + /// Tycon and "module/member" Val objects keep their identity, but the Val objects for all Expr bindings + /// are cloned. This is used to 'fixup' the TAST created by tlr.fs + /// + /// This is a fragile mode of use. It's not really clear why TLR needs to create a "bad" expression tree that + /// reuses Val objects as multiple value bindings, and its been the cause of several subtle bugs. | OnlyCloneExprVals +/// Remap a reference to a type definition using the given remapping substitution val remapTyconRef : TyconRefRemap -> TyconRef -> TyconRef + +/// Remap a reference to a union case using the given remapping substitution val remapUnionCaseRef : TyconRefRemap -> UnionCaseRef -> UnionCaseRef + +/// Remap a reference to a record field using the given remapping substitution val remapRecdFieldRef : TyconRefRemap -> RecdFieldRef -> RecdFieldRef + +/// Remap a reference to a value using the given remapping substitution val remapValRef : Remap -> ValRef -> ValRef + +/// Remap an expression using the given remapping substitution val remapExpr : TcGlobals -> ValCopyFlag -> Remap -> Expr -> Expr + +/// Remap an attribute using the given remapping substitution val remapAttrib : TcGlobals -> Remap -> Attrib -> Attrib + +/// Remap a (possible generic) type using the given remapping substitution val remapPossibleForallTy : TcGlobals -> Remap -> TType -> TType + +/// Copy an entire module or namespace type using the given copying flags val copyModuleOrNamespaceType : TcGlobals -> ValCopyFlag -> ModuleOrNamespaceType -> ModuleOrNamespaceType + +/// Copy an entire expression using the given copying flags val copyExpr : TcGlobals -> ValCopyFlag -> Expr -> Expr + +/// Copy an entire implementation file using the given copying flags val copyImplFile : TcGlobals -> ValCopyFlag -> TypedImplFile -> TypedImplFile + +/// Copy a method slot signature, including new generic type parameters if the slot signature represents a generic method val copySlotSig : SlotSig -> SlotSig + +/// Instantiate the generic type parameters in a method slot signature, building a new one val instSlotSig : TyparInst -> SlotSig -> SlotSig -val instExpr : TcGlobals -> TyparInst -> Expr -> Expr -//------------------------------------------------------------------------- -// Build the remapping that corresponds to a module meeting its signature -// and also report the set of tycons, tycon representations and values hidden in the process. -//------------------------------------------------------------------------- +/// Instantiate the generic type parameters in an expression, building a new one +val instExpr : TcGlobals -> TyparInst -> Expr -> Expr +/// The remapping that corresponds to a module meeting its signature +/// and also report the set of tycons, tycon representations and values hidden in the process. type SignatureRepackageInfo = - { mrpiVals: (ValRef * ValRef) list; - mrpiEntities: (TyconRef * TyconRef) list } + { /// The list of corresponding values + RepackagedVals: (ValRef * ValRef) list + + /// The list of corresponding modules, namespacea and type definitions + RepackagedEntities: (TyconRef * TyconRef) list } + /// The empty table static member Empty : SignatureRepackageInfo +/// A set of tables summarizing the items hidden by a signature type SignatureHidingInfo = - { mhiTycons : Zset; - mhiTyconReprs : Zset; - mhiVals : Zset; - mhiRecdFields : Zset; - mhiUnionCases : Zset } + { HiddenTycons: Zset + HiddenTyconReprs: Zset + HiddenVals: Zset + HiddenRecdFields: Zset + HiddenUnionCases: Zset } + + /// The empty table representing no hiding static member Empty : SignatureHidingInfo -val ComputeRemappingFromInferredSignatureToExplicitSignature : TcGlobals -> ModuleOrNamespaceType -> ModuleOrNamespaceType -> SignatureRepackageInfo * SignatureHidingInfo +/// Compute the remapping information implied by a signature being inferred for a particular implementation val ComputeRemappingFromImplementationToSignature : TcGlobals -> ModuleOrNamespaceExpr -> ModuleOrNamespaceType -> SignatureRepackageInfo * SignatureHidingInfo + +/// Compute the remapping information implied by an explicit signature being given for an inferred signature +val ComputeRemappingFromInferredSignatureToExplicitSignature : TcGlobals -> ModuleOrNamespaceType -> ModuleOrNamespaceType -> SignatureRepackageInfo * SignatureHidingInfo + +/// Compute the hiding information that corresponds to the hiding applied at an assembly boundary val ComputeHidingInfoAtAssemblyBoundary : ModuleOrNamespaceType -> SignatureHidingInfo -> SignatureHidingInfo + val mkRepackageRemapping : SignatureRepackageInfo -> Remap +/// Wrap one module or namespace implementation in a 'namespace N' outer wrapper val wrapModuleOrNamespaceExprInNamespace : Ident -> CompilationPath -> ModuleOrNamespaceExpr -> ModuleOrNamespaceExpr + +/// Wrap one module or namespace definition in a 'namespace N' outer wrapper val wrapModuleOrNamespaceTypeInNamespace : Ident -> CompilationPath -> ModuleOrNamespaceType -> ModuleOrNamespaceType * ModuleOrNamespace + +/// Wrap one module or namespace definition in a 'module M = ..' outer wrapper val wrapModuleOrNamespaceType : Ident -> CompilationPath -> ModuleOrNamespaceType -> ModuleOrNamespace +/// Given an implementation, fetch its recorded signature val SigTypeOfImplFile : TypedImplFile -> ModuleOrNamespaceType -//------------------------------------------------------------------------- -// Given a list of top-most signatures that together constrain the public compilation units -// of an assembly, compute a remapping that converts local references to non-local references. -// This remapping must be applied to all pickled expressions and types -// exported from the assembly. -//------------------------------------------------------------------------- - - +/// Given a namespace, module or type definition, try to produce a reference to that entity. val tryRescopeEntity : CcuThunk -> Entity -> ValueOption + +/// Given a value definition, try to produce a reference to that value. Fails for local values. val tryRescopeVal : CcuThunk -> Remap -> Val -> ValueOption +/// Make the substitution (remapping) table for viewing a module or namespace 'from the outside' +/// +/// Given the top-most signatures constrains the public compilation units +/// of an assembly, compute a remapping that converts local references to non-local references. +/// This remapping must be applied to all pickled expressions and types +/// exported from the assembly. val MakeExportRemapping : CcuThunk -> ModuleOrNamespace -> Remap + +/// Make a remapping table for viewing a module or namespace 'from the outside' val ApplyExportRemappingToEntity : TcGlobals -> Remap -> ModuleOrNamespace -> ModuleOrNamespace -/// Query SignatureRepackageInfo +/// Determine if a type definition is hidden by a signature val IsHiddenTycon : (Remap * SignatureHidingInfo) list -> Tycon -> bool + +/// Determine if the representation of a type definition is hidden by a signature val IsHiddenTyconRepr : (Remap * SignatureHidingInfo) list -> Tycon -> bool + +/// Determine if a member, function or value is hidden by a signature val IsHiddenVal : (Remap * SignatureHidingInfo) list -> Val -> bool -val IsHiddenRecdField : (Remap * SignatureHidingInfo) list -> RecdFieldRef -> bool -//------------------------------------------------------------------------- -// Adjust marks in expressions -//------------------------------------------------------------------------- +/// Determine if a record field is hidden by a signature +val IsHiddenRecdField : (Remap * SignatureHidingInfo) list -> RecdFieldRef -> bool +/// Adjust marks in expressions, replacing all marks by thegiven mark. +/// Used when inlining. val remarkExpr : range -> Expr -> Expr - -//------------------------------------------------------------------------- -// Make applications -//------------------------------------------------------------------------- +/// Build the application of a (possibly generic, possibly curried) function value to a set of type and expression arguments val primMkApp : (Expr * TType) -> TypeInst -> Exprs -> range -> Expr + +/// Build the application of a (possibly generic, possibly curried) function value to a set of type and expression arguments. +/// Reduce the application via let-bindings if the function value is a lambda expression. val mkApps : TcGlobals -> (Expr * TType) * TType list list * Exprs * range -> Expr + +/// Build the application of a generic construct to a set of type arguments. +/// Reduce the application via substitution if the function value is a typed lambda expression. val mkTyAppExpr : range -> Expr * TType -> TType list -> Expr +/// Build an expression to mutate a local /// localv <- e val mkValSet : range -> ValRef -> Expr -> Expr + +/// Build an expression to mutate the contents of a local pointer /// *localv_ptr = e val mkAddrSet : range -> ValRef -> Expr -> Expr + +/// Build an expression to dereference a local pointer /// *localv_ptr val mkAddrGet : range -> ValRef -> Expr + +/// Build an expression to take the address of a local /// &localv val mkValAddr : range -> readonly: bool -> ValRef -> Expr -//------------------------------------------------------------------------- -// Note these take the address of the record expression if it is a struct, and -// apply a type instantiation if it is a first-class polymorphic record field. -//------------------------------------------------------------------------- - +/// Build an exression representing the read of an instance class or record field. +/// First take the address of the record expression if it is a struct. val mkRecdFieldGet : TcGlobals -> Expr * RecdFieldRef * TypeInst * range -> Expr -//------------------------------------------------------------------------- -// Get the targets used in a decision graph (for reporting warnings) -//------------------------------------------------------------------------- - +/// Accumulate the targets actually used in a decision graph (for reporting warnings) val accTargetsOfDecisionTree : DecisionTree -> int list -> int list -//------------------------------------------------------------------------- -// Optimizations on decision graphs -//------------------------------------------------------------------------- - +/// Make a 'match' expression applying some peep-hole optimizations along the way, e.g to +/// pre-decide the branch taken at compile-time. val mkAndSimplifyMatch : SequencePointInfoForBinding -> range -> range -> TType -> DecisionTree -> DecisionTreeTarget list -> Expr +/// Make a 'match' expression without applying any peep-hole optimizations. val primMkMatch : SequencePointInfoForBinding * range * DecisionTree * DecisionTreeTarget array * range * TType -> Expr -//------------------------------------------------------------------------- -// Work out what things on the r.h.s. of a let rec need to be fixed up -//------------------------------------------------------------------------- - +/// Work out what things on the right-han-side of a 'let rec' recursive binding need to be fixed up val IterateRecursiveFixups : TcGlobals -> Val option -> (Val option -> Expr -> (Expr -> Expr) -> Expr -> unit) -> Expr * (Expr -> Expr) -> Expr -> unit -//------------------------------------------------------------------------- -// From lambdas taking multiple variables to lambdas taking a single variable -// of tuple type. -//------------------------------------------------------------------------- - +/// Given a lambda expression taking multiple variables, build a corresponding lambda taking a tuple val MultiLambdaToTupledLambda : TcGlobals -> Val list -> Expr -> Val * Expr -val AdjustArityOfLambdaBody : TcGlobals -> int -> Val list -> Expr -> Val list * Expr -//------------------------------------------------------------------------- -// Make applications, doing beta reduction by introducing let-bindings -//------------------------------------------------------------------------- +/// Given a lambda expression, adjust it to have be one or two lambda expressions (fun a -> (fun b -> ...)) +/// where the first has the given arity. +val AdjustArityOfLambdaBody : TcGlobals -> int -> Val list -> Expr -> Val list * Expr +/// Make an application expression, doing beta reduction by introducing let-bindings val MakeApplicationAndBetaReduce : TcGlobals -> Expr * TType * TypeInst list * Exprs * range -> Expr +/// COmbine two static-resolution requirements on a type parameter val JoinTyparStaticReq : TyparStaticReq -> TyparStaticReq -> TyparStaticReq -//------------------------------------------------------------------------- -// More layout - this is for debugging -//------------------------------------------------------------------------- +/// Layout for internal compiler debugging purposes module DebugPrint = + /// A global flag indicating whether debug output should include ranges val layoutRanges : bool ref + + /// Convert a type to a string for debugging purposes val showType : TType -> string + + /// Convert an expression to a string for debugging purposes val showExpr : Expr -> string + /// Debug layout for a reference to a value val valRefL : ValRef -> layout + + /// Debug layout for a reference to a union case val unionCaseRefL : UnionCaseRef -> layout - val vspecAtBindL : Val -> layout + + /// Debug layout for an value definition at its binding site + val valAtBindL : Val -> layout + + /// Debug layout for an integer val intL : int -> layout + + /// Debug layout for a value definition val valL : Val -> layout + + /// Debug layout for a type parameter definition val typarDeclL : Typar -> layout + + /// Debug layout for a trait constraint val traitL : TraitConstraintInfo -> layout + + /// Debug layout for a type parameter val typarL : Typar -> layout + + /// Debug layout for a set of type parameters val typarsL : Typars -> layout + + /// Debug layout for a type val typeL : TType -> layout + + /// Debug layout for a method slot signature val slotSigL : SlotSig -> layout + + /// Debug layout for the type signature of a module or namespace definition val entityTypeL : ModuleOrNamespaceType -> layout + + /// Debug layout for a module or namespace definition val entityL : ModuleOrNamespace -> layout + + /// Debug layout for the type of a value val typeOfValL : Val -> layout + + /// Debug layout for a binding of an expression to a value val bindingL : Binding -> layout + + /// Debug layout for an expression val exprL : Expr -> layout + + /// Debug layout for a type definition val tyconL : Tycon -> layout + + /// Debug layout for a decision tree val decisionTreeL : DecisionTree -> layout + + /// Debug layout for an implementation file val implFileL : TypedImplFile -> layout + + /// Debug layout for a list of implementation files val implFilesL : TypedImplFile list -> layout - val recdFieldRefL : RecdFieldRef -> layout -//------------------------------------------------------------------------- -// Fold on expressions -//------------------------------------------------------------------------- + /// Debug layout for class and record fields + val recdFieldRefL : RecdFieldRef -> layout +/// A set of function parameters (visitor) for folding over expressions type ExprFolder<'State> = - { exprIntercept : ('State -> Expr -> 'State) -> 'State -> Expr -> 'State option; - valBindingSiteIntercept : 'State -> bool * Val -> 'State; - nonRecBindingsIntercept : 'State -> Binding -> 'State; - recBindingsIntercept : 'State -> Bindings -> 'State; - dtreeIntercept : 'State -> DecisionTree -> 'State; - targetIntercept : ('State -> Expr -> 'State) -> 'State -> DecisionTreeTarget -> 'State option; - tmethodIntercept : ('State -> Expr -> 'State) -> 'State -> ObjExprMethod -> 'State option;} + { exprIntercept : ('State -> Expr -> 'State) -> 'State -> Expr -> 'State option + valBindingSiteIntercept : 'State -> bool * Val -> 'State + nonRecBindingsIntercept : 'State -> Binding -> 'State + recBindingsIntercept : 'State -> Bindings -> 'State + dtreeIntercept : 'State -> DecisionTree -> 'State + targetIntercept : ('State -> Expr -> 'State) -> 'State -> DecisionTreeTarget -> 'State option + tmethodIntercept : ('State -> Expr -> 'State) -> 'State -> ObjExprMethod -> 'State option} + +/// The empty set of actions for folding over expressions val ExprFolder0 : ExprFolder<'State> + +/// Fold over all the expressions in an implementation file val FoldImplFile: ExprFolder<'State> -> ('State -> TypedImplFile -> 'State) + +/// Fold over all the expressions in an expression val FoldExpr : ExprFolder<'State> -> ('State -> Expr -> 'State) #if DEBUG +/// Extract some statistics from an expression val ExprStats : Expr -> string #endif -//------------------------------------------------------------------------- -// Make some common types -//------------------------------------------------------------------------- - +/// Build a nativeptr type val mkNativePtrTy : TcGlobals -> TType -> TType + +/// Build a 'voidptr' type val mkVoidPtrTy : TcGlobals -> TType + +/// Build a single-dimensional array type val mkArrayType : TcGlobals -> TType -> TType + +/// Determine is a type is an option type val isOptionTy : TcGlobals -> TType -> bool + +/// Take apart an option type val destOptionTy : TcGlobals -> TType -> TType + +/// Try to take apart an option type val tryDestOptionTy : TcGlobals -> TType -> ValueOption +/// Determine if a type is a System.Linq.Expression type val isLinqExpressionTy : TcGlobals -> TType -> bool -val destLinqExpressionTy : TcGlobals -> TType -> TType -val tryDestLinqExpressionTy : TcGlobals -> TType -> TType option -(* -val isQuoteExprTy : TcGlobals -> TType -> bool -val destQuoteExprTy : TcGlobals -> TType -> TType -val tryDestQuoteExprTy : TcGlobals -> TType -> TType option -*) +/// Take apart a System.Linq.Expression type +val destLinqExpressionTy : TcGlobals -> TType -> TType -//------------------------------------------------------------------------- -// Primitives associated with compiling the IEvent idiom to .NET events -//------------------------------------------------------------------------- +/// Try to take apart a System.Linq.Expression type +val tryDestLinqExpressionTy : TcGlobals -> TType -> TType option +/// Determine if a type is an IDelegateEvent type val isIDelegateEventType : TcGlobals -> TType -> bool + +/// Take apart an IDelegateEvent type val destIDelegateEventType : TcGlobals -> TType -> TType + +/// Build an IEvent type val mkIEventType : TcGlobals -> TType -> TType -> TType + +/// Build an IObservable type val mkIObservableType : TcGlobals -> TType -> TType -val mkIObserverType : TcGlobals -> TType -> TType -//------------------------------------------------------------------------- -// Primitives associated with printf format string parsing -//------------------------------------------------------------------------- +/// Build an IObserver type +val mkIObserverType : TcGlobals -> TType -> TType +/// Build an Lazy type val mkLazyTy : TcGlobals -> TType -> TType + +/// Build an PrintFormat type val mkPrintfFormatTy : TcGlobals -> TType -> TType -> TType -> TType -> TType -> TType //------------------------------------------------------------------------- // Classify types //------------------------------------------------------------------------- +/// Represents metadata extracted from a nominal type type TypeDefMetadata = | ILTypeMetadata of TILObjectReprData | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata @@ -1075,43 +1439,94 @@ type TypeDefMetadata = | ProvidedTypeMetadata of TProvidedTypeInfo #endif +/// Extract metadata from a type definition val metadataOfTycon : Tycon -> TypeDefMetadata + +/// Extract metadata from a type val metadataOfTy : TcGlobals -> TType -> TypeDefMetadata -val isStringTy : TcGlobals -> TType -> bool -val isListTy : TcGlobals -> TType -> bool -val isILAppTy : TcGlobals -> TType -> bool -val isArrayTy : TcGlobals -> TType -> bool -val isArray1DTy : TcGlobals -> TType -> bool -val destArrayTy : TcGlobals -> TType -> TType -val destListTy : TcGlobals -> TType -> TType +/// Determine if a type is the System.String type +val isStringTy : TcGlobals -> TType -> bool + +/// Determine if a type is an F# list type +val isListTy : TcGlobals -> TType -> bool + +/// Determine if a type is a nominal .NET type +val isILAppTy : TcGlobals -> TType -> bool + +/// Determine if a type is any kind of array type +val isArrayTy : TcGlobals -> TType -> bool + +/// Determine if a type is a single-dimensional array type +val isArray1DTy : TcGlobals -> TType -> bool + +/// Get the element type of an array type +val destArrayTy : TcGlobals -> TType -> TType + +/// Get the element type of an F# list type +val destListTy : TcGlobals -> TType -> TType -val mkArrayTy : TcGlobals -> int -> TType -> range -> TType -val isArrayTyconRef : TcGlobals -> TyconRef -> bool +/// Build an array type of the given rank +val mkArrayTy : TcGlobals -> int -> TType -> range -> TType + +/// Check if a type definition is one of the artifical type definitions used for array types of different ranks +val isArrayTyconRef : TcGlobals -> TyconRef -> bool + +/// Determine the rank of one of the artifical type definitions used for array types val rankOfArrayTyconRef : TcGlobals -> TyconRef -> int -val isUnitTy : TcGlobals -> TType -> bool -val isObjTy : TcGlobals -> TType -> bool -val isVoidTy : TcGlobals -> TType -> bool +/// Determine if a type is the F# unit type +val isUnitTy : TcGlobals -> TType -> bool + +/// Determine if a type is the System.Object type +val isObjTy : TcGlobals -> TType -> bool + +/// Determine if a type is the System.Void type +val isVoidTy : TcGlobals -> TType -> bool /// Get the element type of an array type -val destArrayTy : TcGlobals -> TType -> TType +val destArrayTy : TcGlobals -> TType -> TType + /// Get the rank of an array type val rankOfArrayTy : TcGlobals -> TType -> int -val isInterfaceTyconRef : TyconRef -> bool +/// Determine if a reference to a type definition is an interface type +val isInterfaceTyconRef : TyconRef -> bool + +/// Determine if a type is a delegate type +val isDelegateTy : TcGlobals -> TType -> bool + +/// Determine if a type is an interface type +val isInterfaceTy : TcGlobals -> TType -> bool -val isDelegateTy : TcGlobals -> TType -> bool -val isInterfaceTy : TcGlobals -> TType -> bool -val isRefTy : TcGlobals -> TType -> bool -val isSealedTy : TcGlobals -> TType -> bool -val isComInteropTy : TcGlobals -> TType -> bool -val underlyingTypeOfEnumTy : TcGlobals -> TType -> TType -val normalizeEnumTy : TcGlobals -> TType -> TType +/// Determine if a type is a FSharpRef type +val isRefTy : TcGlobals -> TType -> bool + +/// Determine if a type is a sealed type +val isSealedTy : TcGlobals -> TType -> bool + +/// Determine if a type is a ComInterop type +val isComInteropTy : TcGlobals -> TType -> bool + +/// Determine the underlying type of an enum type (normally int32) +val underlyingTypeOfEnumTy : TcGlobals -> TType -> TType + +/// If the input type is an enum type, then convert to its underlying type, otherwise return the input type +val normalizeEnumTy : TcGlobals -> TType -> TType + +/// Determine if a type is a struct type val isStructTy : TcGlobals -> TType -> bool + +/// Determine if a type is an unmanaged type val isUnmanagedTy : TcGlobals -> TType -> bool + +/// Determine if a type is a class type val isClassTy : TcGlobals -> TType -> bool + +/// Determine if a type is an enum type val isEnumTy : TcGlobals -> TType -> bool + +/// Determine if a type is a struct, record or union type val isStructRecordOrUnionTyconTy : TcGlobals -> TType -> bool /// For "type Class as self", 'self' is fixed up after initialization. To support this, @@ -1119,9 +1534,16 @@ val isStructRecordOrUnionTyconTy : TcGlobals -> TType -> bool /// returns the underlying type. val StripSelfRefCell : TcGlobals * ValBaseOrThisInfo * TType -> TType +/// An active pattern to determine if a type is a nominal type, possibly instantiated val (|AppTy|_|) : TcGlobals -> TType -> (TyconRef * TType list) option + +/// An active pattern to match System.Nullable types val (|NullableTy|_|) : TcGlobals -> TType -> TType option + +/// An active pattern to transform System.Nullable types to their input, otherwise leave the input unchanged val (|StripNullableTy|) : TcGlobals -> TType -> TType + +/// Matches any byref type, yielding the target type val (|ByrefTy|_|) : TcGlobals -> TType -> TType option //------------------------------------------------------------------------- @@ -1129,35 +1551,53 @@ val (|ByrefTy|_|) : TcGlobals -> TType -> TType option //------------------------------------------------------------------------- val IsUnionTypeWithNullAsTrueValue: TcGlobals -> Tycon -> bool + val TyconHasUseNullAsTrueValueAttribute : TcGlobals -> Tycon -> bool + val CanHaveUseNullAsTrueValueAttribute : TcGlobals -> Tycon -> bool + val MemberIsCompiledAsInstance : TcGlobals -> TyconRef -> bool -> ValMemberInfo -> Attribs -> bool + val ValSpecIsCompiledAsInstance : TcGlobals -> Val -> bool + val ValRefIsCompiledAsInstanceMember : TcGlobals -> ValRef -> bool + val ModuleNameIsMangled : TcGlobals -> Attribs -> bool val CompileAsEvent : TcGlobals -> Attribs -> bool val TypeNullIsExtraValue : TcGlobals -> range -> TType -> bool + val TypeNullIsTrueValue : TcGlobals -> TType -> bool + val TypeNullNotLiked : TcGlobals -> range -> TType -> bool + val TypeNullNever : TcGlobals -> TType -> bool val TypeSatisfiesNullConstraint : TcGlobals -> range -> TType -> bool + val TypeHasDefaultValue : TcGlobals -> range -> TType -> bool val isAbstractTycon : Tycon -> bool val isUnionCaseRefDefinitelyMutable : UnionCaseRef -> bool + val isRecdOrUnionOrStructTyconRefDefinitelyMutable : TyconRef -> bool + val isExnDefinitelyMutable : TyconRef -> bool + val isUnionCaseFieldMutable : TcGlobals -> UnionCaseRef -> int -> bool + val isExnFieldMutable : TyconRef -> int -> bool + val isRecdOrStructTyconRefReadOnly: TcGlobals -> range -> TyconRef -> bool + val isRecdOrStructTyconRefAssumedImmutable: TcGlobals -> TyconRef -> bool + val isRecdOrStructTyReadOnly: TcGlobals -> range -> TType -> bool val useGenuineField : Tycon -> RecdField -> bool + val ComputeFieldName : Tycon -> RecdField -> string //------------------------------------------------------------------------- @@ -1165,6 +1605,7 @@ val ComputeFieldName : Tycon -> RecdField -> string //------------------------------------------------------------------------- val slotSigHasVoidReturnTy : SlotSig -> bool + val actualReturnTyOfSlotSig : TypeInst -> TypeInst -> SlotSig -> TType option val returnTyOfMethod : TcGlobals -> ObjExprMethod -> TType option @@ -1174,25 +1615,37 @@ val returnTyOfMethod : TcGlobals -> ObjExprMethod -> TType option //------------------------------------------------------------------------- val mkRefCell : TcGlobals -> range -> TType -> Expr -> Expr + val mkRefCellGet : TcGlobals -> range -> TType -> Expr -> Expr + val mkRefCellSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkLazyDelayed : TcGlobals -> range -> TType -> Expr -> Expr -val mkLazyForce : TcGlobals -> range -> TType -> Expr -> Expr +val mkLazyForce : TcGlobals -> range -> TType -> Expr -> Expr val mkRefCellContentsRef : TcGlobals -> RecdFieldRef + val isRefCellTy : TcGlobals -> TType -> bool + val destRefCellTy : TcGlobals -> TType -> TType + val mkRefCellTy : TcGlobals -> TType -> TType val mkSeqTy : TcGlobals -> TType -> TType + val mkIEnumeratorTy : TcGlobals -> TType -> TType + val mkListTy : TcGlobals -> TType -> TType + val mkOptionTy : TcGlobals -> TType -> TType + val mkNoneCase : TcGlobals -> UnionCaseRef + val mkSomeCase : TcGlobals -> UnionCaseRef val mkNil : TcGlobals -> range -> TType -> Expr + val mkCons : TcGlobals -> TType -> Expr -> Expr -> Expr //------------------------------------------------------------------------- @@ -1200,17 +1653,29 @@ val mkCons : TcGlobals -> TType -> Expr -> Expr -> Expr //------------------------------------------------------------------------- val mkSequential : SequencePointInfoForSeq -> range -> Expr -> Expr -> Expr + val mkCompGenSequential : range -> Expr -> Expr -> Expr + val mkSequentials : SequencePointInfoForSeq -> TcGlobals -> range -> Exprs -> Expr + val mkRecordExpr : TcGlobals -> RecordConstructionInfo * TyconRef * TypeInst * RecdFieldRef list * Exprs * range -> Expr + val mkUnbox : TType -> Expr -> range -> Expr + val mkBox : TType -> Expr -> range -> Expr + val mkIsInst : TType -> Expr -> range -> Expr + val mkNull : range -> TType -> Expr + val mkNullTest : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr + val mkNonNullTest : TcGlobals -> range -> Expr -> Expr + val mkIsInstConditional : TcGlobals -> range -> TType -> Expr -> Val -> Expr -> Expr -> Expr + val mkThrow : range -> TType -> Expr -> Expr + val mkGetArg0 : range -> TType -> Expr val mkDefault : range * TType -> Expr @@ -1218,18 +1683,31 @@ val mkDefault : range * TType -> Expr val isThrow : Expr -> bool val mkString : TcGlobals -> range -> string -> Expr + val mkBool : TcGlobals -> range -> bool -> Expr + val mkByte : TcGlobals -> range -> byte -> Expr + val mkUInt16 : TcGlobals -> range -> uint16 -> Expr + val mkTrue : TcGlobals -> range -> Expr + val mkFalse : TcGlobals -> range -> Expr + val mkUnit : TcGlobals -> range -> Expr + val mkInt32 : TcGlobals -> range -> int32 -> Expr + val mkInt : TcGlobals -> range -> int -> Expr + val mkZero : TcGlobals -> range -> Expr + val mkOne : TcGlobals -> range -> Expr + val mkTwo : TcGlobals -> range -> Expr + val mkMinusOne : TcGlobals -> range -> Expr + val destInt32 : Expr -> int32 option //------------------------------------------------------------------------- @@ -1237,8 +1715,11 @@ val destInt32 : Expr -> int32 option //------------------------------------------------------------------------- val isQuotedExprTy : TcGlobals -> TType -> bool + val destQuotedExprTy : TcGlobals -> TType -> TType + val mkQuotedExprTy : TcGlobals -> TType -> TType + val mkRawQuotedExprTy : TcGlobals -> TType //------------------------------------------------------------------------- @@ -1246,9 +1727,13 @@ val mkRawQuotedExprTy : TcGlobals -> TType //------------------------------------------------------------------------- val mspec_Type_GetTypeFromHandle : TcGlobals -> ILMethodSpec + val fspec_Missing_Value : TcGlobals -> ILFieldSpec + val mkInitializeArrayMethSpec: TcGlobals -> ILMethodSpec + val mkByteArrayTy : TcGlobals -> TType + val mkInvalidCastExnNewobj: TcGlobals -> ILInstr @@ -1259,122 +1744,207 @@ val mkInvalidCastExnNewobj: TcGlobals -> ILInstr val mkCallNewFormat : TcGlobals -> range -> TType -> TType -> TType -> TType -> TType -> Expr -> Expr val mkCallUnbox : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallGetGenericComparer : TcGlobals -> range -> Expr + val mkCallGetGenericEREqualityComparer : TcGlobals -> range -> Expr + val mkCallGetGenericPEREqualityComparer : TcGlobals -> range -> Expr val mkCallUnboxFast : TcGlobals -> range -> TType -> Expr -> Expr + val canUseUnboxFast : TcGlobals -> range -> TType -> bool val mkCallDispose : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallSeq : TcGlobals -> range -> TType -> Expr -> Expr val mkCallTypeTest : TcGlobals -> range -> TType -> Expr -> Expr + val canUseTypeTestFast : TcGlobals -> TType -> bool val mkCallTypeOf : TcGlobals -> range -> TType -> Expr + val mkCallTypeDefOf : TcGlobals -> range -> TType -> Expr val mkCallCreateInstance : TcGlobals -> range -> TType -> Expr + val mkCallCreateEvent : TcGlobals -> range -> TType -> TType -> Expr -> Expr -> Expr -> Expr + val mkCallArrayLength : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallArrayGet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallArray2DGet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr + val mkCallArray3DGet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr + val mkCallArray4DGet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr + val mkCallArraySet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr + val mkCallArray2DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr + val mkCallArray3DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr + val mkCallArray4DSet : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr val mkCallHash : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallBox : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallIsNull : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallIsNotNull : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallRaise : TcGlobals -> range -> TType -> Expr -> Expr val mkCallGenericComparisonWithComparerOuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr + val mkCallGenericEqualityEROuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallGenericEqualityWithComparerOuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr + val mkCallGenericHashWithComparerOuter : TcGlobals -> range -> TType -> Expr -> Expr -> Expr val mkCallEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallNotEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallLessThanOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallLessThanOrEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallGreaterThanOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallGreaterThanOrEqualsOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr val mkCallAdditionOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallSubtractionOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallMultiplyOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallDivisionOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallModulusOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallBitwiseAndOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallBitwiseOrOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallBitwiseXorOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallShiftLeftOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallShiftRightOperator : TcGlobals -> range -> TType -> Expr -> Expr -> Expr val mkCallUnaryNegOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallUnaryNotOperator : TcGlobals -> range -> TType -> Expr -> Expr val mkCallAdditionChecked : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallSubtractionChecked : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallMultiplyChecked : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallUnaryNegChecked : TcGlobals -> range -> TType -> Expr -> Expr val mkCallToByteChecked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToSByteChecked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToInt16Checked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUInt16Checked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToIntChecked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToInt32Checked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUInt32Checked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToInt64Checked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUInt64Checked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToIntPtrChecked : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUIntPtrChecked : TcGlobals -> range -> TType -> Expr -> Expr val mkCallToByteOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToSByteOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToInt16Operator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUInt16Operator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToIntOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToInt32Operator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUInt32Operator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToInt64Operator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUInt64Operator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToSingleOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToDoubleOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToIntPtrOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToUIntPtrOperator : TcGlobals -> range -> TType -> Expr -> Expr val mkCallToCharOperator : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallToEnumOperator : TcGlobals -> range -> TType -> Expr -> Expr val mkCallDeserializeQuotationFSharp20Plus : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr -> Expr + val mkCallDeserializeQuotationFSharp40Plus : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr + val mkCallCastQuotation : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallLiftValueWithName : TcGlobals -> range -> TType -> string -> Expr -> Expr + val mkCallLiftValueWithDefn : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallSeqCollect : TcGlobals -> range -> TType -> TType -> Expr -> Expr -> Expr + val mkCallSeqUsing : TcGlobals -> range -> TType -> TType -> Expr -> Expr -> Expr + val mkCallSeqDelay : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallSeqAppend : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallSeqFinally : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallSeqGenerated : TcGlobals -> range -> TType -> Expr -> Expr -> Expr + val mkCallSeqOfFunctions : TcGlobals -> range -> TType -> TType -> Expr -> Expr -> Expr -> Expr + val mkCallSeqToArray : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallSeqToList : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallSeqMap : TcGlobals -> range -> TType -> TType -> Expr -> Expr -> Expr + val mkCallSeqSingleton : TcGlobals -> range -> TType -> Expr -> Expr + val mkCallSeqEmpty : TcGlobals -> range -> TType -> Expr + val mkILAsmCeq : TcGlobals -> range -> Expr -> Expr -> Expr + val mkILAsmClt : TcGlobals -> range -> Expr -> Expr -> Expr val mkCallFailInit : TcGlobals -> range -> Expr + val mkCallFailStaticInit : TcGlobals -> range -> Expr + val mkCallCheckThis : TcGlobals -> range -> TType -> Expr -> Expr val mkCase : DecisionTreeTest * DecisionTree -> DecisionTreeCase @@ -1382,13 +1952,17 @@ val mkCase : DecisionTreeTest * DecisionTree -> DecisionTreeCase val mkCallQuoteToLinqLambdaExpression : TcGlobals -> range -> TType -> Expr -> Expr val mkCallGetQuerySourceAsEnumerable : TcGlobals -> range -> TType -> TType -> Expr -> Expr + val mkCallNewQuerySource : TcGlobals -> range -> TType -> TType -> Expr -> Expr val mkArray : TType * Exprs * range -> Expr val mkStaticCall_String_Concat2 : TcGlobals -> range -> Expr -> Expr -> Expr + val mkStaticCall_String_Concat3 : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr + val mkStaticCall_String_Concat4 : TcGlobals -> range -> Expr -> Expr -> Expr -> Expr -> Expr + val mkStaticCall_String_Concat_Array : TcGlobals -> range -> Expr -> Expr //------------------------------------------------------------------------- @@ -1397,8 +1971,11 @@ val mkStaticCall_String_Concat_Array : TcGlobals -> range -> Expr -> Expr //------------------------------------------------------------------------- val mkDecr : TcGlobals -> range -> Expr -> Expr + val mkIncr : TcGlobals -> range -> Expr -> Expr + val mkLdlen : TcGlobals -> range -> Expr -> Expr + val mkLdelem : TcGlobals -> range -> TType -> Expr -> Expr -> Expr //------------------------------------------------------------------------- @@ -1406,18 +1983,29 @@ val mkLdelem : TcGlobals -> range -> TType -> Expr -> Expr -> Expr //------------------------------------------------------------------------- val TryDecodeILAttribute : TcGlobals -> ILTypeRef -> ILAttributes -> (ILAttribElem list * ILAttributeNamedArg list) option + val TryFindILAttribute : BuiltinAttribInfo -> ILAttributes -> bool + val TryFindILAttributeOpt : BuiltinAttribInfo option -> ILAttributes -> bool val IsMatchingFSharpAttribute : TcGlobals -> BuiltinAttribInfo -> Attrib -> bool + val IsMatchingFSharpAttributeOpt : TcGlobals -> BuiltinAttribInfo option -> Attrib -> bool + val HasFSharpAttribute : TcGlobals -> BuiltinAttribInfo -> Attribs -> bool + val HasFSharpAttributeOpt : TcGlobals -> BuiltinAttribInfo option -> Attribs -> bool + val TryFindFSharpAttribute : TcGlobals -> BuiltinAttribInfo -> Attribs -> Attrib option + val TryFindFSharpAttributeOpt : TcGlobals -> BuiltinAttribInfo option -> Attribs -> Attrib option + val TryFindFSharpBoolAttribute : TcGlobals -> BuiltinAttribInfo -> Attribs -> bool option + val TryFindFSharpBoolAttributeAssumeFalse : TcGlobals -> BuiltinAttribInfo -> Attribs -> bool option + val TryFindFSharpStringAttribute : TcGlobals -> BuiltinAttribInfo -> Attribs -> string option + val TryFindFSharpInt32Attribute : TcGlobals -> BuiltinAttribInfo -> Attribs -> int32 option /// Try to find a specific attribute on a type definition, where the attribute accepts a string argument. @@ -1438,19 +2026,29 @@ val TryFindAttributeUsageAttribute : TcGlobals -> range -> TyconRef -> bool opti /// returns Some(assemblyName) for success val TryDecodeTypeProviderAssemblyAttr : ILGlobals -> ILAttribute -> string option #endif + val IsSignatureDataVersionAttr : ILAttribute -> bool + val TryFindAutoOpenAttr : IL.ILGlobals -> ILAttribute -> string option + val TryFindInternalsVisibleToAttr : IL.ILGlobals -> ILAttribute -> string option -val IsMatchingSignatureDataVersionAttr : IL.ILGlobals -> ILVersionInfo -> ILAttribute -> bool +val IsMatchingSignatureDataVersionAttr : IL.ILGlobals -> ILVersionInfo -> ILAttribute -> bool val mkCompilationMappingAttr : TcGlobals -> int -> ILAttribute val mkCompilationMappingAttrWithSeqNum : TcGlobals -> int -> int -> ILAttribute + + val mkCompilationMappingAttrWithVariantNumAndSeqNum : TcGlobals -> int -> int -> int -> ILAttribute + val mkCompilationMappingAttrForQuotationResource : TcGlobals -> string * ILTypeRef list -> ILAttribute + val mkCompilationArgumentCountsAttr : TcGlobals -> int list -> ILAttribute + val mkCompilationSourceNameAttr : TcGlobals -> string -> ILAttribute + val mkSignatureDataVersionAttr : TcGlobals -> ILVersionInfo -> ILAttribute + val mkCompilerGeneratedAttr : TcGlobals -> int -> ILAttribute //------------------------------------------------------------------------- @@ -1458,16 +2056,23 @@ val mkCompilerGeneratedAttr : TcGlobals -> int -> ILAtt //------------------------------------------------------------------------- val isInByrefTy : TcGlobals -> TType -> bool + val isOutByrefTy : TcGlobals -> TType -> bool + val isByrefTy : TcGlobals -> TType -> bool val isNativePtrTy : TcGlobals -> TType -> bool + val destByrefTy : TcGlobals -> TType -> TType + val destNativePtrTy : TcGlobals -> TType -> TType val isByrefTyconRef : TcGlobals -> TyconRef -> bool + val isByrefLikeTyconRef : TcGlobals -> range -> TyconRef -> bool + val isSpanLikeTyconRef : TcGlobals -> range -> TyconRef -> bool + val isByrefLikeTy : TcGlobals -> range -> TType -> bool /// Check if the type is a byref-like but not a byref. @@ -1478,33 +2083,37 @@ val isSpanLikeTy : TcGlobals -> range -> TType -> bool //------------------------------------------------------------------------- val isRefTupleExpr : Expr -> bool + val tryDestRefTupleExpr : Expr -> Exprs val mkAnyTupledTy : TcGlobals -> TupInfo -> TType list -> TType + val mkAnyTupled : TcGlobals -> range -> TupInfo -> Exprs -> TType list -> Expr + val mkRefTupled : TcGlobals -> range -> Exprs -> TType list -> Expr + val mkRefTupledNoTypes : TcGlobals -> range -> Exprs -> Expr + val mkRefTupledTy : TcGlobals -> TType list -> TType + val mkRefTupledVarsTy : TcGlobals -> Val list -> TType -val mkRefTupledVars : TcGlobals -> range -> Val list -> Expr -val mkMethodTy : TcGlobals -> TType list list -> TType -> TType +val mkRefTupledVars : TcGlobals -> range -> Val list -> Expr -//------------------------------------------------------------------------- -// Anonymous records -//------------------------------------------------------------------------- +val mkMethodTy : TcGlobals -> TType list list -> TType -> TType val mkAnyAnonRecdTy : TcGlobals -> AnonRecdTypeInfo -> TType list -> TType -val mkAnonRecd : TcGlobals -> range -> AnonRecdTypeInfo -> Exprs -> TType list -> Expr -//------------------------------------------------------------------------- -// -//------------------------------------------------------------------------- +val mkAnonRecd : TcGlobals -> range -> AnonRecdTypeInfo -> Exprs -> TType list -> Expr val AdjustValForExpectedArity : TcGlobals -> range -> ValRef -> ValUseFlag -> ValReprInfo -> Expr * TType + val AdjustValToTopVal : Val -> ParentRef -> ValReprInfo -> unit + val LinearizeTopMatch : TcGlobals -> ParentRef -> Expr -> Expr + val AdjustPossibleSubsumptionExpr : TcGlobals -> Expr -> Exprs -> (Expr * Exprs) option + val NormalizeAndAdjustPossibleSubsumptionExprs : TcGlobals -> Expr -> Expr //------------------------------------------------------------------------- @@ -1514,28 +2123,35 @@ val NormalizeAndAdjustPossibleSubsumptionExprs : TcGlobals -> Expr -> Expr val buildAccessPath : CompilationPath option -> string val XmlDocArgsEnc : TcGlobals -> Typars * Typars -> TType list -> string + val XmlDocSigOfVal : TcGlobals -> string -> Val -> string + val XmlDocSigOfUnionCase : (string list -> string) + val XmlDocSigOfField : (string list -> string) + val XmlDocSigOfProperty : (string list -> string) + val XmlDocSigOfTycon : (string list -> string) + val XmlDocSigOfSubModul : (string list -> string) + val XmlDocSigOfEntity : EntityRef -> string //--------------------------------------------------------------------------- // Resolve static optimizations //------------------------------------------------------------------------- + type StaticOptimizationAnswer = | Yes = 1y | No = -1y | Unknown = 0y + val DecideStaticOptimizations : TcGlobals -> StaticOptimization list -> StaticOptimizationAnswer -val mkStaticOptimizationExpr : TcGlobals -> StaticOptimization list * Expr * Expr * range -> Expr -//--------------------------------------------------------------------------- -// Build for loops -//------------------------------------------------------------------------- +val mkStaticOptimizationExpr : TcGlobals -> StaticOptimization list * Expr * Expr * range -> Expr +/// Build for loops val mkFastForLoop : TcGlobals -> SequencePointInfoForForLoop * range * Val * Expr * bool * Expr * Expr -> Expr //--------------------------------------------------------------------------- @@ -1546,12 +2162,15 @@ type ActivePatternElemRef with member Name : string val TryGetActivePatternInfo : ValRef -> PrettyNaming.ActivePatternInfo option + val mkChoiceCaseRef : TcGlobals -> range -> int -> int -> UnionCaseRef type PrettyNaming.ActivePatternInfo with + member Names : string list member ResultType : TcGlobals -> range -> TType list -> TType + member OverallType : TcGlobals -> range -> TType -> TType list -> TType val doesActivePatternHaveFreeTypars : TcGlobals -> ValRef -> bool @@ -1562,61 +2181,84 @@ val doesActivePatternHaveFreeTypars : TcGlobals -> ValRef -> bool [] type ExprRewritingEnv = - {PreIntercept: ((Expr -> Expr) -> Expr -> Expr option) option; - PostTransform: Expr -> Expr option; - PreInterceptBinding: ((Expr -> Expr) -> Binding -> Binding option) option; - IsUnderQuotations: bool } + { PreIntercept: ((Expr -> Expr) -> Expr -> Expr option) option + PostTransform: Expr -> Expr option + PreInterceptBinding: ((Expr -> Expr) -> Binding -> Binding option) option + IsUnderQuotations: bool } val RewriteExpr : ExprRewritingEnv -> Expr -> Expr + val RewriteImplFile : ExprRewritingEnv -> TypedImplFile -> TypedImplFile val IsGenericValWithGenericContraints: TcGlobals -> Val -> bool type Entity with + member HasInterface : TcGlobals -> TType -> bool + member HasOverride : TcGlobals -> string -> TType list -> bool + member HasMember : TcGlobals -> string -> TType list -> bool type EntityRef with + member HasInterface : TcGlobals -> TType -> bool + member HasOverride : TcGlobals -> string -> TType list -> bool + member HasMember : TcGlobals -> string -> TType list -> bool val (|AttribBitwiseOrExpr|_|) : TcGlobals -> Expr -> (Expr * Expr) option + val (|EnumExpr|_|) : TcGlobals -> Expr -> Expr option + val (|TypeOfExpr|_|) : TcGlobals -> Expr -> TType option + val (|TypeDefOfExpr|_|) : TcGlobals -> Expr -> TType option val EvalLiteralExprOrAttribArg: TcGlobals -> Expr -> Expr + val EvaledAttribExprEquality : TcGlobals -> Expr -> Expr -> bool + val IsSimpleSyntacticConstantExpr: TcGlobals -> Expr -> bool val (|ConstToILFieldInit|_|): Const -> ILFieldInit option val (|ExtractAttribNamedArg|_|) : string -> AttribNamedArg list -> AttribExpr option + val (|AttribInt32Arg|_|) : AttribExpr -> int32 option + val (|AttribInt16Arg|_|) : AttribExpr -> int16 option + val (|AttribBoolArg|_|) : AttribExpr -> bool option + val (|AttribStringArg|_|) : AttribExpr -> string option + val (|Int32Expr|_|) : Expr -> int32 option /// Determines types that are potentially known to satisfy the 'comparable' constraint and returns /// a set of residual types that must also satisfy the constraint val (|SpecialComparableHeadType|_|) : TcGlobals -> TType -> TType list option + val (|SpecialEquatableHeadType|_|) : TcGlobals -> TType -> TType list option + val (|SpecialNotEquatableHeadType|_|) : TcGlobals -> TType -> unit option type OptimizeForExpressionOptions = OptimizeIntRangesOnly | OptimizeAllForExpressions + val DetectAndOptimizeForExpression : TcGlobals -> OptimizeForExpressionOptions -> Expr -> Expr val TryEliminateDesugaredConstants : TcGlobals -> range -> Const -> Expr option val MemberIsExplicitImpl : TcGlobals -> ValMemberInfo -> bool + val ValIsExplicitImpl : TcGlobals -> Val -> bool + val ValRefIsExplicitImpl : TcGlobals -> ValRef -> bool val (|LinearMatchExpr|_|) : Expr -> (SequencePointInfoForBinding * range * DecisionTree * DecisionTreeTarget * Expr * SequencePointInfoForTarget * range * TType) option + val rebuildLinearMatchExpr : (SequencePointInfoForBinding * range * DecisionTree * DecisionTreeTarget * Expr * SequencePointInfoForTarget * range * TType) -> Expr val mkCoerceIfNeeded : TcGlobals -> tgtTy: TType -> srcTy: TType -> Expr -> Expr diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index d9bdb7e52e3..a20b3743ca1 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -17387,7 +17387,7 @@ let CheckModuleSignature g cenv m denvAtEnd rootSigOpt implFileTypePriorToSig im // Compute the remapping from implementation to signature let remapInfo , _ = ComputeRemappingFromInferredSignatureToExplicitSignature cenv.g implFileTypePriorToSig sigFileType - let aenv = { TypeEquivEnv.Empty with EquivTycons = TyconRefMap.OfList remapInfo.mrpiEntities } + let aenv = { TypeEquivEnv.Empty with EquivTycons = TyconRefMap.OfList remapInfo.RepackagedEntities } if not (SignatureConformance.Checker(cenv.g, cenv.amap, denv, remapInfo, true).CheckSignature aenv (mkLocalModRef implFileSpecPriorToSig) sigFileType) then ( // We can just raise 'ReportedError' since CheckModuleOrNamespace raises its own error From 41891aa7c26e09967053e11c869a5c451664b63a Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Wed, 23 Jan 2019 18:04:08 -0800 Subject: [PATCH 23/24] save and publish log from package publishing step (#6141) save and publish log from package publishing step --- .gitignore | 5 +- .vsts-signed.yaml | 54 +- Makefile | 7 +- NuGet.Config | 9 + PublishToBlob.proj | 19 +- build.cmd | 4 - eng/common/CIBuild.cmd | 2 + eng/common/PublishBuildAssets.cmd | 3 + eng/common/PublishToPackageFeed.proj | 37 ++ eng/common/README.md | 28 + eng/common/build.ps1 | 133 +++++ eng/common/build.sh | 213 ++++++++ eng/common/cibuild.sh | 16 + eng/common/cross/android/arm/toolchain.cmake | 41 ++ .../cross/android/arm64/toolchain.cmake | 42 ++ eng/common/cross/arm/sources.list.bionic | 11 + eng/common/cross/arm/sources.list.jessie | 3 + eng/common/cross/arm/sources.list.trusty | 11 + eng/common/cross/arm/sources.list.vivid | 11 + eng/common/cross/arm/sources.list.wily | 11 + eng/common/cross/arm/sources.list.xenial | 11 + eng/common/cross/arm/sources.list.zesty | 11 + eng/common/cross/arm/trusty-lttng-2.4.patch | 71 +++ eng/common/cross/arm/trusty.patch | 97 ++++ eng/common/cross/arm64/sources.list.bionic | 11 + eng/common/cross/arm64/sources.list.trusty | 11 + eng/common/cross/arm64/sources.list.vivid | 11 + eng/common/cross/arm64/sources.list.wily | 11 + eng/common/cross/arm64/sources.list.xenial | 11 + eng/common/cross/arm64/sources.list.zesty | 11 + eng/common/cross/armel/sources.list.jessie | 3 + eng/common/cross/armel/tizen-build-rootfs.sh | 44 ++ eng/common/cross/armel/tizen-fetch.sh | 171 ++++++ eng/common/cross/armel/tizen/tizen-dotnet.ks | 50 ++ eng/common/cross/armel/tizen/tizen.patch | 18 + eng/common/cross/build-android-rootfs.sh | 137 +++++ eng/common/cross/build-rootfs.sh | 210 ++++++++ eng/common/cross/toolchain.cmake | 138 +++++ eng/common/cross/x86/sources.list.bionic | 11 + eng/common/cross/x86/sources.list.trusty | 11 + eng/common/cross/x86/sources.list.vivid | 11 + eng/common/cross/x86/sources.list.wily | 11 + eng/common/cross/x86/sources.list.xenial | 11 + eng/common/darc-init.ps1 | 32 ++ eng/common/darc-init.sh | 38 ++ eng/common/helixpublish.proj | 26 + eng/common/init-tools-native.cmd | 3 + eng/common/init-tools-native.ps1 | 128 +++++ eng/common/init-tools-native.sh | 145 +++++ eng/common/msbuild.ps1 | 27 + eng/common/msbuild.sh | 58 ++ eng/common/native/CommonLibrary.psm1 | 358 ++++++++++++ eng/common/native/common-library.sh | 168 ++++++ eng/common/native/install-cmake.sh | 117 ++++ eng/common/native/install-tool.ps1 | 130 +++++ eng/common/sdk-task.ps1 | 74 +++ eng/common/templates/job/job.yml | 205 +++++++ .../templates/job/publish-build-assets.yml | 63 +++ eng/common/templates/jobs/jobs.yml | 77 +++ eng/common/templates/phases/base.yml | 130 +++++ .../templates/phases/publish-build-assets.yml | 46 ++ eng/common/templates/steps/build-reason.yml | 12 + eng/common/templates/steps/helix-publish.yml | 51 ++ eng/common/templates/steps/run-on-unix.yml | 7 + eng/common/templates/steps/run-on-windows.yml | 7 + .../steps/run-script-ifequalelse.yml | 33 ++ eng/common/templates/steps/send-to-helix.yml | 81 +++ eng/common/templates/steps/telemetry-end.yml | 63 +++ .../templates/steps/telemetry-start.yml | 154 ++++++ eng/common/tools.ps1 | 508 ++++++++++++++++++ eng/common/tools.sh | 319 +++++++++++ fcs/build.fsx | 2 +- global.json | 9 + packages.config | 4 + 74 files changed, 4793 insertions(+), 24 deletions(-) create mode 100644 eng/common/CIBuild.cmd create mode 100644 eng/common/PublishBuildAssets.cmd create mode 100644 eng/common/PublishToPackageFeed.proj create mode 100644 eng/common/README.md create mode 100644 eng/common/build.ps1 create mode 100755 eng/common/build.sh create mode 100755 eng/common/cibuild.sh create mode 100644 eng/common/cross/android/arm/toolchain.cmake create mode 100644 eng/common/cross/android/arm64/toolchain.cmake create mode 100644 eng/common/cross/arm/sources.list.bionic create mode 100644 eng/common/cross/arm/sources.list.jessie create mode 100644 eng/common/cross/arm/sources.list.trusty create mode 100644 eng/common/cross/arm/sources.list.vivid create mode 100644 eng/common/cross/arm/sources.list.wily create mode 100644 eng/common/cross/arm/sources.list.xenial create mode 100644 eng/common/cross/arm/sources.list.zesty create mode 100644 eng/common/cross/arm/trusty-lttng-2.4.patch create mode 100644 eng/common/cross/arm/trusty.patch create mode 100644 eng/common/cross/arm64/sources.list.bionic create mode 100644 eng/common/cross/arm64/sources.list.trusty create mode 100644 eng/common/cross/arm64/sources.list.vivid create mode 100644 eng/common/cross/arm64/sources.list.wily create mode 100644 eng/common/cross/arm64/sources.list.xenial create mode 100644 eng/common/cross/arm64/sources.list.zesty create mode 100644 eng/common/cross/armel/sources.list.jessie create mode 100755 eng/common/cross/armel/tizen-build-rootfs.sh create mode 100755 eng/common/cross/armel/tizen-fetch.sh create mode 100644 eng/common/cross/armel/tizen/tizen-dotnet.ks create mode 100644 eng/common/cross/armel/tizen/tizen.patch create mode 100755 eng/common/cross/build-android-rootfs.sh create mode 100755 eng/common/cross/build-rootfs.sh create mode 100644 eng/common/cross/toolchain.cmake create mode 100644 eng/common/cross/x86/sources.list.bionic create mode 100644 eng/common/cross/x86/sources.list.trusty create mode 100644 eng/common/cross/x86/sources.list.vivid create mode 100644 eng/common/cross/x86/sources.list.wily create mode 100644 eng/common/cross/x86/sources.list.xenial create mode 100644 eng/common/darc-init.ps1 create mode 100755 eng/common/darc-init.sh create mode 100644 eng/common/helixpublish.proj create mode 100644 eng/common/init-tools-native.cmd create mode 100644 eng/common/init-tools-native.ps1 create mode 100755 eng/common/init-tools-native.sh create mode 100644 eng/common/msbuild.ps1 create mode 100755 eng/common/msbuild.sh create mode 100644 eng/common/native/CommonLibrary.psm1 create mode 100755 eng/common/native/common-library.sh create mode 100755 eng/common/native/install-cmake.sh create mode 100644 eng/common/native/install-tool.ps1 create mode 100644 eng/common/sdk-task.ps1 create mode 100644 eng/common/templates/job/job.yml create mode 100644 eng/common/templates/job/publish-build-assets.yml create mode 100644 eng/common/templates/jobs/jobs.yml create mode 100644 eng/common/templates/phases/base.yml create mode 100644 eng/common/templates/phases/publish-build-assets.yml create mode 100644 eng/common/templates/steps/build-reason.yml create mode 100644 eng/common/templates/steps/helix-publish.yml create mode 100644 eng/common/templates/steps/run-on-unix.yml create mode 100644 eng/common/templates/steps/run-on-windows.yml create mode 100644 eng/common/templates/steps/run-script-ifequalelse.yml create mode 100644 eng/common/templates/steps/send-to-helix.yml create mode 100644 eng/common/templates/steps/telemetry-end.yml create mode 100644 eng/common/templates/steps/telemetry-start.yml create mode 100644 eng/common/tools.ps1 create mode 100755 eng/common/tools.sh create mode 100644 global.json create mode 100644 packages.config diff --git a/.gitignore b/.gitignore index 28d53ff4e47..418b3677b36 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,9 @@ # output location artifacts/ -/tests/scripts/current +packages/ -# auto-generated during the build -global.json +/tests/scripts/current # Patches that may have been generated by scripts. # (These aren't generally useful to commit directly; if anything, they should be applied.) diff --git a/.vsts-signed.yaml b/.vsts-signed.yaml index 25d7642cf09..823ac20297a 100644 --- a/.vsts-signed.yaml +++ b/.vsts-signed.yaml @@ -1,10 +1,17 @@ +variables: +- name: PB_PublishBlobFeedUrl + value: https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json +- group: DotNet-Blob-Feed +- name: PB_PublishBlobFeedKey + value: $(dotnetfeed-storage-access-key-1) + jobs: - job: Full_Signed pool: name: VSEng-MicroBuildVS2017 timeoutInMinutes: 300 variables: - MSBuildConfiguration: 'Release' + BuildConfiguration: 'Release' steps: # Install Signing Plugin - task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@1 @@ -29,15 +36,44 @@ jobs: displayName: Publish nightly package to MyGet inputs: scriptName: 'setup\publish-assets.ps1' - arguments: '-binariesPath artifacts\bin -configuration $(MSBuildConfiguration) -branchName $(Build.SourceBranch) -apiKey $(FSharp.MyGetApiKey)' + arguments: '-binariesPath artifacts\bin -configuration $(BuildConfiguration) -branchName $(Build.SourceBranch) -apiKey $(FSharp.MyGetApiKey)' condition: and(succeeded(), contains(variables['PB_PublishType'], 'myget')) - # Publish packages to Azure Blob Storage + # Package publish + - task: CmdLine@1 + displayName: Restore package publishing + inputs: + filename: '.nuget\NuGet.exe' + arguments: 'restore packages.config -PackagesDirectory packages -Source https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json' + condition: and(succeeded(), contains(variables['PB_PublishType'], 'blob')) - task: MSBuild@1 displayName: Publish packages to Azure Blob Storage inputs: solution: PublishToBlob.proj - msbuildArguments: '/t:Build /p:ExpectedFeedUrl=$(PB_PublishBlobFeedUrl) /p:AccountKey=$(PB_PublishBlobFeedKey) /p:ManifestBranch=$(SourceBranch) /p:ManifestCommit=$(SourceVersion) /p:ManifestBuildId=$(OfficialBuildId)' + msbuildArguments: '/t:Build /p:Configuration=$(BuildConfiguration) /p:ExpectedFeedUrl=$(PB_PublishBlobFeedUrl) /p:AccountKey=$(PB_PublishBlobFeedKey) /p:ManifestRepouri=$(Build.Repository.Uri) /p:ManifestBranch=$(Build.SourceBranch) /p:ManifestCommit=$(Build.SourceVersion) /p:ManifestBuildId=$(Build.BuildNumber) /bl:$(Build.SourcesDirectory)/artifacts/log/$(BuildConfiguration)/pub/publish.binlog' + condition: and(succeeded(), contains(variables['PB_PublishType'], 'blob')) + - task: PublishBuildArtifacts@1 + displayName: Publish publishing bin log + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(BuildConfiguration)/pub' + ArtifactName: 'Publish_bin_log' + publishLocation: Container + continueOnError: true + condition: and(succeeded(), contains(variables['PB_PublishType'], 'blob')) + - task: CopyFiles@2 + displayName: Gather Asset Manifests + inputs: + SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(BuildConfiguration)/AssetManifest' + TargetFolder: '$(Build.StagingDirectory)/AssetManifests' + continueOnError: true + condition: and(succeeded(), contains(variables['PB_PublishType'], 'blob')) + - task: PublishBuildArtifacts@1 + displayName: Push Asset Manifests + inputs: + PathtoPublish: '$(Build.StagingDirectory)/AssetManifests' + PublishLocation: Container + ArtifactName: AssetManifests + continueOnError: true condition: and(succeeded(), contains(variables['PB_PublishType'], 'blob')) # Create static drop @@ -69,7 +105,7 @@ jobs: - task: ms-vseng.MicroBuildTasks.4305a8de-ba66-4d8b-b2d1-0dc4ecbbf5e8.MicroBuildUploadVstsDropFolder@1 displayName: Upload VSTS Drop inputs: - DropFolder: '$(Build.SourcesDirectory)\artifacts\VSSetup\$(MSBuildConfiguration)\Insertion' + DropFolder: '$(Build.SourcesDirectory)\artifacts\VSSetup\$(BuildConfiguration)\Insertion' condition: and(succeeded(), contains(variables['PB_PublishType'], 'vsts')) # Execute cleanup tasks @@ -94,3 +130,11 @@ jobs: sourcePath: '$(DropRoot)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildNumber)\SymStore' usePat: false condition: and(succeeded(), contains(variables['PB_PublishType'], 'symweb')) + +- template: /eng/common/templates/job/publish-build-assets.yml + parameters: + dependsOn: + - Full_Signed + pool: + vmImage: vs2017-win2016 + enablePublishBuildArtifacts: true diff --git a/Makefile b/Makefile index 14a5b0a8c07..dfb567b394b 100644 --- a/Makefile +++ b/Makefile @@ -8,10 +8,7 @@ all: proto restore build test tools: $(CURDIR)/scripts/dotnet-install.sh --version $(DotNetVersion) --install-dir "$(DotNetToolPath)" -global.json: tools - echo { \"sdk\": { \"version\": \"$(DotNetVersion)\" } }>global.json - -proto: global.json +proto: tools $(DotNetExe) build-server shutdown $(DotNetExe) restore src/buildtools/buildtools.proj $(DotNetExe) restore src/fsharp/FSharp.Build/FSharp.Build.fsproj @@ -20,7 +17,7 @@ proto: global.json $(DotNetExe) build src/fsharp/FSharp.Build/FSharp.Build.fsproj -f netstandard2.0 -c Proto $(DotNetExe) build src/fsharp/fsc/fsc.fsproj -f netcoreapp2.1 -c Proto -restore: global.json +restore: $(DotNetExe) restore src/fsharp/FSharp.Core/FSharp.Core.fsproj $(DotNetExe) restore src/fsharp/FSharp.Build/FSharp.Build.fsproj $(DotNetExe) restore src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj diff --git a/NuGet.Config b/NuGet.Config index 6efc7f7b978..fdf6d3eda46 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -3,4 +3,13 @@ + + + + + + + + + diff --git a/PublishToBlob.proj b/PublishToBlob.proj index 71fbfad44ed..21e8ec6eb6f 100644 --- a/PublishToBlob.proj +++ b/PublishToBlob.proj @@ -10,26 +10,33 @@ Microsoft.DotNet.Build.Tasks.Feed - 2.1.0-prerelease-02419-02 + 2.2.0-beta.19066.1 - - + + + + $(MSBuildThisFileDirectory)artifacts\log\$(Configuration)\ + AnyCPU + $(Platform) + $(ArtifactsLogDir)AssetManifest\$(OS)-$(PlatformName).xml + + + AssetManifestPath="$(AssetManifestFilePath)" /> diff --git a/build.cmd b/build.cmd index a29dd5de7a3..7a7ce4fe0ff 100644 --- a/build.cmd +++ b/build.cmd @@ -613,10 +613,6 @@ if not exist %_ngenexe% echo Error: Could not find ngen.exe. && goto :failure echo ---------------- Done with prepare, starting package restore ---------------- -:: create a global.json -set /p DOTNET_TOOLS_VERSION=<"%~dp0DotnetCLIToolsVersion.txt" -echo { "sdk": { "version": "%DOTNET_TOOLS_VERSION%" } }>global.json - :: Restore the Tools directory call "%~dp0init-tools.cmd" set _dotnetexe=%~dp0artifacts\toolset\dotnet\dotnet.exe diff --git a/eng/common/CIBuild.cmd b/eng/common/CIBuild.cmd new file mode 100644 index 00000000000..56c2f25ac22 --- /dev/null +++ b/eng/common/CIBuild.cmd @@ -0,0 +1,2 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -publish -ci %*" \ No newline at end of file diff --git a/eng/common/PublishBuildAssets.cmd b/eng/common/PublishBuildAssets.cmd new file mode 100644 index 00000000000..3c6e4ff829d --- /dev/null +++ b/eng/common/PublishBuildAssets.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0sdk-task.ps1""" -msbuildEngine dotnet -restore -projects PublishBuildAssets.proj -ci %*" +exit /b %ErrorLevel% diff --git a/eng/common/PublishToPackageFeed.proj b/eng/common/PublishToPackageFeed.proj new file mode 100644 index 00000000000..7dc478d981f --- /dev/null +++ b/eng/common/PublishToPackageFeed.proj @@ -0,0 +1,37 @@ + + + + netcoreapp2.1 + + + + + + + + + + + + + + + + + + diff --git a/eng/common/README.md b/eng/common/README.md new file mode 100644 index 00000000000..ff49c371527 --- /dev/null +++ b/eng/common/README.md @@ -0,0 +1,28 @@ +# Don't touch this folder + + uuuuuuuuuuuuuuuuuuuu + u" uuuuuuuuuuuuuuuuuu "u + u" u$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u + $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ + $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ + $ $$$" ... "$... ...$" ... "$$$ ... "$$$ $ + $ $$$u `"$$$$$$$ $$$ $$$$$ $$ $$$ $$$ $ + $ $$$$$$uu "$$$$ $$$ $$$$$ $$ """ u$$$ $ + $ $$$""$$$ $$$$ $$$u "$$$" u$$ $$$$$$$$ $ + $ $$$$....,$$$$$..$$$$$....,$$$$..$$$$$$$$ $ + $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ + "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$" u" + "u """""""""""""""""" u" + """""""""""""""""""" + +!!! Changes made in this directory are subject to being overwritten by automation !!! + +The files in this directory are shared by all Arcade repos and managed by automation. If you need to make changes to these files, open an issue or submit a pull request to https://github.com/dotnet/arcade first. diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 new file mode 100644 index 00000000000..8279dc71339 --- /dev/null +++ b/eng/common/build.ps1 @@ -0,0 +1,133 @@ +[CmdletBinding(PositionalBinding=$false)] +Param( + [string][Alias('c')]$configuration = "Debug", + [string] $projects, + [string][Alias('v')]$verbosity = "minimal", + [string] $msbuildEngine = $null, + [bool] $warnAsError = $true, + [bool] $nodeReuse = $true, + [switch][Alias('r')]$restore, + [switch] $deployDeps, + [switch][Alias('b')]$build, + [switch] $rebuild, + [switch] $deploy, + [switch] $test, + [switch] $integrationTest, + [switch] $performanceTest, + [switch] $sign, + [switch] $pack, + [switch] $publish, + [switch][Alias('bl')]$binaryLog, + [switch] $ci, + [switch] $prepareMachine, + [switch] $help, + [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties +) + +. $PSScriptRoot\tools.ps1 + +function Print-Usage() { + Write-Host "Common settings:" + Write-Host " -configuration Build configuration: 'Debug' or 'Release' (short: -c)" + Write-Host " -verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" + Write-Host " -binaryLog Output binary log (short: -bl)" + Write-Host " -help Print help and exit" + Write-Host "" + + Write-Host "Actions:" + Write-Host " -restore Restore dependencies (short: -r)" + Write-Host " -build Build solution (short: -b)" + Write-Host " -rebuild Rebuild solution" + Write-Host " -deploy Deploy built VSIXes" + Write-Host " -deployDeps Deploy dependencies (e.g. VSIXes for integration tests)" + Write-Host " -test Run all unit tests in the solution" + Write-Host " -pack Package build outputs into NuGet packages and Willow components" + Write-Host " -integrationTest Run all integration tests in the solution" + Write-Host " -performanceTest Run all performance tests in the solution" + Write-Host " -sign Sign build outputs" + Write-Host " -publish Publish artifacts (e.g. symbols)" + Write-Host "" + + Write-Host "Advanced settings:" + Write-Host " -projects Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)" + Write-Host " -ci Set when running on CI server" + Write-Host " -prepareMachine Prepare machine for CI run" + Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." + Write-Host "" + Write-Host "Command line arguments not listed above are passed thru to msbuild." + Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)." +} + +function InitializeCustomToolset { + if (-not $restore) { + return + } + + $script = Join-Path $EngRoot "restore-toolset.ps1" + + if (Test-Path $script) { + . $script + } +} + +function Build { + $toolsetBuildProj = InitializeToolset + InitializeCustomToolset + + $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "Build.binlog") } else { "" } + + if ($projects) { + # Re-assign properties to a new variable because PowerShell doesn't let us append properties directly for unclear reasons. + # Explicitly set the type as string[] because otherwise PowerShell would make this char[] if $properties is empty. + [string[]] $msbuildArgs = $properties + $msbuildArgs += "/p:Projects=$projects" + $properties = $msbuildArgs + } + + MSBuild $toolsetBuildProj ` + $bl ` + /p:Configuration=$configuration ` + /p:RepoRoot=$RepoRoot ` + /p:Restore=$restore ` + /p:DeployDeps=$deployDeps ` + /p:Build=$build ` + /p:Rebuild=$rebuild ` + /p:Deploy=$deploy ` + /p:Test=$test ` + /p:Pack=$pack ` + /p:IntegrationTest=$integrationTest ` + /p:PerformanceTest=$performanceTest ` + /p:Sign=$sign ` + /p:Publish=$publish ` + /p:ContinuousIntegrationBuild=$ci ` + @properties +} + +try { + if ($help -or (($properties -ne $null) -and ($properties.Contains("/help") -or $properties.Contains("/?")))) { + Print-Usage + exit 0 + } + + if ($ci) { + $binaryLog = $true + $nodeReuse = $false + } + + # Import custom tools configuration, if present in the repo. + # Note: Import in global scope so that the script set top-level variables without qualification. + $configureToolsetScript = Join-Path $EngRoot "configure-toolset.ps1" + if (Test-Path $configureToolsetScript) { + . $configureToolsetScript + } + + Build +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + ExitWithExitCode 1 +} + +ExitWithExitCode 0 diff --git a/eng/common/build.sh b/eng/common/build.sh new file mode 100755 index 00000000000..4fe8b41ed70 --- /dev/null +++ b/eng/common/build.sh @@ -0,0 +1,213 @@ +#!/usr/bin/env bash + +# Stop script if unbound variable found (use ${var:-} if intentional) +set -u + +# Stop script if command returns non-zero exit code. +# Prevents hidden errors caused by missing error code propagation. +set -e + +usage() +{ + echo "Common settings:" + echo " --configuration Build configuration: 'Debug' or 'Release' (short: --c)" + echo " --verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" + echo " --binaryLog Create MSBuild binary log (short: -bl)" + echo "" + echo "Actions:" + echo " --restore Restore dependencies (short: -r)" + echo " --build Build all projects (short: -b)" + echo " --rebuild Rebuild all projects" + echo " --test Run all unit tests (short: -t)" + echo " --sign Sign build outputs" + echo " --publish Publish artifacts (e.g. symbols)" + echo " --pack Package build outputs into NuGet packages and Willow components" + echo " --help Print help and exit (short: -h)" + echo "" + echo "Advanced settings:" + echo " --projects Project or solution file(s) to build" + echo " --ci Set when running on CI server" + echo " --prepareMachine Prepare machine for CI run, clean up processes after build" + echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" + echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" + echo "" + echo "Command line arguments starting with '/p:' are passed through to MSBuild." +} + +source="${BASH_SOURCE[0]}" + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +restore=false +build=false +rebuild=false +test=false +pack=false +publish=false +integration_test=false +performance_test=false +sign=false +public=false +ci=false + +warn_as_error=true +node_reuse=true +binary_log=false + +projects='' +configuration='Debug' +prepare_machine=false +verbosity='minimal' +properties='' + +while [[ $# > 0 ]]; do + opt="$(echo "$1" | awk '{print tolower($0)}')" + case "$opt" in + --help|-h) + usage + exit 0 + ;; + --configuration|-c) + configuration=$2 + shift + ;; + --verbosity|-v) + verbosity=$2 + shift + ;; + --binarylog|-bl) + binary_log=true + ;; + --restore|-r) + restore=true + ;; + --build|-b) + build=true + ;; + --rebuild) + rebuild=true + ;; + --pack) + pack=true + ;; + --test|-t) + test=true + ;; + --integrationtest) + integration_test=true + ;; + --performancetest) + performance_test=true + ;; + --sign) + sign=true + ;; + --publish) + publish=true + ;; + --preparemachine) + prepare_machine=true + ;; + --projects) + projects=$2 + shift + ;; + --ci) + ci=true + ;; + --warnaserror) + warn_as_error=$2 + shift + ;; + --nodereuse) + node_reuse=$2 + shift + ;; + /p:*) + properties="$properties $1" + ;; + /m:*) + properties="$properties $1" + ;; + /bl:*) + properties="$properties $1" + ;; + *) + echo "Invalid argument: $1" + usage + exit 1 + ;; + esac + + shift +done + +if [[ "$ci" == true ]]; then + binary_log=true + node_reuse=false +fi + +. "$scriptroot/tools.sh" + +function InitializeCustomToolset { + local script="$eng_root/restore-toolset.sh" + + if [[ -a "$script" ]]; then + . "$script" + fi +} + +function Build { + InitializeToolset + InitializeCustomToolset + + if [[ ! -z "$projects" ]]; then + properties="$properties /p:Projects=$projects" + fi + + local bl="" + if [[ "$binary_log" == true ]]; then + bl="/bl:\"$log_dir/Build.binlog\"" + fi + + MSBuild $_InitializeToolset \ + $bl \ + /p:Configuration=$configuration \ + /p:RepoRoot="$repo_root" \ + /p:Restore=$restore \ + /p:Build=$build \ + /p:Rebuild=$rebuild \ + /p:Test=$test \ + /p:Pack=$pack \ + /p:IntegrationTest=$integration_test \ + /p:PerformanceTest=$performance_test \ + /p:Sign=$sign \ + /p:Publish=$publish \ + /p:ContinuousIntegrationBuild=$ci \ + $properties + + ExitWithExitCode 0 +} + +# Import custom tools configuration, if present in the repo. +configure_toolset_script="$eng_root/configure-toolset.sh" +if [[ -a "$configure_toolset_script" ]]; then + . "$configure_toolset_script" +fi + +# TODO: https://github.com/dotnet/arcade/issues/1468 +# Temporary workaround to avoid breaking change. +# Remove once repos are updated. +if [[ -n "${useInstalledDotNetCli:-}" ]]; then + use_installed_dotnet_cli="$useInstalledDotNetCli" +fi + +Build diff --git a/eng/common/cibuild.sh b/eng/common/cibuild.sh new file mode 100755 index 00000000000..1a02c0dec8f --- /dev/null +++ b/eng/common/cibuild.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where + # the symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. "$scriptroot/build.sh" --restore --build --test --pack --publish --ci $@ \ No newline at end of file diff --git a/eng/common/cross/android/arm/toolchain.cmake b/eng/common/cross/android/arm/toolchain.cmake new file mode 100644 index 00000000000..a7e1c73501b --- /dev/null +++ b/eng/common/cross/android/arm/toolchain.cmake @@ -0,0 +1,41 @@ +set(CROSS_NDK_TOOLCHAIN $ENV{ROOTFS_DIR}/../) +set(CROSS_ROOTFS ${CROSS_NDK_TOOLCHAIN}/sysroot) +set(CLR_CMAKE_PLATFORM_ANDROID "Android") + +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_PROCESSOR arm) + +## Specify the toolchain +set(TOOLCHAIN "arm-linux-androideabi") +set(CMAKE_PREFIX_PATH ${CROSS_NDK_TOOLCHAIN}) +set(TOOLCHAIN_PREFIX ${TOOLCHAIN}-) + +find_program(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}clang) +find_program(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}clang++) +find_program(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}clang) +find_program(CMAKE_AR ${TOOLCHAIN_PREFIX}ar) +find_program(CMAKE_LD ${TOOLCHAIN_PREFIX}ar) +find_program(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}objcopy) +find_program(CMAKE_OBJDUMP ${TOOLCHAIN_PREFIX}objdump) + +add_compile_options(--sysroot=${CROSS_ROOTFS}) +add_compile_options(-fPIE) +add_compile_options(-mfloat-abi=soft) +include_directories(SYSTEM ${CROSS_NDK_TOOLCHAIN}/include/c++/4.9.x/) +include_directories(SYSTEM ${CROSS_NDK_TOOLCHAIN}/include/c++/4.9.x/arm-linux-androideabi/) + +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -B ${CROSS_ROOTFS}/usr/lib/gcc/${TOOLCHAIN}") +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -L${CROSS_ROOTFS}/lib/${TOOLCHAIN}") +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} --sysroot=${CROSS_ROOTFS}") +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -fPIE -pie") + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) + +set(CMAKE_FIND_ROOT_PATH "${CROSS_ROOTFS}") +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/eng/common/cross/android/arm64/toolchain.cmake b/eng/common/cross/android/arm64/toolchain.cmake new file mode 100644 index 00000000000..29415899c1c --- /dev/null +++ b/eng/common/cross/android/arm64/toolchain.cmake @@ -0,0 +1,42 @@ +set(CROSS_NDK_TOOLCHAIN $ENV{ROOTFS_DIR}/../) +set(CROSS_ROOTFS ${CROSS_NDK_TOOLCHAIN}/sysroot) +set(CLR_CMAKE_PLATFORM_ANDROID "Android") + +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_PROCESSOR aarch64) + +## Specify the toolchain +set(TOOLCHAIN "aarch64-linux-android") +set(CMAKE_PREFIX_PATH ${CROSS_NDK_TOOLCHAIN}) +set(TOOLCHAIN_PREFIX ${TOOLCHAIN}-) + +find_program(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}clang) +find_program(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}clang++) +find_program(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}clang) +find_program(CMAKE_AR ${TOOLCHAIN_PREFIX}ar) +find_program(CMAKE_LD ${TOOLCHAIN_PREFIX}ar) +find_program(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}objcopy) +find_program(CMAKE_OBJDUMP ${TOOLCHAIN_PREFIX}objdump) + +add_compile_options(--sysroot=${CROSS_ROOTFS}) +add_compile_options(-fPIE) + +## Needed for Android or bionic specific conditionals +add_compile_options(-D__ANDROID__) +add_compile_options(-D__BIONIC__) + +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -B ${CROSS_ROOTFS}/usr/lib/gcc/${TOOLCHAIN}") +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -L${CROSS_ROOTFS}/lib/${TOOLCHAIN}") +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} --sysroot=${CROSS_ROOTFS}") +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -fPIE -pie") + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) + +set(CMAKE_FIND_ROOT_PATH "${CROSS_ROOTFS}") +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/eng/common/cross/arm/sources.list.bionic b/eng/common/cross/arm/sources.list.bionic new file mode 100644 index 00000000000..21095574095 --- /dev/null +++ b/eng/common/cross/arm/sources.list.bionic @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/arm/sources.list.jessie b/eng/common/cross/arm/sources.list.jessie new file mode 100644 index 00000000000..4d142ac9b10 --- /dev/null +++ b/eng/common/cross/arm/sources.list.jessie @@ -0,0 +1,3 @@ +# Debian (sid) # UNSTABLE +deb http://ftp.debian.org/debian/ sid main contrib non-free +deb-src http://ftp.debian.org/debian/ sid main contrib non-free diff --git a/eng/common/cross/arm/sources.list.trusty b/eng/common/cross/arm/sources.list.trusty new file mode 100644 index 00000000000..07d8f88d82e --- /dev/null +++ b/eng/common/cross/arm/sources.list.trusty @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm/sources.list.vivid b/eng/common/cross/arm/sources.list.vivid new file mode 100644 index 00000000000..0b1215e475a --- /dev/null +++ b/eng/common/cross/arm/sources.list.vivid @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ vivid main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ vivid-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ vivid-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ vivid-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm/sources.list.wily b/eng/common/cross/arm/sources.list.wily new file mode 100644 index 00000000000..e23d1e02a05 --- /dev/null +++ b/eng/common/cross/arm/sources.list.wily @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ wily main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ wily-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ wily-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ wily-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm/sources.list.xenial b/eng/common/cross/arm/sources.list.xenial new file mode 100644 index 00000000000..eacd86b7df3 --- /dev/null +++ b/eng/common/cross/arm/sources.list.xenial @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm/sources.list.zesty b/eng/common/cross/arm/sources.list.zesty new file mode 100644 index 00000000000..ea2c14a7874 --- /dev/null +++ b/eng/common/cross/arm/sources.list.zesty @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse diff --git a/eng/common/cross/arm/trusty-lttng-2.4.patch b/eng/common/cross/arm/trusty-lttng-2.4.patch new file mode 100644 index 00000000000..8e4dd7ae719 --- /dev/null +++ b/eng/common/cross/arm/trusty-lttng-2.4.patch @@ -0,0 +1,71 @@ +From e72c9d7ead60e3317bd6d1fade995c07021c947b Mon Sep 17 00:00:00 2001 +From: Mathieu Desnoyers +Date: Thu, 7 May 2015 13:25:04 -0400 +Subject: [PATCH] Fix: building probe providers with C++ compiler + +Robert Daniels wrote: +> > I'm attempting to use lttng userspace tracing with a C++ application +> > on an ARM platform. I'm using GCC 4.8.4 on Linux 3.14 with the 2.6 +> > release of lttng. I've compiled lttng-modules, lttng-ust, and +> > lttng-tools and have been able to get a simple test working with C +> > code. When I attempt to run the hello.cxx test on my target it will +> > segfault. +> +> +> I spent a little time digging into this issue and finally discovered the +> cause of my segfault with ARM C++ tracepoints. +> +> There is a struct called 'lttng_event' in ust-events.h which contains an +> empty union 'u'. This was the cause of my issue. Under C, this empty union +> compiles to a zero byte member while under C++ it compiles to a one byte +> member, and in my case was four-byte aligned which caused my C++ code to +> have the 'cds_list_head node' offset incorrectly by four bytes. This lead +> to an incorrect linked list structure which caused my issue. +> +> Since this union is empty, I simply removed it from the struct and everything +> worked correctly. +> +> I don't know the history or purpose behind this empty union so I'd like to +> know if this is a safe fix. If it is I can submit a patch with the union +> removed. + +That's a very nice catch! + +We do not support building tracepoint probe provider with +g++ yet, as stated in lttng-ust(3): + +"- Note for C++ support: although an application instrumented with + tracepoints can be compiled with g++, tracepoint probes should be + compiled with gcc (only tested with gcc so far)." + +However, if it works fine with this fix, then I'm tempted to take it, +especially because removing the empty union does not appear to affect +the layout of struct lttng_event as seen from liblttng-ust, which must +be compiled with a C compiler, and from probe providers compiled with +a C compiler. So all we are changing is the layout of a probe provider +compiled with a C++ compiler, which is anyway buggy at the moment, +because it is not compatible with the layout expected by liblttng-ust +compiled with a C compiler. + +Reported-by: Robert Daniels +Signed-off-by: Mathieu Desnoyers +--- + include/lttng/ust-events.h | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/usr/include/lttng/ust-events.h b/usr/include/lttng/ust-events.h +index 328a875..3d7a274 100644 +--- a/usr/include/lttng/ust-events.h ++++ b/usr/include/lttng/ust-events.h +@@ -407,8 +407,6 @@ struct lttng_event { + void *_deprecated1; + struct lttng_ctx *ctx; + enum lttng_ust_instrumentation instrumentation; +- union { +- } u; + struct cds_list_head node; /* Event list in session */ + struct cds_list_head _deprecated2; + void *_deprecated3; +-- +2.7.4 + diff --git a/eng/common/cross/arm/trusty.patch b/eng/common/cross/arm/trusty.patch new file mode 100644 index 00000000000..2f2972f8eb5 --- /dev/null +++ b/eng/common/cross/arm/trusty.patch @@ -0,0 +1,97 @@ +diff -u -r a/usr/include/urcu/uatomic/generic.h b/usr/include/urcu/uatomic/generic.h +--- a/usr/include/urcu/uatomic/generic.h 2014-03-28 06:04:42.000000000 +0900 ++++ b/usr/include/urcu/uatomic/generic.h 2017-02-13 10:35:21.189927116 +0900 +@@ -65,17 +65,17 @@ + switch (len) { + #ifdef UATOMIC_HAS_ATOMIC_BYTE + case 1: +- return __sync_val_compare_and_swap_1(addr, old, _new); ++ return __sync_val_compare_and_swap_1((uint8_t *) addr, old, _new); + #endif + #ifdef UATOMIC_HAS_ATOMIC_SHORT + case 2: +- return __sync_val_compare_and_swap_2(addr, old, _new); ++ return __sync_val_compare_and_swap_2((uint16_t *) addr, old, _new); + #endif + case 4: +- return __sync_val_compare_and_swap_4(addr, old, _new); ++ return __sync_val_compare_and_swap_4((uint32_t *) addr, old, _new); + #if (CAA_BITS_PER_LONG == 64) + case 8: +- return __sync_val_compare_and_swap_8(addr, old, _new); ++ return __sync_val_compare_and_swap_8((uint64_t *) addr, old, _new); + #endif + } + _uatomic_link_error(); +@@ -100,20 +100,20 @@ + switch (len) { + #ifdef UATOMIC_HAS_ATOMIC_BYTE + case 1: +- __sync_and_and_fetch_1(addr, val); ++ __sync_and_and_fetch_1((uint8_t *) addr, val); + return; + #endif + #ifdef UATOMIC_HAS_ATOMIC_SHORT + case 2: +- __sync_and_and_fetch_2(addr, val); ++ __sync_and_and_fetch_2((uint16_t *) addr, val); + return; + #endif + case 4: +- __sync_and_and_fetch_4(addr, val); ++ __sync_and_and_fetch_4((uint32_t *) addr, val); + return; + #if (CAA_BITS_PER_LONG == 64) + case 8: +- __sync_and_and_fetch_8(addr, val); ++ __sync_and_and_fetch_8((uint64_t *) addr, val); + return; + #endif + } +@@ -139,20 +139,20 @@ + switch (len) { + #ifdef UATOMIC_HAS_ATOMIC_BYTE + case 1: +- __sync_or_and_fetch_1(addr, val); ++ __sync_or_and_fetch_1((uint8_t *) addr, val); + return; + #endif + #ifdef UATOMIC_HAS_ATOMIC_SHORT + case 2: +- __sync_or_and_fetch_2(addr, val); ++ __sync_or_and_fetch_2((uint16_t *) addr, val); + return; + #endif + case 4: +- __sync_or_and_fetch_4(addr, val); ++ __sync_or_and_fetch_4((uint32_t *) addr, val); + return; + #if (CAA_BITS_PER_LONG == 64) + case 8: +- __sync_or_and_fetch_8(addr, val); ++ __sync_or_and_fetch_8((uint64_t *) addr, val); + return; + #endif + } +@@ -180,17 +180,17 @@ + switch (len) { + #ifdef UATOMIC_HAS_ATOMIC_BYTE + case 1: +- return __sync_add_and_fetch_1(addr, val); ++ return __sync_add_and_fetch_1((uint8_t *) addr, val); + #endif + #ifdef UATOMIC_HAS_ATOMIC_SHORT + case 2: +- return __sync_add_and_fetch_2(addr, val); ++ return __sync_add_and_fetch_2((uint16_t *) addr, val); + #endif + case 4: +- return __sync_add_and_fetch_4(addr, val); ++ return __sync_add_and_fetch_4((uint32_t *) addr, val); + #if (CAA_BITS_PER_LONG == 64) + case 8: +- return __sync_add_and_fetch_8(addr, val); ++ return __sync_add_and_fetch_8((uint64_t *) addr, val); + #endif + } + _uatomic_link_error(); diff --git a/eng/common/cross/arm64/sources.list.bionic b/eng/common/cross/arm64/sources.list.bionic new file mode 100644 index 00000000000..21095574095 --- /dev/null +++ b/eng/common/cross/arm64/sources.list.bionic @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/arm64/sources.list.trusty b/eng/common/cross/arm64/sources.list.trusty new file mode 100644 index 00000000000..07d8f88d82e --- /dev/null +++ b/eng/common/cross/arm64/sources.list.trusty @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm64/sources.list.vivid b/eng/common/cross/arm64/sources.list.vivid new file mode 100644 index 00000000000..0b1215e475a --- /dev/null +++ b/eng/common/cross/arm64/sources.list.vivid @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ vivid main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ vivid-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ vivid-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ vivid-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm64/sources.list.wily b/eng/common/cross/arm64/sources.list.wily new file mode 100644 index 00000000000..e23d1e02a05 --- /dev/null +++ b/eng/common/cross/arm64/sources.list.wily @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ wily main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ wily-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ wily-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ wily-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm64/sources.list.xenial b/eng/common/cross/arm64/sources.list.xenial new file mode 100644 index 00000000000..eacd86b7df3 --- /dev/null +++ b/eng/common/cross/arm64/sources.list.xenial @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm64/sources.list.zesty b/eng/common/cross/arm64/sources.list.zesty new file mode 100644 index 00000000000..ea2c14a7874 --- /dev/null +++ b/eng/common/cross/arm64/sources.list.zesty @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse diff --git a/eng/common/cross/armel/sources.list.jessie b/eng/common/cross/armel/sources.list.jessie new file mode 100644 index 00000000000..3d9c3059d89 --- /dev/null +++ b/eng/common/cross/armel/sources.list.jessie @@ -0,0 +1,3 @@ +# Debian (jessie) # Stable +deb http://ftp.debian.org/debian/ jessie main contrib non-free +deb-src http://ftp.debian.org/debian/ jessie main contrib non-free diff --git a/eng/common/cross/armel/tizen-build-rootfs.sh b/eng/common/cross/armel/tizen-build-rootfs.sh new file mode 100755 index 00000000000..87c48e78fbb --- /dev/null +++ b/eng/common/cross/armel/tizen-build-rootfs.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +set -e + +__ARM_SOFTFP_CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +__TIZEN_CROSSDIR="$__ARM_SOFTFP_CrossDir/tizen" + +if [[ -z "$ROOTFS_DIR" ]]; then + echo "ROOTFS_DIR is not defined." + exit 1; +fi + +# Clean-up (TODO-Cleanup: We may already delete $ROOTFS_DIR at ./cross/build-rootfs.sh.) +# hk0110 +if [ -d "$ROOTFS_DIR" ]; then + umount $ROOTFS_DIR/* + rm -rf $ROOTFS_DIR +fi + +TIZEN_TMP_DIR=$ROOTFS_DIR/tizen_tmp +mkdir -p $TIZEN_TMP_DIR + +# Download files +echo ">>Start downloading files" +VERBOSE=1 $__ARM_SOFTFP_CrossDir/tizen-fetch.sh $TIZEN_TMP_DIR +echo "<>Start constructing Tizen rootfs" +TIZEN_RPM_FILES=`ls $TIZEN_TMP_DIR/*.rpm` +cd $ROOTFS_DIR +for f in $TIZEN_RPM_FILES; do + rpm2cpio $f | cpio -idm --quiet +done +echo "<>Start configuring Tizen rootfs" +rm ./usr/lib/libunwind.so +ln -s libunwind.so.8 ./usr/lib/libunwind.so +ln -sfn asm-arm ./usr/include/asm +patch -p1 < $__TIZEN_CROSSDIR/tizen.patch +echo "</dev/null; then + VERBOSE=0 +fi + +Log() +{ + if [ $VERBOSE -ge $1 ]; then + echo ${@:2} + fi +} + +Inform() +{ + Log 1 -e "\x1B[0;34m$@\x1B[m" +} + +Debug() +{ + Log 2 -e "\x1B[0;32m$@\x1B[m" +} + +Error() +{ + >&2 Log 0 -e "\x1B[0;31m$@\x1B[m" +} + +Fetch() +{ + URL=$1 + FILE=$2 + PROGRESS=$3 + if [ $VERBOSE -ge 1 ] && [ $PROGRESS ]; then + CURL_OPT="--progress-bar" + else + CURL_OPT="--silent" + fi + curl $CURL_OPT $URL > $FILE +} + +hash curl 2> /dev/null || { Error "Require 'curl' Aborting."; exit 1; } +hash xmllint 2> /dev/null || { Error "Require 'xmllint' Aborting."; exit 1; } +hash sha256sum 2> /dev/null || { Error "Require 'sha256sum' Aborting."; exit 1; } + +TMPDIR=$1 +if [ ! -d $TMPDIR ]; then + TMPDIR=./tizen_tmp + Debug "Create temporary directory : $TMPDIR" + mkdir -p $TMPDIR +fi + +TIZEN_URL=http://download.tizen.org/releases/milestone/tizen +BUILD_XML=build.xml +REPOMD_XML=repomd.xml +PRIMARY_XML=primary.xml +TARGET_URL="http://__not_initialized" + +Xpath_get() +{ + XPATH_RESULT='' + XPATH=$1 + XML_FILE=$2 + RESULT=$(xmllint --xpath $XPATH $XML_FILE) + if [[ -z ${RESULT// } ]]; then + Error "Can not find target from $XML_FILE" + Debug "Xpath = $XPATH" + exit 1 + fi + XPATH_RESULT=$RESULT +} + +fetch_tizen_pkgs_init() +{ + TARGET=$1 + PROFILE=$2 + Debug "Initialize TARGET=$TARGET, PROFILE=$PROFILE" + + TMP_PKG_DIR=$TMPDIR/tizen_${PROFILE}_pkgs + if [ -d $TMP_PKG_DIR ]; then rm -rf $TMP_PKG_DIR; fi + mkdir -p $TMP_PKG_DIR + + PKG_URL=$TIZEN_URL/$PROFILE/latest + + BUILD_XML_URL=$PKG_URL/$BUILD_XML + TMP_BUILD=$TMP_PKG_DIR/$BUILD_XML + TMP_REPOMD=$TMP_PKG_DIR/$REPOMD_XML + TMP_PRIMARY=$TMP_PKG_DIR/$PRIMARY_XML + TMP_PRIMARYGZ=${TMP_PRIMARY}.gz + + Fetch $BUILD_XML_URL $TMP_BUILD + + Debug "fetch $BUILD_XML_URL to $TMP_BUILD" + + TARGET_XPATH="//build/buildtargets/buildtarget[@name=\"$TARGET\"]/repo[@type=\"binary\"]/text()" + Xpath_get $TARGET_XPATH $TMP_BUILD + TARGET_PATH=$XPATH_RESULT + TARGET_URL=$PKG_URL/$TARGET_PATH + + REPOMD_URL=$TARGET_URL/repodata/repomd.xml + PRIMARY_XPATH='string(//*[local-name()="data"][@type="primary"]/*[local-name()="location"]/@href)' + + Fetch $REPOMD_URL $TMP_REPOMD + + Debug "fetch $REPOMD_URL to $TMP_REPOMD" + + Xpath_get $PRIMARY_XPATH $TMP_REPOMD + PRIMARY_XML_PATH=$XPATH_RESULT + PRIMARY_URL=$TARGET_URL/$PRIMARY_XML_PATH + + Fetch $PRIMARY_URL $TMP_PRIMARYGZ + + Debug "fetch $PRIMARY_URL to $TMP_PRIMARYGZ" + + gunzip $TMP_PRIMARYGZ + + Debug "unzip $TMP_PRIMARYGZ to $TMP_PRIMARY" +} + +fetch_tizen_pkgs() +{ + ARCH=$1 + PACKAGE_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="location"]/@href)' + + PACKAGE_CHECKSUM_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="checksum"]/text())' + + for pkg in ${@:2} + do + Inform "Fetching... $pkg" + XPATH=${PACKAGE_XPATH_TPL/_PKG_/$pkg} + XPATH=${XPATH/_ARCH_/$ARCH} + Xpath_get $XPATH $TMP_PRIMARY + PKG_PATH=$XPATH_RESULT + + XPATH=${PACKAGE_CHECKSUM_XPATH_TPL/_PKG_/$pkg} + XPATH=${XPATH/_ARCH_/$ARCH} + Xpath_get $XPATH $TMP_PRIMARY + CHECKSUM=$XPATH_RESULT + + PKG_URL=$TARGET_URL/$PKG_PATH + PKG_FILE=$(basename $PKG_PATH) + PKG_PATH=$TMPDIR/$PKG_FILE + + Debug "Download $PKG_URL to $PKG_PATH" + Fetch $PKG_URL $PKG_PATH true + + echo "$CHECKSUM $PKG_PATH" | sha256sum -c - > /dev/null + if [ $? -ne 0 ]; then + Error "Fail to fetch $PKG_URL to $PKG_PATH" + Debug "Checksum = $CHECKSUM" + exit 1 + fi + done +} + +Inform "Initialize arm base" +fetch_tizen_pkgs_init standard base +Inform "fetch common packages" +fetch_tizen_pkgs armv7l gcc glibc glibc-devel libicu libicu-devel +fetch_tizen_pkgs noarch linux-glibc-devel +Inform "fetch coreclr packages" +fetch_tizen_pkgs armv7l lldb lldb-devel libgcc libstdc++ libstdc++-devel libunwind libunwind-devel tizen-release lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu +Inform "fetch corefx packages" +fetch_tizen_pkgs armv7l libcom_err libcom_err-devel zlib zlib-devel libopenssl libopenssl-devel krb5 krb5-devel libcurl libcurl-devel + +Inform "Initialize standard unified" +fetch_tizen_pkgs_init standard unified +Inform "fetch corefx packages" +fetch_tizen_pkgs armv7l gssdp gssdp-devel + diff --git a/eng/common/cross/armel/tizen/tizen-dotnet.ks b/eng/common/cross/armel/tizen/tizen-dotnet.ks new file mode 100644 index 00000000000..506d455bd4f --- /dev/null +++ b/eng/common/cross/armel/tizen/tizen-dotnet.ks @@ -0,0 +1,50 @@ +lang en_US.UTF-8 +keyboard us +timezone --utc Asia/Seoul + +part / --fstype="ext4" --size=3500 --ondisk=mmcblk0 --label rootfs --fsoptions=defaults,noatime + +rootpw tizen +desktop --autologinuser=root +user --name root --groups audio,video --password 'tizen' + +repo --name=standard --baseurl=http://download.tizen.org/releases/milestone/tizen/unified/latest/repos/standard/packages/ --ssl_verify=no +repo --name=base --baseurl=http://download.tizen.org/releases/milestone/tizen/base/latest/repos/standard/packages/ --ssl_verify=no + +%packages +tar +gzip + +sed +grep +gawk +perl + +binutils +findutils +util-linux +lttng-ust +userspace-rcu +procps-ng +tzdata +ca-certificates + + +### Core FX +libicu +libunwind +iputils +zlib +krb5 +libcurl +libopenssl + +%end + +%post + +### Update /tmp privilege +chmod 777 /tmp +#################################### + +%end diff --git a/eng/common/cross/armel/tizen/tizen.patch b/eng/common/cross/armel/tizen/tizen.patch new file mode 100644 index 00000000000..d223427c978 --- /dev/null +++ b/eng/common/cross/armel/tizen/tizen.patch @@ -0,0 +1,18 @@ +diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so +--- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900 ++++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf32-littlearm) +-GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.3 ) ) ++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux.so.3 ) ) +diff -u -r a/usr/lib/libpthread.so b/usr/lib/libpthread.so +--- a/usr/lib/libpthread.so 2016-12-30 23:00:19.408951841 +0900 ++++ b/usr/lib/libpthread.so 2016-12-30 23:00:39.068951801 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf32-littlearm) +-GROUP ( /lib/libpthread.so.0 /usr/lib/libpthread_nonshared.a ) ++GROUP ( libpthread.so.0 libpthread_nonshared.a ) diff --git a/eng/common/cross/build-android-rootfs.sh b/eng/common/cross/build-android-rootfs.sh new file mode 100755 index 00000000000..adceda877ad --- /dev/null +++ b/eng/common/cross/build-android-rootfs.sh @@ -0,0 +1,137 @@ +#!/usr/bin/env bash +set -e +__NDK_Version=r14 + +usage() +{ + echo "Creates a toolchain and sysroot used for cross-compiling for Android." + echo. + echo "Usage: $0 [BuildArch] [ApiLevel]" + echo. + echo "BuildArch is the target architecture of Android. Currently only arm64 is supported." + echo "ApiLevel is the target Android API level. API levels usually match to Android releases. See https://source.android.com/source/build-numbers.html" + echo. + echo "By default, the toolchain and sysroot will be generated in cross/android-rootfs/toolchain/[BuildArch]. You can change this behavior" + echo "by setting the TOOLCHAIN_DIR environment variable" + echo. + echo "By default, the NDK will be downloaded into the cross/android-rootfs/android-ndk-$__NDK_Version directory. If you already have an NDK installation," + echo "you can set the NDK_DIR environment variable to have this script use that installation of the NDK." + echo "By default, this script will generate a file, android_platform, in the root of the ROOTFS_DIR directory that contains the RID for the supported and tested Android build: android.21-arm64. This file is to replace '/etc/os-release', which is not available for Android." + exit 1 +} + +__ApiLevel=21 # The minimum platform for arm64 is API level 21 +__BuildArch=arm64 +__AndroidArch=aarch64 +__AndroidToolchain=aarch64-linux-android + +for i in "$@" + do + lowerI="$(echo $i | awk '{print tolower($0)}')" + case $lowerI in + -?|-h|--help) + usage + exit 1 + ;; + arm64) + __BuildArch=arm64 + __AndroidArch=aarch64 + __AndroidToolchain=aarch64-linux-android + ;; + arm) + __BuildArch=arm + __AndroidArch=arm + __AndroidToolchain=arm-linux-androideabi + ;; + *[0-9]) + __ApiLevel=$i + ;; + *) + __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i" + ;; + esac +done + +# Obtain the location of the bash script to figure out where the root of the repo is. +__CrossDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +__Android_Cross_Dir="$__CrossDir/android-rootfs" +__NDK_Dir="$__Android_Cross_Dir/android-ndk-$__NDK_Version" +__libunwind_Dir="$__Android_Cross_Dir/libunwind" +__lldb_Dir="$__Android_Cross_Dir/lldb" +__ToolchainDir="$__Android_Cross_Dir/toolchain/$__BuildArch" + +if [[ -n "$TOOLCHAIN_DIR" ]]; then + __ToolchainDir=$TOOLCHAIN_DIR +fi + +if [[ -n "$NDK_DIR" ]]; then + __NDK_Dir=$NDK_DIR +fi + +echo "Target API level: $__ApiLevel" +echo "Target architecture: $__BuildArch" +echo "NDK location: $__NDK_Dir" +echo "Target Toolchain location: $__ToolchainDir" + +# Download the NDK if required +if [ ! -d $__NDK_Dir ]; then + echo Downloading the NDK into $__NDK_Dir + mkdir -p $__NDK_Dir + wget -nv -nc --show-progress https://dl.google.com/android/repository/android-ndk-$__NDK_Version-linux-x86_64.zip -O $__Android_Cross_Dir/android-ndk-$__NDK_Version-linux-x86_64.zip + unzip -q $__Android_Cross_Dir/android-ndk-$__NDK_Version-linux-x86_64.zip -d $__Android_Cross_Dir +fi + +if [ ! -d $__lldb_Dir ]; then + mkdir -p $__lldb_Dir + echo Downloading LLDB into $__lldb_Dir + wget -nv -nc --show-progress https://dl.google.com/android/repository/lldb-2.3.3614996-linux-x86_64.zip -O $__Android_Cross_Dir/lldb-2.3.3614996-linux-x86_64.zip + unzip -q $__Android_Cross_Dir/lldb-2.3.3614996-linux-x86_64.zip -d $__lldb_Dir +fi + +# Create the RootFS for both arm64 as well as aarch +rm -rf $__Android_Cross_Dir/toolchain + +echo Generating the $__BuildArch toolchain +$__NDK_Dir/build/tools/make_standalone_toolchain.py --arch $__BuildArch --api $__ApiLevel --install-dir $__ToolchainDir + +# Install the required packages into the toolchain +# TODO: Add logic to get latest pkg version instead of specific version number +rm -rf $__Android_Cross_Dir/deb/ +rm -rf $__Android_Cross_Dir/tmp + +mkdir -p $__Android_Cross_Dir/deb/ +mkdir -p $__Android_Cross_Dir/tmp/$arch/ +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libicu_60.2_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libicu_60.2_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libicu-dev_60.2_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libicu-dev_60.2_$__AndroidArch.deb + +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libandroid-glob-dev_0.4_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libandroid-glob-dev_0.4_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libandroid-glob_0.4_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libandroid-glob_0.4_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libandroid-support-dev_22_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libandroid-support-dev_22_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libandroid-support_22_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libandroid-support_22_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/liblzma-dev_5.2.3_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/liblzma-dev_5.2.3_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/liblzma_5.2.3_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/liblzma_5.2.3_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libunwind-dev_1.2.20170304_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libunwind-dev_1.2.20170304_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libunwind_1.2.20170304_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libunwind_1.2.20170304_$__AndroidArch.deb + +echo Unpacking Termux packages +dpkg -x $__Android_Cross_Dir/deb/libicu_60.2_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/libicu-dev_60.2_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/libandroid-glob-dev_0.4_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/libandroid-glob_0.4_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/libandroid-support-dev_22_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/libandroid-support_22_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/liblzma-dev_5.2.3_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/liblzma_5.2.3_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/libunwind-dev_1.2.20170304_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/libunwind_1.2.20170304_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ + +cp -R $__Android_Cross_Dir/tmp/$__AndroidArch/data/data/com.termux/files/usr/* $__ToolchainDir/sysroot/usr/ + +# Generate platform file for build.sh script to assign to __DistroRid +echo "Generating platform file..." + +echo "RID=android.21-arm64" > $__ToolchainDir/sysroot/android_platform +echo Now run: +echo CONFIG_DIR=\`realpath cross/android/$__BuildArch\` ROOTFS_DIR=\`realpath $__ToolchainDir/sysroot\` ./build.sh cross $__BuildArch skipgenerateversion skipnuget cmakeargs -DENABLE_LLDBPLUGIN=0 + diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh new file mode 100755 index 00000000000..805948ca83c --- /dev/null +++ b/eng/common/cross/build-rootfs.sh @@ -0,0 +1,210 @@ +#!/usr/bin/env bash + +usage() +{ + echo "Usage: $0 [BuildArch] [LinuxCodeName] [lldbx.y] [--skipunmount]" + echo "BuildArch can be: arm(default), armel, arm64, x86" + echo "LinuxCodeName - optional, Code name for Linux, can be: trusty(default), vivid, wily, xenial, zesty, bionic, alpine. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen." + echo "lldbx.y - optional, LLDB version, can be: lldb3.6(default), lldb3.8, lldb3.9, lldb4.0, no-lldb. Ignored for alpine" + echo "--skipunmount - optional, will skip the unmount of rootfs folder." + exit 1 +} + +__LinuxCodeName=trusty +__CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +__InitialDir=$PWD +__BuildArch=arm +__UbuntuArch=armhf +__UbuntuRepo="http://ports.ubuntu.com/" +__LLDB_Package="lldb-3.6-dev" +__SkipUnmount=0 + +# base development support +__UbuntuPackages="build-essential" + +__AlpinePackages="alpine-base" +__AlpinePackages+=" build-base" +__AlpinePackages+=" linux-headers" +__AlpinePackages+=" lldb-dev" +__AlpinePackages+=" llvm-dev" + +# symlinks fixer +__UbuntuPackages+=" symlinks" + +# CoreCLR and CoreFX dependencies +__UbuntuPackages+=" libicu-dev" +__UbuntuPackages+=" liblttng-ust-dev" +__UbuntuPackages+=" libunwind8-dev" + +__AlpinePackages+=" gettext-dev" +__AlpinePackages+=" icu-dev" +__AlpinePackages+=" libunwind-dev" +__AlpinePackages+=" lttng-ust-dev" + +# CoreFX dependencies +__UbuntuPackages+=" libcurl4-openssl-dev" +__UbuntuPackages+=" libkrb5-dev" +__UbuntuPackages+=" libssl-dev" +__UbuntuPackages+=" zlib1g-dev" + +__AlpinePackages+=" curl-dev" +__AlpinePackages+=" krb5-dev" +__AlpinePackages+=" openssl-dev" +__AlpinePackages+=" zlib-dev" + +__UnprocessedBuildArgs= +for i in "$@" ; do + lowerI="$(echo $i | awk '{print tolower($0)}')" + case $lowerI in + -?|-h|--help) + usage + exit 1 + ;; + arm) + __BuildArch=arm + __UbuntuArch=armhf + __AlpineArch=armhf + __QEMUArch=arm + ;; + arm64) + __BuildArch=arm64 + __UbuntuArch=arm64 + __AlpineArch=aarch64 + __QEMUArch=aarch64 + ;; + armel) + __BuildArch=armel + __UbuntuArch=armel + __UbuntuRepo="http://ftp.debian.org/debian/" + __LinuxCodeName=jessie + ;; + x86) + __BuildArch=x86 + __UbuntuArch=i386 + __UbuntuRepo="http://archive.ubuntu.com/ubuntu/" + ;; + lldb3.6) + __LLDB_Package="lldb-3.6-dev" + ;; + lldb3.8) + __LLDB_Package="lldb-3.8-dev" + ;; + lldb3.9) + __LLDB_Package="liblldb-3.9-dev" + ;; + lldb4.0) + __LLDB_Package="liblldb-4.0-dev" + ;; + no-lldb) + unset __LLDB_Package + ;; + vivid) + if [ "$__LinuxCodeName" != "jessie" ]; then + __LinuxCodeName=vivid + fi + ;; + wily) + if [ "$__LinuxCodeName" != "jessie" ]; then + __LinuxCodeName=wily + fi + ;; + xenial) + if [ "$__LinuxCodeName" != "jessie" ]; then + __LinuxCodeName=xenial + fi + ;; + zesty) + if [ "$__LinuxCodeName" != "jessie" ]; then + __LinuxCodeName=zesty + fi + ;; + bionic) + if [ "$__LinuxCodeName" != "jessie" ]; then + __LinuxCodeName=bionic + fi + ;; + jessie) + __LinuxCodeName=jessie + __UbuntuRepo="http://ftp.debian.org/debian/" + ;; + tizen) + if [ "$__BuildArch" != "armel" ]; then + echo "Tizen is available only for armel." + usage; + exit 1; + fi + __LinuxCodeName= + __UbuntuRepo= + __Tizen=tizen + ;; + alpine) + __LinuxCodeName=alpine + __UbuntuRepo= + ;; + --skipunmount) + __SkipUnmount=1 + ;; + *) + __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i" + ;; + esac +done + +if [ "$__BuildArch" == "armel" ]; then + __LLDB_Package="lldb-3.5-dev" +fi +__UbuntuPackages+=" ${__LLDB_Package:-}" + +__RootfsDir="$__CrossDir/rootfs/$__BuildArch" + +if [[ -n "$ROOTFS_DIR" ]]; then + __RootfsDir=$ROOTFS_DIR +fi + +if [ -d "$__RootfsDir" ]; then + if [ $__SkipUnmount == 0 ]; then + umount $__RootfsDir/* + fi + rm -rf $__RootfsDir +fi + +if [[ "$__LinuxCodeName" == "alpine" ]]; then + __ApkToolsVersion=2.9.1 + __AlpineVersion=3.7 + __ApkToolsDir=$(mktemp -d) + wget https://github.com/alpinelinux/apk-tools/releases/download/v$__ApkToolsVersion/apk-tools-$__ApkToolsVersion-x86_64-linux.tar.gz -P $__ApkToolsDir + tar -xf $__ApkToolsDir/apk-tools-$__ApkToolsVersion-x86_64-linux.tar.gz -C $__ApkToolsDir + mkdir -p $__RootfsDir/usr/bin + cp -v /usr/bin/qemu-$__QEMUArch-static $__RootfsDir/usr/bin + $__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \ + -X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/main \ + -X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/community \ + -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \ + -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ + add $__AlpinePackages + rm -r $__ApkToolsDir +elif [[ -n $__LinuxCodeName ]]; then + qemu-debootstrap --arch $__UbuntuArch $__LinuxCodeName $__RootfsDir $__UbuntuRepo + cp $__CrossDir/$__BuildArch/sources.list.$__LinuxCodeName $__RootfsDir/etc/apt/sources.list + chroot $__RootfsDir apt-get update + chroot $__RootfsDir apt-get -f -y install + chroot $__RootfsDir apt-get -y install $__UbuntuPackages + chroot $__RootfsDir symlinks -cr /usr + + if [ $__SkipUnmount == 0 ]; then + umount $__RootfsDir/* + fi + + if [[ "$__BuildArch" == "arm" && "$__LinuxCodeName" == "trusty" ]]; then + pushd $__RootfsDir + patch -p1 < $__CrossDir/$__BuildArch/trusty.patch + patch -p1 < $__CrossDir/$__BuildArch/trusty-lttng-2.4.patch + popd + fi +elif [ "$__Tizen" == "tizen" ]; then + ROOTFS_DIR=$__RootfsDir $__CrossDir/$__BuildArch/tizen-build-rootfs.sh +else + echo "Unsupported target platform." + usage; + exit 1 +fi diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake new file mode 100644 index 00000000000..071d4112419 --- /dev/null +++ b/eng/common/cross/toolchain.cmake @@ -0,0 +1,138 @@ +set(CROSS_ROOTFS $ENV{ROOTFS_DIR}) + +set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH}) +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_VERSION 1) + +if(TARGET_ARCH_NAME STREQUAL "armel") + set(CMAKE_SYSTEM_PROCESSOR armv7l) + set(TOOLCHAIN "arm-linux-gnueabi") + if("$ENV{__DistroRid}" MATCHES "tizen.*") + set(TIZEN_TOOLCHAIN "armv7l-tizen-linux-gnueabi/6.2.1") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "arm") + set(CMAKE_SYSTEM_PROCESSOR armv7l) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf) + set(TOOLCHAIN "armv6-alpine-linux-musleabihf") + else() + set(TOOLCHAIN "arm-linux-gnueabihf") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "arm64") + set(CMAKE_SYSTEM_PROCESSOR aarch64) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl) + set(TOOLCHAIN "aarch64-alpine-linux-musl") + else() + set(TOOLCHAIN "aarch64-linux-gnu") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "x86") + set(CMAKE_SYSTEM_PROCESSOR i686) + set(TOOLCHAIN "i686-linux-gnu") +else() + message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64 and x86 are supported!") +endif() + +# Specify include paths +if(TARGET_ARCH_NAME STREQUAL "armel") + if(DEFINED TIZEN_TOOLCHAIN) + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/) + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7l-tizen-linux-gnueabi) + endif() +endif() + +# add_compile_param - adds only new options without duplicates. +# arg0 - list with result options, arg1 - list with new options. +# arg2 - optional argument, quick summary string for optional using CACHE FORCE mode. +macro(add_compile_param) + if(NOT ${ARGC} MATCHES "^(2|3)$") + message(FATAL_ERROR "Wrong using add_compile_param! Two or three parameters must be given! See add_compile_param description.") + endif() + foreach(OPTION ${ARGV1}) + if(NOT ${ARGV0} MATCHES "${OPTION}($| )") + set(${ARGV0} "${${ARGV0}} ${OPTION}") + if(${ARGC} EQUAL "3") # CACHE FORCE mode + set(${ARGV0} "${${ARGV0}}" CACHE STRING "${ARGV2}" FORCE) + endif() + endif() + endforeach() +endmacro() + +# Specify link flags +add_compile_param(CROSS_LINK_FLAGS "--sysroot=${CROSS_ROOTFS}") +add_compile_param(CROSS_LINK_FLAGS "--gcc-toolchain=${CROSS_ROOTFS}/usr") +add_compile_param(CROSS_LINK_FLAGS "--target=${TOOLCHAIN}") +add_compile_param(CROSS_LINK_FLAGS "-fuse-ld=gold") + +if(TARGET_ARCH_NAME STREQUAL "armel") + if(DEFINED TIZEN_TOOLCHAIN) # For Tizen only + add_compile_param(CROSS_LINK_FLAGS "-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_compile_param(CROSS_LINK_FLAGS "-L${CROSS_ROOTFS}/lib") + add_compile_param(CROSS_LINK_FLAGS "-L${CROSS_ROOTFS}/usr/lib") + add_compile_param(CROSS_LINK_FLAGS "-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "x86") + add_compile_param(CROSS_LINK_FLAGS "-m32") +endif() + +add_compile_param(CMAKE_EXE_LINKER_FLAGS "${CROSS_LINK_FLAGS}" "TOOLCHAIN_EXE_LINKER_FLAGS") +add_compile_param(CMAKE_SHARED_LINKER_FLAGS "${CROSS_LINK_FLAGS}" "TOOLCHAIN_EXE_LINKER_FLAGS") +add_compile_param(CMAKE_MODULE_LINKER_FLAGS "${CROSS_LINK_FLAGS}" "TOOLCHAIN_EXE_LINKER_FLAGS") + +# Specify compile options +add_compile_options("--sysroot=${CROSS_ROOTFS}") +add_compile_options("--target=${TOOLCHAIN}") +add_compile_options("--gcc-toolchain=${CROSS_ROOTFS}/usr") + +if(TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64)$") + set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN}) + set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN}) + set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN}) +endif() + +if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") + add_compile_options(-mthumb) + add_compile_options(-mfpu=vfpv3) + if(TARGET_ARCH_NAME STREQUAL "armel") + add_compile_options(-mfloat-abi=softfp) + if(DEFINED TIZEN_TOOLCHAIN) + add_compile_options(-Wno-deprecated-declarations) # compile-time option + add_compile_options(-D__extern_always_inline=inline) # compile-time option + endif() + endif() +elseif(TARGET_ARCH_NAME STREQUAL "x86") + add_compile_options(-m32) + add_compile_options(-Wno-error=unused-command-line-argument) +endif() + +# Set LLDB include and library paths +if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$") + if(TARGET_ARCH_NAME STREQUAL "x86") + set(LLVM_CROSS_DIR "$ENV{LLVM_CROSS_HOME}") + else() # arm/armel case + set(LLVM_CROSS_DIR "$ENV{LLVM_ARM_HOME}") + endif() + if(LLVM_CROSS_DIR) + set(WITH_LLDB_LIBS "${LLVM_CROSS_DIR}/lib/" CACHE STRING "") + set(WITH_LLDB_INCLUDES "${LLVM_CROSS_DIR}/include" CACHE STRING "") + set(LLDB_H "${WITH_LLDB_INCLUDES}" CACHE STRING "") + set(LLDB "${LLVM_CROSS_DIR}/lib/liblldb.so" CACHE STRING "") + else() + if(TARGET_ARCH_NAME STREQUAL "x86") + set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/i386-linux-gnu" CACHE STRING "") + set(CHECK_LLVM_DIR "${CROSS_ROOTFS}/usr/lib/llvm-3.8/include") + if(EXISTS "${CHECK_LLVM_DIR}" AND IS_DIRECTORY "${CHECK_LLVM_DIR}") + set(WITH_LLDB_INCLUDES "${CHECK_LLVM_DIR}") + else() + set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include") + endif() + else() # arm/armel case + set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}" CACHE STRING "") + set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include" CACHE STRING "") + endif() + endif() +endif() + +set(CMAKE_FIND_ROOT_PATH "${CROSS_ROOTFS}") +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/eng/common/cross/x86/sources.list.bionic b/eng/common/cross/x86/sources.list.bionic new file mode 100644 index 00000000000..a71ccadcffa --- /dev/null +++ b/eng/common/cross/x86/sources.list.bionic @@ -0,0 +1,11 @@ +deb http://archive.ubuntu.com/ubuntu/ bionic main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted +deb-src http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted + +deb http://archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse +deb-src http://archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/x86/sources.list.trusty b/eng/common/cross/x86/sources.list.trusty new file mode 100644 index 00000000000..9b3085436e9 --- /dev/null +++ b/eng/common/cross/x86/sources.list.trusty @@ -0,0 +1,11 @@ +deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted +deb-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted + +deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse +deb-src http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse diff --git a/eng/common/cross/x86/sources.list.vivid b/eng/common/cross/x86/sources.list.vivid new file mode 100644 index 00000000000..26d37b20fc3 --- /dev/null +++ b/eng/common/cross/x86/sources.list.vivid @@ -0,0 +1,11 @@ +deb http://archive.ubuntu.com/ubuntu/ vivid main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ vivid main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ vivid-updates main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ vivid-updates main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ vivid-backports main restricted +deb-src http://archive.ubuntu.com/ubuntu/ vivid-backports main restricted + +deb http://archive.ubuntu.com/ubuntu/ vivid-security main restricted universe multiverse +deb-src http://archive.ubuntu.com/ubuntu/ vivid-security main restricted universe multiverse diff --git a/eng/common/cross/x86/sources.list.wily b/eng/common/cross/x86/sources.list.wily new file mode 100644 index 00000000000..c4b0b442ab6 --- /dev/null +++ b/eng/common/cross/x86/sources.list.wily @@ -0,0 +1,11 @@ +deb http://archive.ubuntu.com/ubuntu/ wily main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ wily main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ wily-updates main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ wily-updates main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ wily-backports main restricted +deb-src http://archive.ubuntu.com/ubuntu/ wily-backports main restricted + +deb http://archive.ubuntu.com/ubuntu/ wily-security main restricted universe multiverse +deb-src http://archive.ubuntu.com/ubuntu/ wily-security main restricted universe multiverse diff --git a/eng/common/cross/x86/sources.list.xenial b/eng/common/cross/x86/sources.list.xenial new file mode 100644 index 00000000000..ad9c5a0144e --- /dev/null +++ b/eng/common/cross/x86/sources.list.xenial @@ -0,0 +1,11 @@ +deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted +deb-src http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted + +deb http://archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse +deb-src http://archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 new file mode 100644 index 00000000000..96cad844ba3 --- /dev/null +++ b/eng/common/darc-init.ps1 @@ -0,0 +1,32 @@ +param ( + $darcVersion = $null +) + +$verbosity = "m" +. $PSScriptRoot\tools.ps1 + +function InstallDarcCli ($darcVersion) { + $darcCliPackageName = "microsoft.dotnet.darc" + + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + $toolList = Invoke-Expression "& `"$dotnet`" tool list -g" + + if ($toolList -like "*$darcCliPackageName*") { + Invoke-Expression "& `"$dotnet`" tool uninstall $darcCliPackageName -g" + } + + # Until we can anonymously query the BAR API for the latest arcade-services + # build applied to the PROD channel, this is hardcoded. + if (-not $darcVersion) { + $darcVersion = '1.1.0-beta.19057.9' + } + + $arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-arcade/index.json' + + Write-Host "Installing Darc CLI version $darcVersion..." + Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." + Invoke-Expression "& `"$dotnet`" tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g" +} + +InstallDarcCli $darcVersion diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh new file mode 100755 index 00000000000..bad07c3ae61 --- /dev/null +++ b/eng/common/darc-init.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +verbosity=m + +. "$scriptroot/tools.sh" + +function InstallDarcCli { + local darc_cli_package_name="microsoft.dotnet.darc" + + InitializeDotNetCli + local dotnet_root=$_InitializeDotNetCli + + local uninstall_command=`$dotnet_root/dotnet tool uninstall $darc_cli_package_name -g` + local tool_list=$($dotnet_root/dotnet tool list -g) + if [[ $tool_list = *$darc_cli_package_name* ]]; then + echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name -g) + fi + + ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk" + local toolset_version=$_ReadGlobalVersion + + echo "Installing Darc CLI version $toolset_version..." + echo "You may need to restart your command shell if this is the first dotnet tool you have installed." + echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $toolset_version -v $verbosity -g) +} + +InstallDarcCli diff --git a/eng/common/helixpublish.proj b/eng/common/helixpublish.proj new file mode 100644 index 00000000000..d7f185856e7 --- /dev/null +++ b/eng/common/helixpublish.proj @@ -0,0 +1,26 @@ + + + + msbuild + + + + + %(Identity) + + + + + + $(WorkItemDirectory) + $(WorkItemCommand) + $(WorkItemTimeout) + + + + + + + + + diff --git a/eng/common/init-tools-native.cmd b/eng/common/init-tools-native.cmd new file mode 100644 index 00000000000..438cd548c45 --- /dev/null +++ b/eng/common/init-tools-native.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -NoProfile -NoLogo -ExecutionPolicy ByPass -command "& """%~dp0init-tools-native.ps1""" %*" +exit /b %ErrorLevel% \ No newline at end of file diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 new file mode 100644 index 00000000000..e25c60fed42 --- /dev/null +++ b/eng/common/init-tools-native.ps1 @@ -0,0 +1,128 @@ +<# +.SYNOPSIS +Entry point script for installing native tools + +.DESCRIPTION +Reads $RepoRoot\global.json file to determine native assets to install +and executes installers for those tools + +.PARAMETER BaseUri +Base file directory or Url from which to acquire tool archives + +.PARAMETER InstallDirectory +Directory to install native toolset. This is a command-line override for the default +Install directory precedence order: +- InstallDirectory command-line override +- NETCOREENG_INSTALL_DIRECTORY environment variable +- (default) %USERPROFILE%/.netcoreeng/native + +.PARAMETER Clean +Switch specifying to not install anything, but cleanup native asset folders + +.PARAMETER Force +Clean and then install tools + +.PARAMETER DownloadRetries +Total number of retry attempts + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds + +.PARAMETER GlobalJsonFile +File path to global.json file + +.NOTES +#> +[CmdletBinding(PositionalBinding=$false)] +Param ( + [string] $BaseUri = "https://netcorenativeassets.blob.core.windows.net/resource-packages/external", + [string] $InstallDirectory, + [switch] $Clean = $False, + [switch] $Force = $False, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30, + [string] $GlobalJsonFile = "$PSScriptRoot\..\..\global.json" +) + +Set-StrictMode -version 2.0 +$ErrorActionPreference="Stop" + +Import-Module -Name (Join-Path $PSScriptRoot "native\CommonLibrary.psm1") + +try { + # Define verbose switch if undefined + $Verbose = $VerbosePreference -Eq "Continue" + + $EngCommonBaseDir = Join-Path $PSScriptRoot "native\" + $NativeBaseDir = $InstallDirectory + if (!$NativeBaseDir) { + $NativeBaseDir = CommonLibrary\Get-NativeInstallDirectory + } + $Env:CommonLibrary_NativeInstallDir = $NativeBaseDir + $InstallBin = Join-Path $NativeBaseDir "bin" + $InstallerPath = Join-Path $EngCommonBaseDir "install-tool.ps1" + + # Process tools list + Write-Host "Processing $GlobalJsonFile" + If (-Not (Test-Path $GlobalJsonFile)) { + Write-Host "Unable to find '$GlobalJsonFile'" + exit 0 + } + $NativeTools = Get-Content($GlobalJsonFile) -Raw | + ConvertFrom-Json | + Select-Object -Expand "native-tools" -ErrorAction SilentlyContinue + if ($NativeTools) { + $NativeTools.PSObject.Properties | ForEach-Object { + $ToolName = $_.Name + $ToolVersion = $_.Value + $LocalInstallerCommand = $InstallerPath + $LocalInstallerCommand += " -ToolName $ToolName" + $LocalInstallerCommand += " -InstallPath $InstallBin" + $LocalInstallerCommand += " -BaseUri $BaseUri" + $LocalInstallerCommand += " -CommonLibraryDirectory $EngCommonBaseDir" + $LocalInstallerCommand += " -Version $ToolVersion" + + if ($Verbose) { + $LocalInstallerCommand += " -Verbose" + } + if (Get-Variable 'Force' -ErrorAction 'SilentlyContinue') { + if($Force) { + $LocalInstallerCommand += " -Force" + } + } + if ($Clean) { + $LocalInstallerCommand += " -Clean" + } + + Write-Verbose "Installing $ToolName version $ToolVersion" + Write-Verbose "Executing '$LocalInstallerCommand'" + Invoke-Expression "$LocalInstallerCommand" + if ($LASTEXITCODE -Ne "0") { + Write-Error "Execution failed" + exit 1 + } + } + } + else { + Write-Host "No native tools defined in global.json" + exit 0 + } + + if ($Clean) { + exit 0 + } + if (Test-Path $InstallBin) { + Write-Host "Native tools are available from" (Convert-Path -Path $InstallBin) + Write-Host "##vso[task.prependpath]$(Convert-Path -Path $InstallBin)" + } + else { + Write-Error "Native tools install directory does not exist, installation failed" + exit 1 + } + exit 0 +} +catch { + Write-Host $_ + Write-Host $_.Exception + exit 1 +} diff --git a/eng/common/init-tools-native.sh b/eng/common/init-tools-native.sh new file mode 100755 index 00000000000..54b70f678ba --- /dev/null +++ b/eng/common/init-tools-native.sh @@ -0,0 +1,145 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +base_uri='https://netcorenativeassets.blob.core.windows.net/resource-packages/external' +install_directory='' +clean=false +force=false +download_retries=5 +retry_wait_time_seconds=30 +global_json_file="${scriptroot}/../../global.json" +declare -A native_assets + +. $scriptroot/native/common-library.sh + +while (($# > 0)); do + lowerI="$(echo $1 | awk '{print tolower($0)}')" + case $lowerI in + --baseuri) + base_uri=$2 + shift 2 + ;; + --installdirectory) + install_directory=$2 + shift 2 + ;; + --clean) + clean=true + shift 1 + ;; + --force) + force=true + shift 1 + ;; + --downloadretries) + download_retries=$2 + shift 2 + ;; + --retrywaittimeseconds) + retry_wait_time_seconds=$2 + shift 2 + ;; + --help) + echo "Common settings:" + echo " --installdirectory Directory to install native toolset." + echo " This is a command-line override for the default" + echo " Install directory precedence order:" + echo " - InstallDirectory command-line override" + echo " - NETCOREENG_INSTALL_DIRECTORY environment variable" + echo " - (default) %USERPROFILE%/.netcoreeng/native" + echo "" + echo " --clean Switch specifying not to install anything, but cleanup native asset folders" + echo " --force Clean and then install tools" + echo " --help Print help and exit" + echo "" + echo "Advanced settings:" + echo " --baseuri Base URI for where to download native tools from" + echo " --downloadretries Number of times a download should be attempted" + echo " --retrywaittimeseconds Wait time between download attempts" + echo "" + exit 0 + ;; + esac +done + +function ReadGlobalJsonNativeTools { + # Get the native-tools section from the global.json. + local native_tools_section=$(cat $global_json_file | awk '/"native-tools"/,/}/') + # Only extract the contents of the object. + local native_tools_list=$(echo $native_tools_section | awk -F"[{}]" '{print $2}') + native_tools_list=${native_tools_list//[\" ]/} + native_tools_list=${native_tools_list//,/$'\n'} + + local old_IFS=$IFS + while read -r line; do + # Lines are of the form: 'tool:version' + IFS=: + while read -r key value; do + native_assets[$key]=$value + done <<< "$line" + done <<< "$native_tools_list" + IFS=$old_IFS + + return 0; +} + +native_base_dir=$install_directory +if [[ -z $install_directory ]]; then + native_base_dir=$(GetNativeInstallDirectory) +fi + +install_bin="${native_base_dir}/bin" + +ReadGlobalJsonNativeTools + +if [[ ${#native_assets[@]} -eq 0 ]]; then + echo "No native tools defined in global.json" + exit 0; +else + native_installer_dir="$scriptroot/native" + for tool in "${!native_assets[@]}" + do + tool_version=${native_assets[$tool]} + installer_name="install-$tool.sh" + installer_command="$native_installer_dir/$installer_name" + installer_command+=" --baseuri $base_uri" + installer_command+=" --installpath $install_bin" + installer_command+=" --version $tool_version" + + if [[ $force = true ]]; then + installer_command+=" --force" + fi + + if [[ $clean = true ]]; then + installer_command+=" --clean" + fi + + echo "Installing $tool version $tool_version" + echo "Executing '$installer_command'" + $installer_command + + if [[ $? != 0 ]]; then + echo "Execution Failed" >&2 + exit 1 + fi + done +fi + +if [[ ! -z $clean ]]; then + exit 0 +fi + +if [[ -d $install_bin ]]; then + echo "Native tools are available from $install_bin" + if [[ !-z BUILD_BUILDNUMBER ]]; then + echo "##vso[task.prependpath]$install_bin" + fi +else + echo "Native tools install directory does not exist, installation failed" >&2 + exit 1 +fi + +exit 0 + diff --git a/eng/common/msbuild.ps1 b/eng/common/msbuild.ps1 new file mode 100644 index 00000000000..b37fd3d5e97 --- /dev/null +++ b/eng/common/msbuild.ps1 @@ -0,0 +1,27 @@ +[CmdletBinding(PositionalBinding=$false)] +Param( + [string] $verbosity = "minimal", + [bool] $warnAsError = $true, + [bool] $nodeReuse = $true, + [switch] $ci, + [switch] $prepareMachine, + [Parameter(ValueFromRemainingArguments=$true)][String[]]$extraArgs +) + +. $PSScriptRoot\tools.ps1 + +try { + if ($ci) { + $nodeReuse = $false + } + + MSBuild @extraArgs +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + ExitWithExitCode 1 +} + +ExitWithExitCode 0 \ No newline at end of file diff --git a/eng/common/msbuild.sh b/eng/common/msbuild.sh new file mode 100755 index 00000000000..8160cd5a59d --- /dev/null +++ b/eng/common/msbuild.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +verbosity='minimal' +warn_as_error=true +node_reuse=true +prepare_machine=false +extra_args='' + +while (($# > 0)); do + lowerI="$(echo $1 | awk '{print tolower($0)}')" + case $lowerI in + --verbosity) + verbosity=$2 + shift 2 + ;; + --warnaserror) + warn_as_error=$2 + shift 2 + ;; + --nodereuse) + node_reuse=$2 + shift 2 + ;; + --ci) + ci=true + shift 1 + ;; + --preparemachine) + prepare_machine=true + shift 1 + ;; + *) + extra_args="$extra_args $1" + shift 1 + ;; + esac +done + +. "$scriptroot/tools.sh" + +if [[ "$ci" == true ]]; then + node_reuse=false +fi + +MSBuild $extra_args +ExitWithExitCode 0 diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 new file mode 100644 index 00000000000..f286ae0cde2 --- /dev/null +++ b/eng/common/native/CommonLibrary.psm1 @@ -0,0 +1,358 @@ +<# +.SYNOPSIS +Helper module to install an archive to a directory + +.DESCRIPTION +Helper module to download and extract an archive to a specified directory + +.PARAMETER Uri +Uri of artifact to download + +.PARAMETER InstallDirectory +Directory to extract artifact contents to + +.PARAMETER Force +Force download / extraction if file or contents already exist. Default = False + +.PARAMETER DownloadRetries +Total number of retry attempts. Default = 5 + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds. Default = 30 + +.NOTES +Returns False if download or extraction fail, True otherwise +#> +function DownloadAndExtract { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $Uri, + [Parameter(Mandatory=$True)] + [string] $InstallDirectory, + [switch] $Force = $False, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30 + ) + # Define verbose switch if undefined + $Verbose = $VerbosePreference -Eq "Continue" + + $TempToolPath = CommonLibrary\Get-TempPathFilename -Path $Uri + + # Download native tool + $DownloadStatus = CommonLibrary\Get-File -Uri $Uri ` + -Path $TempToolPath ` + -DownloadRetries $DownloadRetries ` + -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` + -Force:$Force ` + -Verbose:$Verbose + + if ($DownloadStatus -Eq $False) { + Write-Error "Download failed" + return $False + } + + # Extract native tool + $UnzipStatus = CommonLibrary\Expand-Zip -ZipPath $TempToolPath ` + -OutputDirectory $InstallDirectory ` + -Force:$Force ` + -Verbose:$Verbose + + if ($UnzipStatus -Eq $False) { + Write-Error "Unzip failed" + return $False + } + return $True +} + +<# +.SYNOPSIS +Download a file, retry on failure + +.DESCRIPTION +Download specified file and retry if attempt fails + +.PARAMETER Uri +Uri of file to download. If Uri is a local path, the file will be copied instead of downloaded + +.PARAMETER Path +Path to download or copy uri file to + +.PARAMETER Force +Overwrite existing file if present. Default = False + +.PARAMETER DownloadRetries +Total number of retry attempts. Default = 5 + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds Default = 30 + +#> +function Get-File { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $Uri, + [Parameter(Mandatory=$True)] + [string] $Path, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30, + [switch] $Force = $False + ) + $Attempt = 0 + + if ($Force) { + if (Test-Path $Path) { + Remove-Item $Path -Force + } + } + if (Test-Path $Path) { + Write-Host "File '$Path' already exists, skipping download" + return $True + } + + $DownloadDirectory = Split-Path -ErrorAction Ignore -Path "$Path" -Parent + if (-Not (Test-Path $DownloadDirectory)) { + New-Item -path $DownloadDirectory -force -itemType "Directory" | Out-Null + } + + if (Test-Path -IsValid -Path $Uri) { + Write-Verbose "'$Uri' is a file path, copying file to '$Path'" + Copy-Item -Path $Uri -Destination $Path + return $? + } + else { + Write-Verbose "Downloading $Uri" + while($Attempt -Lt $DownloadRetries) + { + try { + Invoke-WebRequest -UseBasicParsing -Uri $Uri -OutFile $Path + Write-Verbose "Downloaded to '$Path'" + return $True + } + catch { + $Attempt++ + if ($Attempt -Lt $DownloadRetries) { + $AttemptsLeft = $DownloadRetries - $Attempt + Write-Warning "Download failed, $AttemptsLeft attempts remaining, will retry in $RetryWaitTimeInSeconds seconds" + Start-Sleep -Seconds $RetryWaitTimeInSeconds + } + else { + Write-Error $_ + Write-Error $_.Exception + } + } + } + } + + return $False +} + +<# +.SYNOPSIS +Generate a shim for a native tool + +.DESCRIPTION +Creates a wrapper script (shim) that passes arguments forward to native tool assembly + +.PARAMETER ShimName +The name of the shim + +.PARAMETER ShimDirectory +The directory where shims are stored + +.PARAMETER ToolFilePath +Path to file that shim forwards to + +.PARAMETER Force +Replace shim if already present. Default = False + +.NOTES +Returns $True if generating shim succeeds, $False otherwise +#> +function New-ScriptShim { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $ShimName, + [Parameter(Mandatory=$True)] + [string] $ShimDirectory, + [Parameter(Mandatory=$True)] + [string] $ToolFilePath, + [Parameter(Mandatory=$True)] + [string] $BaseUri, + [switch] $Force + ) + try { + Write-Verbose "Generating '$ShimName' shim" + + if (-Not (Test-Path $ToolFilePath)){ + Write-Error "Specified tool file path '$ToolFilePath' does not exist" + return $False + } + + # WinShimmer is a small .NET Framework program that creates .exe shims to bootstrapped programs + # Many of the checks for installed programs expect a .exe extension for Windows tools, rather + # than a .bat or .cmd file. + # Source: https://github.com/dotnet/arcade/tree/master/src/WinShimmer + if (-Not (Test-Path "$ShimDirectory\WinShimmer\winshimmer.exe")) { + $InstallStatus = DownloadAndExtract -Uri "$BaseUri/windows/winshimmer/WinShimmer.zip" ` + -InstallDirectory $ShimDirectory\WinShimmer ` + -Force:$Force ` + -DownloadRetries 2 ` + -RetryWaitTimeInSeconds 5 ` + -Verbose:$Verbose + } + + if ((Test-Path (Join-Path $ShimDirectory "$ShimName.exe"))) { + Write-Host "$ShimName.exe already exists; replacing..." + Remove-Item (Join-Path $ShimDirectory "$ShimName.exe") + } + + Invoke-Expression "$ShimDirectory\WinShimmer\winshimmer.exe $ShimName $ToolFilePath $ShimDirectory" + return $True + } + catch { + Write-Host $_ + Write-Host $_.Exception + return $False + } +} + +<# +.SYNOPSIS +Returns the machine architecture of the host machine + +.NOTES +Returns 'x64' on 64 bit machines + Returns 'x86' on 32 bit machines +#> +function Get-MachineArchitecture { + $ProcessorArchitecture = $Env:PROCESSOR_ARCHITECTURE + $ProcessorArchitectureW6432 = $Env:PROCESSOR_ARCHITEW6432 + if($ProcessorArchitecture -Eq "X86") + { + if(($ProcessorArchitectureW6432 -Eq "") -Or + ($ProcessorArchitectureW6432 -Eq "X86")) { + return "x86" + } + $ProcessorArchitecture = $ProcessorArchitectureW6432 + } + if (($ProcessorArchitecture -Eq "AMD64") -Or + ($ProcessorArchitecture -Eq "IA64") -Or + ($ProcessorArchitecture -Eq "ARM64")) { + return "x64" + } + return "x86" +} + +<# +.SYNOPSIS +Get the name of a temporary folder under the native install directory +#> +function Get-TempDirectory { + return Join-Path (Get-NativeInstallDirectory) "temp/" +} + +function Get-TempPathFilename { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $Path + ) + $TempDir = CommonLibrary\Get-TempDirectory + $TempFilename = Split-Path $Path -leaf + $TempPath = Join-Path $TempDir $TempFilename + return $TempPath +} + +<# +.SYNOPSIS +Returns the base directory to use for native tool installation + +.NOTES +Returns the value of the NETCOREENG_INSTALL_DIRECTORY if that environment variable +is set, or otherwise returns an install directory under the %USERPROFILE% +#> +function Get-NativeInstallDirectory { + $InstallDir = $Env:NETCOREENG_INSTALL_DIRECTORY + if (!$InstallDir) { + $InstallDir = Join-Path $Env:USERPROFILE ".netcoreeng/native/" + } + return $InstallDir +} + +<# +.SYNOPSIS +Unzip an archive + +.DESCRIPTION +Powershell module to unzip an archive to a specified directory + +.PARAMETER ZipPath (Required) +Path to archive to unzip + +.PARAMETER OutputDirectory (Required) +Output directory for archive contents + +.PARAMETER Force +Overwrite output directory contents if they already exist + +.NOTES +- Returns True and does not perform an extraction if output directory already exists but Overwrite is not True. +- Returns True if unzip operation is successful +- Returns False if Overwrite is True and it is unable to remove contents of OutputDirectory +- Returns False if unable to extract zip archive +#> +function Expand-Zip { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $ZipPath, + [Parameter(Mandatory=$True)] + [string] $OutputDirectory, + [switch] $Force + ) + + Write-Verbose "Extracting '$ZipPath' to '$OutputDirectory'" + try { + if ((Test-Path $OutputDirectory) -And (-Not $Force)) { + Write-Host "Directory '$OutputDirectory' already exists, skipping extract" + return $True + } + if (Test-Path $OutputDirectory) { + Write-Verbose "'Force' is 'True', but '$OutputDirectory' exists, removing directory" + Remove-Item $OutputDirectory -Force -Recurse + if ($? -Eq $False) { + Write-Error "Unable to remove '$OutputDirectory'" + return $False + } + } + if (-Not (Test-Path $OutputDirectory)) { + New-Item -path $OutputDirectory -Force -itemType "Directory" | Out-Null + } + + Add-Type -assembly "system.io.compression.filesystem" + [io.compression.zipfile]::ExtractToDirectory("$ZipPath", "$OutputDirectory") + if ($? -Eq $False) { + Write-Error "Unable to extract '$ZipPath'" + return $False + } + } + catch { + Write-Host $_ + Write-Host $_.Exception + + return $False + } + return $True +} + +export-modulemember -function DownloadAndExtract +export-modulemember -function Expand-Zip +export-modulemember -function Get-File +export-modulemember -function Get-MachineArchitecture +export-modulemember -function Get-NativeInstallDirectory +export-modulemember -function Get-TempDirectory +export-modulemember -function Get-TempPathFilename +export-modulemember -function New-ScriptShim diff --git a/eng/common/native/common-library.sh b/eng/common/native/common-library.sh new file mode 100755 index 00000000000..271bddfac5a --- /dev/null +++ b/eng/common/native/common-library.sh @@ -0,0 +1,168 @@ +#!/usr/bin/env bash + +function GetNativeInstallDirectory { + local install_dir + + if [[ -z $NETCOREENG_INSTALL_DIRECTORY ]]; then + install_dir=$HOME/.netcoreeng/native/ + else + install_dir=$NETCOREENG_INSTALL_DIRECTORY + fi + + echo $install_dir + return 0 +} + +function GetTempDirectory { + + echo $(GetNativeInstallDirectory)temp/ + return 0 +} + +function ExpandZip { + local zip_path=$1 + local output_directory=$2 + local force=${3:-false} + + echo "Extracting $zip_path to $output_directory" + if [[ -d $output_directory ]] && [[ $force = false ]]; then + echo "Directory '$output_directory' already exists, skipping extract" + return 0 + fi + + if [[ -d $output_directory ]]; then + echo "'Force flag enabled, but '$output_directory' exists. Removing directory" + rm -rf $output_directory + if [[ $? != 0 ]]; then + echo Unable to remove '$output_directory'>&2 + return 1 + fi + fi + + echo "Creating directory: '$output_directory'" + mkdir -p $output_directory + + echo "Extracting archive" + tar -xf $zip_path -C $output_directory + if [[ $? != 0 ]]; then + echo "Unable to extract '$zip_path'" >&2 + return 1 + fi + + return 0 +} + +function GetCurrentOS { + local unameOut="$(uname -s)" + case $unameOut in + Linux*) echo "Linux";; + Darwin*) echo "MacOS";; + esac + return 0 +} + +function GetFile { + local uri=$1 + local path=$2 + local force=${3:-false} + local download_retries=${4:-5} + local retry_wait_time_seconds=${5:-30} + + if [[ -f $path ]]; then + if [[ $force = false ]]; then + echo "File '$path' already exists. Skipping download" + return 0 + else + rm -rf $path + fi + fi + + if [[ -f $uri ]]; then + echo "'$uri' is a file path, copying file to '$path'" + cp $uri $path + return $? + fi + + echo "Downloading $uri" + # Use curl if available, otherwise use wget + if command -v curl > /dev/null; then + curl "$uri" -sSL --retry $download_retries --retry-delay $retry_wait_time_seconds --create-dirs -o "$path" --fail + else + wget -q -O "$path" "$uri" --tries="$download_retries" + fi + + return $? +} + +function GetTempPathFileName { + local path=$1 + + local temp_dir=$(GetTempDirectory) + local temp_file_name=$(basename $path) + echo $temp_dir$temp_file_name + return 0 +} + +function DownloadAndExtract { + local uri=$1 + local installDir=$2 + local force=${3:-false} + local download_retries=${4:-5} + local retry_wait_time_seconds=${5:-30} + + local temp_tool_path=$(GetTempPathFileName $uri) + + echo "downloading to: $temp_tool_path" + + # Download file + GetFile "$uri" "$temp_tool_path" $force $download_retries $retry_wait_time_seconds + if [[ $? != 0 ]]; then + echo "Failed to download '$uri' to '$temp_tool_path'." >&2 + return 1 + fi + + # Extract File + echo "extracting from $temp_tool_path to $installDir" + ExpandZip "$temp_tool_path" "$installDir" $force $download_retries $retry_wait_time_seconds + if [[ $? != 0 ]]; then + echo "Failed to extract '$temp_tool_path' to '$installDir'." >&2 + return 1 + fi + + return 0 +} + +function NewScriptShim { + local shimpath=$1 + local tool_file_path=$2 + local force=${3:-false} + + echo "Generating '$shimpath' shim" + if [[ -f $shimpath ]]; then + if [[ $force = false ]]; then + echo "File '$shimpath' already exists." >&2 + return 1 + else + rm -rf $shimpath + fi + fi + + if [[ ! -f $tool_file_path ]]; then + echo "Specified tool file path:'$tool_file_path' does not exist" >&2 + return 1 + fi + + local shim_contents=$'#!/usr/bin/env bash\n' + shim_contents+="SHIMARGS="$'$1\n' + shim_contents+="$tool_file_path"$' $SHIMARGS\n' + + # Write shim file + echo "$shim_contents" > $shimpath + + chmod +x $shimpath + + echo "Finished generating shim '$shimpath'" + + return $? +} + diff --git a/eng/common/native/install-cmake.sh b/eng/common/native/install-cmake.sh new file mode 100755 index 00000000000..293af6017df --- /dev/null +++ b/eng/common/native/install-cmake.sh @@ -0,0 +1,117 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. $scriptroot/common-library.sh + +base_uri= +install_path= +version= +clean=false +force=false +download_retries=5 +retry_wait_time_seconds=30 + +while (($# > 0)); do + lowerI="$(echo $1 | awk '{print tolower($0)}')" + case $lowerI in + --baseuri) + base_uri=$2 + shift 2 + ;; + --installpath) + install_path=$2 + shift 2 + ;; + --version) + version=$2 + shift 2 + ;; + --clean) + clean=true + shift 1 + ;; + --force) + force=true + shift 1 + ;; + --downloadretries) + download_retries=$2 + shift 2 + ;; + --retrywaittimeseconds) + retry_wait_time_seconds=$2 + shift 2 + ;; + --help) + echo "Common settings:" + echo " --baseuri Base file directory or Url wrom which to acquire tool archives" + echo " --installpath Base directory to install native tool to" + echo " --clean Don't install the tool, just clean up the current install of the tool" + echo " --force Force install of tools even if they previously exist" + echo " --help Print help and exit" + echo "" + echo "Advanced settings:" + echo " --downloadretries Total number of retry attempts" + echo " --retrywaittimeseconds Wait time between retry attempts in seconds" + echo "" + exit 0 + ;; + esac +done + +tool_name="cmake" +tool_os=$(GetCurrentOS) +tool_folder=$(echo $tool_os | awk '{print tolower($0)}') +tool_arch="x86_64" +tool_name_moniker="$tool_name-$version-$tool_os-$tool_arch" +tool_install_directory="$install_path/$tool_name/$version" +tool_file_path="$tool_install_directory/$tool_name_moniker/bin/$tool_name" +shim_path="$install_path/$tool_name.sh" +uri="${base_uri}/$tool_folder/cmake/$tool_name_moniker.tar.gz" + +# Clean up tool and installers +if [[ $clean = true ]]; then + echo "Cleaning $tool_install_directory" + if [[ -d $tool_install_directory ]]; then + rm -rf $tool_install_directory + fi + + echo "Cleaning $shim_path" + if [[ -f $shim_path ]]; then + rm -rf $shim_path + fi + + tool_temp_path=$(GetTempPathFileName $uri) + echo "Cleaning $tool_temp_path" + if [[ -f $tool_temp_path ]]; then + rm -rf $tool_temp_path + fi + + exit 0 +fi + +# Install tool +if [[ -f $tool_file_path ]] && [[ $force = false ]]; then + echo "$tool_name ($version) already exists, skipping install" + exit 0 +fi + +DownloadAndExtract $uri $tool_install_directory $force $download_retries $retry_wait_time_seconds + +if [[ $? != 0 ]]; then + echo "Installation failed" >&2 + exit 1 +fi + +# Generate Shim +# Always rewrite shims so that we are referencing the expected version +NewScriptShim $shim_path $tool_file_path true + +if [[ $? != 0 ]]; then + echo "Shim generation failed" >&2 + exit 1 +fi + +exit 0 \ No newline at end of file diff --git a/eng/common/native/install-tool.ps1 b/eng/common/native/install-tool.ps1 new file mode 100644 index 00000000000..635ab3fd414 --- /dev/null +++ b/eng/common/native/install-tool.ps1 @@ -0,0 +1,130 @@ +<# +.SYNOPSIS +Install native tool + +.DESCRIPTION +Install cmake native tool from Azure blob storage + +.PARAMETER InstallPath +Base directory to install native tool to + +.PARAMETER BaseUri +Base file directory or Url from which to acquire tool archives + +.PARAMETER CommonLibraryDirectory +Path to folder containing common library modules + +.PARAMETER Force +Force install of tools even if they previously exist + +.PARAMETER Clean +Don't install the tool, just clean up the current install of the tool + +.PARAMETER DownloadRetries +Total number of retry attempts + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds + +.NOTES +Returns 0 if install succeeds, 1 otherwise +#> +[CmdletBinding(PositionalBinding=$false)] +Param ( + [Parameter(Mandatory=$True)] + [string] $ToolName, + [Parameter(Mandatory=$True)] + [string] $InstallPath, + [Parameter(Mandatory=$True)] + [string] $BaseUri, + [Parameter(Mandatory=$True)] + [string] $Version, + [string] $CommonLibraryDirectory = $PSScriptRoot, + [switch] $Force = $False, + [switch] $Clean = $False, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30 +) + +# Import common library modules +Import-Module -Name (Join-Path $CommonLibraryDirectory "CommonLibrary.psm1") + +try { + # Define verbose switch if undefined + $Verbose = $VerbosePreference -Eq "Continue" + + $Arch = CommonLibrary\Get-MachineArchitecture + $ToolOs = "win64" + if($Arch -Eq "x32") { + $ToolOs = "win32" + } + $ToolNameMoniker = "$ToolName-$Version-$ToolOs-$Arch" + $ToolInstallDirectory = Join-Path $InstallPath "$ToolName\$Version\" + $Uri = "$BaseUri/windows/$ToolName/$ToolNameMoniker.zip" + $ShimPath = Join-Path $InstallPath "$ToolName.exe" + + if ($Clean) { + Write-Host "Cleaning $ToolInstallDirectory" + if (Test-Path $ToolInstallDirectory) { + Remove-Item $ToolInstallDirectory -Force -Recurse + } + Write-Host "Cleaning $ShimPath" + if (Test-Path $ShimPath) { + Remove-Item $ShimPath -Force + } + $ToolTempPath = CommonLibrary\Get-TempPathFilename -Path $Uri + Write-Host "Cleaning $ToolTempPath" + if (Test-Path $ToolTempPath) { + Remove-Item $ToolTempPath -Force + } + exit 0 + } + + # Install tool + if ((Test-Path $ToolInstallDirectory) -And (-Not $Force)) { + Write-Verbose "$ToolName ($Version) already exists, skipping install" + } + else { + $InstallStatus = CommonLibrary\DownloadAndExtract -Uri $Uri ` + -InstallDirectory $ToolInstallDirectory ` + -Force:$Force ` + -DownloadRetries $DownloadRetries ` + -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` + -Verbose:$Verbose + + if ($InstallStatus -Eq $False) { + Write-Error "Installation failed" + exit 1 + } + } + + $ToolFilePath = Get-ChildItem $ToolInstallDirectory -Recurse -Filter "$ToolName.exe" | % { $_.FullName } + if (@($ToolFilePath).Length -Gt 1) { + Write-Error "There are multiple copies of $ToolName in $($ToolInstallDirectory): `n$(@($ToolFilePath | out-string))" + exit 1 + } elseif (@($ToolFilePath).Length -Lt 1) { + Write-Error "$ToolName was not found in $ToolFilePath." + exit 1 + } + + # Generate shim + # Always rewrite shims so that we are referencing the expected version + $GenerateShimStatus = CommonLibrary\New-ScriptShim -ShimName $ToolName ` + -ShimDirectory $InstallPath ` + -ToolFilePath "$ToolFilePath" ` + -BaseUri $BaseUri ` + -Force:$Force ` + -Verbose:$Verbose + + if ($GenerateShimStatus -Eq $False) { + Write-Error "Generate shim failed" + return 1 + } + + exit 0 +} +catch { + Write-Host $_ + Write-Host $_.Exception + exit 1 +} diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 new file mode 100644 index 00000000000..9ba7530122f --- /dev/null +++ b/eng/common/sdk-task.ps1 @@ -0,0 +1,74 @@ +[CmdletBinding(PositionalBinding=$false)] +Param( + [string] $projects = "", + [string][Alias('v')]$verbosity = "minimal", + [string] $msbuildEngine = $null, + [bool] $warnAsError = $true, + [switch][Alias('bl')]$binaryLog, + [switch][Alias('r')]$restore, + [switch] $ci, + [switch] $prepareMachine, + [switch] $help, + [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties +) + +. $PSScriptRoot\tools.ps1 + +function Print-Usage() { + Write-Host "Common settings:" + Write-Host " -v[erbosity] Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]" + Write-Host " -[bl|binaryLog] Output binary log (short: -bl)" + Write-Host " -help Print help and exit" + Write-Host "" + + Write-Host "Advanced settings:" + Write-Host " -restore Restore dependencies (short: -r)" + Write-Host " -projects Semi-colon delimited list of sln/proj's from the Arcade sdk to build. Globbing is supported (*.sln)" + Write-Host " -ci Set when running on CI server" + Write-Host " -prepareMachine Prepare machine for CI run" + Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." + Write-Host "" + Write-Host "Command line arguments not listed above are passed thru to msbuild." + Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)." +} + +function Build { + $toolsetBuildProj = InitializeToolset + + $toolsetBuildProj = Join-Path (Split-Path $toolsetBuildProj -Parent) "SdkTasks\SdkTask.proj" + $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "SdkTask.binlog") } else { "" } + MSBuild $toolsetBuildProj ` + $bl ` + /p:Projects=$projects ` + /p:Restore=$restore ` + /p:RepoRoot=$RepoRoot ` + /p:ContinuousIntegrationBuild=$ci ` + @properties +} + +try { + if ($help -or (($null -ne $properties) -and ($properties.Contains("/help") -or $properties.Contains("/?")))) { + Print-Usage + exit 0 + } + + if ($projects -eq "") { + Write-Error "Missing required parameter '-projects '" + Print-Usage + ExitWithExitCode 1 + } + + if ($ci) { + $binaryLog = $true + } + + Build +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + ExitWithExitCode 1 +} + +ExitWithExitCode 0 diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml new file mode 100644 index 00000000000..5e293db35d7 --- /dev/null +++ b/eng/common/templates/job/job.yml @@ -0,0 +1,205 @@ +parameters: +# Job schema parameters - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + cancelTimeoutInMinutes: '' + + condition: '' + + continueOnError: false + + container: '' + + dependsOn: '' + + displayName: '' + + steps: [] + + pool: '' + + strategy: '' + + timeoutInMinutes: '' + + variables: [] + + workspace: '' + +# Job base template specific parameters + # Optional: Enable installing Microbuild plugin + # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix + # _TeamName - the name of your team + # _SignType - 'test' or 'real' + enableMicrobuild: false + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: Enable publishing to the build asset registry + enablePublishBuildAssets: false + + # Optional: Include PublishTestResults task + enablePublishTestResults: false + + # Optional: enable sending telemetry + # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix + # _HelixBuildConfig - differentiate between Debug, Release, other + # _HelixType - Example: build/product/ + # _HelixSource - Example: official/dotnet/arcade/$(Build.SourceBranch) + enableTelemetry: false + + # Optional: If specified, then automatically derive "_HelixSource" variable for telemetry + helixRepo: '' + + # Optional: Define the type for helix telemetry (must end in '/') + helixType: build/product/ + + # Required: name of the job + name: '' + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + +# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, +# and some (Microbuild) should only be applied to non-PR cases for internal builds. + +jobs: +- job: ${{ parameters.name }} + + ${{ if ne(parameters.cancelTimeoutInMinutes, '') }}: + cancelTimeoutInMinutes: ${{ parameters.cancelTimeoutInMinutes }} + + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} + + ${{ if ne(parameters.container, '') }}: + container: ${{ parameters.container }} + + ${{ if ne(parameters.continueOnError, '') }}: + continueOnError: ${{ parameters.continueOnError }} + + ${{ if ne(parameters.dependsOn, '') }}: + dependsOn: ${{ parameters.dependsOn }} + + ${{ if ne(parameters.displayName, '') }}: + displayName: ${{ parameters.displayName }} + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + + ${{ if ne(parameters.strategy, '') }}: + strategy: ${{ parameters.strategy }} + + ${{ if ne(parameters.timeoutInMinutes, '') }}: + timeoutInMinutes: ${{ parameters.timeoutInMinutes }} + + variables: + - ${{ each variable in parameters.variables }}: + # handle name-value variable syntax + # example: + # - name: [key] + # value: [value] + - ${{ if ne(variable.name, '') }}: + - name: ${{ variable.name }} + value: ${{ variable.value }} + + # handle variable groups + - ${{ if ne(variable.group, '') }}: + - group: ${{ variable.group }} + + # handle key-value variable syntax. + # example: + # - [key]: [value] + - ${{ if and(eq(variable.name, ''), eq(variable.group, '')) }}: + - ${{ each pair in variable }}: + - name: ${{ pair.key }} + value: ${{ pair.value }} + + # Add additional variables + - ${{ if and(ne(parameters.helixRepo, ''), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notIn(variables['Build.Reason'], 'PullRequest')) }}: + - name: _HelixSource + value: official/${{ parameters.helixRepo }}/$(Build.SourceBranch) + - ${{ if and(ne(parameters.helixRepo, ''), or(ne(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest'))) }}: + - name: _HelixSource + value: pr/${{ parameters.helixRepo }}/$(Build.SourceBranch) + - name: _HelixType + value: ${{ parameters.helixType }} + - name: _HelixBuildConfig + value: $(_BuildConfig) + + ${{ if ne(parameters.workspace, '') }}: + workspace: ${{ parameters.workspace }} + + steps: + - ${{ if eq(parameters.enableTelemetry, 'true') }}: + - template: /eng/common/templates/steps/telemetry-start.yml + parameters: + buildConfig: $(_HelixBuildConfig) + helixSource: $(_HelixSource) + helixType: $(_HelixType) + runAsPublic: ${{ parameters.runAsPublic }} + + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: MicroBuildSigningPlugin@2 + displayName: Install MicroBuild plugin + inputs: + signType: $(_SignType) + zipSources: false + feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + env: + TeamName: $(_TeamName) + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + + - ${{ each step in parameters.steps }}: + - ${{ step }} + + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: MicroBuildCleanup@1 + displayName: Execute Microbuild cleanup tasks + condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + env: + TeamName: $(_TeamName) + + - ${{ if eq(parameters.enableTelemetry, 'true') }}: + - template: /eng/common/templates/steps/telemetry-end.yml + + - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: + - task: PublishBuildArtifacts@1 + displayName: Publish Logs to VSTS + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: $(Agent.Os)_$(Agent.JobName) + continueOnError: true + condition: always() + + - ${{ if eq(parameters.enablePublishTestResults, 'true') }}: + - task: PublishTestResults@2 + displayName: Publish Test Results + inputs: + testResultsFormat: 'xUnit' + testResultsFiles: '*.xml' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + continueOnError: true + condition: always() + + - ${{ if and(eq(parameters.enablePublishBuildAssets, true), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: CopyFiles@2 + displayName: Gather Asset Manifests + inputs: + SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest' + TargetFolder: '$(Build.StagingDirectory)/AssetManifests' + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + - task: PublishBuildArtifacts@1 + displayName: Push Asset Manifests + inputs: + PathtoPublish: '$(Build.StagingDirectory)/AssetManifests' + PublishLocation: Container + ArtifactName: AssetManifests + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) \ No newline at end of file diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml new file mode 100644 index 00000000000..c094658fefc --- /dev/null +++ b/eng/common/templates/job/publish-build-assets.yml @@ -0,0 +1,63 @@ +parameters: + configuration: 'Debug' + + # Optional: condition for the job to run + condition: '' + + # Optional: 'true' if future jobs should run even if this job fails + continueOnError: false + + # Optional: dependencies of the job + dependsOn: '' + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool + pool: {} + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + +jobs: +- job: Asset_Registry_Publish + + dependsOn: ${{ parameters.dependsOn }} + + displayName: Publish to Build Asset Registry + + pool: ${{ parameters.pool }} + + variables: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - name: _BuildConfig + value: ${{ parameters.configuration }} + - group: Publish-Build-Assets + + steps: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download artifact + inputs: + artifactName: AssetManifests + downloadPath: '$(Build.StagingDirectory)/Download' + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + - script: eng\common\publishbuildassets.cmd + /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' + /p:BuildAssetRegistryToken=$(MaestroAccessToken) + /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com + /p:Configuration=$(_BuildConfig) + displayName: Publish Build Assets + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: + - task: PublishBuildArtifacts@1 + displayName: Publish Logs to VSTS + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: $(Agent.Os)_PublishBuildAssets + continueOnError: true + condition: always() diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml new file mode 100644 index 00000000000..c7226b12ed2 --- /dev/null +++ b/eng/common/templates/jobs/jobs.yml @@ -0,0 +1,77 @@ +parameters: + # Optional: 'true' if failures in job.yml job should not fail the job + continueOnError: false + + # Optional: Enable installing Microbuild plugin + # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix + # _TeamName - the name of your team + # _SignType - 'test' or 'real' + enableMicrobuild: false + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: Enable publishing to the build asset registry + enablePublishBuildAssets: false + + # Optional: Include PublishTestResults task + enablePublishTestResults: false + + # Optional: enable sending telemetry + # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix + # _HelixBuildConfig - differentiate between Debug, Release, other + # _HelixType - Example: build/product/ + # _HelixSource - Example: official/dotnet/arcade/$(Build.SourceBranch) + enableTelemetry: false + + # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + jobs: [] + + # Optional: If specified, then automatically derive "_HelixSource" variable for telemetry + helixRepo: '' + + # Optional: Define the type for helix telemetry (must end in '/') + helixType: build/product/ + + # Optional: Override automatically derived dependsOn value for "publish build assets" job + publishBuildAssetsDependsOn: '' + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + +# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, +# and some (Microbuild) should only be applied to non-PR cases for internal builds. + +jobs: +- ${{ each job in parameters.jobs }}: + - template: ../job/job.yml + parameters: + # pass along parameters + ${{ each parameter in parameters }}: + ${{ if ne(parameter.key, 'jobs') }}: + ${{ parameter.key }}: ${{ parameter.value }} + + # pass along job properties + ${{ each property in job }}: + ${{ if ne(property.key, 'job') }}: + ${{ property.key }}: ${{ property.value }} + + name: ${{ job.job }} + +- ${{ if and(eq(parameters.enablePublishBuildAssets, true), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - template: ../job/publish-build-assets.yml + parameters: + continueOnError: ${{ parameters.continueOnError }} + dependsOn: + - ${{ if ne(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.publishBuildAssetsDependsOn }}: + - ${{ job.job }} + - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.jobs }}: + - ${{ job.job }} + pool: + vmImage: vs2017-win2016 + runAsPublic: ${{ parameters.runAsPublic }} + enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} + diff --git a/eng/common/templates/phases/base.yml b/eng/common/templates/phases/base.yml new file mode 100644 index 00000000000..0123cf43b16 --- /dev/null +++ b/eng/common/templates/phases/base.yml @@ -0,0 +1,130 @@ +parameters: + # Optional: Clean sources before building + clean: true + + # Optional: Git fetch depth + fetchDepth: '' + + # Optional: name of the phase (not specifying phase name may cause name collisions) + name: '' + # Optional: display name of the phase + displayName: '' + + # Optional: condition for the job to run + condition: '' + + # Optional: dependencies of the phase + dependsOn: '' + + # Required: A defined YAML queue + queue: {} + + # Required: build steps + steps: [] + + # Optional: variables + variables: {} + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + + ## Telemetry variables + + # Optional: enable sending telemetry + # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix + # _HelixBuildConfig - differentiate between Debug, Release, other + # _HelixSource - Example: build/product + # _HelixType - Example: official/dotnet/arcade/$(Build.SourceBranch) + enableTelemetry: false + + # Optional: Enable installing Microbuild plugin + # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix + # _TeamName - the name of your team + # _SignType - 'test' or 'real' + enableMicrobuild: false + +# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, +# and some (Microbuild) should only be applied to non-PR cases for internal builds. + +phases: +- phase: ${{ parameters.name }} + + ${{ if ne(parameters.displayName, '') }}: + displayName: ${{ parameters.displayName }} + + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} + + ${{ if ne(parameters.dependsOn, '') }}: + dependsOn: ${{ parameters.dependsOn }} + + queue: ${{ parameters.queue }} + + ${{ if ne(parameters.variables, '') }}: + variables: + ${{ insert }}: ${{ parameters.variables }} + + steps: + - checkout: self + clean: ${{ parameters.clean }} + ${{ if ne(parameters.fetchDepth, '') }}: + fetchDepth: ${{ parameters.fetchDepth }} + + - ${{ if eq(parameters.enableTelemetry, 'true') }}: + - template: /eng/common/templates/steps/telemetry-start.yml + parameters: + buildConfig: $(_HelixBuildConfig) + helixSource: $(_HelixSource) + helixType: $(_HelixType) + runAsPublic: ${{ parameters.runAsPublic }} + + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + # Internal only resource, and Microbuild signing shouldn't be applied to PRs. + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: MicroBuildSigningPlugin@2 + displayName: Install MicroBuild plugin + inputs: + signType: $(_SignType) + zipSources: false + feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + + env: + TeamName: $(_TeamName) + continueOnError: false + condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + + # Run provided build steps + - ${{ parameters.steps }} + + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + # Internal only resources + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: MicroBuildCleanup@1 + displayName: Execute Microbuild cleanup tasks + condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + env: + TeamName: $(_TeamName) + + - ${{ if eq(parameters.enableTelemetry, 'true') }}: + - template: /eng/common/templates/steps/telemetry-end.yml + parameters: + helixSource: $(_HelixSource) + helixType: $(_HelixType) + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: CopyFiles@2 + displayName: Gather Asset Manifests + inputs: + SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest' + TargetFolder: '$(Build.StagingDirectory)/AssetManifests' + continueOnError: false + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + - task: PublishBuildArtifacts@1 + displayName: Push Asset Manifests + inputs: + PathtoPublish: '$(Build.StagingDirectory)/AssetManifests' + PublishLocation: Container + ArtifactName: AssetManifests + continueOnError: false + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) diff --git a/eng/common/templates/phases/publish-build-assets.yml b/eng/common/templates/phases/publish-build-assets.yml new file mode 100644 index 00000000000..0df6203b506 --- /dev/null +++ b/eng/common/templates/phases/publish-build-assets.yml @@ -0,0 +1,46 @@ +parameters: + dependsOn: '' + queue: {} + configuration: 'Debug' + condition: succeeded() + continueOnError: false + runAsPublic: false +phases: + - phase: Asset_Registry_Publish + displayName: Publish to Build Asset Registry + dependsOn: ${{ parameters.dependsOn }} + queue: ${{ parameters.queue }} + variables: + _BuildConfig: ${{ parameters.configuration }} + steps: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download artifact + inputs: + artifactName: AssetManifests + downloadPath: '$(Build.StagingDirectory)/Download' + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + - task: AzureKeyVault@1 + inputs: + azureSubscription: 'DotNet-Engineering-Services_KeyVault' + KeyVaultName: EngKeyVault + SecretsFilter: 'MaestroAccessToken' + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + - script: eng\common\publishbuildassets.cmd + -configuration $(_BuildConfig) + /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' + /p:BuildAssetRegistryToken=$(MaestroAccessToken) + /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com + displayName: Publish Build Assets + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + - task: PublishBuildArtifacts@1 + displayName: Publish Logs to VSTS + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: $(Agent.Os)_Asset_Registry_Publish + continueOnError: true + condition: always() diff --git a/eng/common/templates/steps/build-reason.yml b/eng/common/templates/steps/build-reason.yml new file mode 100644 index 00000000000..eba58109b52 --- /dev/null +++ b/eng/common/templates/steps/build-reason.yml @@ -0,0 +1,12 @@ +# build-reason.yml +# Description: runs steps if build.reason condition is valid. conditions is a string of valid build reasons +# to include steps (',' separated). +parameters: + conditions: '' + steps: [] + +steps: + - ${{ if and( not(startsWith(parameters.conditions, 'not')), contains(parameters.conditions, variables['build.reason'])) }}: + - ${{ parameters.steps }} + - ${{ if and( startsWith(parameters.conditions, 'not'), not(contains(parameters.conditions, variables['build.reason']))) }}: + - ${{ parameters.steps }} diff --git a/eng/common/templates/steps/helix-publish.yml b/eng/common/templates/steps/helix-publish.yml new file mode 100644 index 00000000000..470ab65da0c --- /dev/null +++ b/eng/common/templates/steps/helix-publish.yml @@ -0,0 +1,51 @@ +parameters: + HelixSource: 'pr/dotnet-github-anon-kaonashi-bot' + HelixType: ̓'tests/default' + HelixBuild: $(Build.BuildNumber) + HelixTargetQueues: '' + HelixAccessToken: '' + HelixPreCommands: '' + HelixPostCommands: '' + WorkItemDirectory: '' + WorkItemCommand: '' + CorrelationPayloadDirectory: '' + XUnitProjects: '' + XUnitTargetFramework: '' + XUnitRunnerVersion: '' + IncludeDotNetCli: false + DotNetCliPackageType: '' + DotNetCliVersion: '' + EnableXUnitReporter: false + WaitForWorkItemCompletion: true + condition: succeeded() + continueOnError: false + +steps: + - task: DotNetCoreCLI@2 + inputs: + command: custom + projects: eng/common/helixpublish.proj + custom: msbuild + arguments: '/bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog' + displayName: Send job to Helix + env: + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/templates/steps/run-on-unix.yml b/eng/common/templates/steps/run-on-unix.yml new file mode 100644 index 00000000000..e1733814f65 --- /dev/null +++ b/eng/common/templates/steps/run-on-unix.yml @@ -0,0 +1,7 @@ +parameters: + agentOs: '' + steps: [] + +steps: +- ${{ if ne(parameters.agentOs, 'Windows_NT') }}: + - ${{ parameters.steps }} diff --git a/eng/common/templates/steps/run-on-windows.yml b/eng/common/templates/steps/run-on-windows.yml new file mode 100644 index 00000000000..73e7e9c275a --- /dev/null +++ b/eng/common/templates/steps/run-on-windows.yml @@ -0,0 +1,7 @@ +parameters: + agentOs: '' + steps: [] + +steps: +- ${{ if eq(parameters.agentOs, 'Windows_NT') }}: + - ${{ parameters.steps }} diff --git a/eng/common/templates/steps/run-script-ifequalelse.yml b/eng/common/templates/steps/run-script-ifequalelse.yml new file mode 100644 index 00000000000..3d1242f5587 --- /dev/null +++ b/eng/common/templates/steps/run-script-ifequalelse.yml @@ -0,0 +1,33 @@ +parameters: + # if parameter1 equals parameter 2, run 'ifScript' command, else run 'elsescript' command + parameter1: '' + parameter2: '' + ifScript: '' + elseScript: '' + + # name of script step + name: Script + + # display name of script step + displayName: If-Equal-Else Script + + # environment + env: {} + + # conditional expression for step execution + condition: '' + +steps: +- ${{ if and(ne(parameters.ifScript, ''), eq(parameters.parameter1, parameters.parameter2)) }}: + - script: ${{ parameters.ifScript }} + name: ${{ parameters.name }} + displayName: ${{ parameters.displayName }} + env: ${{ parameters.env }} + condition: ${{ parameters.condition }} + +- ${{ if and(ne(parameters.elseScript, ''), ne(parameters.parameter1, parameters.parameter2)) }}: + - script: ${{ parameters.elseScript }} + name: ${{ parameters.name }} + displayName: ${{ parameters.displayName }} + env: ${{ parameters.env }} + condition: ${{ parameters.condition }} \ No newline at end of file diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml new file mode 100644 index 00000000000..a5835c0f473 --- /dev/null +++ b/eng/common/templates/steps/send-to-helix.yml @@ -0,0 +1,81 @@ +parameters: + HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ + HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' + HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number + HelixTargetQueues: '' # required -- semicolon delimited list of Helix queues to test on; see https://helix.dot.net/api/2018-03-14/info/queues for a list of queues + HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group + HelixPreCommands: '' # optional -- commands to run before Helix work item execution + HelixPostCommands: '' # optional -- commands to run after Helix work item execution + WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects + WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects + WorkItemTimeout: '' # optional -- a timeout in seconds for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects + CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload + XUnitProjects: '' # optional -- semicolon delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true + XUnitPublishTargetFramework: '' # optional -- framework to use to publish your xUnit projects + XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner + XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects + IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion + DotNetCliPackageType: '' # optional -- either 'sdk' or 'runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json + DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json + EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control + WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." + IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set + Creator: '' # optional -- if the build is external, use this to specify who is sending the job + condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() + continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false + +steps: + - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' + displayName: Send job to Helix (Windows) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + Creator: ${{ parameters.Creator }} + condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog + displayName: Send job to Helix (Unix) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + Creator: ${{ parameters.Creator }} + condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/templates/steps/telemetry-end.yml b/eng/common/templates/steps/telemetry-end.yml new file mode 100644 index 00000000000..9b61481e7e1 --- /dev/null +++ b/eng/common/templates/steps/telemetry-end.yml @@ -0,0 +1,63 @@ +steps: +- bash: | + if [ "$AGENT_JOBSTATUS" = "Succeeded" ] || [ "$AGENT_JOBSTATUS" = "PartiallySucceeded" ]; then + errorCount=0 + else + errorCount=1 + fi + warningCount=0 + + # create a temporary file for curl output + res=`mktemp` + + curlResult=` + curl --verbose --output $res --write-out "%{http_code}"\ + -H 'Content-Type: application/json' \ + -H "X-Helix-Job-Token: $Helix_JobToken" \ + -H 'Content-Length: 0' \ + -X POST -G "https://helix.dot.net/api/2018-03-14/telemetry/job/build/$Helix_WorkItemId/finish" \ + --data-urlencode "errorCount=$errorCount" \ + --data-urlencode "warningCount=$warningCount"` + curlStatus=$? + + if [ $curlStatus -eq 0 ]; then + if [ $curlResult -gt 299 ] || [ $curlResult -lt 200 ]; then + curlStatus=$curlResult + fi + fi + + if [ $curlStatus -ne 0 ]; then + echo "Failed to Send Build Finish information" + vstsLogOutput="vso[task.logissue type=error;sourcepath=templates/steps/telemetry-end.yml;code=1;]Failed to Send Build Finish information: $curlStatus" + echo "##$vstsLogOutput" + exit 1 + fi + displayName: Send Unix Build End Telemetry + env: + # defined via VSTS variables in start-job.sh + Helix_JobToken: $(Helix_JobToken) + Helix_WorkItemId: $(Helix_WorkItemId) + condition: and(always(), ne(variables['Agent.Os'], 'Windows_NT')) +- powershell: | + if (($env:Agent_JobStatus -eq 'Succeeded') -or ($env:Agent_JobStatus -eq 'PartiallySucceeded')) { + $ErrorCount = 0 + } else { + $ErrorCount = 1 + } + $WarningCount = 0 + + try { + Invoke-RestMethod -Uri "https://helix.dot.net/api/2018-03-14/telemetry/job/build/$env:Helix_WorkItemId/finish?errorCount=$ErrorCount&warningCount=$WarningCount" -Method Post -ContentType "application/json" -Body "" ` + -Headers @{ 'X-Helix-Job-Token'=$env:Helix_JobToken } + } + catch { + Write-Error $_ + Write-Error $_.Exception + exit 1 + } + displayName: Send Windows Build End Telemetry + env: + # defined via VSTS variables in start-job.ps1 + Helix_JobToken: $(Helix_JobToken) + Helix_WorkItemId: $(Helix_WorkItemId) + condition: and(always(),eq(variables['Agent.Os'], 'Windows_NT')) diff --git a/eng/common/templates/steps/telemetry-start.yml b/eng/common/templates/steps/telemetry-start.yml new file mode 100644 index 00000000000..79c128c5de8 --- /dev/null +++ b/eng/common/templates/steps/telemetry-start.yml @@ -0,0 +1,154 @@ +parameters: + helixSource: 'undefined_defaulted_in_telemetry.yml' + helixType: 'undefined_defaulted_in_telemetry.yml' + buildConfig: '' + runAsPublic: false + +steps: +- ${{ if and(eq(parameters.runAsPublic, 'false'), not(eq(variables['System.TeamProject'], 'public'))) }}: + - task: AzureKeyVault@1 + inputs: + azureSubscription: 'HelixProd_KeyVault' + KeyVaultName: HelixProdKV + SecretsFilter: 'HelixApiAccessToken' + condition: always() +- bash: | + # create a temporary file + jobInfo=`mktemp` + + # write job info content to temporary file + cat > $jobInfo <' | Set-Content $proj + MSBuild $proj $bl /t:__WriteToolsetLocation /noconsolelogger /p:__ToolsetLocationOutputFile=$toolsetLocationFile + + $path = Get-Content $toolsetLocationFile -TotalCount 1 + if (!(Test-Path $path)) { + throw "Invalid toolset path: $path" + } + + return $global:_ToolsetBuildProj = $path +} + +function ExitWithExitCode([int] $exitCode) { + if ($ci -and $prepareMachine) { + Stop-Processes + } + exit $exitCode +} + +function Stop-Processes() { + Write-Host "Killing running build processes..." + foreach ($processName in $processesToStopOnExit) { + Get-Process -Name $processName -ErrorAction SilentlyContinue | Stop-Process + } +} + +# +# Executes msbuild (or 'dotnet msbuild') with arguments passed to the function. +# The arguments are automatically quoted. +# Terminates the script if the build fails. +# +function MSBuild() { + if ($ci) { + if (!$binaryLog) { + throw "Binary log must be enabled in CI build." + } + + if ($nodeReuse) { + throw "Node reuse must be disabled in CI build." + } + } + + $buildTool = InitializeBuildTool + + $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse" + + if ($warnAsError) { + $cmdArgs += " /warnaserror /p:TreatWarningsAsErrors=true" + } + + foreach ($arg in $args) { + if ($arg -ne $null -and $arg.Trim() -ne "") { + $cmdArgs += " `"$arg`"" + } + } + + $exitCode = Exec-Process $buildTool.Path $cmdArgs + + if ($exitCode -ne 0) { + Write-Host "Build failed." -ForegroundColor Red + + $buildLog = GetMSBuildBinaryLogCommandLineArgument $args + if ($buildLog -ne $null) { + Write-Host "See log: $buildLog" -ForegroundColor DarkGray + } + + ExitWithExitCode $exitCode + } +} + +function GetMSBuildBinaryLogCommandLineArgument($arguments) { + foreach ($argument in $arguments) { + if ($argument -ne $null) { + $arg = $argument.Trim() + if ($arg.StartsWith("/bl:", "OrdinalIgnoreCase")) { + return $arg.Substring("/bl:".Length) + } + + if ($arg.StartsWith("/binaryLogger:", "OrdinalIgnoreCase")) { + return $arg.Substring("/binaryLogger:".Length) + } + } + } + + return $null +} + +$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..") +$EngRoot = Resolve-Path (Join-Path $PSScriptRoot "..") +$ArtifactsDir = Join-Path $RepoRoot "artifacts" +$ToolsetDir = Join-Path $ArtifactsDir "toolset" +$ToolsDir = Join-Path $RepoRoot ".tools" +$LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration +$TempDir = Join-Path (Join-Path $ArtifactsDir "tmp") $configuration +$GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json + +Create-Directory $ToolsetDir +Create-Directory $TempDir +Create-Directory $LogDir + +if ($ci) { + $env:TEMP = $TempDir + $env:TMP = $TempDir +} diff --git a/eng/common/tools.sh b/eng/common/tools.sh new file mode 100755 index 00000000000..8a253bef513 --- /dev/null +++ b/eng/common/tools.sh @@ -0,0 +1,319 @@ +# Initialize variables if they aren't already defined. + +# CI mode - set to true on CI server for PR validation build or official build. +ci=${ci:-false} + +# Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names. +configuration=${configuration:-'Debug'} + +# Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. +# Binary log must be enabled on CI. +binary_log=${binary_log:-$ci} + +# Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes). +prepare_machine=${prepare_machine:-false} + +# True to restore toolsets and dependencies. +restore=${restore:-true} + +# Adjusts msbuild verbosity level. +verbosity=${verbosity:-'minimal'} + +# Set to true to reuse msbuild nodes. Recommended to not reuse on CI. +if [[ "$ci" == true ]]; then + node_reuse=${node_reuse:-false} +else + node_reuse=${node_reuse:-true} +fi + +# Configures warning treatment in msbuild. +warn_as_error=${warn_as_error:-true} + +# True to attempt using .NET Core already that meets requirements specified in global.json +# installed on the machine instead of downloading one. +use_installed_dotnet_cli=${use_installed_dotnet_cli:-true} + +# True to use global NuGet cache instead of restoring packages to repository-local directory. +if [[ "$ci" == true ]]; then + use_global_nuget_cache=${use_global_nuget_cache:-false} +else + use_global_nuget_cache=${use_global_nuget_cache:-true} +fi + +# Resolve any symlinks in the given path. +function ResolvePath { + local path=$1 + + while [[ -h $path ]]; do + local dir="$( cd -P "$( dirname "$path" )" && pwd )" + path="$(readlink "$path")" + + # if $path was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $path != /* ]] && path="$dir/$path" + done + + # return value + _ResolvePath="$path" +} + +# ReadVersionFromJson [json key] +function ReadGlobalVersion { + local key=$1 + + local line=`grep -m 1 "$key" "$global_json_file"` + local pattern="\"$key\" *: *\"(.*)\"" + + if [[ ! $line =~ $pattern ]]; then + echo "Error: Cannot find \"$key\" in $global_json_file" >&2 + ExitWithExitCode 1 + fi + + # return value + _ReadGlobalVersion=${BASH_REMATCH[1]} +} + +function InitializeDotNetCli { + if [[ -n "${_InitializeDotNetCli:-}" ]]; then + return + fi + + local install=$1 + + # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism + export DOTNET_MULTILEVEL_LOOKUP=0 + + # Disable first run since we want to control all package sources + export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + + # Disable telemetry on CI + if [[ $ci == true ]]; then + export DOTNET_CLI_TELEMETRY_OPTOUT=1 + fi + + # LTTNG is the logging infrastructure used by Core CLR. Need this variable set + # so it doesn't output warnings to the console. + export LTTNG_HOME="$HOME" + + # Source Build uses DotNetCoreSdkDir variable + if [[ -n "${DotNetCoreSdkDir:-}" ]]; then + export DOTNET_INSTALL_DIR="$DotNetCoreSdkDir" + fi + + # Find the first path on $PATH that contains the dotnet.exe + if [[ "$use_installed_dotnet_cli" == true && -z "${DOTNET_INSTALL_DIR:-}" ]]; then + local dotnet_path=`command -v dotnet` + if [[ -n "$dotnet_path" ]]; then + ResolvePath "$dotnet_path" + export DOTNET_INSTALL_DIR=`dirname "$_ResolvePath"` + fi + fi + + ReadGlobalVersion "dotnet" + local dotnet_sdk_version=$_ReadGlobalVersion + local dotnet_root="" + + # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, + # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. + if [[ -n "${DOTNET_INSTALL_DIR:-}" && -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then + dotnet_root="$DOTNET_INSTALL_DIR" + else + dotnet_root="$repo_root/.dotnet" + export DOTNET_INSTALL_DIR="$dotnet_root" + + if [[ ! -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then + if [[ "$install" == true ]]; then + InstallDotNetSdk "$dotnet_root" "$dotnet_sdk_version" + else + echo "Unable to find dotnet with SDK version '$dotnet_sdk_version'" >&2 + ExitWithExitCode 1 + fi + fi + fi + + # Add dotnet to PATH. This prevents any bare invocation of dotnet in custom + # build steps from using anything other than what we've downloaded. + export PATH="$dotnet_root:$PATH" + + if [[ $ci == true ]]; then + # Make Sure that our bootstrapped dotnet cli is avaliable in future steps of the Azure Pipelines build + echo "##vso[task.prependpath]$dotnet_root" + echo "##vso[task.setvariable variable=DOTNET_MULTILEVEL_LOOKUP]0" + echo "##vso[task.setvariable variable=DOTNET_SKIP_FIRST_TIME_EXPERIENCE]1" + fi + + # return value + _InitializeDotNetCli="$dotnet_root" +} + +function InstallDotNetSdk { + local root=$1 + local version=$2 + + GetDotNetInstallScript "$root" + local install_script=$_GetDotNetInstallScript + + bash "$install_script" --version $version --install-dir "$root" || { + local exit_code=$? + echo "Failed to install dotnet SDK (exit code '$exit_code')." >&2 + ExitWithExitCode $exit_code + } +} + +function GetDotNetInstallScript { + local root=$1 + local install_script="$root/dotnet-install.sh" + local install_script_url="https://dot.net/v1/dotnet-install.sh" + + if [[ ! -a "$install_script" ]]; then + mkdir -p "$root" + + echo "Downloading '$install_script_url'" + + # Use curl if available, otherwise use wget + if command -v curl > /dev/null; then + curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" + else + wget -q -O "$install_script" "$install_script_url" + fi + fi + + # return value + _GetDotNetInstallScript="$install_script" +} + +function InitializeBuildTool { + if [[ -n "${_InitializeBuildTool:-}" ]]; then + return + fi + + InitializeDotNetCli $restore + + # return values + _InitializeBuildTool="$_InitializeDotNetCli/dotnet" + _InitializeBuildToolCommand="msbuild" +} + +function GetNuGetPackageCachePath { + if [[ -z ${NUGET_PACKAGES:-} ]]; then + if [[ "$use_global_nuget_cache" == true ]]; then + export NUGET_PACKAGES="$HOME/.nuget/packages" + else + export NUGET_PACKAGES="$repo_root/.packages" + fi + fi + + # return value + _GetNuGetPackageCachePath=$NUGET_PACKAGES +} + +function InitializeToolset { + if [[ -n "${_InitializeToolset:-}" ]]; then + return + fi + + GetNuGetPackageCachePath + + ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk" + + local toolset_version=$_ReadGlobalVersion + local toolset_location_file="$toolset_dir/$toolset_version.txt" + + if [[ -a "$toolset_location_file" ]]; then + local path=`cat "$toolset_location_file"` + if [[ -a "$path" ]]; then + # return value + _InitializeToolset="$path" + return + fi + fi + + if [[ "$restore" != true ]]; then + echo "Toolset version $toolsetVersion has not been restored." >&2 + ExitWithExitCode 2 + fi + + local toolset_restore_log="$log_dir/ToolsetRestore.binlog" + local proj="$toolset_dir/restore.proj" + + echo '' > "$proj" + MSBuild "$proj" /t:__WriteToolsetLocation /noconsolelogger /bl:"$toolset_restore_log" /p:__ToolsetLocationOutputFile="$toolset_location_file" + + local toolset_build_proj=`cat "$toolset_location_file"` + + if [[ ! -a "$toolset_build_proj" ]]; then + echo "Invalid toolset path: $toolset_build_proj" >&2 + ExitWithExitCode 3 + fi + + # return value + _InitializeToolset="$toolset_build_proj" +} + +function ExitWithExitCode { + if [[ "$ci" == true && "$prepare_machine" == true ]]; then + StopProcesses + fi + exit $1 +} + +function StopProcesses { + echo "Killing running build processes..." + pkill -9 "dotnet" || true + pkill -9 "vbcscompiler" || true + return 0 +} + +function MSBuild { + if [[ "$ci" == true ]]; then + if [[ "$binary_log" != true ]]; then + echo "Binary log must be enabled in CI build." >&2 + ExitWithExitCode 1 + fi + + if [[ "$node_reuse" == true ]]; then + echo "Node reuse must be disabled in CI build." >&2 + ExitWithExitCode 1 + fi + fi + + InitializeBuildTool + + local warnaserror_switch="" + if [[ $warn_as_error == true ]]; then + warnaserror_switch="/warnaserror" + fi + + "$_InitializeBuildTool" "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error "$@" || { + local exit_code=$? + echo "Build failed (exit code '$exit_code')." >&2 + ExitWithExitCode $exit_code + } +} + +ResolvePath "${BASH_SOURCE[0]}" +_script_dir=`dirname "$_ResolvePath"` + +eng_root=`cd -P "$_script_dir/.." && pwd` +repo_root=`cd -P "$_script_dir/../.." && pwd` +artifacts_dir="$repo_root/artifacts" +toolset_dir="$artifacts_dir/toolset" +log_dir="$artifacts_dir/log/$configuration" +temp_dir="$artifacts_dir/tmp/$configuration" + +global_json_file="$repo_root/global.json" + +# HOME may not be defined in some scenarios, but it is required by NuGet +if [[ -z $HOME ]]; then + export HOME="$repo_root/artifacts/.home/" + mkdir -p "$HOME" +fi + +mkdir -p "$toolset_dir" +mkdir -p "$temp_dir" +mkdir -p "$log_dir" + +if [[ $ci == true ]]; then + export TEMP="$temp_dir" + export TMP="$temp_dir" +fi diff --git a/fcs/build.fsx b/fcs/build.fsx index 7f9f96f3574..8549ed86348 100644 --- a/fcs/build.fsx +++ b/fcs/build.fsx @@ -94,7 +94,7 @@ Target "Test" (fun _ -> runDotnet __SOURCE_DIRECTORY__ "build ../tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj -v n" // Now run the tests - runDotnet __SOURCE_DIRECTORY__ "test FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj -v n -c release" + runDotnet __SOURCE_DIRECTORY__ "test FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj --no-restore --no-build -v n -c release" ) Target "NuGet" (fun _ -> diff --git a/global.json b/global.json new file mode 100644 index 00000000000..ac6900880b3 --- /dev/null +++ b/global.json @@ -0,0 +1,9 @@ +{ + "tools": { + "dotnet": "2.1.500" + }, + "msbuild-sdks": { + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19069.2", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" + } +} diff --git a/packages.config b/packages.config new file mode 100644 index 00000000000..709d225851d --- /dev/null +++ b/packages.config @@ -0,0 +1,4 @@ + + + + From 99e307f3a3ef2109ba6542ffc58affe76fc0e2a0 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Mon, 28 Jan 2019 19:14:59 -0800 Subject: [PATCH 24/24] remove test that was only testing the default machine state (#6154) --- .../CompilerOptions/fsc/codepage/E_DefaultCodePage01.fsx | 4 ---- tests/fsharpqa/Source/CompilerOptions/fsc/codepage/env.lst | 1 - 2 files changed, 5 deletions(-) delete mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/codepage/E_DefaultCodePage01.fsx diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/E_DefaultCodePage01.fsx b/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/E_DefaultCodePage01.fsx deleted file mode 100644 index 1ed9611bb9d..00000000000 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/E_DefaultCodePage01.fsx +++ /dev/null @@ -1,4 +0,0 @@ -// #Regression #NoMT #CompilerOptions -#load "FunctionalLibrary01.fs";; -#q;; -//Unexpected character '\?' in type name$ \ No newline at end of file diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/env.lst index 1befab598a4..b80eac641bd 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/env.lst +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/codepage/env.lst @@ -29,7 +29,6 @@ SOURCE=E_RequiresParameter01.fs TAILFLAGS="--codepage" # E_RequiresParameter01.fs SOURCE=E_RequiresParameter01.fs TAILFLAGS="--codepage" FSIMODE=EXEC # E_RequiresParameter01.fs-fsi - SOURCE=E_DefaultCodePage01.fsx COMPILE_ONLY=1 FSIMODE=EXEC # E_DefaultCodePage01.fsx SOURCE=E_DefaultCodePage02.fsx COMPILE_ONLY=1 # E_DefaultCodePage02.fsx SOURCE=MatchingCodePage01.fsx COMPILE_ONLY=1 SCFLAGS="--codepage:1250" FSIMODE=EXEC # MatchingCodePage01.fsx