Browse Source

cli local path fixes

resolves https://github.com/volosoft/volo/issues/2374
pull/4209/head
Yunus Emre Kalkan 6 years ago
parent
commit
e8457fe009
  1. 21
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs
  2. 22
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs
  3. 5
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs
  4. 25
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs
  5. 5
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs
  6. 1
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

21
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs

@ -48,16 +48,22 @@ namespace Volo.Abp.Cli.Commands
var outputFolder = GetOutPutFolder(commandLineArgs);
Logger.LogInformation("Output folder: " + outputFolder);
var gitHubLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubLocalRepositoryPath.Long);
if (gitHubLocalRepositoryPath != null)
var gitHubAbpLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubAbpLocalRepositoryPath.Long);
if (gitHubAbpLocalRepositoryPath != null)
{
Logger.LogInformation("GitHub Local Repository Path: " + gitHubLocalRepositoryPath);
Logger.LogInformation("GitHub Abp Local Repository Path: " + gitHubAbpLocalRepositoryPath);
}
var gitHubVoloLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubVoloLocalRepositoryPath.Long);
if (gitHubVoloLocalRepositoryPath != null)
{
Logger.LogInformation("GitHub Volo Local Repository Path: " + gitHubVoloLocalRepositoryPath);
}
commandLineArgs.Options.Add(CliConsts.Command, commandLineArgs.Command);
await _sourceCodeDownloadService.DownloadAsync(
commandLineArgs.Target, outputFolder, version, gitHubLocalRepositoryPath, commandLineArgs.Options);
commandLineArgs.Target, outputFolder, version, gitHubAbpLocalRepositoryPath, gitHubVoloLocalRepositoryPath, commandLineArgs.Options);
}
private static string GetOutPutFolder(CommandLineArgs commandLineArgs)
@ -117,11 +123,16 @@ namespace Volo.Abp.Cli.Commands
public const string Long = "output-folder";
}
public static class GitHubLocalRepositoryPath
public static class GitHubAbpLocalRepositoryPath
{
public const string Long = "abp-path";
}
public static class GitHubVoloLocalRepositoryPath
{
public const string Long = "volo-path";
}
public static class Version
{
public const string Short = "v";

22
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs

@ -86,10 +86,16 @@ namespace Volo.Abp.Cli.Commands
Logger.LogInformation("Mobile App: " + mobileApp);
}
var gitHubLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubLocalRepositoryPath.Long);
if (gitHubLocalRepositoryPath != null)
var gitHubAbpLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubAbpLocalRepositoryPath.Long);
if (gitHubAbpLocalRepositoryPath != null)
{
Logger.LogInformation("GitHub Local Repository Path: " + gitHubLocalRepositoryPath);
Logger.LogInformation("GitHub Abp Local Repository Path: " + gitHubAbpLocalRepositoryPath);
}
var gitHubVoloLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubVoloLocalRepositoryPath.Long);
if (gitHubVoloLocalRepositoryPath != null)
{
Logger.LogInformation("GitHub Volo Local Repository Path: " + gitHubVoloLocalRepositoryPath);
}
var templateSource = commandLineArgs.Options.GetOrNull(Options.TemplateSource.Short, Options.TemplateSource.Long);
@ -127,7 +133,8 @@ namespace Volo.Abp.Cli.Commands
databaseProvider,
uiFramework,
mobileApp,
gitHubLocalRepositoryPath,
gitHubAbpLocalRepositoryPath,
gitHubVoloLocalRepositoryPath,
templateSource,
commandLineArgs.Options,
connectionString
@ -299,11 +306,16 @@ namespace Volo.Abp.Cli.Commands
public const string Long = "output-folder";
}
public static class GitHubLocalRepositoryPath
public static class GitHubAbpLocalRepositoryPath
{
public const string Long = "abp-path";
}
public static class GitHubVoloLocalRepositoryPath
{
public const string Long = "volo-path";
}
public static class Version
{
public const string Short = "v";

5
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs

@ -25,7 +25,7 @@ namespace Volo.Abp.Cli.Commands.Services
Logger = NullLogger<SourceCodeDownloadService>.Instance;
}
public async Task DownloadAsync(string moduleName, string outputFolder, string version, string gitHubLocalRepositoryPath, AbpCommandLineOptions options)
public async Task DownloadAsync(string moduleName, string outputFolder, string version, string gitHubAbpLocalRepositoryPath, string gitHubVoloLocalRepositoryPath, AbpCommandLineOptions options)
{
Logger.LogInformation("Downloading source code of " + moduleName);
Logger.LogInformation("Version: " + version);
@ -39,7 +39,8 @@ namespace Volo.Abp.Cli.Commands.Services
DatabaseProvider.NotSpecified,
UiFramework.NotSpecified,
null,
gitHubLocalRepositoryPath,
gitHubAbpLocalRepositoryPath,
gitHubVoloLocalRepositoryPath,
null,
options
)

25
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs

@ -22,10 +22,13 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
return;
}
var localVoloRepoPath = context.BuildArgs.VoloGitHubLocalRepositoryPath;
new ProjectReferenceReplacer.LocalProjectPathReferenceReplacer(
context.Files,
context.Module?.Namespace ?? "MyCompanyName.MyProjectName",
localAbpRepoPath
localAbpRepoPath,
localVoloRepoPath
).Run();
}
else
@ -177,12 +180,14 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
public class LocalProjectPathReferenceReplacer : ProjectReferenceReplacer
{
private readonly string _gitHubLocalRepositoryPath;
private readonly string _gitHubAbpLocalRepositoryPath;
private readonly string _gitHubVoloLocalRepositoryPath;
public LocalProjectPathReferenceReplacer(List<FileEntry> entries, string projectName, string gitHubLocalRepositoryPath)
public LocalProjectPathReferenceReplacer(List<FileEntry> entries, string projectName, string gitHubAbpLocalRepositoryPath, string gitHubVoloLocalRepositoryPath)
: base(entries, projectName)
{
_gitHubLocalRepositoryPath = gitHubLocalRepositoryPath;
_gitHubAbpLocalRepositoryPath = gitHubAbpLocalRepositoryPath;
_gitHubVoloLocalRepositoryPath = gitHubVoloLocalRepositoryPath;
}
protected override XmlElement GetNewReferenceNode(XmlDocument doc, string oldNodeIncludeValue)
@ -204,9 +209,17 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
includeValue = includeValue.TrimStart('\\');
}
includeValue = _gitHubLocalRepositoryPath.EnsureEndsWith('\\') + includeValue;
if (!string.IsNullOrWhiteSpace(_gitHubVoloLocalRepositoryPath))
{
if (includeValue.StartsWith("abp\\", StringComparison.InvariantCultureIgnoreCase))
{
return _gitHubAbpLocalRepositoryPath.EnsureEndsWith('\\') + includeValue.Substring("abp\\".Length);
}
return _gitHubVoloLocalRepositoryPath.EnsureEndsWith('\\') + "abp\\" + includeValue;
}
return includeValue;
return _gitHubAbpLocalRepositoryPath.EnsureEndsWith('\\') + includeValue;
}
}
}

5
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs

@ -24,6 +24,9 @@ namespace Volo.Abp.Cli.ProjectBuilding
[CanBeNull]
public string AbpGitHubLocalRepositoryPath { get; set; }
[CanBeNull]
public string VoloGitHubLocalRepositoryPath { get; set; }
[CanBeNull]
public string TemplateSource { get; set; }
@ -41,6 +44,7 @@ namespace Volo.Abp.Cli.ProjectBuilding
UiFramework uiFramework = UiFramework.NotSpecified,
MobileApp? mobileApp = null,
[CanBeNull] string abpGitHubLocalRepositoryPath = null,
[CanBeNull] string voloGitHubLocalRepositoryPath = null,
[CanBeNull] string templateSource = null,
Dictionary<string, string> extraProperties = null,
[CanBeNull] string connectionString = null)
@ -52,6 +56,7 @@ namespace Volo.Abp.Cli.ProjectBuilding
UiFramework = uiFramework;
MobileApp = mobileApp;
AbpGitHubLocalRepositoryPath = abpGitHubLocalRepositoryPath;
VoloGitHubLocalRepositoryPath = voloGitHubLocalRepositoryPath;
TemplateSource = templateSource;
ExtraProperties = extraProperties ?? new Dictionary<string, string>();
ConnectionString = connectionString;

1
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

@ -129,6 +129,7 @@ namespace Volo.Abp.Cli.ProjectModification
targetModuleFolder,
version,
null,
null,
null
);

Loading…
Cancel
Save