Making some of the testbase methods protected.

Renaming variables according to code review comments. Adding the folder logic to the builder tests. Creating a separate compilation folder during the build.
This commit is contained in:
Livar Cunha 2016-01-21 15:01:21 -08:00 committed by Livar Cunha
parent b459c3665e
commit fdea0b87e0
24 changed files with 132 additions and 131 deletions

View file

@ -19,7 +19,6 @@ $IntermediatePackagesDir = "$RepoRoot\artifacts\packages\intermediate"
$PackagesDir = "$RepoRoot\artifacts\packages"
New-Item -ItemType Directory -Force -Path $IntermediatePackagesDir
New-Item -ItemType Directory -Force -Path $PackagesDir\$Configuration\$Tfm
$Projects = @(
"Microsoft.DotNet.Cli.Utils",
@ -30,12 +29,10 @@ $Projects = @(
"Microsoft.Extensions.Testing.Abstractions"
)
cp $Stage2Dir\bin\* $PackagesDir\$Configuration\$Tfm -force -recurse
foreach ($ProjectName in $Projects) {
$ProjectFile = "$RepoRoot\src\$ProjectName\project.json"
& $toolsDir\dotnet pack "$ProjectFile" --basepath "$PackagesDir" --output "$IntermediatePackagesDir" --configuration "$Configuration" $versionArg
& $toolsDir\dotnet pack "$ProjectFile" --basepath "$Stage2CompilationDir\bin" --output "$IntermediatePackagesDir" --configuration "$Configuration" $versionArg
if (!$?) {
Write-Host "$toolsDir\dotnet pack failed for: $ProjectFile"
Exit 1

View file

@ -12,7 +12,9 @@ $OutputDir = "$RepoRoot\artifacts\$Rid"
$DnxDir = "$OutputDir\dnx"
$DnxRoot = "$DnxDir\bin"
$Stage1Dir = "$OutputDir\stage1"
$Stage1CompilationDir = "$OutputDir\stage1compilation"
$Stage2Dir = "$OutputDir\stage2"
$Stage2CompilationDir = "$OutputDir\stage2compilation"
$HostDir = "$OutputDir\corehost"
$PackageDir = "$RepoRoot\artifacts\packages\dnvm"
$env:ReleaseSuffix = "beta"

View file

@ -21,7 +21,9 @@ export OUTPUT_ROOT=$REPOROOT/artifacts/$RID
export DNX_DIR=$OUTPUT_ROOT/dnx
export DNX_ROOT=$DNX_DIR/bin
export STAGE1_DIR=$OUTPUT_ROOT/stage1
export STAGE1_COMPILATION_DIR=$OUTPUT_ROOT/stage1compilation
export STAGE2_DIR=$OUTPUT_ROOT/stage2
export STAGE2_COMPILATION_DIR=$OUTPUT_ROOT/stage2compilation
export HOST_DIR=$OUTPUT_ROOT/corehost
export RELEASE_SUFFIX=beta
export CHANNEL=$RELEASE_SUFFIX

View file

@ -9,6 +9,6 @@ header "Compiling stage1 dotnet using downloaded stage0 ..."
$StartPath = $env:PATH
$env:PATH = "$env:DOTNET_INSTALL_DIR\cli\bin;$StartPath"
_ "$RepoRoot\scripts\compile\compile-stage.ps1" @("$Tfm","$Rid","$Configuration","$Stage1Dir","$RepoRoot","$HostDir")
_ "$RepoRoot\scripts\compile\compile-stage.ps1" @("$Tfm","$Rid","$Configuration","$Stage1Dir","$RepoRoot","$HostDir", "$Stage1CompilationDir")
$env:PATH=$StartPath

View file

@ -21,6 +21,6 @@ export PATH=$DOTNET_INSTALL_DIR/bin:$PATH
# Build Stage 1
header "Building stage1 dotnet using downloaded stage0 ..."
OUTPUT_DIR=$STAGE1_DIR $REPOROOT/scripts/compile/compile-stage.sh
COMPILATION_OUTPUT_DIR=$STAGE1_COMPILATION_DIR OUTPUT_DIR=$STAGE1_DIR $REPOROOT/scripts/compile/compile-stage.sh
export PATH=$StartPath

View file

@ -10,6 +10,6 @@ $StartPath = $env:PATH
$env:PATH = "$Stage1Dir\bin;$env:PATH"
# Compile
_ "$RepoRoot\scripts\compile\compile-stage.ps1" @("$Tfm","$Rid","$Configuration","$Stage2Dir","$RepoRoot","$HostDir")
_ "$RepoRoot\scripts\compile\compile-stage.ps1" @("$Tfm","$Rid","$Configuration","$Stage2Dir","$RepoRoot","$HostDir", "$Stage2CompilationDir")
$env:PATH=$StartPath

View file

@ -23,7 +23,7 @@ export PATH=$STAGE1_DIR/bin:$PATH
# Compile Stage 2
header "Compiling stage2 dotnet using just-built stage1 ..."
OUTPUT_DIR=$STAGE2_DIR $REPOROOT/scripts/compile/compile-stage.sh
COMPILATION_OUTPUT_DIR=$STAGE2_COMPILATION_DIR OUTPUT_DIR=$STAGE2_DIR $REPOROOT/scripts/compile/compile-stage.sh
export DOTNET_HOME=$STAGE2_DIR
export DOTNET_TOOLS=$STAGE2_DIR

View file

@ -9,7 +9,8 @@ param(
[Parameter(Mandatory=$true)][string]$Configuration,
[Parameter(Mandatory=$true)][string]$OutputDir,
[Parameter(Mandatory=$true)][string]$RepoRoot,
[Parameter(Mandatory=$true)][string]$HostDir)
[Parameter(Mandatory=$true)][string]$HostDir,
[Parameter(Mandatory=$true)][string]$CompilationOutputDir)
$Projects = @(
"Microsoft.DotNet.Cli",
@ -49,35 +50,47 @@ $FilesToClean = @(
)
$RuntimeOutputDir = "$OutputDir\runtime\coreclr"
$binariesOutputDir = "$OutputDir\bin\$Configuration\$Tfm"
$runtimeBinariesOutputDir = "$RuntimeOutputDir\$Configuration\$Tfm"
$binariesOutputDir = "$CompilationOutputDir\bin\$Configuration\$Tfm"
$runtimeBinariesOutputDir = "$CompilationOutputDir\runtime\coreclr\$Configuration\$Tfm"
if(!(Test-Path $OutputDir\bin))
{
mkdir $OutputDir\bin | Out-Null
}
if(!(Test-Path $RuntimeOutputDir))
{
mkdir $RuntimeOutputDir | Out-Null
}
# Publish each project
$Projects | ForEach-Object {
dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$OutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$_"
dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$CompilationOutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$_"
if (!$?) {
Write-Host Command failed: dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$OutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$_"
Write-Host Command failed: dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$CompilationOutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$_"
exit 1
}
}
if (Test-Path $binariesOutputDir) {
cp $binariesOutputDir\* $OutputDir\bin -force -recurse
Remove-Item $binariesOutputDir -recurse
if (! (Test-Path $binariesOutputDir)) {
$binariesOutputDir = "$CompilationOutputDir\bin"
}
cp $binariesOutputDir\* $OutputDir\bin -force -recurse
# Publish the runtime
dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$RuntimeOutputDir" --configuration "$Configuration" "$RepoRoot\src\Microsoft.DotNet.Runtime"
dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$CompilationOutputDir\runtime\coreclr" --configuration "$Configuration" "$RepoRoot\src\Microsoft.DotNet.Runtime"
if (!$?) {
Write-Host Command failed: dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$RuntimeOutputDir" --configuration "$Configuration" "$RepoRoot\src\Microsoft.DotNet.Runtime"
Write-Host Command failed: dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$CompilationOutputDir\runtime\coreclr" --configuration "$Configuration" "$RepoRoot\src\Microsoft.DotNet.Runtime"
Exit 1
}
if (Test-Path $runtimeBinariesOutputDir) {
cp $runtimeBinariesOutputDir\* $RuntimeOutputDir -force -recurse
Remove-Item $runtimeBinariesOutputDir -recurse
if (! (Test-Path $runtimeBinariesOutputDir)) {
$runtimeBinariesOutputDir = "$CompilationOutputDir\runtime\coreclr"
}
cp $runtimeBinariesOutputDir\* $RuntimeOutputDir -force -recurse
# Clean up bogus additional files
$FilesToClean | ForEach-Object {
$path = Join-Path $RuntimeOutputDir $_

View file

@ -21,6 +21,7 @@ source "$DIR/../common/_common.sh"
[ ! -z "$CONFIGURATION" ] || die "Missing required environment variable CONFIGURATION"
[ ! -z "$OUTPUT_DIR" ] || die "Missing required environment variable OUTPUT_DIR"
[ ! -z "$HOST_DIR" ] || die "Missing required environment variable HOST_DIR"
[ ! -z "$COMPILATION_OUTPUT_DIR" ] || die "Missing required environment variable COMPILATION_OUTPUT_DIR"
PROJECTS=( \
Microsoft.DotNet.Cli \
@ -56,29 +57,32 @@ FILES_TO_CLEAN=( \
)
RUNTIME_OUTPUT_DIR="$OUTPUT_DIR/runtime/coreclr"
BINARIES_OUTPUT_DIR="$OUTPUT_DIR/bin/$CONFIGURATION/$TFM"
RUNTIME_BINARIES_OUTPUT_DIR="$RUNTIME_OUTPUT_DIR/$CONFIGURATION/$TFM"
BINARIES_OUTPUT_DIR="$COMPILATION_OUTPUT_DIR/bin/$CONFIGURATION/$TFM"
RUNTIME_BINARIES_OUTPUT_DIR="$COMPILATION_OUTPUT_DIR/runtime/coreclr/$CONFIGURATION/$TFM"
mkdir -p "$OUTPUT_DIR/bin"
mkdir -p "$RUNTIME_OUTPUT_DIR"
for project in ${PROJECTS[@]}
do
echo dotnet publish --native-subdirectory --framework "$TFM" --output "$OUTPUT_DIR/bin" --configuration "$CONFIGURATION" "$REPOROOT/src/$project"
dotnet publish --native-subdirectory --framework "$TFM" --output "$OUTPUT_DIR/bin" --configuration "$CONFIGURATION" "$REPOROOT/src/$project"
echo dotnet publish --native-subdirectory --framework "$TFM" --output "$COMPILATION_OUTPUT_DIR/bin" --configuration "$CONFIGURATION" "$REPOROOT/src/$project"
dotnet publish --native-subdirectory --framework "$TFM" --output "$COMPILATION_OUTPUT_DIR/bin" --configuration "$CONFIGURATION" "$REPOROOT/src/$project"
done
if [ -d "$BINARIES_OUTPUT_DIR" ]
if [ ! -d "$BINARIES_OUTPUT_DIR" ]
then
cp -R -f $BINARIES_OUTPUT_DIR/* $OUTPUT_DIR/bin
BINARIES_OUTPUT_DIR="$COMPILATION_OUTPUT_DIR/bin"
fi
rm -rf $OUTPUT_DIR/bin/$CONFIGURATION
cp -R -f $BINARIES_OUTPUT_DIR/* $OUTPUT_DIR/bin
# Bring in the runtime
dotnet publish --output "$RUNTIME_OUTPUT_DIR" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Runtime"
dotnet publish --output "$COMPILATION_OUTPUT_DIR/runtime/coreclr" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Runtime"
if [ -d "$RUNTIME_BINARIES_OUTPUT_DIR" ]
if [ ! -d "$RUNTIME_BINARIES_OUTPUT_DIR" ]
then
cp -R -f $RUNTIME_BINARIES_OUTPUT_DIR/* $RUNTIME_OUTPUT_DIR
RUNTIME_BINARIES_OUTPUT_DIR="$COMPILATION_OUTPUT_DIR/runtime/coreclr"
fi
rm -rf "$RUNTIME_OUTPUT_DIR/$CONFIGURATION"
cp -R -f $RUNTIME_BINARIES_OUTPUT_DIR/* $RUNTIME_OUTPUT_DIR
# Clean up bogus additional files
for file in ${FILES_TO_CLEAN[@]}

View file

@ -28,7 +28,6 @@ $TestProjects | ForEach-Object {
if (Test-Path $TestBinRoot\$Configuration\dnxcore50) {
cp $TestBinRoot\$Configuration\dnxcore50\* $TestBinRoot -force -recurse
Remove-Item $TestBinRoot\$Configuration\dnxcore50 -recurse
}
## Temporary Workaround for Native Compilation

View file

@ -36,7 +36,6 @@ if [ -d "$TestBinRoot/$CONFIGURATION/dnxcore50" ]
then
cp -R -f $TestBinRoot/$CONFIGURATION/dnxcore50/* $TestBinRoot
fi
rm -rf $TestBinRoot/$CONFIGURATION/dnxcore50
# copy TestProjects folder which is used by the test cases
mkdir -p "$TestBinRoot/TestProjects"

View file

@ -20,58 +20,6 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
{
public static string ProjectName(this ProjectContext context) => context.RootProject.Identity.Name;
public static string GetOutputPath(this ProjectContext context, string configuration, string currentOutputPath)
{
var outputPath = string.Empty;
if (string.IsNullOrEmpty(currentOutputPath))
{
outputPath = Path.Combine(
GetDefaultRootOutputPath(context, currentOutputPath),
Constants.BinDirectoryName,
configuration,
context.TargetFramework.GetTwoDigitShortFolderName());
}
else
{
outputPath = currentOutputPath;
}
return outputPath;
}
public static string GetIntermediateOutputPath(this ProjectContext context, string configuration, string intermediateOutputValue, string currentOutputPath)
{
var intermediateOutputPath = string.Empty;
if (string.IsNullOrEmpty(intermediateOutputValue))
{
intermediateOutputPath = Path.Combine(
GetDefaultRootOutputPath(context, currentOutputPath),
Constants.ObjDirectoryName,
configuration,
context.TargetFramework.GetTwoDigitShortFolderName());
}
else
{
intermediateOutputPath = intermediateOutputValue;
}
return intermediateOutputPath;
}
public static string GetDefaultRootOutputPath(ProjectContext context, string currentOutputPath)
{
var rootOutputPath = string.Empty;
if (string.IsNullOrEmpty(currentOutputPath))
{
rootOutputPath = context.ProjectFile.ProjectDirectory;
}
return rootOutputPath;
}
public static void MakeCompilationOutputRunnable(this ProjectContext context, string outputPath, string configuration)
{
context

View file

@ -8,33 +8,58 @@ namespace Microsoft.DotNet.ProjectModel
{
public class OutputPathCalculator
{
private const string ObjDirectoryName = "obj";
private readonly ProjectContext _project;
public string BaseRootOutputPath { get; }
/// <summary>
/// Unaltered output path. Either what is passed in in the constructor, or the project directory.
/// </summary>
private string BaseOutputPath { get; }
public string BaseCompilationOutputPath { get; }
public OutputPathCalculator(
ProjectContext project,
string rootOutputPath)
string baseOutputPath)
{
_project = project;
BaseRootOutputPath = string.IsNullOrWhiteSpace(rootOutputPath)
BaseOutputPath = string.IsNullOrWhiteSpace(baseOutputPath) ? _project.ProjectDirectory : baseOutputPath;
BaseCompilationOutputPath = string.IsNullOrWhiteSpace(baseOutputPath)
? Path.Combine(_project.ProjectDirectory, DirectoryNames.Bin)
: rootOutputPath;
: baseOutputPath;
}
public string GetOutputDirectoryPath(string buildConfiguration)
public string GetCompilationOutputPath(string buildConfiguration)
{
var outDir = Path.Combine(
BaseRootOutputPath,
BaseCompilationOutputPath,
buildConfiguration,
_project.TargetFramework.GetTwoDigitShortFolderName());
// if (!string.IsNullOrEmpty(_project.RuntimeIdentifier))
// {
// outDir = Path.Combine(outDir, _project.RuntimeIdentifier);
// }
return outDir;
}
public string GetIntermediateOutputPath(string buildConfiguration, string intermediateOutputValue)
{
string intermediateOutputPath;
if (string.IsNullOrEmpty(intermediateOutputValue))
{
intermediateOutputPath = Path.Combine(
BaseOutputPath,
ObjDirectoryName,
buildConfiguration,
_project.TargetFramework.GetTwoDigitShortFolderName());
}
else
{
intermediateOutputPath = intermediateOutputValue;
}
return intermediateOutputPath;
}
}
}

View file

@ -39,8 +39,10 @@ namespace Microsoft.DotNet.Tools.Build
_args = (BuilderCommandApp) args.ShallowCopy();
// Set up Output Paths. They are unique per each CompileContext
_args.OutputValue = _rootProject.GetOutputPathCalculator(_args.OutputValue).BaseRootOutputPath;
_args.IntermediateValue = _rootProject.GetIntermediateOutputPath(_args.ConfigValue, _args.IntermediateValue, _args.OutputValue);
var outputPathCalculator = _rootProject.GetOutputPathCalculator(_args.OutputValue);
_args.OutputValue = outputPathCalculator.BaseCompilationOutputPath;
_args.IntermediateValue =
outputPathCalculator.GetIntermediateOutputPath(_args.ConfigValue, _args.IntermediateValue);
// Set up dependencies
_dependencies = new ProjectDependenciesFacade(_rootProject, _args.ConfigValue);
@ -338,7 +340,7 @@ namespace Microsoft.DotNet.Tools.Build
public static CompilerIO GetCompileIO(ProjectContext project, string config, string outputPath, string intermediaryOutputPath, ProjectDependenciesFacade dependencies)
{
var compilerIO = new CompilerIO(new List<string>(), new List<string>());
var binariesOutputPath = project.GetOutputPathCalculator(outputPath).GetOutputDirectoryPath(config);
var binariesOutputPath = project.GetOutputPathCalculator(outputPath).GetCompilationOutputPath(config);
var compilationOutput = CompilerUtil.GetCompilationOutput(project.ProjectFile, project.TargetFramework, config, binariesOutputPath);
// input: project.json

View file

@ -61,10 +61,11 @@ namespace Microsoft.DotNet.Tools.Compiler
ProjectContext context,
CompilerCommandApp args)
{
var outputPath = context.GetOutputPathCalculator(args.OutputValue).GetOutputDirectoryPath(args.ConfigValue);
var outputPathCalculator = context.GetOutputPathCalculator(args.OutputValue);
var outputPath = outputPathCalculator.GetCompilationOutputPath(args.ConfigValue);
var nativeOutputPath = Path.Combine(outputPath, "native");
var intermediateOutputPath =
context.GetIntermediateOutputPath(args.ConfigValue, args.IntermediateValue, outputPath);
var intermediateOutputPath =
outputPathCalculator.GetIntermediateOutputPath(args.ConfigValue, args.IntermediateValue);
var nativeIntermediateOutputPath = Path.Combine(intermediateOutputPath, "native");
Directory.CreateDirectory(nativeOutputPath);
Directory.CreateDirectory(nativeIntermediateOutputPath);
@ -160,8 +161,10 @@ namespace Microsoft.DotNet.Tools.Compiler
private static bool CompileProject(ProjectContext context, CompilerCommandApp args)
{
// Set up Output Paths
var outputPath = context.GetOutputPathCalculator(args.OutputValue).GetOutputDirectoryPath(args.ConfigValue);
string intermediateOutputPath = context.GetIntermediateOutputPath(args.ConfigValue, args.IntermediateValue, outputPath);
var outputPathCalculator = context.GetOutputPathCalculator(args.OutputValue);
var outputPath = outputPathCalculator.GetCompilationOutputPath(args.ConfigValue);
var intermediateOutputPath =
outputPathCalculator.GetIntermediateOutputPath(args.ConfigValue, args.IntermediateValue);
Directory.CreateDirectory(outputPath);
Directory.CreateDirectory(intermediateOutputPath);

View file

@ -14,24 +14,24 @@ namespace Microsoft.DotNet.Tools.Pack
private readonly string _configuration;
public bool PackageArtifactsPathSet => !string.IsNullOrWhiteSpace(PackageArtifactsPathParameter);
public bool PackageOutputPathSet => !string.IsNullOrWhiteSpace(PackageOutputPathParameter);
public string CompiledArtifactsPathParameter { get; }
public string PackageArtifactsPathParameter { get; }
public string PackageOutputPathParameter { get; }
public bool CompiledArtifactsPathSet => !string.IsNullOrWhiteSpace(CompiledArtifactsPathParameter);
public string CompiledArtifactsPath =>
CompiledArtifactsPathSet ? CompiledArtifactsPathParameter : PackageArtifactsPath;
CompiledArtifactsPathSet ? CompiledArtifactsPathParameter : PackageOutputPath;
public string PackageArtifactsPath
public string PackageOutputPath
{
get
{
if (PackageArtifactsPathSet)
if (PackageOutputPathSet)
{
return PackageArtifactsPathParameter;
return PackageOutputPathParameter;
}
var outputPath = Path.Combine(
@ -45,12 +45,12 @@ namespace Microsoft.DotNet.Tools.Pack
public ArtifactPathsCalculator(
Project project,
string compiledArtifactsPath,
string packageArtifactsPath,
string packageOutputPath,
string configuration)
{
_project = project;
CompiledArtifactsPathParameter = compiledArtifactsPath;
PackageArtifactsPathParameter = packageArtifactsPath;
PackageOutputPathParameter = packageOutputPath;
_configuration = configuration;
}

View file

@ -42,9 +42,9 @@ namespace Microsoft.DotNet.Tools.Pack
var argsBuilder = new StringBuilder();
argsBuilder.Append($"--configuration {_configuration}");
if (_artifactPathsCalculator.PackageArtifactsPathSet)
if (_artifactPathsCalculator.PackageOutputPathSet)
{
argsBuilder.Append($" --output \"{_artifactPathsCalculator.PackageArtifactsPathParameter}\"");
argsBuilder.Append($" --output \"{_artifactPathsCalculator.PackageOutputPathParameter}\"");
}
if (!string.IsNullOrEmpty(_intermediateOutputPath))

View file

@ -58,7 +58,7 @@ namespace Microsoft.DotNet.Tools.Compiler
}
var packageOutputPath = Path.Combine(
ArtifactPathsCalculator.PackageArtifactsPath,
ArtifactPathsCalculator.PackageOutputPath,
Configuration,
GetPackageName() + NuGet.Constants.PackageExtension);

View file

@ -83,28 +83,28 @@ namespace Microsoft.DotNet.Tools.Publish
var options = context.ProjectFile.GetCompilerOptions(context.TargetFramework, configuration);
var outputPathCalculator = context.GetOutputPathCalculator(baseOutputPath);
var outputPath = outputPathCalculator.GetOutputDirectoryPath(configuration);
var outputPath = outputPathCalculator.GetCompilationOutputPath(configuration);
var contextVariables = new Dictionary<string, string>
{
{ "publish:ProjectPath", context.ProjectDirectory },
{ "publish:Configuration", configuration },
{ "publish:OutputPath", outputPathCalculator.BaseRootOutputPath },
{ "publish:OutputPath", outputPathCalculator.BaseCompilationOutputPath },
{ "publish:Framework", context.TargetFramework.Framework },
{ "publish:Runtime", context.RuntimeIdentifier },
};
RunScripts(context, ScriptNames.PrePublish, contextVariables);
if (!Directory.Exists(outputPathCalculator.BaseRootOutputPath))
if (!Directory.Exists(outputPathCalculator.BaseCompilationOutputPath))
{
Directory.CreateDirectory(outputPathCalculator.BaseRootOutputPath);
Directory.CreateDirectory(outputPathCalculator.BaseCompilationOutputPath);
}
// Compile the project (and transitively, all it's dependencies)
var result = Command.Create("dotnet-build",
$"--framework \"{context.TargetFramework.DotNetFrameworkName}\" " +
$"--output \"{outputPathCalculator.BaseRootOutputPath}\" " +
$"--output \"{outputPathCalculator.BaseCompilationOutputPath}\" " +
$"--configuration \"{configuration}\" " +
"--no-host " +
$"\"{context.ProjectFile.ProjectDirectory}\"")

View file

@ -102,7 +102,7 @@ namespace Microsoft.DotNet.Tools.Run
// Now launch the output and give it the results
var outputName = Path.Combine(
_context.GetOutputPathCalculator(tempDir).GetOutputDirectoryPath(Configuration),
_context.GetOutputPathCalculator(tempDir).GetCompilationOutputPath(Configuration),
_context.ProjectFile.Name + Constants.ExeSuffix);
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{

View file

@ -58,7 +58,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
buildCommand.Execute().Should().Pass();
TestOutputExecutable(OutputDirectory, buildCommand.GetOutputExecutableName(), s_expectedOutput);
var binariesOutputDirectory = GetBinariesOutputDirectory(OutputDirectory, false);
var binariesOutputDirectory = GetCompilationOutputPath(OutputDirectory, false);
var latestWriteTimeFirstBuild = GetLastWriteTimeOfDirectoryFiles(
binariesOutputDirectory);
@ -125,7 +125,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
// first build
var buildCommand = new BuildCommand(TestProject, output: OutputDirectory, native: true, nativeCppMode: true);
var binariesOutputDirectory = GetBinariesOutputDirectory(OutputDirectory, false);
var binariesOutputDirectory = GetCompilationOutputPath(OutputDirectory, false);
buildCommand.Execute().Should().Pass();

View file

@ -100,7 +100,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
private string GetOutputFileForProject(string projectName)
{
return Path.Combine(GetBinDirectory(), projectName + ".dll");
return Path.Combine(GetCompilationOutputPath(), projectName + ".dll");
}
private IEnumerable<string> GetSourceFilesForProject(string projectName)
@ -109,6 +109,13 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
Where(f => f.EndsWith(".cs"));
}
protected string GetCompilationOutputPath()
{
var executablePath = Path.Combine(GetBinDirectory(), "Debug", "dnxcore50");
return executablePath;
}
private void RunRestore(string args)
{
var restoreCommand = new RestoreCommand();

View file

@ -102,14 +102,14 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
var buildResult = BuildProject();
AssertProjectCompiled(_mainProject, buildResult);
Reporter.Verbose.WriteLine($"Files in {GetBinDirectory()}");
foreach (var file in Directory.EnumerateFiles(GetBinDirectory()))
Reporter.Verbose.WriteLine($"Files in {GetCompilationOutputPath()}");
foreach (var file in Directory.EnumerateFiles(GetCompilationOutputPath()))
{
Reporter.Verbose.Write($"\t {file}");
}
// delete output files with extensions
foreach (var outputFile in Directory.EnumerateFiles(GetBinDirectory()).Where(f =>
foreach (var outputFile in Directory.EnumerateFiles(GetCompilationOutputPath()).Where(f =>
{
var fileName = Path.GetFileName(f);
return fileName.StartsWith(_mainProject, StringComparison.OrdinalIgnoreCase) &&

View file

@ -64,7 +64,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
string expectedOutput,
bool native = false)
{
var executablePath = Path.Combine(GetBinariesOutputDirectory(outputDir, native), executableName);
var executablePath = Path.Combine(GetCompilationOutputPath(outputDir, native), executableName);
var executableCommand = new TestCommand(executablePath);
@ -75,12 +75,12 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
result.Should().Pass();
}
private void TestNativeOutputExecutable(string outputDir, string executableName, string expectedOutput)
protected void TestNativeOutputExecutable(string outputDir, string executableName, string expectedOutput)
{
TestOutputExecutable(outputDir, executableName, expectedOutput, true);
}
private string GetBinariesOutputDirectory(string outputDir, bool native)
protected string GetCompilationOutputPath(string outputDir, bool native)
{
var executablePath = Path.Combine(outputDir, "Debug", "dnxcore50");
if (native)