Skip to content

Commit

Permalink
Removed MS.CA dependencies from our build task
Browse files Browse the repository at this point in the history
The code is separated out and can compile now.  Had to break server functionality to enable this though.
  • Loading branch information
jaredpar committed Oct 27, 2016
1 parent 62bbd60 commit d00363d
Show file tree
Hide file tree
Showing 16 changed files with 204 additions and 206 deletions.
35 changes: 14 additions & 21 deletions Compilers.sln
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ Global
src\Compilers\Core\CommandLine\CommandLine.projitems*{4b45ca0c-03a0-400f-b454-3d4bcb16af38}*SharedItemsImports = 4
src\Test\Utilities\Shared\TestUtilities.projitems*{6ff42825-5464-4151-ac55-ed828168c192}*SharedItemsImports = 13
src\Test\Utilities\Shared\TestUtilities.projitems*{76c6f005-c89d-4348-bb4a-391898dbeb52}*SharedItemsImports = 4
src\Compilers\Core\CommandLine\CommandLine.projitems*{7ad4fe65-9a30-41a6-8004-aa8f89bcb7f3}*SharedItemsImports = 4
src\Compilers\Core\CommandLine\CommandLine.projitems*{8ce3a581-2969-4864-a803-013e9d977c3a}*SharedItemsImports = 4
src\Compilers\Core\CommandLine\CommandLine.projitems*{9508f118-f62e-4c16-a6f4-7c3b56e166ad}*SharedItemsImports = 4
src\Compilers\Server\ServerShared\ServerShared.projitems*{9508f118-f62e-4c16-a6f4-7c3b56e166ad}*SharedItemsImports = 4
Expand Down Expand Up @@ -933,26 +932,20 @@ Global
{CCBD3438-3E84-40A9-83AD-533F23BCFCA5}.Release|x64.Build.0 = Release|x64
{CCBD3438-3E84-40A9-83AD-533F23BCFCA5}.Release|x86.ActiveCfg = Release|Any CPU
{CCBD3438-3E84-40A9-83AD-533F23BCFCA5}.Release|x86.Build.0 = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|ARM.ActiveCfg = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|ARM.Build.0 = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|x64.ActiveCfg = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|x64.Build.0 = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|x86.ActiveCfg = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|x86.Build.0 = Debug|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|Any CPU.Build.0 = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|ARM.ActiveCfg = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|ARM.Build.0 = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|x64.ActiveCfg = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|x64.Build.0 = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|x86.ActiveCfg = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|x86.Build.0 = Release|Any CPU
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|Any CPU.ActiveCfg = Debug|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|ARM.ActiveCfg = Debug|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|Mixed Platforms.Build.0 = Debug|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|x64.ActiveCfg = Debug|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|x64.Build.0 = Debug|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Debug|x86.ActiveCfg = Debug|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|Any CPU.ActiveCfg = Release|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|ARM.ActiveCfg = Release|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|Mixed Platforms.ActiveCfg = Release|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|Mixed Platforms.Build.0 = Release|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|x64.ActiveCfg = Release|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|x64.Build.0 = Release|x64
{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}.Release|x86.ActiveCfg = Release|x64
{1B665337-9D6A-451A-AEAC-F7BF1AF95FFB}.Debug|Any CPU.ActiveCfg = Debug|x64
{1B665337-9D6A-451A-AEAC-F7BF1AF95FFB}.Debug|ARM.ActiveCfg = Debug|x64
{1B665337-9D6A-451A-AEAC-F7BF1AF95FFB}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
Expand Down
1 change: 1 addition & 0 deletions src/Compilers/CSharp/Portable/Parser/CharacterInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System.Diagnostics;
using System.Globalization;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.CSharp
{
Expand Down
8 changes: 2 additions & 6 deletions src/Compilers/Core/MSBuildTask/Csc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
using System.Diagnostics;
using System.Globalization;
using System.Text;

using Roslyn.Utilities;
using Microsoft.Build.Framework;
using Microsoft.Build.Tasks.Hosting;
using Microsoft.Build.Utilities;
using Microsoft.CodeAnalysis.CommandLine;
using Microsoft.CodeAnalysis.CSharp;

namespace Microsoft.CodeAnalysis.BuildTasks
{
Expand Down Expand Up @@ -154,8 +152,6 @@ public string WarningsNotAsErrors

#region Tool Members

internal override RequestLanguage Language => RequestLanguage.CSharpCompile;

private static readonly string[] s_separators = { "\r\n" };

internal override void LogMessages(string output, MessageImportance messageImportance)
Expand Down Expand Up @@ -412,7 +408,7 @@ internal static string GetDefineConstantsSwitch(string originalDefineConstants,
// add them to the outgoing string.
foreach (string singleIdentifier in allIdentifiers)
{
if (SyntaxFacts.IsValidIdentifier(singleIdentifier))
if (UnicodeCharacterUtilities.IsValidIdentifier(singleIdentifier))
{
// Separate them with a semicolon if there's something already in
// the outgoing string.
Expand Down
2 changes: 0 additions & 2 deletions src/Compilers/Core/MSBuildTask/Csi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

using System;
using System.Text;

using Microsoft.Build.Framework;
using Microsoft.CodeAnalysis.CSharp;

namespace Microsoft.CodeAnalysis.BuildTasks
{
Expand Down
8 changes: 3 additions & 5 deletions src/Compilers/Core/MSBuildTask/InteractiveCompiler.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections;
using System.Linq;
using Roslyn.Utilities;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.BuildTasks
{
Expand Down Expand Up @@ -281,8 +279,8 @@ protected virtual void AddResponseFileCommands(CommandLineBuilderExtension comma
/// </summary>
private string[] GetArguments(string commandLineCommands, string responseFileCommands)
{
var commandLineArguments = CommandLineParser.SplitCommandLineIntoArguments(commandLineCommands, removeHashComments: true);
var responseFileArguments = CommandLineParser.SplitCommandLineIntoArguments(responseFileCommands, removeHashComments: true);
var commandLineArguments = CommandLineUtilities.SplitCommandLineIntoArguments(commandLineCommands, removeHashComments: true);
var responseFileArguments = CommandLineUtilities.SplitCommandLineIntoArguments(responseFileCommands, removeHashComments: true);
return commandLineArguments.Concat(responseFileArguments).ToArray();
}
}
Expand Down
26 changes: 12 additions & 14 deletions src/Compilers/Core/MSBuildTask/MSBuildTask.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,17 @@
<!-- A reference to the entire .NET Framework is automatically included -->
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\CSharp\Portable\CSharpCodeAnalysis.csproj">
<Project>{b501a547-c911-4a05-ac6e-274a50dff30e}</Project>
<Name>CSharpCodeAnalysis</Name>
</ProjectReference>
<ProjectReference Include="..\Portable\CodeAnalysis.csproj">
<Project>{1ee8cad3-55f9-4d91-96b2-084641da9a6c}</Project>
<Name>CodeAnalysis</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\Shared\DesktopBuildClient.cs">
<Link>DesktopBuildClient.cs</Link>
<Compile Include="..\Portable\InternalUtilities\CommandLineUtilities.cs">
<Link>CommandLineUtilities.cs</Link>
</Compile>
<Compile Include="..\Portable\InternalUtilities\CompilerOptionParseUtilities.cs">
<Link>CompilerOptionParseUtilities.cs</Link>
</Compile>
<Compile Include="..\Portable\InternalUtilities\IReadOnlySet.cs">
<Link>IReadOnlySet.cs</Link>
</Compile>
<Compile Include="..\Portable\InternalUtilities\UnicodeCharacterUtilities.cs">
<Link>UnicodeCharacterUtilities.cs</Link>
</Compile>
<Compile Include="CanonicalError.cs" />
<Compile Include="ValidateBootstrap.cs" />
Expand Down Expand Up @@ -70,6 +69,5 @@
<LastGenOutput>ErrorString.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Import Project="..\CommandLine\CommandLine.projitems" Label="Shared" />
<Import Project="..\..\..\..\build\Targets\VSL.Imports.targets" />
</Project>
</Project>
16 changes: 8 additions & 8 deletions src/Compilers/Core/MSBuildTask/ManagedCompiler.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using Roslyn.Utilities;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Microsoft.CodeAnalysis.CommandLine;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.BuildTasks
{
Expand Down Expand Up @@ -378,8 +376,6 @@ protected override Encoding StandardOutputEncoding

#endregion

internal abstract RequestLanguage Language { get; }

protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands)
{
if (ProvideCommandLineArgs)
Expand All @@ -400,6 +396,7 @@ protected override int ExecuteTool(string pathToTool, string responseFileCommand
return base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands);
}

/* TODO: This needs to get fixed obviously
using (_sharedCompileCts = new CancellationTokenSource())
{
try
Expand Down Expand Up @@ -459,6 +456,7 @@ protected override int ExecuteTool(string pathToTool, string responseFileCommand
ExitCode = -1;
}
}
*/
return ExitCode;
}

Expand Down Expand Up @@ -574,6 +572,7 @@ private string LibDirectoryToUse()
[Output]
public new int ExitCode { get; private set; }

/*
/// <summary>
/// Handle a response from the server, reporting messages and returning
/// the appropriate exit code.
Expand Down Expand Up @@ -609,6 +608,7 @@ private int HandleResponse(BuildResponse response, string pathToTool, string res
throw new InvalidOperationException("Encountered unknown response type");
}
}
*/

private void LogErrorOutput(string output)
{
Expand Down Expand Up @@ -643,9 +643,9 @@ public string GenerateResponseFileContents()
private string[] GetArguments(string commandLineCommands, string responseFileCommands)
{
var commandLineArguments =
CommandLineParser.SplitCommandLineIntoArguments(commandLineCommands, removeHashComments: true);
CommandLineUtilities.SplitCommandLineIntoArguments(commandLineCommands, removeHashComments: true);
var responseFileArguments =
CommandLineParser.SplitCommandLineIntoArguments(responseFileCommands, removeHashComments: true);
CommandLineUtilities.SplitCommandLineIntoArguments(responseFileCommands, removeHashComments: true);
return commandLineArguments.Concat(responseFileArguments).ToArray();
}

Expand Down
5 changes: 3 additions & 2 deletions src/Compilers/Core/MSBuildTask/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.IO;
using System.Security;
using Microsoft.Build.Framework;
using Microsoft.CodeAnalysis.CommandLine;
using System.Runtime.InteropServices;
using System.Reflection;

Expand All @@ -19,11 +18,13 @@ internal static class Utilities
/// <summary>
/// False if the compiler server is not supported on this platform.
/// </summary>
internal static bool IsCompilerServerSupported =>
internal static bool IsCompilerServerSupported => true;
/* TODO: fix this
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
DesktopBuildClient.GetRuntimeDirectoryOpt() != null &&
// Test that we can retrieve a valid pipe name
DesktopBuildClient.GetPipeNameForPathOpt("") != null;
*/

/// <summary>
/// Convert a task item metadata to bool. Throw an exception if the string is badly formed and can't
Expand Down
3 changes: 0 additions & 3 deletions src/Compilers/Core/MSBuildTask/ValidateBootstrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Microsoft.Build.Utilities;
using System.IO;
using System.Reflection;
using Microsoft.CodeAnalysis.CSharp;
using System;

namespace Microsoft.CodeAnalysis.BuildTasks
Expand Down Expand Up @@ -40,8 +39,6 @@ public override bool Execute()
var dependencies = new[]
{
typeof(ValidateBootstrap).GetTypeInfo().Assembly,
typeof(CSharpCompilation).GetTypeInfo().Assembly,
typeof(Compilation).GetTypeInfo().Assembly,
};

var allGood = true;
Expand Down
6 changes: 1 addition & 5 deletions src/Compilers/Core/MSBuildTask/Vbc.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Collections.Generic;
using System.Globalization;

using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Microsoft.Build.Tasks.Hosting;
using Microsoft.CodeAnalysis.CommandLine;
using System.Diagnostics;

namespace Microsoft.CodeAnalysis.BuildTasks
{
Expand Down Expand Up @@ -232,8 +230,6 @@ public string PdbFile

#region Tool Members

internal override RequestLanguage Language => RequestLanguage.VisualBasicCompile;

private static readonly string[] s_separator = { "\r\n" };

internal override void LogMessages(string output, MessageImportance messageImportance)
Expand Down
5 changes: 3 additions & 2 deletions src/Compilers/Core/Portable/CodeAnalysis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</Content>
<Compile Include="InternalUtilities\CommandLineUtilities.cs" />
<Compile Include="Syntax\InternalSyntax\GreenNodeExtensions.cs" />
<Compile Include="Syntax\InternalSyntax\SyntaxListPool.cs" />
<Compile Include="Syntax\SyntaxList.SeparatedWithManyWeakChildren.cs" />
Expand Down Expand Up @@ -143,7 +144,7 @@
<Compile Include="Text\SourceTextComparer.cs" />
<Compile Include="Text\SourceTextWriter.cs" />
<Compile Include="Text\StringTextWriter.cs" />
<Compile Include="UnicodeCharacterUtilities.cs" />
<Compile Include="InternalUtilities\UnicodeCharacterUtilities.cs" />
<Compile Include="CodeAnalysisResources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
Expand Down Expand Up @@ -813,4 +814,4 @@
<Import Project="..\..\..\Dependencies\CodeAnalysis.Metadata\Microsoft.CodeAnalysis.Metadata.projitems" Label="Shared" />
<Import Project="..\..\..\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems" Label="Shared" />
<Import Project="..\..\..\..\build\Targets\VSL.Imports.targets" />
</Project>
</Project>
Loading

0 comments on commit d00363d

Please sign in to comment.