Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VCI-669: Make install stable by default #104

Merged
merged 6 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/CLI-tools/package-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ The `vc-package.json` file is used to maintain the list of installed modules wit
- `vc-build install (with no args)`

This target downloads and installs the platform and modules into the relevant folder with versions described in `vc-package.json`.
If `vc-package.json` is not found in the local folder, the command will by default download and install the latest platform and module versions marked as `commerce`.
If `vc-package.json` is not found in the local folder, the command will by default download and install the latest stable bundle. If -Edge parameter has been used then this target will download the latest available platform and modules marked as `commerce`.

By default, the `install` target will install all modules listed as dependencies in `vc-package.json`.

Expand Down
4 changes: 3 additions & 1 deletion docs/targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ By default, install target will install all modules listed as dependencies in vc
Path to vc-package.json, discovery and probing paths can be overridden with PackageManifestPath, DiscoveryPath, ProbingPath parameters. Also we can skip dependency solving with SkipDependencySolving parameter.
Since version 2.0.0-beta0005 the -module parameter is case insensitive

When you are using one of the source which requires the authorization you can pass tokens using these parameters: GithubToken, AzureToken, GitLabToken.
When you are using one of the source which requires the authorization you can pass tokens using these parameters: GithubToken, AzureToken, GitLabToken.

Since version 3.17.0 this target installs stable versions of modules by default. If you need the latest available versions you should use -Edge parameter
Examples:
```console
vc-build install (with no args)
Expand Down
9 changes: 3 additions & 6 deletions src/VirtoCommerce.Build/PlatformTools/Build.PackageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ internal partial class Build
[Parameter("Gitlab Server (default: https://gitlab.com/api/v4)")]
public static string GitLabServer { get; set; } = "https://gitlab.com/api/v4";

[Parameter("Get bundle")]
public static bool Stable { get; set; }

[Parameter("Bundle name (default: latest)", Name = "v")]
public static string BundleName { get; set; } = "latest";

Expand All @@ -74,7 +71,7 @@ internal partial class Build
.DependsOn(Backup)
.Executes(async () =>
{
var packageManifest = await OpenOrCreateManifest(PackageManifestPath, Stable);
var packageManifest = await OpenOrCreateManifest(PackageManifestPath, Edge);
var githubModuleSources = PackageManager.GetGithubModuleManifests(packageManifest);
var modules = PackageManager.GetGithubModules(packageManifest);

Expand Down Expand Up @@ -593,11 +590,11 @@ private async Task<ManifestBase> UpdateEdgeModulesAsync(ManifestBase manifest)
return manifest;
}

private async Task<ManifestBase> OpenOrCreateManifest(string packageManifestPath, bool isStableBundle)
private async Task<ManifestBase> OpenOrCreateManifest(string packageManifestPath, bool isEdge)
{
ManifestBase packageManifest;
var platformWebDllPath = Path.Combine(Directory.GetParent(packageManifestPath).FullName, "VirtoCommerce.Platform.Web.dll");
if (isStableBundle)
if (!isEdge)
{
SkipDependencySolving = true;
if (File.Exists(packageManifestPath))
Expand Down
72 changes: 36 additions & 36 deletions src/VirtoCommerce.Build/PlatformTools/PackageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
using Nuke.Common.IO;
using VirtoCommerce.Build.PlatformTools;

namespace PlatformTools
namespace PlatformTools
{
public static class PackageManager
{
private static readonly string _defaultModuleManifest = "https://raw.githubusercontent.com/VirtoCommerce/vc-modules/master/modules_v3.json";

public static ManifestBase CreatePackageManifest(string platformVersion, string platformAssetUrl)
{
public static class PackageManager
{
private static readonly string _defaultModuleManifest = "https://raw.githubusercontent.com/VirtoCommerce/vc-modules/master/modules_v3.json";
public static ManifestBase CreatePackageManifest(string platformVersion, string platformAssetUrl)
{
var manifest = new MixedPackageManifest
{
ManifestVersion = "2.0",
Expand All @@ -28,30 +28,30 @@ public static ManifestBase CreatePackageManifest(string platformVersion, string
Modules = new List<ModuleItem>()
}
}
};
return manifest;
}

};
return manifest;
}
public static ManifestBase CreatePackageManifest(string platformVersion)
{
return CreatePackageManifest(platformVersion, "");
}

public static MixedPackageManifest UpdatePlatform(MixedPackageManifest manifest, string newVersion)
{
manifest.PlatformVersion = newVersion;
return manifest;
}

public static void ToFile(ManifestBase manifest, string path = "./vc-package.json")
public static MixedPackageManifest UpdatePlatform(MixedPackageManifest manifest, string newVersion)
{
manifest.PlatformVersion = newVersion;
return manifest;
}
public static void ToFile(ManifestBase manifest, string path = "./vc-package.json")
{
SerializationTasks.JsonSerializeToFile(manifest, path);
SerializationTasks.JsonSerializeToFile(manifest, path);
}

public static ManifestBase FromFile(string path = "./vc-package.json")
{
var baseManifest = SerializationTasks.JsonDeserializeFromFile<ManifestBase>(path);
ManifestBase result;
public static ManifestBase FromFile(string path = "./vc-package.json")
{
var baseManifest = SerializationTasks.JsonDeserializeFromFile<ManifestBase>(path);
ManifestBase result;
if (string.IsNullOrEmpty(baseManifest.ManifestVersion) || new Version(baseManifest.ManifestVersion) < new Version("2.0"))
{
result = SerializationTasks.JsonDeserializeFromFile<PackageManifest>(path);
Expand All @@ -61,9 +61,9 @@ public static ManifestBase FromFile(string path = "./vc-package.json")
result = SerializationTasks.JsonDeserializeFromFile<MixedPackageManifest>(path);
}

return result;
}

return result;
}
public static List<ModuleSource> GetModuleSources(ManifestBase manifest)
{

Expand All @@ -86,14 +86,14 @@ public static List<ModuleSource> GetModuleSources(ManifestBase manifest)
break;
}
return result;
}

}
public static GithubReleases GetGithubModulesSource(ManifestBase manifest)
{
var sources = GetModuleSources(manifest);
return (GithubReleases)sources.FirstOrDefault(s => s.Name == nameof(GithubReleases));
}

}
public static List<string> GetGithubModuleManifests(ManifestBase manifest)
{
List<string> result;
Expand All @@ -111,8 +111,8 @@ public static List<string> GetGithubModuleManifests(ManifestBase manifest)
break;
}
return result;
}

}
public static List<ModuleItem> GetGithubModules(ManifestBase manifest)
{
List<ModuleItem> result;
Expand All @@ -130,6 +130,6 @@ public static List<ModuleItem> GetGithubModules(ManifestBase manifest)
break;
}
return result;
}
}
}
}
}
}
Loading