Skip to content

Commit

Permalink
Merge pull request dotnet#24672 from jaredpar/fix-msbuild
Browse files Browse the repository at this point in the history
Multitarget our msbuild task
  • Loading branch information
jaredpar committed Mar 5, 2018
2 parents 45a8675 + ed6f523 commit 2424421
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 91 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ then
dotnet publish "${root_path}"/src/Compilers/CSharp/csc -o "${bootstrap_path}/bincore" --framework ${bootstrap_framework} ${bootstrap_build_args} "/bl:${binaries_path}/BootstrapCsc.binlog"
dotnet publish "${root_path}"/src/Compilers/VisualBasic/vbc -o "${bootstrap_path}/bincore" --framework ${bootstrap_framework} ${bootstrap_build_args} "/bl:${binaries_path}/BootstrapVbc.binlog"
dotnet publish "${root_path}"/src/Compilers/Server/VBCSCompiler -o "${bootstrap_path}/bincore" --framework ${bootstrap_framework} ${bootstrap_build_args} "/bl:${binaries_path}/BootstrapVBCSCompiler.binlog"
dotnet publish "${root_path}"/src/Compilers/Core/MSBuildTask -o "${bootstrap_path}" ${bootstrap_build_args} "/bl:${binaries_path}/BoostrapMSBuildTask.binlog"
dotnet publish "${root_path}"/src/Compilers/Core/MSBuildTask -o "${bootstrap_path}" --framework ${bootstrap_framework} ${bootstrap_build_args} "/bl:${binaries_path}/BoostrapMSBuildTask.binlog"
fi

if [[ "${use_bootstrap}" == true ]]
Expand Down
6 changes: 4 additions & 2 deletions build/config/SignToolData.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@
"Dlls\\InteractiveEditorFeatures\\Microsoft.CodeAnalysis.InteractiveEditorFeatures.dll",
"Dlls\\InteractiveEditorFeatures\\*\\Microsoft.CodeAnalysis.InteractiveEditorFeatures.resources.dll",
"Dlls\\InteractiveFeatures\\Microsoft.CodeAnalysis.InteractiveFeatures.dll",
"Dlls\\MSBuildTask\\Microsoft.Build.Tasks.CodeAnalysis.dll",
"Dlls\\MSBuildTask\\*\\Microsoft.Build.Tasks.CodeAnalysis.resources.dll",
"Dlls\\MSBuildTask\\net46\\Microsoft.Build.Tasks.CodeAnalysis.dll",
"Dlls\\MSBuildTask\\net46\\*\\Microsoft.Build.Tasks.CodeAnalysis.resources.dll",
"Dlls\\MSBuildTask\\netcoreapp2.0\\Microsoft.Build.Tasks.CodeAnalysis.dll",
"Dlls\\MSBuildTask\\netcoreapp2.0\\*\\Microsoft.Build.Tasks.CodeAnalysis.resources.dll",
"Dlls\\RemoteWorkspaces\\Microsoft.CodeAnalysis.Remote.Workspaces.dll",
"Dlls\\Scripting\\Microsoft.CodeAnalysis.Scripting.dll",
"Dlls\\Scripting\\*\\Microsoft.CodeAnalysis.Scripting.resources.dll",
Expand Down
8 changes: 4 additions & 4 deletions build/scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function Make-BootstrapBuild() {
Exec-Console "dotnet" "publish --no-restore src/Compilers/CSharp/csc -o `"$dir/bincore`" --framework $bootstrapFramework $bootstrapArgs -bl:$logDir/BootstrapCsc.binlog"
Exec-Console "dotnet" "publish --no-restore src/Compilers/VisualBasic/vbc -o `"$dir/bincore`" --framework $bootstrapFramework $bootstrapArgs -bl:$logDir/BootstrapVbc.binlog"
Exec-Console "dotnet" "publish --no-restore src/Compilers/Server/VBCSCompiler -o `"$dir/bincore`" --framework $bootstrapFramework $bootstrapArgs -bl:$logDir/BootstrapVBCSCompiler.binlog"
Exec-Console "dotnet" "publish --no-restore src/Compilers/Core/MSBuildTask -o `"$dir`" $bootstrapArgs -bl:$binariesDir/BootstrapMSBuildTask.binlog"
Exec-Console "dotnet" "publish --no-restore src/Compilers/Core/MSBuildTask -o `"$dir`" --framework $bootstrapFramework $bootstrapArgs -bl:$binariesDir/BootstrapMSBuildTask.binlog"
Stop-BuildProcesses
}
else {
Expand Down Expand Up @@ -246,6 +246,7 @@ function Build-Artifacts() {
# finish building these before we can run signing.
function Build-ExtraSignArtifacts() {

Ensure-NuGet | Out-Null
Push-Location (Join-Path $repoDir "src\Setup")
try {
# Publish the CoreClr projects (CscCore and VbcCore) and dependencies for later NuGet packaging.
Expand All @@ -256,10 +257,9 @@ function Build-ExtraSignArtifacts() {
Write-Host "Publishing VBCSCompiler"
Run-MSBuild "..\Compilers\Server\VBCSCompiler\VBCSCompiler.csproj" "/p:TargetFramework=netcoreapp2.0 /t:PublishWithoutBuilding"
Write-Host "Publishing MSBuildTask"
Run-MSBuild "..\Compilers\Core\MSBuildTask\MSBuildTask.csproj" "/p:TargetFramework=netstandard1.3 /t:PublishWithoutBuilding"
Run-MSBuild "..\Compilers\Core\MSBuildTask\MSBuildTask.csproj" "/p:TargetFramework=netcoreapp2.0 /t:PublishWithoutBuilding"

$dest = @(
$configDir)
$dest = @($configDir)
foreach ($dir in $dest) {
Copy-Item "PowerShell\*.ps1" $dir
}
Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/Core/MSBuildTask/CopyRefAssembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public override bool Execute()

if (File.Exists(DestinationPath))
{
Guid source;
var source = Guid.Empty;
try
{
source = ExtractMvid(SourcePath);
Expand Down
5 changes: 2 additions & 3 deletions src/Compilers/Core/MSBuildTask/ErrorString.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 2 additions & 19 deletions src/Compilers/Core/MSBuildTask/MSBuildTask.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<RootNamespace>Microsoft.CodeAnalysis.BuildTasks</RootNamespace>
<AssemblyName>Microsoft.Build.Tasks.CodeAnalysis</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetFramework>netstandard1.3</TargetFramework>
<TargetFrameworks>$(RoslynPortableTargetFrameworks46)</TargetFrameworks>
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
Expand Down Expand Up @@ -65,26 +66,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.Build" Version="$(MicrosoftBuildFixedVersion)" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCoreFixedVersion)" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="$(MicrosoftNETCorePlatformsVersion)" />
<PackageReference Include="Microsoft.Win32.Primitives" Version="$(MicrosoftWin32PrimitivesVersion)" />
<PackageReference Include="System.AppContext" Version="$(SystemAppContextVersion)" />
<PackageReference Include="System.Console" Version="$(SystemConsoleVersion)" />
<PackageReference Include="System.Collections.Concurrent" Version="$(SystemCollectionsConcurrentVersion)" />
<PackageReference Include="System.Diagnostics.Process" Version="$(SystemDiagnosticsProcessVersion)" />
<PackageReference Include="System.Diagnostics.Tools" Version="$(SystemDiagnosticsToolsVersion)" />
<PackageReference Include="System.IO.FileSystem" Version="$(SystemIOFileSystemVersion)" />
<PackageReference Include="System.IO.FileSystem.DriveInfo" Version="$(SystemIOFileSystemDriveInfoVersion)" />
<PackageReference Include="System.IO.Pipes" Version="$(SystemIOPipesVersion)" />
<PackageReference Include="System.IO.Pipes.AccessControl" Version="$(SystemIOPipesAccessControlVersion)" />
<PackageReference Include="System.Linq" Version="$(SystemLinqVersion)" />
<PackageReference Include="System.Reflection" Version="$(SystemReflectionVersion)" />
<PackageReference Include="System.Security.AccessControl" Version="$(SystemSecurityAccessControlVersion)" />
<PackageReference Include="System.Security.Cryptography.Algorithms" Version="$(SystemSecurityCryptographyAlgorithmsVersion)" />
<PackageReference Include="System.Security.Principal.Windows" Version="$(SystemSecurityPrincipalWindowsVersion)" />
<PackageReference Include="System.Text.Encoding" Version="$(SystemTextEncodingVersion)" />
<PackageReference Include="System.Text.Encoding.Extensions" Version="$(SystemTextEncodingExtensionsVersion)" />
<PackageReference Include="System.Text.RegularExpressions" Version="$(SystemTextRegularExpressionsVersion)" />
<PackageReference Include="System.Threading.Thread" Version="$(SystemThreadingThreadVersion)" />
</ItemGroup>
<Import Project="..\CommandLine\CommandLine.projitems" Label="Shared" />
</Project>
3 changes: 0 additions & 3 deletions src/Compilers/Extension/AssemblyRedirects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.AppContext.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Console.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Diagnostics.FileVersionInfo.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Diagnostics.Process.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.IO.Compression.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.IO.FileSystem.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.IO.FileSystem.DriveInfo.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.IO.FileSystem.Primitives.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.IO.Pipes.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.IO.Pipes.AccessControl.dll")]
Expand All @@ -24,7 +22,6 @@
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Security.Cryptography.X509Certificates.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Security.Principal.Windows.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Text.Encoding.CodePages.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Threading.Thread.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Xml.XmlDocument.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Xml.XPath.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Xml.XPath.XDocument.dll")]
4 changes: 1 addition & 3 deletions src/Compilers/Extension/CompilerExtension.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,11 @@
<NuGetPackageToIncludeInVsix Include="System.Console" />
<NugetPackageToIncludeInVsix Include="System.Diagnostics.Contracts" />
<NuGetPackageToIncludeInVsix Include="System.Diagnostics.FileVersionInfo" />
<NuGetPackageToIncludeInVsix Include="System.Diagnostics.Process" />
<NuGetPackageToIncludeInVsix Include="System.Diagnostics.StackTrace" />
<NuGetPackageToIncludeInVsix Include="System.Diagnostics.Tools" />
<NuGetPackageToIncludeInVsix Include="System.IO" />
<NuGetPackageToIncludeInVsix Include="System.IO.Compression" />
<NuGetPackageToIncludeInVsix Include="System.IO.FileSystem" />
<NuGetPackageToIncludeInVsix Include="System.IO.FileSystem.DriveInfo" />
<NuGetPackageToIncludeInVsix Include="System.IO.FileSystem.Primitives" />
<NuGetPackageToIncludeInVsix Include="System.IO.Pipes" />
<NuGetPackageToIncludeInVsix Include="System.IO.Pipes.AccessControl" />
Expand All @@ -75,7 +73,6 @@
<NuGetPackageToIncludeInVsix Include="System.Text.Encoding.Extensions" />
<NuGetPackageToIncludeInVsix Include="System.Text.RegularExpressions" />
<NuGetPackageToIncludeInVsix Include="System.Threading.Tasks.Parallel" />
<NuGetPackageToIncludeInVsix Include="System.Threading.Thread" />
<NuGetPackageToIncludeInVsix Include="System.ValueTuple" />
<NuGetPackageToIncludeInVsix Include="System.Xml.ReaderWriter" />
<NuGetPackageToIncludeInVsix Include="System.Xml.XDocument" />
Expand All @@ -100,6 +97,7 @@
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup%3bGetCopyToOutputDirectoryItems</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup%3b</IncludeOutputGroupsInVSIXLocalOnly>
<ForceIncludeInVSIX>true</ForceIncludeInVSIX>
<AdditionalProperties>TargetFramework=net46</AdditionalProperties>
</ProjectReference>
<ProjectReference Include="..\Core\Portable\CodeAnalysis.csproj">
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup</IncludeOutputGroupsInVSIX>
Expand Down
10 changes: 2 additions & 8 deletions src/Compilers/Shared/BuildServerConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ private static bool CheckPipeConnectionOwnership(NamedPipeClientStream pipeStrea
}
}

#if NETSTANDARD1_3
#if NET46
internal static bool CheckIdentityUnix(PipeStream stream)
{
// Identity verification is unavailable in the MSBuild task,
Expand Down Expand Up @@ -508,12 +508,6 @@ private static ObjectSecurity GetPipeSecurity(PipeStream pipeStream)
return pipeStream.GetAccessControl();
}

private static string GetUserName() =>
(string)typeof(Environment)
.GetTypeInfo()
.GetDeclaredProperty("UserName")
?.GetMethod?.Invoke(null, parameters: null);

/// <returns>
/// Null if not enough information was found to create a valid pipe name.
/// </returns>
Expand All @@ -530,7 +524,7 @@ internal static string GetPipeNameForPathOpt(string compilerExeDirectory)
isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator);
}

var userName = GetUserName();
var userName = Environment.UserName;
if (userName == null)
{
return null;
Expand Down
33 changes: 15 additions & 18 deletions src/NuGet/Microsoft.CodeAnalysis.Build.Tasks.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,20 @@
$commitPathMessage$
</description>
<dependencies>
<group targetFramework="netstandard1.3">
<group targetFramework="net46">
<dependency id="Microsoft.CodeAnalysis.CSharp" version="[$version$]" />
<dependency id="Microsoft.Build" version="$MicrosoftBuildFixedVersion$" />
<dependency id="Microsoft.Build.Tasks.Core" version="$MicrosoftBuildTasksCoreFixedVersion$" />
<dependency id="System.Security.AccessControl" version="$SystemSecurityAccessControlVersion$" />
<dependency id="System.IO.Pipes.AccessControl" version="$SystemIOPipesAccessControlVersion$" />
</group>

<dependency id="System.AppContext" version="$SystemAppContextVersion$" />
<dependency id="System.Console" version="$SystemConsoleVersion$" />
<dependency id="System.Diagnostics.Process" version="$SystemDiagnosticsProcessVersion$" />
<dependency id="System.Diagnostics.Tools" version="$SystemDiagnosticsToolsVersion$"/>
<dependency id="System.IO.FileSystem" version="$SystemIOFileSystemVersion$"/>
<dependency id="System.IO.FileSystem.DriveInfo" version="$SystemIOFileSystemDriveInfoVersion$"/>
<dependency id="System.IO.Pipes" version="$SystemIOPipesVersion$" />
<group targetFramework="netcoreapp2.0">
<dependency id="Microsoft.CodeAnalysis.CSharp" version="[$version$]" />
<dependency id="Microsoft.Build" version="$MicrosoftBuildFixedVersion$" />
<dependency id="Microsoft.Build.Tasks.Core" version="$MicrosoftBuildTasksCoreFixedVersion$" />
<dependency id="System.Security.AccessControl" version="$SystemSecurityAccessControlVersion$" />
<dependency id="System.Security.Cryptography.Algorithms" version="$SystemSecurityCryptographyAlgorithmsVersion$"/>
<dependency id="System.Security.Principal.Windows" version="$SystemSecurityPrincipalWindowsVersion$" />
<dependency id="System.Text.Encoding" version="$SystemTextEncodingVersion$"/>
<dependency id="System.Text.Encoding.Extensions" version="$SystemTextEncodingExtensionsVersion$"/>
<dependency id="System.Text.RegularExpressions" version="$SystemTextRegularExpressionsVersion$"/>
<dependency id="System.Threading.Thread" version="$SystemThreadingThreadVersion$" />
<dependency id="System.IO.Pipes.AccessControl" version="$SystemIOPipesAccessControlVersion$" />
</group>
</dependencies>

Expand All @@ -52,10 +47,12 @@
</metadata>
<files>
<!-- Include PDB unless embedded into DLL -->
<file src="Dlls\MSBuildTask\Microsoft.Build.Tasks.CodeAnalysis.dll" target="lib\netstandard1.3" />
<file src="Dlls\MSBuildTask\Microsoft.Build.Tasks.CodeAnalysis.pdb*" target="lib\netstandard1.3" />
<file src="Dlls\MSBuildTask\Microsoft.CSharp.Core.targets" target="contentFiles\any\any" />
<file src="Dlls\MSBuildTask\Microsoft.VisualBasic.Core.targets" target="contentFiles\any\any" />
<file src="Dlls\MSBuildTask\netcoreapp2.0\Microsoft.Build.Tasks.CodeAnalysis.dll" target="lib\netcoreapp2.0" />
<file src="Dlls\MSBuildTask\netcoreapp2.0\Microsoft.Build.Tasks.CodeAnalysis.pdb*" target="lib\netcoreapp2.0" />
<file src="Dlls\MSBuildTask\net46\Microsoft.Build.Tasks.CodeAnalysis.dll" target="lib\net46" />
<file src="Dlls\MSBuildTask\net46\Microsoft.Build.Tasks.CodeAnalysis.pdb*" target="lib\net46" />
<file src="Dlls\MSBuildTask\net46\Microsoft.CSharp.Core.targets" target="contentFiles\any\any" />
<file src="Dlls\MSBuildTask\net46\Microsoft.VisualBasic.Core.targets" target="contentFiles\any\any" />
<file src="$thirdPartyNoticesPath$" target="" />
</files>
</package>
9 changes: 4 additions & 5 deletions src/NuGet/Microsoft.NETCore.Compilers.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@
<file src="$additionalFilesPath$/Microsoft.NETCore.Compilers.props" target="build" />

<!-- Targets and task files -->
<file src="Dlls/MSBuildTask/netstandard1.3/publish/Microsoft.Build.Tasks.CodeAnalysis.dll" target="tools" />
<file src="Dlls/MSbuildTask/netstandard1.3/publish/Microsoft.CSharp.Core.targets" target="tools" />
<file src="Dlls/MSbuildTask/netstandard1.3/publish/Microsoft.VisualBasic.Core.targets" target="tools" />
<file src="Dlls/MSBuildTask/netcoreapp2.0/Microsoft.Build.Tasks.CodeAnalysis.dll" target="tools" />
<file src="Dlls/MSbuildTask/netcoreapp2.0/Microsoft.CSharp.Core.targets" target="tools" />
<file src="Dlls/MSbuildTask/netcoreapp2.0/Microsoft.VisualBasic.Core.targets" target="tools" />
<!-- N.B.: The backslashes below cannot be replaced with forward slashes.
https://github.com/NuGet/Home/issues/3584 -->
<file src="Dlls\MSBuildTask\netstandard1.3\publish\System.*.dll" target="tools" />
<file src="Dlls\MSBuildTask\netstandard1.3\publish\runtimes\**" target="tools\runtimes" />
<file src="Dlls\MSBuildTask\netcoreapp2.0\publish\runtimes\**" target="tools\runtimes" />

<!-- Compiler exe files -->
<file src="Dlls/CodeAnalysis/Microsoft.CodeAnalysis.dll" target="tools/bincore" />
Expand Down
Loading

0 comments on commit 2424421

Please sign in to comment.