Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #661 from dsyme/integrate-889
Browse files Browse the repository at this point in the history
Integrate from Microsoft/visualfsharp master
  • Loading branch information
dsyme committed Feb 10, 2017
2 parents c3e55bf + 1783a19 commit 11c0a08
Show file tree
Hide file tree
Showing 48 changed files with 1,215 additions and 742 deletions.
2 changes: 1 addition & 1 deletion .nuget/NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<packageSources>

<clear />
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
1 change: 1 addition & 0 deletions build-everything.proj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

<ItemGroup Condition="'$(BUILD_VS)'=='1'">
<ProjectsWithNet40 Include="vsintegration/fsharp-vsintegration-src-build.proj" />
<ProjectsWithNet40 Include="vsintegration/Utils/LanguageServiceProfiling/LanguageServiceProfiling.fsproj" />
<ProjectsWithNet40 Include="vsintegration/fsharp-vsintegration-project-templates-build.proj" />
<ProjectsWithNet40 Include="vsintegration/fsharp-vsintegration-item-templates-build.proj" />
<ProjectsWithNet40 Include="vsintegration/fsharp-vsintegration-vsix-build.proj" />
Expand Down
16 changes: 10 additions & 6 deletions src/FSharpSource.Settings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<ConfigurationGroup Condition="'$(ConfigurationGroup)'==''">Debug</ConfigurationGroup>
</PropertyGroup>

<!-- Nuget Package properties -->
<PropertyGroup>
<!-- Settings used all the time -->
<Tailcalls>true</Tailcalls>
Expand Down Expand Up @@ -106,12 +105,15 @@
<DefineConstants Condition="'$(VisualStudioVersion)'=='' AND '$(ProjectLanguage)' != 'VisualBasic'">$(DefineConstants);VS_VERSION_DEV14</DefineConstants>
</PropertyGroup>

<PropertyGroup>
<!-- Nuget Package properties -->
<PropertyGroup>
<BuildRevision>$([System.DateTime]::Now.ToString(`yyMMdd`))</BuildRevision>
<NuGetReleaseVersion>1.0.0</NuGetReleaseVersion>
<NuGetReleaseVersion>1.0.0</NuGetReleaseVersion>
<NuGetPreReleaseVersion>$(NuGetReleaseVersion)-rc</NuGetPreReleaseVersion>
<NuGetPerBuildPreReleaseVersion Condition="'$(BuildRevision)' != ''">$(NuGetPreReleaseVersion)-$(BuildRevision.Trim())</NuGetPerBuildPreReleaseVersion>
</PropertyGroup>
<NuGetPerBuildPreReleaseVersion Condition="'$(BuildRevision)' != ''">$(NuGetPreReleaseVersion)-$(BuildRevision.Trim())</NuGetPerBuildPreReleaseVersion>
<NUGET_PACKAGES Condition=" '$(NUGET_PACKAGES)' == '' ">$(MSBuildThisFileDirectory)..\packages</NUGET_PACKAGES>
<RestorePackagesPath>$(NUGET_PACKAGES)</RestorePackagesPath>
</PropertyGroup>

<PropertyGroup>
<!-- Compiler tool locations. -->
Expand All @@ -121,7 +123,7 @@
<FsLexToolExe>fslex.exe</FsLexToolExe>
<FsYaccToolExe>fsyacc.exe</FsYaccToolExe>
<!--
<RoslynVersion>2.0.0-rc2</RoslynVersion>
<RoslynVersion>2.0.0-rc3-61324-01</RoslynVersion>
<RoslynVSBinariesVersion>14.0</RoslynVSBinariesVersion>
<RoslynVSPackagesVersion>14.3.25407</RoslynVSPackagesVersion>
-->
Expand All @@ -131,6 +133,8 @@
<!-- The LKG FSI.EXE requires MSBuild 15 to be installed, which is painful -->
<FsiToolPath>$(FSharpSourcesRoot)\..\packages\FSharp.Compiler.Tools.4.0.1.21\tools</FsiToolPath>
</PropertyGroup>

<Import Project="../Tools/Build.Common.props" Condition="'$(TargetFramework)'=='coreclr'"/>
<Import Project="$(BuildVersionFilePath)" Condition="Exists('$(BuildVersionFilePath)')" />

</Project>
104 changes: 88 additions & 16 deletions src/FSharpSource.targets
Original file line number Diff line number Diff line change
Expand Up @@ -492,18 +492,16 @@

<!-- Hook up .NET Core to enable solution refresh of packages -->
<PropertyGroup Condition="'$(TargetFramework)'=='coreclr'">

<NuGetPackagesPath Condition="'$(NuGetPackagesPath)' == ''">$(FSharpSourcesRoot)\..\packages</NuGetPackagesPath>

<!-- Implicitly needed by packageresolve.targets. Should file a bug for a better error message here -->
<PackagesDir>$(NuGetPackagesPath)\</PackagesDir>
<PackagesDir>$(NUGET_PACKAGES)</PackagesDir>

<NuGetToolPath Condition="'$(NuGetToolPath)' == ''">$(FSharpSourcesRoot)\..\.nuget\</NuGetToolPath>
<NuGetConfigCommandLine>-ConfigFile "$(NuGetConfigFile)"</NuGetConfigCommandLine>

<NugetRestoreCommand>"$(NuGetToolPath)NuGet.exe install -OutputDirectory "$(NuGetPackagesPath)" -Config "$(NuGetToolPath)NuGet.Config"</NugetRestoreCommand>
<NugetRestoreCommand>"$(NuGetToolPath)NuGet.exe install -OutputDirectory "$(PackagesDir)" -Config "$(NuGetToolPath)NuGet.Config"</NugetRestoreCommand>

<DnuRestoreCommand>"$(NuGetToolPath)NuGet.exe" restore -OutputDirectory "$(NuGetPackagesPath)" -Config "$(NuGetToolPath)NuGet.Config"</DnuRestoreCommand>
<DnuRestoreCommand>"$(NuGetToolPath)NuGet.exe" restore -OutputDirectory "$(PackagesDir)" -Config "$(NuGetToolPath)NuGet.Config"</DnuRestoreCommand>

<!-- Current version of .NET Core does not support all semantics used in our packages,
so we ignore the pre-calculation in the lock file and calculate asset applicability in the build task -->
Expand Down Expand Up @@ -556,35 +554,31 @@
<!-- Not included in Linux/Mono build because target 'CopyFilesToOutputDirectory' doesn't exist and this fails the Mono build -->
<!--
<Target Name="dotnetrestore" BeforeTargets="Build" Condition=" '$(TargetFramework)' == 'coreclr' ">
<Exec Command="$(MSBuildThisFileDirectory)..\.nuget\nuget.exe restore -PackagesDirectory $(MSBuildThisFileDirectory)..\packages -Config $(MSBuildThisFileDirectory)..\.nuget\NuGet.Config project.json" />
</Target>
<Target Name="nugetpack" AfterTargets="Build" Condition="'$(TargetFramework)' == 'coreclr' "
Inputs="@(PackageNuspec)" Outputs='$(OutputPath.TrimEnd("\"))\nuget\"%(PackageNuspec.Filename)).nupkg'>
<PropertyGroup>
<PackageProperties>-prop "licenseUrl=$(PackageLicenceUrl)" -prop "version=$(PackageVersion)" -prop "authors=$(PackageAuthors)" -prop "projectUrl=$(PackageProjectUrl)" -prop "tags=$(PackageTags)"</PackageProperties>
</PropertyGroup>
<Exec Command='$(MSBuildThisFileDirectory)..\.nuget\nuget.exe pack %(PackageNuspec.Filename)%(PackageNuspec.Extension) -BasePath "$(OutputPath.TrimEnd("\"))" -ExcludeEmptyDirectories $(PackageProperties) -OutputDirectory "$(MSBuildThisFileDirectory)..\artifacts' />
<Exec Command="$(MSBuildThisFileDirectory)..\.nuget\nuget.exe restore -PackagesDirectory $(PackagesDir) -Config $(MSBuildThisFileDirectory)..\.nuget\NuGet.Config project.json" />
</Target>
<Target Name="dotnetrestore" BeforeTargets="Build" Condition=" '$(DOTNET_PUBLISH)' == 'true' ">
<SetEnvVar Name="NUGET_PACKAGES" Value="$(NUGET_PACKAGES)" />
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe restore &#45;&#45;configfile $(MSBuildThisFileDirectory)..\.nuget\NuGet.Config project.json"/>
</Target>
<Target Name="dotnetpublish" AfterTargets="Build" Condition=" '$(DOTNET_PUBLISH)' == 'true' ">
<SetEnvVar Name="NUGET_PACKAGES" Value="$(NUGET_PACKAGES)" />
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe &#45;&#45;verbose publish &#45;&#45;no-build project.json -r $(DOTNET_PUBLISH_PLATFORM) -c $(Configuration) -o $(DOTNET_PUBLISH_PATH)"/>
</Target>
<Target Name="dotnetpublishfsccompiler" AfterTargets="CopyFilesToOutputDirectory" Condition=" '$(DOTNET_PUBLISH_FSC)' == 'true' ">
<SetEnvVar Name="NUGET_PACKAGES" Value="$(NUGET_PACKAGES)" />
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe restore DeployCompiler\fsc\project.json"/>
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe &#45;&#45;verbose publish &#45;&#45;no-build DeployCompiler\fsc\project.json -r $(DOTNET_PUBLISH_PLATFORM) -c $(Configuration) -o $(DOTNET_PUBLISH_FSC_PATH)"/>
</Target>
<Target Name="dotnetpublishfsicompiler" AfterTargets="CopyFilesToOutputDirectory" Condition=" '$(DOTNET_PUBLISH_FSI)' == 'true' ">
<SetEnvVar Name="NUGET_PACKAGES" Value="$(NUGET_PACKAGES)" />
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe restore DeployCompiler\fsi\project.json"/>
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe &#45;&#45;verbose publish &#45;&#45;no-build DeployCompiler\fsi\project.json -r $(DOTNET_PUBLISH_PLATFORM) -c $(Configuration) -o $(DOTNET_PUBLISH_FSI_PATH)"/>
</Target>
-->

<Target Name="GenerateSourceLink" BeforeTargets="CoreCompile" Condition="'$(UseSourceLink)' == 'true'">
<PropertyGroup>
Expand All @@ -600,6 +594,69 @@
<WriteLinesToFile File="$(IntermediateOutputPath)source_link.json" Overwrite="true" Lines='{"documents": { "$(SrcRootDirectory)/*" : "$(RemoteUri.Replace(".git", "").Replace("github.com", "raw.githubusercontent.com"))/$(LatestCommit)/*" }}' />
</Target>

<!-- If BuildVersionFilePath not specified then do nothing -->
<Target Name="CleanVersionFile" Condition ="'$(BuildVersionFilePath)' != '' ">
<PropertyGroup>
<BuildVersionFileDir>$([System.IO.Path]::GetDirectoryName($(BuildVersionFilePath)))</BuildVersionFileDir>
</PropertyGroup>
<RemoveDir Condition="Exists('$(BuildVersionFileDir)')" Directories="$(BuildVersionFileDir)" />
</Target>

<!-- If BuildVersionFilePath not specified then do nothing -->
<Target Name="CreateOrUpdateBuildVersionFile" Condition ="'$(BuildVersionFilePath)' != '' ">
<PropertyGroup>
<BuildVersionFileDir>$([System.IO.Path]::GetDirectoryName($(BuildVersionFilePath)))</BuildVersionFileDir>
<PackageVersionMajor Condition="'$(PackageVersionMajor)' == ''" >$(NuGetPerBuildPreReleaseVersion)</PackageVersionMajor>
<PackageVersionMinor Condition="'$(PackageVersionMinor)' != ''" >$([MSBuild]::Add($(PackageVersionMinor), 1))</PackageVersionMinor>
<PackageVersionMinor Condition="'$(PackageVersionMinor)' == ''" >1</PackageVersionMinor>
</PropertyGroup>

<ItemGroup>
<CurrentVersionLines Include="%3C%3Fxml version=%221.0%22 encoding=%22utf-8%22%3F%3E" />
<CurrentVersionLines Include="%3C!-- This is a generated file. $(VersionSeedSourceComment) Seed Date is $(VersionSeedDate). --%3E" />
<CurrentVersionLines Include="%3CProject xmlns=%22http://schemas.microsoft.com/developer/msbuild/2003%22%3E" />
<CurrentVersionLines Include="%3CPropertyGroup%3E" />
<CurrentVersionLines Include="%3CPackageVersionMajor Condition=%22%27%24(PackageVersionMajor)%27==%27%27%22%3E$(NuGetPerBuildPreReleaseVersion)%3C/PackageVersionMajor%3E" />
<CurrentVersionLines Include="%3CPackageVersionMinor Condition=%22%27%24(PackageVersionMinor)%27==%27%27%22%3E$(PackageVersionMinor)%3C/PackageVersionMinor%3E" />
<CurrentVersionLines Include="%3C/PropertyGroup%3E" />
<CurrentVersionLines Include="%3C/Project%3E" />
</ItemGroup>

<!-- Since by default the file will get dropped at the obj dir, make sure that the dir is created already or else WriteLinesToFile will error. -->
<MakeDir Condition="!Exists('$(BuildVersionFileDir)')" Directories="$(BuildVersionFileDir)" />

<WriteLinesToFile
ContinueOnError="WarnAndContinue"
File="$(BuildVersionFilePath)"
Lines="@(CurrentVersionLines)"
Overwrite="true" />

<!-- Delete old BuildVersion.props files -->
<ItemGroup>
<OldBuildVersionFiles Include="$(BuildVersionFilePath)BuildVersions-*.props" Exclude="$(BuildVersionFilePath)%(BuildVersionFileItem.Filename).props" />
</ItemGroup>
<Delete Files="@(OldBuildVersionFiles)" TreatErrorsAsWarnings="true"/>
</Target>

<!--
<Target Name="nugetpack"
DependsOnTargets="CreateOrUpdateBuildVersionFile"
AfterTargets="Build"
Condition="'$(TargetFramework)' == 'coreclr' "
Inputs="@(PackageNuspec)"
Outputs='$(FSharpSourcesRoot.TrimEnd("\"))\..\$(Configuration)\artifacts\"%(PackageNuspec.Filename)).nupkg'>
<PropertyGroup>
<PackageProperties>-prop "licenseUrl=$(PackageLicenceUrl)" -prop "version=$(PackageVersion)" -prop "authors=$(PackageAuthors)" -prop "projectUrl=$(PackageProjectUrl)" -prop "tags=$(PackageTags)"</PackageProperties>
</PropertyGroup>
<MakeDir Directories="$(FSharpSourcesRoot.TrimEnd('\'))\..\$(Configuration)\artifacts" />
<MakeDir Directories="$(FSharpSourcesRoot.TrimEnd('\'))\..\artifacts" />
<SetEnvVar Name="NUGET_PACKAGES" Value="$(NUGET_PACKAGES)" />
<Exec Command='$(MSBuildThisFileDirectory)..\.nuget\nuget.exe pack @(PackageNuspec) -BasePath $(OutputPath.TrimEnd("\")) -ExcludeEmptyDirectories $(PackageProperties) -OutputDirectory $(FSharpSourcesRoot.TrimEnd("\"))\..\$(Configuration)\artifacts' />
<Exec Command='$(MSBuildThisFileDirectory)..\.nuget\nuget.exe pack @(PackageNuspec) -BasePath $(OutputPath.TrimEnd("\")) -ExcludeEmptyDirectories $(PackageProperties) -OutputDirectory $(FSharpSourcesRoot.TrimEnd("\"))\..\artifacts' />
</Target>
<UsingTask TaskName="ReplaceFileText" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<InputFilename ParameterType="System.String" Required="true" />
Expand All @@ -624,4 +681,19 @@
</UsingTask>
-->

</Project>
<UsingTask TaskName="SetEnvVar" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<Name ParameterType="System.String" Required="true" />
<Value ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
Environment.SetEnvironmentVariable(Name, Value);
]]>
</Code>
</Task>
</UsingTask>

</Project>
24 changes: 23 additions & 1 deletion src/Microbuild.Settings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,28 @@
<Compile Include="@(TempCompile)" />
</ItemGroup>
</Target>


<Target Name="GetVsixPackageVersion" Outputs="$(VsixPackageVersion)">
<PropertyGroup>
<!--
Given $(BUILD_BUILDNUMBER) = '20161225.1'
Given $(MicroBuildAssemblyVersion) = '15.4.1.0'
Then $(BuildTimeStamp_Day) = 161225
Then $(BuildTimeStamp_Number) = 01
Then $(BuildTimeStamp) = 16122501
Then $(MicroBuildAssemblyVersion_WithoutRevision) = 15.4.1
Then $(VsixPackageVersion) = 15.4.1.16122501
-->
<BuildTimeStamp_Day>$(BUILD_BUILDNUMBER.Split('.')[0].Substring(2))</BuildTimeStamp_Day>
<BuildTimeStamp_Number>$(BUILD_BUILDNUMBER.Split('.')[1].PadLeft(2, '0'))</BuildTimeStamp_Number>
<BuildTimeStamp>$(BuildTimeStamp_Day)$(BuildTimeStamp_Number)</BuildTimeStamp>
<MicroBuildAssemblyVersion_WithoutRevision>$(MicroBuildAssemblyVersion.Substring(0, $(MicroBuildAssemblyVersion.LastIndexOf('.'))))</MicroBuildAssemblyVersion_WithoutRevision>
<VsixPackageVersion>$(MicroBuildAssemblyVersion_WithoutRevision).$(BuildTimeStamp)</VsixPackageVersion>
</PropertyGroup>
</Target>

<Import Project="..\packages\MicroBuild.Core.$(MicroBuildCoreVersion)\build\MicroBuild.Core.targets" />
</Project>
20 changes: 14 additions & 6 deletions src/absil/il.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2494,11 +2494,19 @@ let prependInstrsToCode (instrs: ILInstr list) (c2: ILCode) =
let n = instrs.Length
match c2.Instrs.[0] with
// If there is a sequence point as the first instruction then keep it at the front
| I_seqpoint _ as i0 ->
{ c2 with Labels = Dictionary.ofList [ for kvp in c2.Labels -> (kvp.Key, if kvp.Value = 0 then 0 else kvp.Value + n) ]
Instrs = Array.append [| i0 |] (Array.append instrs c2.Instrs.[1..]) }
| _ ->
{ c2 with Labels = Dictionary.ofList [ for kvp in c2.Labels -> (kvp.Key, kvp.Value + n) ]
| I_seqpoint _ as i0 ->
let labels =
let dict = Dictionary.newWithSize c2.Labels.Count
for kvp in c2.Labels do dict.Add(kvp.Key, if kvp.Value = 0 then 0 else kvp.Value + n)
dict
{ c2 with Labels = labels
Instrs = Array.concat [| [|i0|] ; instrs ; c2.Instrs.[1..] |] }
| _ ->
let labels =
let dict = Dictionary.newWithSize c2.Labels.Count
for kvp in c2.Labels do dict.Add(kvp.Key, kvp.Value + n)
dict
{ c2 with Labels = labels
Instrs = Array.append instrs c2.Instrs }

let prependInstrsToMethod new_code md =
Expand Down Expand Up @@ -2706,7 +2714,7 @@ let mkILTypeDefForGlobalFunctions ilg (methods,fields) = mkILSimpleClass ilg (ty
let destTypeDefsWithGlobalFunctionsFirst ilg (tdefs: ILTypeDefs) =
let l = tdefs.AsList
let top,nontop = l |> List.partition (fun td -> td.Name = typeNameForGlobalFunctions)
let top2 = if top.Length = 0 then [ mkILTypeDefForGlobalFunctions ilg (emptyILMethods, emptyILFields) ] else top
let top2 = if isNil top then [ mkILTypeDefForGlobalFunctions ilg (emptyILMethods, emptyILFields) ] else top
top2@nontop

let mkILSimpleModule assname modname dll subsystemVersion useHighEntropyVA tdefs hashalg locale flags exportedTypes metadataVersion =
Expand Down
60 changes: 32 additions & 28 deletions src/absil/ilbinary.fs
Original file line number Diff line number Diff line change
Expand Up @@ -758,36 +758,40 @@ let isNoArgInstr i =
| _ -> false

let ILCmpInstrMap =
lazy
(Dictionary.ofList
[ BI_beq , i_beq
BI_bgt , i_bgt
BI_bgt_un , i_bgt_un
BI_bge , i_bge
BI_bge_un , i_bge_un
BI_ble , i_ble
BI_ble_un , i_ble_un
BI_blt , i_blt
BI_blt_un , i_blt_un
BI_bne_un , i_bne_un
BI_brfalse , i_brfalse
BI_brtrue , i_brtrue ])
lazy (
let dict = Dictionary.newWithSize 12
dict.Add (BI_beq , i_beq )
dict.Add (BI_bgt , i_bgt )
dict.Add (BI_bgt_un , i_bgt_un )
dict.Add (BI_bge , i_bge )
dict.Add (BI_bge_un , i_bge_un )
dict.Add (BI_ble , i_ble )
dict.Add (BI_ble_un , i_ble_un )
dict.Add (BI_blt , i_blt )
dict.Add (BI_blt_un , i_blt_un )
dict.Add (BI_bne_un , i_bne_un )
dict.Add (BI_brfalse , i_brfalse )
dict.Add (BI_brtrue , i_brtrue )
dict
)

let ILCmpInstrRevMap =
lazy
(Dictionary.ofList
[ BI_beq , i_beq_s
BI_bgt , i_bgt_s
BI_bgt_un , i_bgt_un_s
BI_bge , i_bge_s
BI_bge_un , i_bge_un_s
BI_ble , i_ble_s
BI_ble_un , i_ble_un_s
BI_blt , i_blt_s
BI_blt_un , i_blt_un_s
BI_bne_un , i_bne_un_s
BI_brfalse , i_brfalse_s
BI_brtrue , i_brtrue_s ])
lazy (
let dict = Dictionary.newWithSize 12
dict.Add ( BI_beq , i_beq_s )
dict.Add ( BI_bgt , i_bgt_s )
dict.Add ( BI_bgt_un , i_bgt_un_s )
dict.Add ( BI_bge , i_bge_s )
dict.Add ( BI_bge_un , i_bge_un_s )
dict.Add ( BI_ble , i_ble_s )
dict.Add ( BI_ble_un , i_ble_un_s )
dict.Add ( BI_blt , i_blt_s )
dict.Add ( BI_blt_un , i_blt_un_s )
dict.Add ( BI_bne_un , i_bne_un_s )
dict.Add ( BI_brfalse , i_brfalse_s )
dict.Add ( BI_brtrue , i_brtrue_s )
dict
)

// From corhdr.h

Expand Down

0 comments on commit 11c0a08

Please sign in to comment.