Skip to content

Commit

Permalink
3.5 - Refresh compilers with small fixes (#105)
Browse files Browse the repository at this point in the history
* Update compilers to 3.5

* Add signing for task dll.

* Add key file for delay signing the task dll.

* Adjust task signing target for SDK-style project.

* A whole mess of project/target cleanup.

* I think this still misses SignFiles for SDK projects.

* I think this is the last step in a clean signing pipeline.

* Project TFM != target framework attribute

* Correct escapting for generating config through powershell/xml.
  • Loading branch information
StephenMolloy authored May 13, 2020
1 parent d354405 commit f8a4c9c
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory),RoslynCodeProvider.sln))\tools\RoslynCodeProvider.settings.targets" />

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<SignAssembly>true</SignAssembly>
<DelaySign>true</DelaySign>
<AssemblyOriginatorKeyFile>..\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,4 @@
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<Target Name="AfterBuild">
<ItemGroup>
<FilesToSign Include="$(TargetPath)" Condition="'$(SignAssembly)' == 'true'">
<Authenticode>Microsoft400</Authenticode>
<StrongName>MsSharedLib72</StrongName>
</FilesToSign>
</ItemGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

param($installPath, $toolsPath, $package, $project)

$assemblyVersion = '3.5.0.0'
$roslynSubFolder = 'roslyn'

if ($project -eq $null) {
Expand All @@ -17,7 +18,6 @@ if ($project -eq $null) {
$libDirectory = Join-Path $installPath 'lib\net45'
$projectRoot = $project.Properties.Item('FullPath').Value
$projectTargetFramework = $project.Properties.Item('TargetFrameworkMoniker').Value
$shouldUseRoslyn45 = $projectTargetFramework -match '4.5'
$binDirectory = Join-Path $projectRoot 'bin'

#
Expand All @@ -32,13 +32,13 @@ $compilerPackageDirectory = Join-Path $packageDirectory $compilerPackageFolderNa
$compilerPackageToolsDirectory = Join-Path $compilerPackageDirectory 'tools\roslyn472'
$csLanguageVersion = 'default'
$vbLanguageVersion = 'default'
if ($projectTargetFramework -match '^4\.5')
if ($projectTargetFramework -match 'v4\.5')
{
$compilerPackageToolsDirectory = Join-Path $compilerPackageDirectory 'tools\roslyn45'
$csLanguageVersion = '6'
$vbLanguageVersion = '14'
}
elseif (($projectTargetFramework -match '^4\.6') -or ($projectTargetFramework -match '^4\.7$') -or ($projectTargetFramework -match '^4\.7\.[01]'))
elseif (($projectTargetFramework -match 'v4\.6') -or ($projectTargetFramework -match 'v4\.7[^\.]') -or ($projectTargetFramework -match 'v4\.7\.[01]'))
{
$compilerPackageToolsDirectory = Join-Path $compilerPackageDirectory 'tools\roslyn46'
$csLanguageVersion = 'default'
Expand All @@ -53,25 +53,23 @@ elseif (($projectTargetFramework -match '^4\.6') -or ($projectTargetFramework -m
$csCodeDomProvider = [CodeDomProviderDescription]@{
TypeName="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider";
Assembly="Microsoft.CodeDom.Providers.DotNetCompilerPlatform";
Version="3.4.0.0";
Version=$assemblyVersion;
FileExtension=".cs";
Parameters=@(
[CompilerParameterDescription]@{ Name="language"; DefaultValue="c#;cs;csharp"; IsRequired=$true; IsProviderOption=$false },
[CompilerParameterDescription]@{ Name="warningLevel"; DefaultValue="4"; IsRequired=$true; IsProviderOption=$false },
[CompilerParameterDescription]@{ Name="goofyParam"; DefaultValue="foobaz"; IsRequired=$true; IsProviderOption=$true },
[CompilerParameterDescription]@{ Name="verySeriousParam"; DefaultValue="synergy"; IsRequired=$true; IsProviderOption=$true },
[CompilerParameterDescription]@{ Name="compilerOptions"; DefaultValue="/langversion:" + $csLanguageVersion + " /nowarn:1659;1699;1701;612;618"; IsRequired=$false; IsProviderOption=$false });
}
InstallCodeDomProvider $csCodeDomProvider
$vbCodeDomProvider = [CodeDomProviderDescription]@{
TypeName="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider";
Assembly="Microsoft.CodeDom.Providers.DotNetCompilerPlatform";
Version="3.4.0.0";
Version=$assemblyVersion;
FileExtension=".vb";
Parameters=@(
[CompilerParameterDescription]@{ Name="language"; DefaultValue="vb;vbs;visualbasic;vbscript"; IsRequired=$true; IsProviderOption=$false },
[CompilerParameterDescription]@{ Name="warningLevel"; DefaultValue="4"; IsRequired=$true; IsProviderOption=$false },
[CompilerParameterDescription]@{ Name="compilerOptions"; DefaultValue="/langversion:" + $vbLanguageVersion + " /nowarn:41008,40000,40008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"; IsRequired=$false; IsProviderOption=$false });
[CompilerParameterDescription]@{ Name="compilerOptions"; DefaultValue="/langversion:" + $vbLanguageVersion + " /nowarn:41008,40000,40008 /define:_MYTYPE=\""Web\"" /optionInfer+"; IsRequired=$false; IsProviderOption=$false });
}
InstallCodeDomProvider $vbCodeDomProvider

Expand Down
18 changes: 2 additions & 16 deletions src/Packages/Packages.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,8 @@
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\tools\Roslyn472\Microsoft.CSharp.Core.targets" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\tools\Roslyn472\Microsoft.Managed.Core.targets" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\tools\Roslyn472\Microsoft.VisualBasic.Core.targets" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\app.config.install.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\app.config.uninstall.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\net45\app.config.install.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\net45\app.config.uninstall.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\net45\web.config.install.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\net45\web.config.uninstall.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\net46\app.config.install.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\net46\app.config.uninstall.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\net46\web.config.install.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\net46\web.config.uninstall.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\net472\app.config.install.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\net472\app.config.uninstall.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\net472\web.config.install.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\net472\web.config.uninstall.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\web.config.install.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\web.config.uninstall.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\config.install.xdt" />
<None Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform\content\config.uninstall.xdt" />
<None Include="**\*.ps1" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
1 change: 1 addition & 0 deletions tools/.verif.whitelist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*\lib\*\*.xml,ignore xmldoc files
6 changes: 3 additions & 3 deletions tools/RoslynCodeProvider.settings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
<!-- Configurable properties-->

<PropertyGroup>
<BuildQuality Condition="'$(BuildQuality)' == ''">preview</BuildQuality>
<BuildQuality Condition="'$(BuildQuality)' == ''">preview1</BuildQuality>
<VersionStartYear>2020</VersionStartYear>
<VersionMajor>3</VersionMajor>
<VersionMinor>4</VersionMinor>
<VersionMinor>5</VersionMinor>
<VersionRelease>0</VersionRelease>
</PropertyGroup>

<PropertyGroup Label="NuGet package dependencies">
<MSNetCompilers45NuGetPackageVersion>1.3.2</MSNetCompilers45NuGetPackageVersion>
<MSNetCompilers46NuGetPackageVersion>2.10.0</MSNetCompilers46NuGetPackageVersion>
<MSNetCompilers472NuGetPackageVersion>3.4.0</MSNetCompilers472NuGetPackageVersion>
<MSNetCompilers472NuGetPackageVersion>3.5.0</MSNetCompilers472NuGetPackageVersion>
</PropertyGroup>

<Target Name="SuperClean" AfterTargets="Clean" Condition="'$(MSBuildProjectExtension)' != '.nuproj'">
Expand Down
3 changes: 2 additions & 1 deletion tools/RoslynCodeProvider.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

<Import Project="$(MSBuildThisFileDirectory)version.targets"/>
<Import Project="$(MSBuildThisFileDirectory)RoslynCodeProvider.Extensions.targets"/>
<Import Project="$(MSBuildThisFileDirectory)signing.targets"/>

<!-- Post-targets computed properties. -->
<!-- Post-targets computed properties. -->

<PropertyGroup>
<SatelliteContractVersion Condition="'$(SatelliteContractVersion)' == ''">$(AssemblyVersion)</SatelliteContractVersion>
Expand Down
35 changes: 35 additions & 0 deletions tools/signing.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- Setup signing for built assemblies. -->
<Target Name="GetAssemblyFilesToSign" BeforeTargets="SignFiles" Condition="'$(MSBuildProjectExtension)' != '.nuproj' And '$(MSBuildProjectName)' != 'Microsoft.CodeDom.Providers.DotNetCompilerPlatformTest' And '$(SignAssembly)' == 'true'">
<ItemGroup>
<FilesToSign Include="$(TargetPath)">
<Authenticode>Microsoft400</Authenticode>
<StrongName>MsSharedLib72</StrongName>
</FilesToSign>
</ItemGroup>
</Target>

<!-- Set up signing for nuget packages. -->
<Target Name="SignPowerShellScript" BeforeTargets="GetNuGetContentFromProject" Condition="'$(MSBuildProjectExtension)' == '.nuproj' And '$(SignAssembly)' == 'true'">
<ItemGroup>
<ScriptFilesToSign Include="tools\*.ps1">
<Authenticode>Microsoft400</Authenticode>
</ScriptFilesToSign>
</ItemGroup>
<SignFiles Files="@(ScriptFilesToSign)" Type="$(SignType)" BinariesDirectory="$(NuGetScriptDirectory)\$(NuGetProcessedScriptSubDirectory)"
IntermediatesDirectory="$(NuGetScriptDirectory)" ESRPSigning="$(ESRPSigning)" UseBearerToken="$(UseBearerToken)" Condition="'@(ScriptFilesToSign->Count())' &gt; 0" />
</Target>

<Target Name="GetPackageFilesToSign" BeforeTargets="SignFiles" Condition="'$(MSBuildProjectExtension)' == '.nuproj' And '$(SignAssembly)' == 'true'">
<PropertyGroup>
<OutDir>$(PackageOutputDir)</OutDir>
</PropertyGroup>
<ItemGroup>
<FilesToSign Include="$(NuGetPackTargetFile)">
<Authenticode>NuGet</Authenticode>
</FilesToSign>
</ItemGroup>
</Target>

</Project>

0 comments on commit f8a4c9c

Please sign in to comment.