[binderator] Tweaks to `update-config` console output. (#945)

Make 2 tweaks to the `update-config` console output.  Note these do not affect anything that is written to `config.json`, just what is written to the console.

- Add number of packages and dependencies to table header:

```console
| 340 Packages (* = Has Update)                              | Currently Bound   | Latest Stable   |
|------------------------------------------------------------|-------------------|-----------------|
| androidx.activity.activity                                 | 1.9.1             | 1.9.1           |
...

| 18 Dependencies (* = Has Update)                           | Current Reference | Latest Publish  |
|------------------------------------------------------------|-------------------|-----------------|
| Xamarin.GooglePlayServices.Ads.Identifier                  | 118.1.0.1         | 118.1.0.1       |
...
```

- Show if there are updates available for "Frozen" packages.  Previously it would just show as frozen and not show if there were updates available.

```console
// Previous behavior
| # com.google.android.material.material                     | 1.11.0            | 1.11.0          |

// New behavior
| #* com.google.android.material.material                    | 1.11.0            | 1.12.0          |
```
This commit is contained in:
Jonathan Pobst 2024-08-22 19:10:20 -10:00 коммит произвёл GitHub
Родитель a9594744db
Коммит d8ae98125e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -38,7 +38,7 @@ static class UpdateCommand
OutputDependencyTable (config);
// Write updated values back to original locations so they get serialized
foreach (var a in config.MavenArtifacts) {
foreach (var a in config.MavenArtifacts.Where (a => !a.Frozen)) {
a.Version = a.LatestVersion;
a.NugetVersion = a.LatestNuGetVersion;
}
@ -48,21 +48,23 @@ static class UpdateCommand
static void OutputArtifactTable (BindingConfig config)
{
var column1 = "Package (* = Has Update)".PadRight (58);
var bound_artifacts = config.MavenArtifacts.Where (a => !a.DependencyOnly);
var column1 = $"{bound_artifacts.Count ()} Packages (* = Has Update)".PadRight (58);
var column2 = "Currently Bound".PadRight (17);
var column3 = "Latest Stable".PadRight (15);
Console.WriteLine ($"| {column1} | {column2} | {column3} |");
Console.WriteLine ("|------------------------------------------------------------|-------------------|-----------------|");
foreach (var art in config.MavenArtifacts.Where (a => !a.DependencyOnly)) {
foreach (var art in bound_artifacts) {
var package_name = $"{art.GroupId}.{art.ArtifactId}";
if (art.NewVersionAvailable)
package_name = "* " + package_name;
if (art.Frozen)
package_name = "# " + package_name;
package_name = (package_name.StartsWith ('*') ? "#" : "# ") + package_name;
Console.WriteLine ($"| {package_name.PadRight (58)} | {art.Version.PadRight (17)} | {art.LatestVersion.PadRight (15)} |");
}
@ -70,14 +72,16 @@ static class UpdateCommand
static void OutputDependencyTable (BindingConfig config)
{
var column1 = "Dependencies (* = Has Update)".PadRight (58);
var dependency_artifacts = config.MavenArtifacts.Where (a => a.DependencyOnly);
var column1 = $"{dependency_artifacts.Count ()} Dependencies (* = Has Update)".PadRight (58);
var column2 = "Current Reference".PadRight (17);
var column3 = "Latest Publish".PadRight (15);
Console.WriteLine ($"| {column1} | {column2} | {column3} |");
Console.WriteLine ("|------------------------------------------------------------|-------------------|-----------------|");
foreach (var art in config.MavenArtifacts.Where (a => a.DependencyOnly)) {
foreach (var art in dependency_artifacts) {
var package_name = art.NugetPackageId ?? $"{art.GroupId}.{art.ArtifactId}";
if (art.NewNuGetVersionAvailable)

Просмотреть файл

@ -65,10 +65,6 @@ public class ConfigUpdater
static bool HasUpdate (MavenArtifactConfig model, Artifact artifact)
{
// Don't update package if it's "Frozen"
if (model.Frozen)
return false;
// Get latest stable version
var latest = GetLatestVersion (artifact);