Skip to content

Commit

Permalink
feat: add interface for user interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
futrime committed Jan 9, 2025
1 parent 1d8fa12 commit d198d5c
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 95 deletions.
2 changes: 1 addition & 1 deletion Lip/ConditionWaiter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static class ConditionWaiter
/// <param name="interval">The interval to check the condition.</param>
/// <returns></returns>
/// <exception cref="TimeoutException"></exception>
public static async Task AsyncWaitFor(Func<bool> condition, TimeSpan? timeout = null, TimeSpan? interval = null)
public static async Task WaitForAsync(Func<bool> condition, TimeSpan? timeout = null, TimeSpan? interval = null)
{
var sw = Stopwatch.StartNew();
while (!condition())
Expand Down
37 changes: 37 additions & 0 deletions Lip/IUserInteraction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace Lip;

/// <summary>
/// Represents a user interaction interface.
/// </summary>
public interface IUserInteraction
{
/// <summary>
/// Displays a confirmation dialog and returns user's choice.
/// </summary>
/// <param name="format">The message to display</param>
/// <returns>True if confirmed, false otherwise</returns>
Task<bool> ConfirmAsync(string format, params object[] args);

/// <summary>
/// Prompts user for text input.
/// </summary>
/// <param name="format">The prompt message</param>
/// <param name="defaultValue">Optional default value</param>
/// <returns>User input as string</returns>
Task<string?> PromptForInputAsync(string format, params object[] args);

/// <summary>
/// Prompts user to select from multiple options.
/// </summary>
/// <param name="format">The prompt message</param>
/// <param name="options">Available options</param>
/// <returns>Selected option</returns>
Task<string> PromptForSelectionAsync(IEnumerable<string> options, string format, params object[] args);

/// <summary>
/// Shows progress for long-running operations.
/// </summary>
/// <param name="format">Progress message</param>
/// <param name="progress">Progress value (0.0-1.0)</param>
Task UpdateProgressAsync(float progress, string format, params object[] args);
}
22 changes: 11 additions & 11 deletions Lip/Lip.Init.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text;
using Microsoft.Extensions.Logging;

namespace Lip;

Expand All @@ -24,7 +25,7 @@ public async Task Init(InitArgs args)
{
string workspace = args.Workspace ?? _filesystem.Directory.GetCurrentDirectory();

// Check if the workspace is a valid directory.
// Check if the workspace is a directory.
if (!_filesystem.Directory.Exists(workspace))
{
throw new DirectoryNotFoundException($"The directory '{workspace}' does not exist.");
Expand Down Expand Up @@ -54,12 +55,12 @@ public async Task Init(InitArgs args)
}
else
{
string tooth = args.InitTooth ?? await PromptUserInteraction(UserInteractionEventType.InitTooth) ?? DefaultTooth;
string version = args.InitVersion ?? await PromptUserInteraction(UserInteractionEventType.InitVersion) ?? DefaultVersion;
string? name = args.InitName ?? await PromptUserInteraction(UserInteractionEventType.InitName);
string? description = args.InitDescription ?? await PromptUserInteraction(UserInteractionEventType.InitDescription);
string? author = args.InitAuthor ?? await PromptUserInteraction(UserInteractionEventType.InitAuthor);
string? avatarUrl = args.InitAvatarUrl ?? await PromptUserInteraction(UserInteractionEventType.InitAvatarUrl);
string tooth = args.InitTooth ?? await _userInteraction.PromptForInputAsync("Enter the tooth path (e.g. {DefaultTooth}):", DefaultTooth) ?? DefaultTooth;
string version = args.InitVersion ?? await _userInteraction.PromptForInputAsync("Enter the package version (e.g. {DefaultVersion}):", DefaultVersion) ?? DefaultVersion;
string? name = args.InitName ?? await _userInteraction.PromptForInputAsync("Enter the package name:");
string? description = args.InitDescription ?? await _userInteraction.PromptForInputAsync("Enter the package description:");
string? author = args.InitAuthor ?? await _userInteraction.PromptForInputAsync("Enter the package author:");
string? avatarUrl = args.InitAvatarUrl ?? await _userInteraction.PromptForInputAsync("Enter the author's avatar URL:");

manifest = new()
{
Expand All @@ -77,8 +78,7 @@ public async Task Init(InitArgs args)
};

string jsonString = Encoding.UTF8.GetString(manifest.ToBytes());
string? response = (await PromptUserInteraction(UserInteractionEventType.InitConfirm, [jsonString]))?.ToLower();
if (response != "y")
if (!await _userInteraction.ConfirmAsync("Do you want to create the following package manifest file?\n{jsonString}", jsonString))
{
throw new OperationCanceledException("Operation canceled by the user.");
}
Expand All @@ -95,11 +95,11 @@ public async Task Init(InitArgs args)
throw new InvalidOperationException($"The file '{manifestPath}' already exists. Use the -f or --force option to overwrite it.");
}

_logger.Warning($"The file '{manifestPath}' already exists. Overwriting it.");
_logger.LogWarning("The file '{ManifestPath}' already exists. Overwriting it.", manifestPath);
}

await _filesystem.File.WriteAllBytesAsync(manifestPath, manifest!.ToBytes());

_logger.Information($"Successfully initialized the package manifest file '{manifestPath}'.");
_logger.LogInformation("Successfully initialized the package manifest file '{ManifestPath}'.", manifestPath);
}
}
78 changes: 0 additions & 78 deletions Lip/Lip.UserInteraction.cs

This file was deleted.

15 changes: 12 additions & 3 deletions Lip/Lip.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
using System.IO.Abstractions;
using Microsoft.Extensions.Logging;
using System.IO.Abstractions;

namespace Lip;

public partial class Lip(RuntimeConfiguration runtimeConfig, IFileSystem filesystem, Serilog.ILogger logger)
/// <summary>
/// The main class of the Lip library.
/// </summary>
/// <param name="runtimeConfig">The runtime configuration.</param>
/// <param name="filesystem">The file system wrapper.</param>
/// <param name="logger">The logger.</param>
/// <param name="userInteraction">The user interaction wrapper.</param>
public partial class Lip(RuntimeConfiguration runtimeConfig, IFileSystem filesystem, ILogger logger, IUserInteraction userInteraction)
{
private const string PackageManifestFileName = "tooth.json";

private readonly IFileSystem _filesystem = filesystem;
private readonly Serilog.ILogger _logger = logger;
private readonly ILogger _logger = logger;
private readonly RuntimeConfiguration _runtimeConfig = runtimeConfig;
private readonly IUserInteraction _userInteraction = userInteraction;
}
3 changes: 1 addition & 2 deletions Lip/Lip.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="Semver" Version="3.0.0" />
<PackageReference Include="Serilog" Version="4.2.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="TestableIO.System.IO.Abstractions" Version="21.2.1" />
</ItemGroup>

Expand Down
12 changes: 12 additions & 0 deletions Lip/PackageManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

namespace Lip;

/// <summary>
/// Represents the package manifest.
/// </summary>
public record PackageManifest
{
public record AssetType
Expand Down Expand Up @@ -256,6 +259,11 @@ public required string Version

private string _version = "0.0.0"; // The default value does never get used.

/// <summary>
/// Deserializes a package manifest from the specified byte array.
/// </summary>
/// <param name="bytes">The byte array to deserialize.</param>
/// <returns>The deserialized package manifest.</returns>
public static PackageManifest FromBytes(byte[] bytes)
{
PackageManifest? manifest = JsonSerializer.Deserialize<PackageManifest>(

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-x64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-x64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-x64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-x64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-arm64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-arm64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-arm64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-arm64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-arm64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-arm64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, win-x64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, win-x64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-x64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-x64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-x64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-x64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-arm64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-arm64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, win-x64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, win-x64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, win-arm64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, win-arm64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, win-arm64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 269 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, win-arm64)

Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.
Expand All @@ -266,6 +274,10 @@ public static PackageManifest FromBytes(byte[] bytes)
return manifest;
}

/// <summary>
/// Serializes the package manifest to a byte array.
/// </summary>
/// <returns>The serialized package manifest.</returns>
public byte[] ToBytes()
{
byte[] bytes = JsonSerializer.SerializeToUtf8Bytes(this, s_jsonSerializerOptions);

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-x64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-x64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-x64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-x64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-arm64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-arm64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-arm64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-arm64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-arm64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-arm64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, win-x64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, win-x64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-x64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, osx-x64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-x64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-x64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-arm64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, linux-arm64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, win-x64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, win-x64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, win-arm64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 283 in Lip/PackageManifest.cs

View workflow job for this annotation

GitHub Actions / build-app (Lip.CLI, win-arm64)

Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.
Expand Down
3 changes: 3 additions & 0 deletions Lip/RuntimeConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

namespace Lip;

/// <summary>
/// Represents the runtime configuration.
/// </summary>
public record RuntimeConfiguration
{
private static readonly string s_defaultCache = OperatingSystem.IsWindows()
Expand Down
3 changes: 3 additions & 0 deletions Lip/StringValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Lip;

/// <summary>
/// Provides utility methods for validating various strings.
/// </summary>
public static partial class StringValidator
{
/// <summary>
Expand Down

0 comments on commit d198d5c

Please sign in to comment.