Skip to content
Open
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
123 changes: 55 additions & 68 deletions build/SourceFetcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,38 @@ public static void GetSources(this AbsolutePath fileSystem, AbsolutePath rootDir
FetchGitHubZip(fileSystem, rootDirectory, owner, repositories, "external", true, true);
}

internal static void LogInfo(string message)
{
lock (_lockConsoleObject)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("[INFO] ");
Console.ResetColor();
Console.Write($"{message}");
Console.WriteLine();
}
}

internal static void LogRepositoryInfo(string owner, string repository, string message) =>
LogInfo($"{message} {owner}/{repository}...");

internal static void LogRepositoryError(string owner, string repository, string message)
{
LogError($"{message} {owner}/{repository}...");
}

internal static void LogError(string message)
{
lock (_lockConsoleObject)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("[ERROR] ");
Console.ResetColor();
Console.Write(message);
Console.WriteLine();
}
}

private static void FetchGitHubZip(AbsolutePath fileSystem, AbsolutePath rootDirectory, string owner, string[] repositories, string outputFolder, bool fetchNuGet, bool useSrc)
{
var zipCache = fileSystem / "zip";
Expand All @@ -37,7 +69,7 @@ private static void FetchGitHubZip(AbsolutePath fileSystem, AbsolutePath rootDir
6, // We can also do this with WaitAndRetryForever... but chose WaitAndRetry this time.
attempt => TimeSpan.FromSeconds(0.1 * Math.Pow(2, attempt))); // Back off! 2, 4, 8, 16 etc times 1/4-second

Task.WaitAll(repositories.Select(repository => Task.Run(async () =>
Task.WaitAll([.. repositories.Select(repository => Task.Run(async () =>
{
await semaphore.WaitAsync();
try
Expand Down Expand Up @@ -107,7 +139,7 @@ await waitAndRetry.ExecuteAsync(async () =>
{
semaphore.Release();
}
})).ToArray());
}))]);
}

private static void FetchNuGet(string owner, string repository, AbsolutePath finalPath, bool useSrc)
Expand All @@ -116,53 +148,40 @@ private static void FetchNuGet(string owner, string repository, AbsolutePath fin

var directory = useSrc ? finalPath / $"{repository}-main" / "src" : finalPath;

RunDotNetOnSolution(owner, repository, directory, "restore");
}

private static void WorkflowRestore(string owner, string repository, AbsolutePath finalPath, bool useSrc)
{
lock (_lockWorkloadObject)
{
LogRepositoryInfo(owner, repository, "Restoring workload for ");

var directory = useSrc ? finalPath / $"{repository}-main" / "src" : finalPath;

RunDotNetOnSolution(owner, repository, directory, "workload restore");
}
}

private static void RunDotNetOnSolution(string owner, string repository, AbsolutePath directory, string command)
{
// Find any .sln or .slnx file and run dotnet restore on it
var solutionFile = Directory.EnumerateFiles(directory.ToString(), "*.sln*").FirstOrDefault();

if (File.Exists(directory / $"{repository}.sln"))
{
RunDotNet(directory, $"restore {repository}.sln");
RunDotNet(directory, $"{command} {repository}.sln");
}
else if (File.Exists(directory / $"{repository}.slnx"))
{
RunDotNet(directory, $"restore {repository}.slnx");
RunDotNet(directory, $"{command} {repository}.slnx");
}
else if (solutionFile != null)
{
RunDotNet(directory, $"restore {Path.GetFileName(solutionFile)}");
RunDotNet(directory, $"{command} {Path.GetFileName(solutionFile)}");
}
else
{
LogRepositoryError(owner, repository, "No solution file found to restore packages.");
}
}

private static void WorkflowRestore(string owner, string repository, AbsolutePath finalPath, bool useSrc)
{
lock (_lockWorkloadObject)
{
LogRepositoryInfo(owner, repository, "Restoring workload for ");

var directory = useSrc ? finalPath / $"{repository}-main" / "src" : finalPath;

// Find any .sln or .slnx file and run dotnet restore on it
var solutionFile = Directory.EnumerateFiles(directory.ToString(), "*.sln*").FirstOrDefault();
if (File.Exists(directory / $"{repository}.sln"))
{
RunDotNet(directory, $"workload restore {repository}.sln");
}
else if (File.Exists(directory / $"{repository}.slnx"))
{
RunDotNet(directory, $"workload restore {repository}.slnx");
}
else if (solutionFile != null)
{
RunDotNet(directory, $"workload restore {Path.GetFileName(solutionFile)}");
}
else
{
LogRepositoryError(owner, repository, "No solution file found to restore workloads.");
}
LogRepositoryError(owner, repository, $"No solution file found to {command}.");
}
}

Expand All @@ -183,36 +202,4 @@ private static void RunDotNet(AbsolutePath finalPath, string parameters)
process.WaitForExit();
process.Dispose();
}

internal static void LogInfo(string message)
{
lock (_lockConsoleObject)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("[INFO] ");
Console.ResetColor();
Console.Write($"{message}");
Console.WriteLine();
}
}

internal static void LogRepositoryInfo(string owner, string repository, string message) =>
LogInfo($"{message} {owner}/{repository}...");

internal static void LogRepositoryError(string owner, string repository, string message)
{
LogError($"{message} {owner}/{repository}...");
}

internal static void LogError(string message)
{
lock (_lockConsoleObject)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("[ERROR] ");
Console.ResetColor();
Console.Write(message);
Console.WriteLine();
}
}
}
41 changes: 35 additions & 6 deletions reactiveui/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,40 @@

Browse the latest API documentation generated from the current ReactiveUI source code. This section provides reference material for all major ReactiveUI packages and related projects.

- [ReactiveUI API](api/ReactiveUI.html)
- [DynamicData API](api/DynamicData.html)
- [Splat API](api/Splat.html)
- [Akavache API](api/Akavache.html)
- [Fusillade API](api/Fusillade.html)
- [Punchclock API](Punchclock.html)
- [Akavache API](akavache.html)
- [DynamicData API](dynamicdata.html)
- [ReactiveUI API](reactiveui.html)
- [ReactiveUI.AndroidX API](reactiveui.androidx.html)
- [ReactiveUI.Blazor API](reactiveui.blazor.html)
- [ReactiveUI.Blend](reactiveui.blend.html)
- [ReactiveUI.Builder](reactiveui.builder.html)
- [ReactiveUI.Drawing API](reactiveui.drawing.html)
- [ReactiveUI.Extensions API](reactiveui.extensions.html)
- [ReactiveUI.Maui API](reactiveui.maui.html)
- [ReactiveUI.Maui.Plugins.Popup API](reactiveui.maui.plugins.popup.html)
- [ReactiveUI.Testing API](reactiveui.testing.html)
- [ReactiveUI.Validation API](reactiveui.validation.helpers.html)
- [ReactiveUI.WinUI API](reactiveui.winui.html)
- [ReactiveUI.WinForms API](reactiveui.winforms.html)
- [ReactiveUI.WPF API](reactiveui.wpf.html)
- [Splat API](splat.html)
- [Splat.ApplicationInsights API](splat.applicationinsights.html)
- [Splat.ApplicationPerformanceMonitoring API](splat.applicationperformancemonitoring.html)
- [Splat.AutoFac API](splat.autofac.html)
- [Splat.Builder API](splat.builder.html)
- [Splat.DryIoc API](splat.dryioc.html)
- [Splat.Exceptionless API](splat.exceptionless.html)
- [Splat.Log4Net API](splat.log4net.html)
- [Splat.Microsoft.Extensions.DependencyInjection API](splat.microsoft.extensions.dependencyinjection.html)
- [Splat.Microsoft.Extensions.Logging API](splat.microsoft.extensions.logging.html)
- [Splat.ModeDetection API](splat.modedetection.html)
- [Splat.NLog API](splat.nlog.html)
- [Splat.Ninject API](splat.ninject.html)
- [Splat.Prism API](splat.prism.html)
- [Splat.Prism.Forms API](splat.prism.forms.html)
- [Splat.Serilog API](splat.serilog.html)
- [Splat.SimpleInjector API](splat.simpleinjector.html)
- [Fusillade API](fusillade.html)
- [Punchclock API](punchclock.html)

> The API documentation is generated from the latest source and reflects .NET 8 compatibility and current best practices.
24 changes: 4 additions & 20 deletions reactiveui/docs/guidelines/framework/command-names.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ public ReactiveCommand<Unit, Unit> Save { get; } // Missing 'Command' suffix
public ReactiveCommand<Unit, Unit> PerformSave { get; } // Unclear naming
```

### Implementation Method Names
### Using Legacy Implementation Method Names

When implementation is too complex for inline code, suffix the method with `Impl`:
When implementation is suffixed the method with `Impl` as per legacy conventions:

```csharp
public partial class MyViewModel : ReactiveObject
Expand All @@ -105,7 +105,7 @@ public partial class MyViewModel : ReactiveObject
await DeleteImpl();
}

// Implementation methods
// Legacy Implementation methods
private async Task SaveImpl() { /* ... */ }
private async Task DeleteImpl() { /* ... */ }
}
Expand All @@ -125,15 +125,9 @@ public partial class MainViewModel : ReactiveObject
[ReactiveCommand]
private async Task Search()
{
var results = await SearchImpl(SearchText);
var results = await _searchService.SearchAsync(searchText);
Results = results;
}

private async Task<List<SearchResult>> SearchImpl(string searchText)
{
// Actual search implementation
return await _searchService.SearchAsync(searchText);
}
}
```

Expand All @@ -145,11 +139,6 @@ public partial class ItemViewModel : ReactiveObject
// Generates: public ReactiveCommand<Item, Unit> DeleteItemCommand { get; }
[ReactiveCommand]
private async Task DeleteItem(Item item)
{
await DeleteItemImpl(item);
}

private async Task DeleteItemImpl(Item item)
{
await _repository.DeleteAsync(item);
}
Expand All @@ -174,11 +163,6 @@ public partial class EditViewModel : ReactiveObject
// Generates: public ReactiveCommand<Unit, Unit> SaveCommand { get; }
[ReactiveCommand(CanExecute = nameof(_canSave))]
private async Task Save()
{
await SaveImpl();
}

private async Task SaveImpl()
{
await _dataService.SaveAsync(Data);
}
Expand Down
4 changes: 2 additions & 2 deletions reactiveui/docs/guidelines/framework/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Prefer binding user interactions to commands rather than methods.

```csharp
// In the view
this.BindCommand(ViewModel, vm => vm.Delete, v => v.deleteButton);
this.BindCommand(ViewModel, vm => vm.DeleteCommand, v => v.deleteButton);

public class RepositoryViewModel : ReactiveObject
{
Expand All @@ -16,7 +16,7 @@ public class RepositoryViewModel : ReactiveObject
Delete.ThrownExceptions.Subscribe(ex => /*...*/);
}

public ReactiveAsyncCommand Delete { get; private set; }
public ReactiveAsyncCommand DeleteCommand { get; private set; }

public IObservable<Unit> DeleteImpl() {...}
}
Expand Down
Loading