|
|
@ -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)) |
|
|
{ |
|
|
{ |
|
|
|