Browse Source

Merge pull request #18916 from abpframework/auto-merge/prerel-8-1/2460

Merge branch dev with prerel-8.1
pull/18933/head
maliming 2 years ago
committed by GitHub
parent
commit
fa8b23aaee
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 10
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs
  2. 56
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs
  3. 3
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ISourceCodeStore.cs
  4. 6
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs
  5. 3
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs

10
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs

@ -233,6 +233,8 @@ public abstract class ProjectCreationCommandBase
var skipCache = commandLineArgs.Options.ContainsKey(Options.SkipCache.Long) || commandLineArgs.Options.ContainsKey(Options.SkipCache.Short); var skipCache = commandLineArgs.Options.ContainsKey(Options.SkipCache.Long) || commandLineArgs.Options.ContainsKey(Options.SkipCache.Short);
var trustUserVersion = !version.IsNullOrEmpty() && commandLineArgs.Options.ContainsKey(Options.TrustUserVersion.Long) || commandLineArgs.Options.ContainsKey(Options.TrustUserVersion.Short);
return new ProjectBuildArgs( return new ProjectBuildArgs(
solutionName, solutionName,
template, template,
@ -251,7 +253,8 @@ public abstract class ProjectCreationCommandBase
pwa, pwa,
theme, theme,
themeStyle, themeStyle,
skipCache skipCache,
trustUserVersion
); );
} }
@ -902,6 +905,11 @@ public abstract class ProjectCreationCommandBase
public const string Long = "skip-cache"; public const string Long = "skip-cache";
} }
public static class TrustUserVersion
{
public const string Short = "tv";
public const string Long = "trust-version";
}
public static class Tiered public static class Tiered
{ {

56
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs

@ -65,7 +65,8 @@ public class AbpIoSourceCodeStore : ISourceCodeStore, ITransientDependency
string version = null, string version = null,
string templateSource = null, string templateSource = null,
bool includePreReleases = false, bool includePreReleases = false,
bool skipCache = false) bool skipCache = false,
bool trustUserVersion = false)
{ {
DirectoryHelper.CreateIfNotExists(CliPaths.TemplateCache); DirectoryHelper.CreateIfNotExists(CliPaths.TemplateCache);
var userSpecifiedVersion = version != null; var userSpecifiedVersion = version != null;
@ -96,33 +97,36 @@ public class AbpIoSourceCodeStore : ISourceCodeStore, ITransientDependency
var templateVersion = SemanticVersion.Parse(version); var templateVersion = SemanticVersion.Parse(version);
var outputWarning = false; var outputWarning = false;
if (currentCliVersion.Major != templateVersion.Major || currentCliVersion.Minor != templateVersion.Minor) if (!trustUserVersion)
{ {
// major and minor version are different if (currentCliVersion.Major != templateVersion.Major || currentCliVersion.Minor != templateVersion.Minor)
outputWarning = true; {
} // major and minor version are different
else if (currentCliVersion.Major == templateVersion.Major && outputWarning = true;
currentCliVersion.Minor == templateVersion.Minor && }
currentCliVersion.Patch < templateVersion.Patch) else if (currentCliVersion.Major == templateVersion.Major &&
{ currentCliVersion.Minor == templateVersion.Minor &&
// major and minor version are same but patch version is lower currentCliVersion.Patch < templateVersion.Patch)
outputWarning = true; {
} // major and minor version are same but patch version is lower
else if(currentCliVersion.Major == templateVersion.Major && outputWarning = true;
currentCliVersion.Minor == templateVersion.Minor && }
currentCliVersion.Patch == templateVersion.Patch && else if(currentCliVersion.Major == templateVersion.Major &&
currentCliVersion.IsPrerelease && templateVersion.IsPrerelease) currentCliVersion.Minor == templateVersion.Minor &&
{ currentCliVersion.Patch == templateVersion.Patch &&
// major and minor and patch version are same but prerelease version may be lower currentCliVersion.IsPrerelease && templateVersion.IsPrerelease)
var cliRcVersion = currentCliVersion.ReleaseLabels.LastOrDefault();
var templateRcVersion = templateVersion.ReleaseLabels.LastOrDefault();
if (cliRcVersion != null && templateRcVersion != null)
{ {
if (int.TryParse(cliRcVersion, out var cliRcVersionNumber) && int.TryParse(templateRcVersion, out var templateRcVersionNumber)) // major and minor and patch version are same but prerelease version may be lower
var cliRcVersion = currentCliVersion.ReleaseLabels.LastOrDefault();
var templateRcVersion = templateVersion.ReleaseLabels.LastOrDefault();
if (cliRcVersion != null && templateRcVersion != null)
{ {
if (cliRcVersionNumber < templateRcVersionNumber) if (int.TryParse(cliRcVersion, out var cliRcVersionNumber) && int.TryParse(templateRcVersion, out var templateRcVersionNumber))
{ {
outputWarning = true; if (cliRcVersionNumber < templateRcVersionNumber)
{
outputWarning = true;
}
} }
} }
} }
@ -147,12 +151,12 @@ public class AbpIoSourceCodeStore : ISourceCodeStore, ITransientDependency
} }
} }
if (!await IsVersionExists(name, version)) if (!trustUserVersion && !await IsVersionExists(name, version))
{ {
throw new Exception("There is no version found with given version: " + version); throw new Exception("There is no version found with given version: " + version);
} }
var nugetVersion = (await GetTemplateNugetVersionAsync(name, type, version)) ?? version; var nugetVersion = await GetTemplateNugetVersionAsync(name, type, version) ?? version;
if (!string.IsNullOrWhiteSpace(templateSource) && !IsNetworkSource(templateSource)) if (!string.IsNullOrWhiteSpace(templateSource) && !IsNetworkSource(templateSource))
{ {

3
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ISourceCodeStore.cs

@ -11,6 +11,7 @@ public interface ISourceCodeStore
[CanBeNull] string version = null, [CanBeNull] string version = null,
[CanBeNull] string templateSource = null, [CanBeNull] string templateSource = null,
bool includePreReleases = false, bool includePreReleases = false,
bool skipCache = false bool skipCache = false,
bool trustUserVersion = false
); );
} }

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

@ -15,6 +15,8 @@ public class ProjectBuildArgs
[CanBeNull] [CanBeNull]
public string Version { get; set; } public string Version { get; set; }
public bool TrustUserVersion { get; set; }
public DatabaseProvider DatabaseProvider { get; set; } public DatabaseProvider DatabaseProvider { get; set; }
public DatabaseManagementSystem DatabaseManagementSystem { get; set; } public DatabaseManagementSystem DatabaseManagementSystem { get; set; }
@ -69,7 +71,8 @@ public class ProjectBuildArgs
bool pwa = false, bool pwa = false,
Theme? theme = null, Theme? theme = null,
ThemeStyle? themeStyle = null, ThemeStyle? themeStyle = null,
bool skipCache = false) bool skipCache = false,
bool trustUserVersion = false)
{ {
SolutionName = Check.NotNull(solutionName, nameof(solutionName)); SolutionName = Check.NotNull(solutionName, nameof(solutionName));
TemplateName = templateName; TemplateName = templateName;
@ -89,5 +92,6 @@ public class ProjectBuildArgs
Theme = theme; Theme = theme;
ThemeStyle = themeStyle; ThemeStyle = themeStyle;
SkipCache = skipCache; SkipCache = skipCache;
TrustUserVersion = trustUserVersion;
} }
} }

3
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs

@ -68,7 +68,8 @@ public class TemplateProjectBuilder : IProjectBuilder, ITransientDependency
SourceCodeTypes.Template, SourceCodeTypes.Template,
args.Version, args.Version,
args.TemplateSource, args.TemplateSource,
args.ExtraProperties.ContainsKey(NewCommand.Options.Preview.Long) args.ExtraProperties.ContainsKey(NewCommand.Options.Preview.Long),
trustUserVersion: args.TrustUserVersion
); );
ConfigureThemeOptions(args, templateFile.Version); ConfigureThemeOptions(args, templateFile.Version);

Loading…
Cancel
Save