Folding ProjectFile.Name to compiler options
This commit is contained in:
parent
621d8376c3
commit
ce6ce3c49b
6 changed files with 19 additions and 22 deletions
|
@ -80,7 +80,7 @@ namespace Microsoft.Dotnet.Cli.Compiler.Common
|
||||||
if (emitEntryPoint && !string.IsNullOrEmpty(_context.RuntimeIdentifier))
|
if (emitEntryPoint && !string.IsNullOrEmpty(_context.RuntimeIdentifier))
|
||||||
{
|
{
|
||||||
// TODO: Pick a host based on the RID
|
// TODO: Pick a host based on the RID
|
||||||
CoreHost.CopyTo(_runtimeOutputPath, GetOutputName() + Constants.ExeSuffix);
|
CoreHost.CopyTo(_runtimeOutputPath, _compilerOptions.OutputName + Constants.ExeSuffix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ namespace Microsoft.Dotnet.Cli.Compiler.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
var runtimeConfigJsonFile =
|
var runtimeConfigJsonFile =
|
||||||
Path.Combine(_runtimeOutputPath, GetOutputName() + FileNameSuffixes.RuntimeConfigJson);
|
Path.Combine(_runtimeOutputPath, _compilerOptions.OutputName + FileNameSuffixes.RuntimeConfigJson);
|
||||||
|
|
||||||
using (var writer = new JsonTextWriter(new StreamWriter(File.Create(runtimeConfigJsonFile))))
|
using (var writer = new JsonTextWriter(new StreamWriter(File.Create(runtimeConfigJsonFile))))
|
||||||
{
|
{
|
||||||
|
@ -159,7 +159,7 @@ namespace Microsoft.Dotnet.Cli.Compiler.Common
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(_runtimeOutputPath);
|
Directory.CreateDirectory(_runtimeOutputPath);
|
||||||
|
|
||||||
var depsFilePath = Path.Combine(_runtimeOutputPath, GetOutputName() + FileNameSuffixes.Deps);
|
var depsFilePath = Path.Combine(_runtimeOutputPath, _compilerOptions.OutputName + FileNameSuffixes.Deps);
|
||||||
File.WriteAllLines(depsFilePath, exporter
|
File.WriteAllLines(depsFilePath, exporter
|
||||||
.GetDependencies(LibraryType.Package)
|
.GetDependencies(LibraryType.Package)
|
||||||
.SelectMany(GenerateLines));
|
.SelectMany(GenerateLines));
|
||||||
|
@ -176,7 +176,7 @@ namespace Microsoft.Dotnet.Cli.Compiler.Common
|
||||||
runtime: _context.RuntimeIdentifier ?? string.Empty);
|
runtime: _context.RuntimeIdentifier ?? string.Empty);
|
||||||
|
|
||||||
var writer = new DependencyContextWriter();
|
var writer = new DependencyContextWriter();
|
||||||
var depsJsonFilePath = Path.Combine(_runtimeOutputPath, GetOutputName() + FileNameSuffixes.DepsJson);
|
var depsJsonFilePath = Path.Combine(_runtimeOutputPath, _compilerOptions.OutputName + FileNameSuffixes.DepsJson);
|
||||||
using (var fileStream = File.Create(depsJsonFilePath))
|
using (var fileStream = File.Create(depsJsonFilePath))
|
||||||
{
|
{
|
||||||
writer.Write(dependencyContext, fileStream);
|
writer.Write(dependencyContext, fileStream);
|
||||||
|
@ -212,11 +212,6 @@ namespace Microsoft.Dotnet.Cli.Compiler.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetOutputName()
|
|
||||||
{
|
|
||||||
return _compilerOptions.OutputName ?? _context.ProjectFile.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<string> GenerateLines(LibraryExport export)
|
private static IEnumerable<string> GenerateLines(LibraryExport export)
|
||||||
{
|
{
|
||||||
return GenerateLines(export, export.RuntimeAssemblies, "runtime")
|
return GenerateLines(export, export.RuntimeAssemblies, "runtime")
|
||||||
|
|
|
@ -42,9 +42,7 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
{
|
{
|
||||||
var compilationOptions = Project.GetCompilerOptions(Framework, Configuration);
|
var compilationOptions = Project.GetCompilerOptions(Framework, Configuration);
|
||||||
|
|
||||||
return Path.Combine(
|
return Path.Combine(BasePath, compilationOptions.OutputName + OutputExtension);
|
||||||
BasePath,
|
|
||||||
(compilationOptions.OutputName ?? Project.Name) + OutputExtension);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,14 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
var targetFrameworkOptions = targetFramework != null ? GetCompilerOptions(targetFramework) : null;
|
var targetFrameworkOptions = targetFramework != null ? GetCompilerOptions(targetFramework) : null;
|
||||||
|
|
||||||
// Combine all of the options
|
// Combine all of the options
|
||||||
return CommonCompilerOptions.Combine(rootOptions, configurationOptions, targetFrameworkOptions);
|
var compilerOptions = CommonCompilerOptions.Combine(rootOptions, configurationOptions, targetFrameworkOptions);
|
||||||
|
|
||||||
|
if (compilerOptions.OutputName == null)
|
||||||
|
{
|
||||||
|
compilerOptions.OutputName = Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return compilerOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TargetFrameworkInformation GetTargetFramework(NuGetFramework targetFramework)
|
public TargetFrameworkInformation GetTargetFramework(NuGetFramework targetFramework)
|
||||||
|
|
|
@ -37,12 +37,10 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
// The executable is a DLL in this case
|
// The executable is a DLL in this case
|
||||||
extension = FileNameSuffixes.DotNet.DynamicLib;
|
extension = FileNameSuffixes.DotNet.DynamicLib;
|
||||||
}
|
}
|
||||||
|
|
||||||
var compilationOptions = Project.GetCompilerOptions(Framework, Configuration);
|
var compilationOptions = Project.GetCompilerOptions(Framework, Configuration);
|
||||||
|
|
||||||
return Path.Combine(
|
return Path.Combine(BasePath, compilationOptions.OutputName + extension);
|
||||||
BasePath,
|
|
||||||
(compilationOptions.OutputName ?? Project.Name) + extension);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ namespace Microsoft.DotNet.Tools.Compiler
|
||||||
{
|
{
|
||||||
var transformedResource = resourceFile.GetTransformedFile(intermediateOutputPath);
|
var transformedResource = resourceFile.GetTransformedFile(intermediateOutputPath);
|
||||||
var resourceName = ResourceManifestName.CreateManifestName(
|
var resourceName = ResourceManifestName.CreateManifestName(
|
||||||
Path.GetFileName(resourceFile.ResolvedPath), compilationOptions.OutputName ?? context.ProjectFile.Name);
|
Path.GetFileName(resourceFile.ResolvedPath), compilationOptions.OutputName);
|
||||||
compilerArgs.Add($"--resource:\"{transformedResource}\",{resourceName}");
|
compilerArgs.Add($"--resource:\"{transformedResource}\",{resourceName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,14 +120,13 @@ namespace Microsoft.DotNet.Tools.Compiler
|
||||||
context.RuntimeIdentifier ?? string.Empty);
|
context.RuntimeIdentifier ?? string.Empty);
|
||||||
|
|
||||||
var writer = new DependencyContextWriter();
|
var writer = new DependencyContextWriter();
|
||||||
var depsJsonFile = Path.Combine(intermediateOutputPath,
|
var depsJsonFile = Path.Combine(intermediateOutputPath, compilationOptions.OutputName + "dotnet-compile.deps.json");
|
||||||
(compilationOptions.OutputName ?? context.ProjectFile.Name) + "dotnet-compile.deps.json");
|
|
||||||
using (var fileStream = File.Create(depsJsonFile))
|
using (var fileStream = File.Create(depsJsonFile))
|
||||||
{
|
{
|
||||||
writer.Write(dependencyContext, fileStream);
|
writer.Write(dependencyContext, fileStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
compilerArgs.Add($"--resource:\"{depsJsonFile}\",{compilationOptions.OutputName ?? context.ProjectFile.Name}.deps.json");
|
compilerArgs.Add($"--resource:\"{depsJsonFile}\",{compilationOptions.OutputName}.deps.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AddNonCultureResources(context.ProjectFile, compilerArgs, intermediateOutputPath))
|
if (!AddNonCultureResources(context.ProjectFile, compilerArgs, intermediateOutputPath))
|
||||||
|
|
|
@ -240,7 +240,7 @@ namespace Microsoft.DotNet.Tools.Publish
|
||||||
}
|
}
|
||||||
|
|
||||||
var outputBinaryName = binaryName.Equals(Constants.HostExecutableName)
|
var outputBinaryName = binaryName.Equals(Constants.HostExecutableName)
|
||||||
? ((compilationOptions.OutputName ?? context.ProjectFile.Name) + Constants.ExeSuffix)
|
? compilationOptions.OutputName + Constants.ExeSuffix
|
||||||
: binaryName;
|
: binaryName;
|
||||||
var outputBinaryPath = Path.Combine(outputPath, outputBinaryName);
|
var outputBinaryPath = Path.Combine(outputPath, outputBinaryName);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue