Skip to content

Commit 442dfc2

Browse files
authored
Merge pull request #4002 from brettfo/reenable-delay-sign
reenable delay signing and `sn -Vr` for build assemblies to speed up local work
2 parents ee05187 + 0be804a commit 442dfc2

File tree

8 files changed

+107
-9
lines changed

8 files changed

+107
-9
lines changed

DEVGUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ For **Release**:
192192

193193
#### Notes on the Windows .NET Framework build
194194

195-
1. The `update.cmd` script NGens the compiler and libraries. This requires admin privileges.
195+
1. The `update.cmd` script adds required strong name validation skips and NGens the compiler and libraries. This requires admin privileges.
196196
1. The compiler binaries produced are "private" and strong-named signed with a test key.
197197
1. Some additional tools are required to build the compiler, notably `fslex.exe`, `fsyacc.exe`, `FSharp.PowerPack.Build.Tasks.dll`, `FsSrGen.exe`, `FSharp.SRGen.Build.Tasks.dll`, and the other tools found in the `lkg` directory.
198198
1. The overall bootstrapping process executes as follows

build.cmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,8 @@ if "%RestorePackages%"=="" (
497497
@echo VSSDKToolsPath: %VSSDKToolsPath%
498498
@echo VSSDKIncludes: %VSSDKIncludes%
499499

500+
@call src\update.cmd signonly
501+
500502
:: Check prerequisites
501503
if not "%VisualStudioVersion%" == "" goto vsversionset
502504
if exist "%VS150COMNTOOLS%\..\ide\devenv.exe" set VisualStudioVersion=15.0
@@ -702,12 +704,16 @@ set PATH=%PATH%;%CORDIR%
702704

703705
set REGEXE32BIT=reg.exe
704706

707+
IF NOT DEFINED SNEXE32 IF EXIST "%WINSDKNETFXTOOLS%\sn.exe" set SNEXE32=%WINSDKNETFXTOOLS%sn.exe
708+
IF NOT DEFINED SNEXE64 IF EXIST "%WINSDKNETFXTOOLS%x64\sn.exe" set SNEXE64=%WINSDKNETFXTOOLS%x64\sn.exe
705709
IF NOT DEFINED ildasm IF EXIST "%WINSDKNETFXTOOLS%\ildasm.exe" set ildasm=%WINSDKNETFXTOOLS%ildasm.exe
706710

707711
echo.
708712
echo SDK environment vars
709713
echo =======================
710714
echo WINSDKNETFXTOOLS: %WINSDKNETFXTOOLS%
715+
echo SNEXE32: %SNEXE32%
716+
echo SNEXE64: %SNEXE64%
711717
echo ILDASM: %ILDASM%
712718
echo
713719

fcs/FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<DefineConstants>$(DefineConstants);DOTNETCORE;FX_ATLEAST_45;FX_ATLEAST_PORTABLE;FX_NO_RUNTIMEENVIRONMENT;FX_RESHAPED_REFLECTION;TODO_REWORK_ASSEMBLY_LOAD;</DefineConstants>
55
<NoWarn>$(NoWarn);44;</NoWarn>
66
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
7-
<PublicSign>true</PublicSign>
7+
<DelaySign>true</DelaySign>
88
<GenerateDocumentationFile>true</GenerateDocumentationFile>
99
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
1010
</PropertyGroup>

fcs/FSharp.Compiler.Service.netstandard/FSharp.Compiler.Service.netstandard.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<DefineConstants>$(DefineConstants);TODO_REWORK_SERVER</DefineConstants>
6868
<NoWarn>$(NoWarn);44;69;65;54;61;75;62;9;2003;</NoWarn>
6969
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
70-
<PublicSign>true</PublicSign>
70+
<DelaySign>true</DelaySign>
7171
<GenerateDocumentationFile>true</GenerateDocumentationFile>
7272
</PropertyGroup>
7373
<ItemGroup>

src/FSharpSource.Settings.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<SignAssembly>true</SignAssembly>
6161
<AssemblyOriginatorKeyFile>$(FSharpSourcesRoot)\fsharp\msft.pubkey</AssemblyOriginatorKeyFile>
6262
<StrongNames>true</StrongNames>
63-
<PublicSign>true</PublicSign>
63+
<DelaySign>true</DelaySign>
6464
</PropertyGroup>
6565

6666
<PropertyGroup Condition="'$(OS)' != 'Unix'">

src/FSharpSource.targets

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@
2929
<!-- We have to do unit test DLLs well because they can see the internals of other strong-named DLLs -->
3030
<Otherwise>
3131
<PropertyGroup>
32-
<OtherFlags>$(OtherFlags) --publicsign+</OtherFlags>
32+
<DelaySign>true</DelaySign>
3333
<StrongNames>true</StrongNames>
34-
<ExcludeSigningImport>true</ExcludeSigningImport>
3534
<MicroBuildAssemblyVersion>$(FSCoreVersion)</MicroBuildAssemblyVersion>
3635
<!-- certain delivered F# VS assemblies use a specific MicroBuildAssemblyVersion, otherwise use FSCoreVersion -->
3736
<MicroBuildAssemblyVersion Condition="'$(UseVsMicroBuildAssemblyVersion)' == 'true'">15.4.1.0</MicroBuildAssemblyVersion>
@@ -46,8 +45,7 @@
4645
<SignAssembly>true</SignAssembly>
4746
<AssemblyOriginatorKeyFile>$(FSharpSourcesRoot)\fsharp\msft.pubkey</AssemblyOriginatorKeyFile>
4847
<StrongNames>true</StrongNames>
49-
<ExcludeSigningImport>true</ExcludeSigningImport>
50-
<PublicSign>true</PublicSign>
48+
<DelaySign>true</DelaySign>
5149
<MicroBuildAssemblyVersion>$(FSCoreVersion)</MicroBuildAssemblyVersion>
5250
<MicroBuildAssemblyFileLanguage>fs</MicroBuildAssemblyFileLanguage>
5351
</PropertyGroup>

src/update.cmd

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
if /i "%1" == "debug" goto :ok
88
if /i "%1" == "release" goto :ok
9+
if /i "%1" == "signonly" goto :ok
910

10-
echo NGening built binaries
11+
echo adding required strong name verification skipping and NGening built binaries
1112
echo Usage:
1213
echo update.cmd debug [-ngen]
1314
echo update.cmd release [-ngen]
@@ -37,9 +38,20 @@ if "%WINSDKNETFXTOOLS_x86%"=="" FOR /F "tokens=2* delims= " %%A IN ('%REGEXE32B
3738
set WINSDKNETFXTOOLS_x64=%WINSDKNETFXTOOLS_x86%x64\
3839

3940
:havesdk
41+
set SN32="%WINSDKNETFXTOOLS_x86%sn.exe"
42+
set SN64="%WINSDKNETFXTOOLS_x64%sn.exe"
43+
4044
set NGEN32=%windir%\Microsoft.NET\Framework\v4.0.30319\ngen.exe
4145
set NGEN64=%windir%\Microsoft.NET\Framework64\v4.0.30319\ngen.exe
4246

47+
rem Disable strong-name validation for binaries that are delay-signed with the microsoft key
48+
%SN32% -q -Vr *,b03f5f7f11d50a3a
49+
50+
if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
51+
%SN64% -q -Vr *,b03f5f7f11d50a3a
52+
)
53+
54+
if /i "%1" == "signonly" goto :eof
4355
if /i "%1" == "debug" set NGEN_FLAGS=/Debug
4456

4557
rem NGen fsc, fsi, fsiAnyCpu, and FSharp.Build.dll

vsintegration/update-vsintegration.cmd

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ if "%WINSDKNETFXTOOLS%"=="" FOR /F "tokens=2* delims= " %%A IN ('%REGEXE32BIT%
153153
if "%WINSDKNETFXTOOLS%"=="" FOR /F "tokens=2* delims= " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL') DO SET WINSDKNETFXTOOLS=%%B
154154
if "%WINSDKNETFXTOOLS%"=="" FOR /F "tokens=2* delims= " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL') DO SET WINSDKNETFXTOOLS=%%B
155155

156+
set SN32="%WINSDKNETFXTOOLS%sn.exe"
157+
set SN64="%WINSDKNETFXTOOLS%x64\sn.exe"
156158
set NGEN32=%windir%\Microsoft.NET\Framework\v4.0.30319\ngen.exe
157159
set NGEN64=%windir%\Microsoft.NET\Framework64\v4.0.30319\ngen.exe
158160

@@ -326,6 +328,46 @@ if "%DEPLOY%" == "yes" if "!ISADMIN!" == "yes" (
326328
REG ADD "HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\F# !FSHARPVERSION! Core Assemblies (Open Source)" /ve /t REG_SZ /f /d "!X86_PROGRAMFILES!\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.!FSHARPVERSION!.0\
327329
REG ADD "HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.50709\AssemblyFoldersEx\F# !FSHARPVERSION! Core Assemblies (Open Source)" /ve /t REG_SZ /f /d "!X86_PROGRAMFILES!\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.!FSHARPVERSION!.0\
328330

331+
rem Disable strong-name validation for F# binaries built from open source that are signed with the microsoft key
332+
echo.
333+
CALL :colorEcho 02 "[!ACTION!] Removing strong-name validation of F# binaries" & echo.
334+
!SN32! -Vr FSharp.Core,b03f5f7f11d50a3a 1>NUL 2>NUL
335+
!SN32! -Vr FSharp.Build,b03f5f7f11d50a3a 1>NUL 2>NUL
336+
!SN32! -Vr FSharp.Compiler.Interactive.Settings,b03f5f7f11d50a3a 1>NUL 2>NUL
337+
!SN32! -Vr HostedCompilerServer,b03f5f7f11d50a3a 1>NUL 2>NUL
338+
339+
!SN32! -Vr FSharp.Compiler,b03f5f7f11d50a3a 1>NUL 2>NUL
340+
!SN32! -Vr FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 1>NUL 2>NUL
341+
!SN32! -Vr FSharp.Editor,b03f5f7f11d50a3a 1>NUL 2>NUL
342+
!SN32! -Vr FSharp.LanguageService,b03f5f7f11d50a3a 1>NUL 2>NUL
343+
!SN32! -Vr FSharp.LanguageService.Base,b03f5f7f11d50a3a 1>NUL 2>NUL
344+
!SN32! -Vr FSharp.ProjectSystem.Base,b03f5f7f11d50a3a 1>NUL 2>NUL
345+
!SN32! -Vr FSharp.ProjectSystem.FSharp,b03f5f7f11d50a3a 1>NUL 2>NUL
346+
!SN32! -Vr FSharp.ProjectSystem.PropertyPages,b03f5f7f11d50a3a 1>NUL 2>NUL
347+
!SN32! -Vr FSharp.VS.FSI,b03f5f7f11d50a3a 1>NUL 2>NUL
348+
!SN32! -Vr VisualFSharp.Unittests,b03f5f7f11d50a3a 1>NUL 2>NUL
349+
!SN32! -Vr VisualFSharp.Salsa,b03f5f7f11d50a3a 1>NUL 2>NUL
350+
351+
REM Do this *in addition* to the above for x64 systems
352+
if /i "!PROCESSOR_ARCHITECTURE!"=="AMD64" (
353+
!SN64! -Vr FSharp.Core,b03f5f7f11d50a3a 1>NUL 2>NUL
354+
!SN64! -Vr FSharp.Build,b03f5f7f11d50a3a 1>NUL 2>NUL
355+
!SN64! -Vr FSharp.Compiler.Interactive.Settings,b03f5f7f11d50a3a 1>NUL 2>NUL
356+
!SN64! -Vr HostedCompilerServer,b03f5f7f11d50a3a 1>NUL 2>NUL
357+
358+
!SN64! -Vr FSharp.Compiler,b03f5f7f11d50a3a 1>NUL 2>NUL
359+
!SN64! -Vr FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 1>NUL 2>NUL
360+
!SN64! -Vr FSharp.Editor,b03f5f7f11d50a3a 1>NUL 2>NUL
361+
!SN64! -Vr FSharp.LanguageService,b03f5f7f11d50a3a 1>NUL 2>NUL
362+
!SN64! -Vr FSharp.LanguageService.Base,b03f5f7f11d50a3a 1>NUL 2>NUL
363+
!SN64! -Vr FSharp.ProjectSystem.Base,b03f5f7f11d50a3a 1>NUL 2>NUL
364+
!SN64! -Vr FSharp.ProjectSystem.FSharp,b03f5f7f11d50a3a 1>NUL 2>NUL
365+
!SN64! -Vr FSharp.ProjectSystem.PropertyPages,b03f5f7f11d50a3a 1>NUL 2>NUL
366+
!SN64! -Vr FSharp.VS.FSI,b03f5f7f11d50a3a 1>NUL 2>NUL
367+
!SN64! -Vr VisualFSharp.Unittests,b03f5f7f11d50a3a 1>NUL 2>NUL
368+
!SN64! -Vr VisualFSharp.Salsa,b03f5f7f11d50a3a 1>NUL 2>NUL
369+
)
370+
329371
rem NGen fsc, fsi, fsiAnyCpu, and FSharp.Build.dll
330372

331373
echo.
@@ -358,6 +400,46 @@ if "%DEPLOY%" == "yes" if "!ISADMIN!" == "no" (
358400
rem Re-enable certain settings when restoring, NGEN the original files again, requires admin rights
359401
if "%ACTION%" == "restore" if "!ISADMIN!" == "yes" (
360402

403+
rem Re-enable strong-name validation for F# binaries that were previously installed
404+
echo.
405+
CALL :colorEcho 02 "[!ACTION!] Re-enabling strong-name validation of original F# binaries" & echo.
406+
!SN32! -Vu FSharp.Core,b03f5f7f11d50a3a 2>NUL 1>NUL
407+
!SN32! -Vu FSharp.Build,b03f5f7f11d50a3a 2>NUL 1>NUL
408+
!SN32! -Vu FSharp.Compiler.Interactive.Settings,b03f5f7f11d50a3a 2>NUL 1>NUL
409+
!SN32! -Vu HostedCompilerServer,b03f5f7f11d50a3a 2>NUL 1>NUL
410+
411+
!SN32! -Vu FSharp.Compiler,b03f5f7f11d50a3a 2>NUL 1>NUL
412+
!SN32! -Vu FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 2>NUL 1>NUL
413+
!SN32! -Vu FSharp.Editor,b03f5f7f11d50a3a 2>NUL 1>NUL
414+
!SN32! -Vu FSharp.LanguageService,b03f5f7f11d50a3a 2>NUL 1>NUL
415+
!SN32! -Vu FSharp.LanguageService.Base,b03f5f7f11d50a3a 2>NUL 1>NUL
416+
!SN32! -Vu FSharp.ProjectSystem.Base,b03f5f7f11d50a3a 2>NUL 1>NUL
417+
!SN32! -Vu FSharp.ProjectSystem.FSharp,b03f5f7f11d50a3a 2>NUL 1>NUL
418+
!SN32! -Vu FSharp.ProjectSystem.PropertyPages,b03f5f7f11d50a3a 2>NUL 1>NUL
419+
!SN32! -Vu FSharp.VS.FSI,b03f5f7f11d50a3a 2>NUL 1>NUL
420+
!SN32! -Vu VisualFSharp.Unittests,b03f5f7f11d50a3a 2>NUL 1>NUL
421+
!SN32! -Vu VisualFSharp.Salsa,b03f5f7f11d50a3a 2>NUL 1>NUL
422+
423+
REM Do this *in addition* to the above for x64 systems
424+
if /i "!PROCESSOR_ARCHITECTURE!"=="AMD64" (
425+
!SN64! -Vu FSharp.Core,b03f5f7f11d50a3a 2>NUL 1>NUL
426+
!SN64! -Vu FSharp.Build,b03f5f7f11d50a3a 2>NUL 1>NUL
427+
!SN64! -Vu FSharp.Compiler.Interactive.Settings,b03f5f7f11d50a3a 2>NUL 1>NUL
428+
!SN64! -Vu HostedCompilerServer,b03f5f7f11d50a3a 2>NUL 1>NUL
429+
430+
!SN64! -Vu FSharp.Compiler,b03f5f7f11d50a3a 2>NUL 1>NUL
431+
!SN64! -Vu FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 2>NUL 1>NUL
432+
!SN64! -Vu FSharp.Editor,b03f5f7f11d50a3a 2>NUL 1>NUL
433+
!SN64! -Vu FSharp.LanguageService,b03f5f7f11d50a3a 2>NUL 1>NUL
434+
!SN64! -Vu FSharp.LanguageService.Base,b03f5f7f11d50a3a 2>NUL 1>NUL
435+
!SN64! -Vu FSharp.ProjectSystem.Base,b03f5f7f11d50a3a 2>NUL 1>NUL
436+
!SN64! -Vu FSharp.ProjectSystem.FSharp,b03f5f7f11d50a3a 2>NUL 1>NUL
437+
!SN64! -Vu FSharp.ProjectSystem.PropertyPages,b03f5f7f11d50a3a 2>NUL 1>NUL
438+
!SN64! -Vu FSharp.VS.FSI,b03f5f7f11d50a3a 2>NUL 1>NUL
439+
!SN64! -Vu VisualFSharp.Unittests,b03f5f7f11d50a3a 2>NUL 1>NUL
440+
!SN64! -Vu VisualFSharp.Salsa,b03f5f7f11d50a3a 2>NUL 1>NUL
441+
)
442+
361443
rem NGen fsc, fsi, fsiAnyCpu, and FSharp.Build.dll
362444

363445
echo.

0 commit comments

Comments
 (0)