Skip to content

Commit

Permalink
Merge branch 'nullness' into merges/master-to-nullness
Browse files Browse the repository at this point in the history
  • Loading branch information
brettfo authored Apr 19, 2019
2 parents 95f733d + c8d40a5 commit 0842454
Show file tree
Hide file tree
Showing 423 changed files with 13,432 additions and 3,288 deletions.
3 changes: 3 additions & 0 deletions FSharp.Profiles.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -->
<Project>
<PropertyGroup Condition="'$(Configuration)' == 'Proto'">
<DefineConstants>BUILDING_WITH_LKG;$(DefineConstants)</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
<DefineConstants Condition="'$(MonoPackaging)' == 'true'">$(DefineConstants);CROSS_PLATFORM_COMPILER</DefineConstants>
Expand Down
12 changes: 6 additions & 6 deletions FSharpBuild.Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
<PropertyGroup>
<FSharpSourcesRoot>$(RepoRoot)src</FSharpSourcesRoot>
<SymStoreDirectory>$(ArtifactsDir)\SymStore</SymStoreDirectory>
<ProtoOutputPath Condition="'$(OS)' != 'Unix'">$(ArtifactsDir)\Bootstrap</ProtoOutputPath>
<ProtoOutputPath Condition="'$(OS)' == 'Unix'">$(ArtifactsDir)/fsc/Proto/netcoreapp2.1</ProtoOutputPath>
<ProtoOutputPath>$(ArtifactsDir)\Bootstrap</ProtoOutputPath>
<ValueTupleImplicitPackageVersion>4.4.0</ValueTupleImplicitPackageVersion>
<WarningsAsErrors>1182;0025;$(WarningsAsErrors)</WarningsAsErrors>
</PropertyGroup>
Expand Down Expand Up @@ -92,14 +91,15 @@
<MicroBuildAssemblyFileLanguage>fs</MicroBuildAssemblyFileLanguage>
<UseStandardResourceNames>false</UseStandardResourceNames>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<FSharpCoreProtoVersion>4.6.2</FSharpCoreProtoVersion>
</PropertyGroup>

<!-- SDK targets override -->
<PropertyGroup Condition="'$(Configuration)' != 'Proto' AND '$(DisableCompilerRedirection)'!='true' AND Exists('$(ProtoOutputPath)')">
<FSharpTargetsPath>$(ProtoOutputPath)\Microsoft.FSharp.Targets</FSharpTargetsPath>
<FSharpPropsShim>$(ProtoOutputPath)\Microsoft.FSharp.NetSdk.props</FSharpPropsShim>
<FSharpTargetsShim>$(ProtoOutputPath)\Microsoft.FSharp.NetSdk.targets</FSharpTargetsShim>
<FSharpOverridesTargetsShim>$(ProtoOutputPath)\Microsoft.FSharp.Overrides.NetSdk.targets</FSharpOverridesTargetsShim>
<FSharpTargetsPath>$(ProtoOutputPath)\fsc\Microsoft.FSharp.Targets</FSharpTargetsPath>
<FSharpPropsShim>$(ProtoOutputPath)\fsc\Microsoft.FSharp.NetSdk.props</FSharpPropsShim>
<FSharpTargetsShim>$(ProtoOutputPath)\fsc\Microsoft.FSharp.NetSdk.targets</FSharpTargetsShim>
<FSharpOverridesTargetsShim>$(ProtoOutputPath)\fsc\Microsoft.FSharp.Overrides.NetSdk.targets</FSharpOverridesTargetsShim>
</PropertyGroup>

</Project>
6 changes: 3 additions & 3 deletions FSharpTests.Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

<!-- SDK targets override -->
<PropertyGroup>
<_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'net40'">net472</_FSharpBuildTargetFramework>
<_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'coreclr'">netcoreapp2.1</_FSharpBuildTargetFramework>
<_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\FSharp.Build\$(Configuration)\$(_FSharpBuildTargetFramework)</_FSharpBuildBinPath>
<_FSharpBuildTargetFramework Condition="'$(MSBuildRuntimeType)'!='Core'">net472</_FSharpBuildTargetFramework>
<_FSharpBuildTargetFramework Condition="'$(MSBuildRuntimeType)'=='Core'">netcoreapp2.1</_FSharpBuildTargetFramework>
<_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\$(_FSharpBuildTargetFramework)</_FSharpBuildBinPath>

<FSharpBuildAssemblyFile>$(_FSharpBuildBinPath)\FSharp.Build.dll</FSharpBuildAssemblyFile>

Expand Down
8 changes: 5 additions & 3 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function Print-Usage() {
Write-Host ""
Write-Host "Actions:"
Write-Host " -restore Restore packages (short: -r)"
Write-Host " -norestore Don't restore packages"
Write-Host " -build Build main solution (short: -b)"
Write-Host " -rebuild Rebuild main solution"
Write-Host " -pack Build NuGet packages, VS insertion manifests and installer"
Expand Down Expand Up @@ -100,6 +101,7 @@ function Process-Arguments() {
Print-Usage
exit 0
}
$script:nodeReuse = $False;

if ($testAll) {
$script:testDesktop = $True
Expand All @@ -126,7 +128,7 @@ function Process-Arguments() {
}

function Update-Arguments() {
if (-Not (Test-Path "$ArtifactsDir\Bootstrap\fsc.exe")) {
if (-Not (Test-Path "$ArtifactsDir\Bootstrap\fsc\fsc.exe")) {
$script:bootstrap = $True
}
}
Expand Down Expand Up @@ -160,10 +162,10 @@ function BuildSolution() {
/p:Publish=$publish `
/p:ContinuousIntegrationBuild=$ci `
/p:OfficialBuildId=$officialBuildId `
/p:BootstrapBuildPath=$bootstrapDir `
/p:QuietRestore=$quietRestore `
/p:QuietRestoreBinaryLog=$binaryLog `
/p:TestTargetFrameworks=$testTargetFrameworks `
/v:$verbosity `
$suppressExtensionDeployment `
@properties
}
Expand Down Expand Up @@ -194,7 +196,7 @@ function UpdatePath() {
}

function VerifyAssemblyVersions() {
$fsiPath = Join-Path $ArtifactsDir "bin\fsi\Proto\net472\fsi.exe"
$fsiPath = Join-Path $ArtifactsDir "bin\fsi\Proto\net472\publish\fsi.exe"

# Only verify versions on CI or official build
if ($ci -or $official) {
Expand Down
22 changes: 9 additions & 13 deletions eng/build-utils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function Get-PackageDir([string]$name, [string]$version = "") {
return $p
}

function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string]$logFileName = "", [switch]$parallel = $true, [switch]$summary = $true, [switch]$warnAsError = $true, [string]$configuration = $script:configuration) {
function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string]$logFileName = "", [switch]$parallel = $true, [switch]$summary = $true, [switch]$warnAsError = $true, [string]$configuration = $script:configuration, [string]$verbosity = $script:verbosity) {
# Because we override the C#/VB toolset to build against our LKG package, it is important
# that we do not reuse MSBuild nodes from other jobs/builds on the machine. Otherwise,
# we'll run into issues such as https://github.com/dotnet/roslyn/issues/6211.
Expand All @@ -190,9 +190,9 @@ function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string]
}

if ($summary) {
$args += " /consoleloggerparameters:Verbosity=minimal;summary"
$args += " /consoleloggerparameters:Verbosity=$verbosity;summary"
} else {
$args += " /consoleloggerparameters:Verbosity=minimal"
$args += " /consoleloggerparameters:Verbosity=$verbosity"
}

if ($parallel) {
Expand All @@ -216,10 +216,6 @@ function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string]
$args += " /p:ContinuousIntegrationBuild=true"
}

if ($bootstrapDir -ne "") {
$args += " /p:BootstrapBuildPath=$bootstrapDir"
}

$args += " $buildArgs"
$args += " $projectFilePath"
$args += " $properties"
Expand All @@ -241,15 +237,15 @@ function Make-BootstrapBuild() {
Create-Directory $dir

# prepare FsLex and Fsyacc
Run-MSBuild "$RepoRoot\src\buildtools\buildtools.proj" "/restore /t:Build" -logFileName "BuildTools" -configuration $bootstrapConfiguration
Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\netcoreapp2.1\*" -Destination $dir
Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\netcoreapp2.1\*" -Destination $dir
Run-MSBuild "$RepoRoot\src\buildtools\buildtools.proj" "/restore /t:Publish" -logFileName "BuildTools" -configuration $bootstrapConfiguration -verbosity $verbosity
Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\netcoreapp2.1\publish" -Destination "$dir\fslex" -Force -Recurse
Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\netcoreapp2.1\publish" -Destination "$dir\fsyacc" -Force -Recurse

# prepare compiler
$projectPath = "$RepoRoot\proto.proj"
Run-MSBuild $projectPath "/restore /t:Build" -logFileName "Bootstrap" -configuration $bootstrapConfiguration
Copy-Item "$ArtifactsDir\bin\fsc\$bootstrapConfiguration\$bootstrapTfm\*" -Destination $dir
Copy-Item "$ArtifactsDir\bin\fsi\$bootstrapConfiguration\$bootstrapTfm\*" -Destination $dir
Run-MSBuild $projectPath "/restore /t:Publish" -logFileName "Bootstrap" -configuration $bootstrapConfiguration -verbosity $verbosity
Copy-Item "$ArtifactsDir\bin\fsc\$bootstrapConfiguration\$bootstrapTfm\publish" -Destination "$dir\fsc" -Force -Recurse
Copy-Item "$ArtifactsDir\bin\fsi\$bootstrapConfiguration\$bootstrapTfm\publish" -Destination "$dir\fsi" -Force -Recurse

return $dir
}
41 changes: 33 additions & 8 deletions eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ usage()
echo " --binaryLog Create MSBuild binary log (short: -bl)"
echo ""
echo "Actions:"
echo " --bootstrap Force the build of the bootstrap compiler"
echo " --restore Restore projects required to build (short: -r)"
echo " --norestore Don't restore projects required to build"
echo " --build Build all projects (short: -b)"
echo " --rebuild Rebuild all projects"
echo " --pack Build nuget packages"
Expand Down Expand Up @@ -54,6 +56,7 @@ test_core_clr=false
configuration="Debug"
verbosity='minimal'
binary_log=false
force_bootstrap=false
ci=false
skip_analyzers=false
prepare_machine=false
Expand Down Expand Up @@ -88,6 +91,9 @@ while [[ $# > 0 ]]; do
--binarylog|-bl)
binary_log=true
;;
--bootstrap)
force_bootstrap=true
;;
--restore|-r)
restore=true
;;
Expand Down Expand Up @@ -205,21 +211,40 @@ function BuildSolution {
quiet_restore=true
fi

# Node reuse fails because multiple different versions of FSharp.Build.dll get loaded into MSBuild nodes
node_reuse=false

# build bootstrap tools
bootstrap_config=Proto
MSBuild "$repo_root/src/buildtools/buildtools.proj" \
/restore \
/p:Configuration=$bootstrap_config \
/t:Build

bootstrap_dir=$artifacts_dir/Bootstrap
mkdir -p "$bootstrap_dir"
cp $artifacts_dir/bin/fslex/$bootstrap_config/netcoreapp2.1/* $bootstrap_dir
cp $artifacts_dir/bin/fsyacc/$bootstrap_config/netcoreapp2.1/* $bootstrap_dir
if [[ "$force_bootstrap" == true ]]; then
rm -fr $bootstrap_dir
fi
if [ ! -f "$bootstrap_dir/fslex.dll" ]; then
MSBuild "$repo_root/src/buildtools/buildtools.proj" \
/restore \
/v:$verbosity \
/p:Configuration=$bootstrap_config \
/t:Publish

mkdir -p "$bootstrap_dir"
cp -pr $artifacts_dir/bin/fslex/$bootstrap_config/netcoreapp2.1/publish $bootstrap_dir/fslex
cp -pr $artifacts_dir/bin/fsyacc/$bootstrap_config/netcoreapp2.1/publish $bootstrap_dir/fsyacc
fi
if [ ! -f "$bootstrap_dir/fsc.exe" ]; then
MSBuild "$repo_root/proto.proj" \
/restore \
/v:$verbosity \
/p:Configuration=$bootstrap_config \
/t:Publish

cp -pr $artifacts_dir/bin/fsc/$bootstrap_config/netcoreapp2.1/publish $bootstrap_dir/fsc
fi

# do real build
MSBuild $toolset_build_proj \
$bl \
/v:$verbosity \
/p:Configuration=$configuration \
/p:Projects="$projects" \
/p:RepoRoot="$repo_root" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <!-- Tests won't run without this, at least on OSX, see https://github.com/NuGet/Home/issues/4837#issuecomment-354536302 -->
<DefineConstants>$(DefineConstants);USES_FSHARP_CORE_45_PACKAGE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
<DefineConstants>$(DefineConstants);FX_NO_RUNTIMEENVIRONMENT</DefineConstants>
Expand Down
7 changes: 0 additions & 7 deletions fcs/FSharp.Compiler.Service/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,4 @@ open System.Runtime.InteropServices
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("FSharp.Compiler.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee")>]

// Until dotnet sdk can version assemblies, use this
#if BUILD_FROM_SOURCE
[<assembly: System.Reflection.AssemblyInformationalVersion("4.4.1.0")>]
[<assembly: System.Reflection.AssemblyVersion("4.4.1.0")>]
[<assembly: System.Reflection.AssemblyFileVersion("2017.06.27.0")>]
#endif

do()
4 changes: 2 additions & 2 deletions fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<PropertyGroup>
<TargetFrameworks>$(FcsTargetNetFxFramework);netstandard2.0</TargetFrameworks>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<DefineConstants>$(DefineConstants);COMPILER_SERVICE_AS_DLL</DefineConstants>
<DefineConstants>$(DefineConstants);COMPILER</DefineConstants>
<DefineConstants>$(DefineConstants);BUILD_FROM_SOURCE</DefineConstants>
<DefineConstants>$(DefineConstants);ENABLE_MONO_SUPPORT</DefineConstants>
<DefineConstants>$(DefineConstants);NO_STRONG_NAMES</DefineConstants>
<FsLexOutputFolder Condition="'$(TargetFramework)' != ''">$(TargetFramework)\</FsLexOutputFolder>
Expand Down Expand Up @@ -39,7 +39,7 @@
<DefineConstants>$(DefineConstants);FX_RESHAPED_REFEMIT</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\FSharp.Compiler.Service\AssemblyInfo.fs">
<Compile Include="AssemblyInfo.fs">
<Link>AssemblyInfo/AssemblyInfo.fs</Link>
</Compile>
<EmbeddedText Include="$(FSharpSourcesRoot)\fsharp\FSComp.txt">
Expand Down
4 changes: 4 additions & 0 deletions proto.proj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
<MSBuild Projects="@(Projects)" Targets="Rebuild" Properties="Configuration=$(Configuration);BUILD_PUBLICSIGN=$(BUILD_PUBLICSIGN);$(CustomProps)" />
</Target>

<Target Name="Publish">
<MSBuild Projects="@(Projects)" Targets="Publish" Properties="Configuration=$(Configuration);BUILD_PUBLICSIGN=$(BUILD_PUBLICSIGN);$(CustomProps)" />
</Target>

<Target Name="Clean">
<MSBuild Projects="@(Projects)" Targets="Clean" Properties="Configuration=$(Configuration);BUILD_PUBLICSIGN=$(BUILD_PUBLICSIGN);$(CustomProps)" />
</Target>
Expand Down
8 changes: 3 additions & 5 deletions src/absil/bytes.fs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ type internal ByteStream =
{ bytes: byte[]
mutable pos: int
max: int }

member b.IsEOF = (b.pos >= b.max)

member b.ReadByte() =
if b.pos >= b.max then failwith "end of stream"
let res = b.bytes.[b.pos]
Expand All @@ -56,11 +59,6 @@ type internal ByteStream =
res

member b.Position = b.pos
#if LAZY_UNPICKLE
member b.CloneAndSeek = { bytes=b.bytes; pos=pos; max=b.max }
member b.Skip = b.pos <- b.pos + n
#endif


type internal ByteBuffer =
{ mutable bbArray: byte[]
Expand Down
5 changes: 1 addition & 4 deletions src/absil/bytes.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,10 @@ type internal ByteBuffer =

[<Sealed>]
type internal ByteStream =
member IsEOF : bool
member ReadByte : unit -> byte
member ReadBytes : int -> byte[]
member ReadUtf8String : int -> string
member Position : int
static member FromBytes : byte[] * start:int * length:int -> ByteStream
#if LAZY_UNPICKLE
member CloneAndSeek : int -> ByteStream
member Skip : int -> unit
#endif
Loading

0 comments on commit 0842454

Please sign in to comment.