Merge pull request #102 from agocke/AddCompilerNameOption
Add a compilerName option to the project.json
This commit is contained in:
commit
1564a48760
4 changed files with 10 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -182,21 +182,22 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
}
|
||||
|
||||
// Add project source files
|
||||
compilerArgs.AddRange(context.ProjectFile.Files.SourceFiles.Select(s => $"\"{s}\""));
|
||||
var sourceFiles = context.ProjectFile.Files.SourceFiles;
|
||||
compilerArgs.AddRange(sourceFiles.Select(s => $"\"{s}\""));
|
||||
|
||||
if (!AddResources(context.ProjectFile, compilerArgs, intermediateOutputPath))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: Read this from the project
|
||||
const string compiler = "csc";
|
||||
var compilerName = context.ProjectFile.CompilerName;
|
||||
compilerName = compilerName ?? "csc";
|
||||
|
||||
// Write RSP file
|
||||
var rsp = Path.Combine(intermediateOutputPath, $"dotnet-compile.{compiler}.rsp");
|
||||
var rsp = Path.Combine(intermediateOutputPath, $"dotnet-compile.{compilerName}.rsp");
|
||||
File.WriteAllLines(rsp, compilerArgs);
|
||||
|
||||
var result = Command.Create($"dotnet-compile-{compiler}", $"\"{rsp}\"")
|
||||
var result = Command.Create($"dotnet-compile-{compilerName}", $"\"{rsp}\"")
|
||||
.OnErrorLine(line =>
|
||||
{
|
||||
var diagnostic = ParseDiagnostic(context.ProjectDirectory, line);
|
||||
|
|
|
@ -74,6 +74,8 @@ namespace Microsoft.Extensions.ProjectModel
|
|||
|
||||
public string[] Tags { get; set; }
|
||||
|
||||
public string CompilerName { get; set; }
|
||||
|
||||
public ProjectFilesCollection Files { get; set; }
|
||||
|
||||
public IDictionary<string, string> Commands { get; } = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
|
|
@ -139,6 +139,7 @@ namespace Microsoft.Extensions.ProjectModel
|
|||
project.ProjectUrl = rawProject.ValueAsString("projectUrl");
|
||||
project.LicenseUrl = rawProject.ValueAsString("licenseUrl");
|
||||
project.IconUrl = rawProject.ValueAsString("iconUrl");
|
||||
project.CompilerName = rawProject.ValueAsString("compilerName");
|
||||
|
||||
project.Authors = rawProject.ValueAsStringArray("authors") ?? Array.Empty<string>();
|
||||
project.Owners = rawProject.ValueAsStringArray("owners") ?? Array.Empty<string>();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"description": "Types to model a .NET Project",
|
||||
|
||||
"dependencies": {
|
||||
"Microsoft.CSharp": "4.0.1-beta-23419",
|
||||
"System.Collections": "4.0.11-beta-23419",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue