Fix build-base-path to be converted to a full path.
This allows commands to run in different working directories and pass around the full path to the build-base-path, instead of a relative path.
This commit is contained in:
parent
f2d917ed2e
commit
6249829e68
5 changed files with 22 additions and 4 deletions
|
@ -223,5 +223,19 @@ namespace Microsoft.DotNet.Tools.Common
|
||||||
|
|
||||||
return Path.GetExtension(filePath).Equals(extension, comparison);
|
return Path.GetExtension(filePath).Equals(extension, comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the fully-qualified path without failing if the
|
||||||
|
/// path is empty.
|
||||||
|
/// </summary>
|
||||||
|
public static string GetFullPath(string path)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
|
{
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Path.GetFullPath(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@ using Microsoft.DotNet.Cli.CommandLine;
|
||||||
using Microsoft.DotNet.Cli.Utils;
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
using Microsoft.DotNet.InternalAbstractions;
|
using Microsoft.DotNet.InternalAbstractions;
|
||||||
using Microsoft.DotNet.ProjectModel;
|
using Microsoft.DotNet.ProjectModel;
|
||||||
|
using Microsoft.DotNet.Tools.Common;
|
||||||
using NuGet.Frameworks;
|
using NuGet.Frameworks;
|
||||||
|
|
||||||
// This class is responsible with defining the arguments for the Compile verb.
|
// This class is responsible with defining the arguments for the Compile verb.
|
||||||
|
@ -97,7 +98,7 @@ namespace Microsoft.DotNet.Tools.Compiler
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputValue = _outputOption.Value();
|
OutputValue = _outputOption.Value();
|
||||||
BuildBasePathValue = _buildBasePath.Value();
|
BuildBasePathValue = PathUtility.GetFullPath(_buildBasePath.Value());
|
||||||
ConfigValue = _configurationOption.Value() ?? Constants.DefaultConfiguration;
|
ConfigValue = _configurationOption.Value() ?? Constants.DefaultConfiguration;
|
||||||
RuntimeValue = _runtimeOption.Value();
|
RuntimeValue = _runtimeOption.Value();
|
||||||
VersionSuffixValue = _versionSuffixOption.Value();
|
VersionSuffixValue = _versionSuffixOption.Value();
|
||||||
|
|
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||||
using Microsoft.DotNet.Cli.CommandLine;
|
using Microsoft.DotNet.Cli.CommandLine;
|
||||||
using Microsoft.DotNet.Cli.Utils;
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
using Microsoft.DotNet.ProjectModel;
|
using Microsoft.DotNet.ProjectModel;
|
||||||
|
using Microsoft.DotNet.Tools.Common;
|
||||||
using Microsoft.DotNet.Tools.Pack;
|
using Microsoft.DotNet.Tools.Pack;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Tools.Compiler
|
namespace Microsoft.DotNet.Tools.Compiler
|
||||||
|
@ -61,7 +62,7 @@ namespace Microsoft.DotNet.Tools.Compiler
|
||||||
|
|
||||||
var configValue = configuration.Value() ?? Cli.Utils.Constants.DefaultConfiguration;
|
var configValue = configuration.Value() ?? Cli.Utils.Constants.DefaultConfiguration;
|
||||||
var outputValue = output.Value();
|
var outputValue = output.Value();
|
||||||
var buildBasePathValue = buildBasePath.Value();
|
var buildBasePathValue = PathUtility.GetFullPath(buildBasePath.Value());
|
||||||
|
|
||||||
var contexts = ProjectContext.CreateContextForEachFramework(pathValue, settings);
|
var contexts = ProjectContext.CreateContextForEachFramework(pathValue, settings);
|
||||||
var project = contexts.First().ProjectFile;
|
var project = contexts.First().ProjectFile;
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.IO;
|
||||||
using Microsoft.DotNet.Cli.CommandLine;
|
using Microsoft.DotNet.Cli.CommandLine;
|
||||||
using Microsoft.DotNet.Cli.Utils;
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
using Microsoft.DotNet.ProjectModel;
|
using Microsoft.DotNet.ProjectModel;
|
||||||
|
using Microsoft.DotNet.Tools.Common;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Tools.Publish
|
namespace Microsoft.DotNet.Tools.Publish
|
||||||
{
|
{
|
||||||
|
@ -37,7 +38,7 @@ namespace Microsoft.DotNet.Tools.Publish
|
||||||
|
|
||||||
publish.Framework = framework.Value();
|
publish.Framework = framework.Value();
|
||||||
publish.Runtime = runtime.Value();
|
publish.Runtime = runtime.Value();
|
||||||
publish.BuildBasePath = buildBasePath.Value();
|
publish.BuildBasePath = PathUtility.GetFullPath(buildBasePath.Value());
|
||||||
publish.OutputPath = output.Value();
|
publish.OutputPath = output.Value();
|
||||||
publish.Configuration = configuration.Value() ?? Constants.DefaultConfiguration;
|
publish.Configuration = configuration.Value() ?? Constants.DefaultConfiguration;
|
||||||
publish.NativeSubdirectories = nativeSubdirectories.HasValue();
|
publish.NativeSubdirectories = nativeSubdirectories.HasValue();
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.DotNet.Cli.CommandLine;
|
using Microsoft.DotNet.Cli.CommandLine;
|
||||||
using Microsoft.DotNet.Cli.Utils;
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
|
using Microsoft.DotNet.Tools.Common;
|
||||||
using NuGet.Frameworks;
|
using NuGet.Frameworks;
|
||||||
using static System.Int32;
|
using static System.Int32;
|
||||||
|
|
||||||
|
@ -103,7 +104,7 @@ namespace Microsoft.DotNet.Tools.Test
|
||||||
}
|
}
|
||||||
|
|
||||||
Output = _outputOption.Value();
|
Output = _outputOption.Value();
|
||||||
BuildBasePath = _buildBasePath.Value();
|
BuildBasePath = PathUtility.GetFullPath(_buildBasePath.Value());
|
||||||
Config = _configurationOption.Value() ?? Constants.DefaultConfiguration;
|
Config = _configurationOption.Value() ?? Constants.DefaultConfiguration;
|
||||||
Runtime = _runtimeOption.Value();
|
Runtime = _runtimeOption.Value();
|
||||||
NoBuild = _noBuildOption.HasValue();
|
NoBuild = _noBuildOption.HasValue();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue