Changing native out flag to output flag to match compiler. Also changing the rsp file spliting to handle both /r/n and /r
Fixing the input path to the native compiler. It was adding /native to it before. Switching compile native to System.CommandLine for args parsing and removing quotes from -native.rsp. Fixing build_appdeps.cmd: Removed the * from __ApPDepSDK as xcopy does not honor that. In order to stay independent of the version of appDep, we CD into the appDepSDK and then navigate to the first folder we find, which should always be one, as we clear the folder before restoring appDep, after that we xcopy
This commit is contained in:
parent
9fbf7a7995
commit
d0100335da
4 changed files with 125 additions and 114 deletions
|
@ -92,25 +92,39 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
}
|
||||
}
|
||||
|
||||
private static bool CompileNative(ProjectContext context, string configuration, string outputOptionValue, bool buildProjectReferences, string intermediateOutputValue, string archValue, string ilcArgsValue, bool isCppMode)
|
||||
private static bool CompileNative(
|
||||
ProjectContext context,
|
||||
string configuration,
|
||||
string outputOptionValue,
|
||||
bool buildProjectReferences,
|
||||
string intermediateOutputValue,
|
||||
string archValue,
|
||||
string ilcArgsValue,
|
||||
bool isCppMode)
|
||||
{
|
||||
var outputPath = Path.Combine(GetOutputPath(context, configuration, outputOptionValue), "native");
|
||||
var intermediateOutputPath = GetIntermediateOutputPath(context, configuration, intermediateOutputValue, outputOptionValue);
|
||||
var outputPath = GetOutputPath(context, configuration, outputOptionValue);
|
||||
var nativeOutputPath = Path.Combine(GetOutputPath(context, configuration, outputOptionValue), "native");
|
||||
var intermediateOutputPath =
|
||||
GetIntermediateOutputPath(context, configuration, intermediateOutputValue, outputOptionValue);
|
||||
|
||||
Directory.CreateDirectory(outputPath);
|
||||
Directory.CreateDirectory(nativeOutputPath);
|
||||
Directory.CreateDirectory(intermediateOutputPath);
|
||||
|
||||
var compilationOptions = context.ProjectFile.GetCompilerOptions(context.TargetFramework, configuration);
|
||||
var managedOutput = GetProjectOutput(context.ProjectFile, context.TargetFramework, configuration, outputPath);
|
||||
var managedOutput =
|
||||
GetProjectOutput(context.ProjectFile, context.TargetFramework, configuration, outputPath);
|
||||
|
||||
var nativeArgs = new List<string>();
|
||||
|
||||
// Input Assembly
|
||||
nativeArgs.Add($"\"{managedOutput}\"");
|
||||
nativeArgs.Add($"{managedOutput}");
|
||||
|
||||
// ILC Args
|
||||
nativeArgs.Add("--ilcargs");
|
||||
nativeArgs.Add($"\"{ilcArgsValue}\"");
|
||||
if (!string.IsNullOrWhiteSpace(ilcArgsValue))
|
||||
{
|
||||
nativeArgs.Add("--ilcargs");
|
||||
nativeArgs.Add($"{ilcArgsValue}");
|
||||
}
|
||||
|
||||
// CodeGen Mode
|
||||
if(isCppMode)
|
||||
|
@ -135,37 +149,11 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
|
||||
// Intermediate Path
|
||||
nativeArgs.Add("--temp-output");
|
||||
nativeArgs.Add($"\"{intermediateOutputPath}\"");
|
||||
nativeArgs.Add($"{intermediateOutputPath}");
|
||||
|
||||
// Output Path
|
||||
nativeArgs.Add("--output");
|
||||
nativeArgs.Add($"\"{outputPath}\"");
|
||||
|
||||
// Dependencies
|
||||
var exporter = context.CreateExporter(configuration);
|
||||
var dependencies = exporter.GetDependencies().ToList();
|
||||
foreach (var dependency in dependencies)
|
||||
{
|
||||
var projectDependency = dependency.Library as ProjectDescription;
|
||||
|
||||
if (projectDependency != null)
|
||||
{
|
||||
if (projectDependency.Project.Files.SourceFiles.Any())
|
||||
{
|
||||
var projectOutputPath = GetProjectOutput(projectDependency.Project, projectDependency.Framework, configuration, outputPath);
|
||||
nativeArgs.Add("-r");
|
||||
nativeArgs.Add($"\"{projectOutputPath}\"");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach(var dep in dependency.RuntimeAssemblies)
|
||||
{
|
||||
nativeArgs.Add("-r");
|
||||
nativeArgs.Add($"\"{dep.ResolvedPath}\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
nativeArgs.Add($"{nativeOutputPath}");
|
||||
|
||||
// Write Response File
|
||||
var rsp = Path.Combine(intermediateOutputPath, $"dotnet-compile-native.{context.ProjectFile.Name}.rsp");
|
||||
|
@ -175,7 +163,7 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
// Need CoreRT Framework published to nuget
|
||||
|
||||
// Do Native Compilation
|
||||
var result = Command.Create($"dotnet-compile-native", $"--rsp \"{rsp}\"")
|
||||
var result = Command.Create("dotnet-compile-native", $"--rsp \"{rsp}\"")
|
||||
.ForwardStdErr()
|
||||
.ForwardStdOut()
|
||||
.Execute();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue