From 549c9c9525a06a2b47db0413daeb5fec22bbcc4e Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:01:24 +0300 Subject: [PATCH 01/22] add global using refactoring --- tools/compiler/CompileCommand.cs | 5 ----- tools/compiler/GlobalUsings.cs | 16 ++++++++++++++++ tools/compiler/IAssemblyResolver.cs | 2 -- tools/compiler/Log.cs | 4 ---- tools/compiler/Program.cs | 7 +++---- tools/compiler/compilation/Analyzer.cs | 3 --- tools/compiler/compilation/Cache.cs | 7 ------- tools/compiler/compilation/Collect.cs | 6 ------ tools/compiler/compilation/CompilationLog.cs | 3 --- tools/compiler/compilation/CompilationTarget.cs | 5 ----- tools/compiler/compilation/CompilationTask.cs | 13 ------------- tools/compiler/compilation/parts/args.cs | 7 ------- tools/compiler/compilation/parts/aspects.cs | 7 ------- tools/compiler/compilation/parts/bodies.cs | 7 ------- tools/compiler/compilation/parts/classes.cs | 9 --------- tools/compiler/compilation/parts/ctors.cs | 7 ------- tools/compiler/compilation/parts/fields.cs | 5 ----- tools/compiler/compilation/parts/inheritance.cs | 5 ----- tools/compiler/compilation/parts/methods.cs | 7 ------- tools/compiler/compilation/parts/props.cs | 5 ----- .../compiler/compilation/parts/shitcode_plug.cs | 5 ----- tools/compiler/compilation/parts/types.cs | 5 ----- tools/compiler/pipes/CompilerPipeline.cs | 5 ----- tools/compiler/pipes/CopyDependencies.cs | 3 --- tools/compiler/pipes/GeneratePackage.cs | 5 ----- tools/compiler/pipes/PipelineRunner.cs | 2 -- tools/compiler/pipes/SingleFileOutputPipe.cs | 5 ----- tools/compiler/pipes/WriteOutputPipe.cs | 2 -- 28 files changed, 19 insertions(+), 143 deletions(-) create mode 100644 tools/compiler/GlobalUsings.cs diff --git a/tools/compiler/CompileCommand.cs b/tools/compiler/CompileCommand.cs index 6c0d57fa..0eff852c 100644 --- a/tools/compiler/CompileCommand.cs +++ b/tools/compiler/CompileCommand.cs @@ -1,12 +1,7 @@ namespace vein.cmd; -using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Threading.Tasks; using compilation; using project; -using Spectre.Console; using Spectre.Console.Cli; using static Spectre.Console.AnsiConsole; diff --git a/tools/compiler/GlobalUsings.cs b/tools/compiler/GlobalUsings.cs new file mode 100644 index 00000000..29142cb1 --- /dev/null +++ b/tools/compiler/GlobalUsings.cs @@ -0,0 +1,16 @@ +global using System; +global using System.Collections.Concurrent; +global using System.Collections.Generic; +global using System.Diagnostics; +global using System.IO; +global using System.Linq; +global using System.Threading; +global using System.Threading.Tasks; +global using ishtar; +global using ishtar.emit; +global using Newtonsoft.Json; +global using Spectre.Console; +global using vein.cmd; +global using vein.compiler.shared; +global using vein.runtime; +global using vein.syntax; diff --git a/tools/compiler/IAssemblyResolver.cs b/tools/compiler/IAssemblyResolver.cs index 1348eadf..c2b80852 100644 --- a/tools/compiler/IAssemblyResolver.cs +++ b/tools/compiler/IAssemblyResolver.cs @@ -1,8 +1,6 @@ namespace vein { - using System; using compilation; - using ishtar; public class AssemblyResolver : ModuleResolverBase { diff --git a/tools/compiler/Log.cs b/tools/compiler/Log.cs index 4d355bcb..eef63094 100644 --- a/tools/compiler/Log.cs +++ b/tools/compiler/Log.cs @@ -1,12 +1,8 @@ namespace vein; -using System; -using System.Collections.Generic; using System.Text; using compilation; -using ishtar; using MoreLinq; -using syntax; using static Spectre.Console.AnsiConsole; diff --git a/tools/compiler/Program.cs b/tools/compiler/Program.cs index d49e8424..94c2634a 100644 --- a/tools/compiler/Program.cs +++ b/tools/compiler/Program.cs @@ -1,14 +1,13 @@ -using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; using System.Globalization; using System.Runtime.CompilerServices; -using Newtonsoft.Json; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; using Newtonsoft.Json.Converters; -using Spectre.Console; using Spectre.Console.Cli; using vein; -using vein.cmd; +using vein.cli; using static Spectre.Console.AnsiConsole; using vein.json; diff --git a/tools/compiler/compilation/Analyzer.cs b/tools/compiler/compilation/Analyzer.cs index 97942d7c..ac0c8ca2 100644 --- a/tools/compiler/compilation/Analyzer.cs +++ b/tools/compiler/compilation/Analyzer.cs @@ -1,8 +1,5 @@ namespace vein.compilation; -using ishtar; -using Spectre.Console; -using syntax; using static runtime.VeinTypeCode; public partial class CompilationTask diff --git a/tools/compiler/compilation/Cache.cs b/tools/compiler/compilation/Cache.cs index c7c5780b..c61faf4b 100644 --- a/tools/compiler/compilation/Cache.cs +++ b/tools/compiler/compilation/Cache.cs @@ -1,15 +1,8 @@ namespace vein.compilation; -using System; -using Spectre.Console; -using System.Collections.Generic; -using System.IO; -using System.Linq; using System.Security.Cryptography; using System.Text; using MoreLinq; -using Newtonsoft.Json; -using vein.cmd; [ExcludeFromCodeCoverage] public class Cache diff --git a/tools/compiler/compilation/Collect.cs b/tools/compiler/compilation/Collect.cs index 0a2dad21..a7220166 100644 --- a/tools/compiler/compilation/Collect.cs +++ b/tools/compiler/compilation/Collect.cs @@ -1,12 +1,6 @@ namespace vein.compilation; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using cmd; using project; -using Spectre.Console; using styles; using vein.extensions; diff --git a/tools/compiler/compilation/CompilationLog.cs b/tools/compiler/compilation/CompilationLog.cs index 13ea4e3e..2eabb698 100644 --- a/tools/compiler/compilation/CompilationLog.cs +++ b/tools/compiler/compilation/CompilationLog.cs @@ -1,8 +1,5 @@ namespace vein.compilation; -using System.Collections.Generic; -using ishtar; - public class CompilationLog { public Queue Info { get; } = new(); diff --git a/tools/compiler/compilation/CompilationTarget.cs b/tools/compiler/compilation/CompilationTarget.cs index 397cae39..fc23b0e2 100644 --- a/tools/compiler/compilation/CompilationTarget.cs +++ b/tools/compiler/compilation/CompilationTarget.cs @@ -1,12 +1,7 @@ namespace vein.compilation; -using System.Collections.Generic; -using System.IO; -using cmd; using fs; using project; -using runtime; -using syntax; public record CompilationTarget { diff --git a/tools/compiler/compilation/CompilationTask.cs b/tools/compiler/compilation/CompilationTask.cs index 2fd7ea2f..b99387d0 100644 --- a/tools/compiler/compilation/CompilationTask.cs +++ b/tools/compiler/compilation/CompilationTask.cs @@ -1,24 +1,11 @@ namespace vein.compilation; using MoreLinq; -using Spectre.Console; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using ishtar; using vein; -using cmd; -using ishtar.emit; using extensions; using pipes; using project; -using runtime; using stl; -using syntax; using vein.fs; using vein.styles; diff --git a/tools/compiler/compilation/parts/args.cs b/tools/compiler/compilation/parts/args.cs index b256e7cd..dfe19cb9 100644 --- a/tools/compiler/compilation/parts/args.cs +++ b/tools/compiler/compilation/parts/args.cs @@ -1,12 +1,5 @@ namespace vein.compilation; -using System.Collections.Generic; -using System.Linq; -using ishtar; -using ishtar.emit; -using runtime; -using syntax; - public partial class CompilationTask { private VeinArgumentRef[] GenerateArgument(ClassBuilder clazz, MethodDeclarationSyntax method, DocumentDeclaration doc) diff --git a/tools/compiler/compilation/parts/aspects.cs b/tools/compiler/compilation/parts/aspects.cs index 3b83381f..be11ed92 100644 --- a/tools/compiler/compilation/parts/aspects.cs +++ b/tools/compiler/compilation/parts/aspects.cs @@ -1,13 +1,6 @@ namespace vein.compilation; -using System; -using System.Collections.Generic; -using System.Linq; using extensions; -using ishtar; -using ishtar.emit; -using runtime; -using syntax; using vein.reflection; using static runtime.VeinTypeCode; diff --git a/tools/compiler/compilation/parts/bodies.cs b/tools/compiler/compilation/parts/bodies.cs index 9c9fc509..95488dc0 100644 --- a/tools/compiler/compilation/parts/bodies.cs +++ b/tools/compiler/compilation/parts/bodies.cs @@ -1,12 +1,5 @@ namespace vein.compilation; -using ishtar; -using System; -using System.Linq; -using ishtar.emit; -using runtime; -using Spectre.Console; -using vein.syntax; using static runtime.VeinTypeCode; public partial class CompilationTask diff --git a/tools/compiler/compilation/parts/classes.cs b/tools/compiler/compilation/parts/classes.cs index b8783dbd..5e93b8da 100644 --- a/tools/compiler/compilation/parts/classes.cs +++ b/tools/compiler/compilation/parts/classes.cs @@ -1,17 +1,8 @@ namespace vein.compilation; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; using exceptions; using extensions; -using ishtar; -using ishtar.emit; using MoreLinq; -using runtime; -using Spectre.Console; -using syntax; using vein.reflection; using static runtime.MethodFlags; diff --git a/tools/compiler/compilation/parts/ctors.cs b/tools/compiler/compilation/parts/ctors.cs index ab7ca733..57489b0d 100644 --- a/tools/compiler/compilation/parts/ctors.cs +++ b/tools/compiler/compilation/parts/ctors.cs @@ -1,13 +1,6 @@ namespace vein.compilation; -using System; -using ishtar.emit; -using System.Collections.Generic; -using System.Linq; -using ishtar; using MoreLinq; -using vein.runtime; -using vein.syntax; using static runtime.VeinTypeCode; public partial class CompilationTask diff --git a/tools/compiler/compilation/parts/fields.cs b/tools/compiler/compilation/parts/fields.cs index cae4e342..07f020f4 100644 --- a/tools/compiler/compilation/parts/fields.cs +++ b/tools/compiler/compilation/parts/fields.cs @@ -1,11 +1,6 @@ namespace vein.compilation; -using System.Linq; using System.Linq.Expressions; -using ishtar; -using ishtar.emit; -using runtime; -using syntax; using vein.exceptions; using static runtime.VeinTypeCode; diff --git a/tools/compiler/compilation/parts/inheritance.cs b/tools/compiler/compilation/parts/inheritance.cs index af2237fd..8d6bacf6 100644 --- a/tools/compiler/compilation/parts/inheritance.cs +++ b/tools/compiler/compilation/parts/inheritance.cs @@ -1,10 +1,5 @@ namespace vein.compilation; -using System.Linq; -using ishtar.emit; -using Spectre.Console; -using syntax; - public partial class CompilationTask { public void ValidateInheritance((ClassBuilder @class, MemberDeclarationSyntax member) x) diff --git a/tools/compiler/compilation/parts/methods.cs b/tools/compiler/compilation/parts/methods.cs index 8703f5fc..964427f4 100644 --- a/tools/compiler/compilation/parts/methods.cs +++ b/tools/compiler/compilation/parts/methods.cs @@ -1,12 +1,5 @@ namespace vein.compilation; -using ishtar.emit; -using System.Collections.Generic; -using ishtar; -using Spectre.Console; -using runtime; -using syntax; - public partial class CompilationTask { private MethodFlags GenerateMethodFlags(MethodDeclarationSyntax method) diff --git a/tools/compiler/compilation/parts/props.cs b/tools/compiler/compilation/parts/props.cs index e9d43f98..d2f35e4c 100644 --- a/tools/compiler/compilation/parts/props.cs +++ b/tools/compiler/compilation/parts/props.cs @@ -1,10 +1,5 @@ namespace vein.compilation; -using ishtar.emit; -using runtime; -using syntax; -using System; - public partial class CompilationTask { public (VeinProperty prop, PropertyDeclarationSyntax member) diff --git a/tools/compiler/compilation/parts/shitcode_plug.cs b/tools/compiler/compilation/parts/shitcode_plug.cs index 5737d475..a54e7241 100644 --- a/tools/compiler/compilation/parts/shitcode_plug.cs +++ b/tools/compiler/compilation/parts/shitcode_plug.cs @@ -1,10 +1,5 @@ namespace vein.compilation; -using System.Linq; -using ishtar; -using ishtar.emit; -using runtime; -using syntax; using static runtime.VeinTypeCode; public partial class CompilationTask diff --git a/tools/compiler/compilation/parts/types.cs b/tools/compiler/compilation/parts/types.cs index 26b79ec8..a34b0628 100644 --- a/tools/compiler/compilation/parts/types.cs +++ b/tools/compiler/compilation/parts/types.cs @@ -1,11 +1,6 @@ namespace vein.compilation; -using System.Linq; -using ishtar.emit; using reflection; -using runtime; -using Spectre.Console; -using syntax; public partial class CompilationTask { diff --git a/tools/compiler/pipes/CompilerPipeline.cs b/tools/compiler/pipes/CompilerPipeline.cs index b7ba9e7d..32c823f4 100644 --- a/tools/compiler/pipes/CompilerPipeline.cs +++ b/tools/compiler/pipes/CompilerPipeline.cs @@ -1,12 +1,7 @@ namespace vein.pipes; -using System; -using System.Collections.Generic; -using System.IO; -using cmd; using compilation; using fs; -using ishtar.emit; using project; [ExcludeFromCodeCoverage] diff --git a/tools/compiler/pipes/CopyDependencies.cs b/tools/compiler/pipes/CopyDependencies.cs index 6393401d..430c1376 100644 --- a/tools/compiler/pipes/CopyDependencies.cs +++ b/tools/compiler/pipes/CopyDependencies.cs @@ -1,9 +1,6 @@ namespace vein.pipes; -using System.IO; -using System.Linq; using System.Text; -using cmd; using fs; [ExcludeFromCodeCoverage] diff --git a/tools/compiler/pipes/GeneratePackage.cs b/tools/compiler/pipes/GeneratePackage.cs index f806659d..ebf5be37 100644 --- a/tools/compiler/pipes/GeneratePackage.cs +++ b/tools/compiler/pipes/GeneratePackage.cs @@ -1,11 +1,6 @@ namespace vein.pipes; -using System.Diagnostics; -using System.IO; -using System.Linq; -using cmd; using fs; -using Newtonsoft.Json; using project; using project.shards; diff --git a/tools/compiler/pipes/PipelineRunner.cs b/tools/compiler/pipes/PipelineRunner.cs index ea7a87e2..3cfa7318 100644 --- a/tools/compiler/pipes/PipelineRunner.cs +++ b/tools/compiler/pipes/PipelineRunner.cs @@ -1,7 +1,5 @@ namespace vein.pipes; -using System.Collections.Generic; -using System.Threading; using compilation; using fs; diff --git a/tools/compiler/pipes/SingleFileOutputPipe.cs b/tools/compiler/pipes/SingleFileOutputPipe.cs index 707ff20b..0cad2b96 100644 --- a/tools/compiler/pipes/SingleFileOutputPipe.cs +++ b/tools/compiler/pipes/SingleFileOutputPipe.cs @@ -1,10 +1,5 @@ namespace vein.pipes; -using System; -using System.IO; -using System.Linq; -using cmd; - [ExcludeFromCodeCoverage] public class SingleFileOutputPipe : CompilerPipeline { diff --git a/tools/compiler/pipes/WriteOutputPipe.cs b/tools/compiler/pipes/WriteOutputPipe.cs index 89e5543f..8625b7c1 100644 --- a/tools/compiler/pipes/WriteOutputPipe.cs +++ b/tools/compiler/pipes/WriteOutputPipe.cs @@ -1,7 +1,5 @@ namespace vein.pipes; -using System.IO; -using cmd; using fs; using MoreLinq; From a2cbb3957d479c78285bf83d4082b069783ea653 Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:01:37 +0300 Subject: [PATCH 02/22] drop unused code --- tools/compiler/CompileCommand.cs | 40 ------ tools/compiler/shards/ShardRegistryQuery.cs | 134 -------------------- tools/compiler/shards/ShardStorage.cs | 113 ----------------- 3 files changed, 287 deletions(-) delete mode 100644 tools/compiler/shards/ShardRegistryQuery.cs delete mode 100644 tools/compiler/shards/ShardStorage.cs diff --git a/tools/compiler/CompileCommand.cs b/tools/compiler/CompileCommand.cs index 0eff852c..519a0d4c 100644 --- a/tools/compiler/CompileCommand.cs +++ b/tools/compiler/CompileCommand.cs @@ -5,46 +5,6 @@ namespace vein.cmd; using Spectre.Console.Cli; using static Spectre.Console.AnsiConsole; -[ExcludeFromCodeCoverage] -public class CompileSettings : CommandSettings, IProjectSettingProvider -{ - [Description("Path to vproj file")] - [CommandArgument(0, "[PROJECT]")] - public string Project { get; set; } - - [Description("Display exported types table")] - [CommandOption("--print-result-types")] - public bool PrintResultType { get; set; } - - [Description("Display exported types table")] - [CommandOption("--disable-optimization|-O")] - public bool DisableOptimization { get; set; } - - [Description("Compile into single file")] - [CommandOption("--single-file|-s")] - public bool HasSingleFile { get; set; } - - [Description("Wait to attach debbugger (ONLY DEBUG COMPILER)")] - [CommandOption("--sys-debugger")] - public bool IsNeedDebuggerAttach { get; set; } - [Description("Enable stacktrace printing when error.")] - [CommandOption("--sys-stack-trace")] - public bool DisplayStacktraceGenerator { get; set; } - - [Description("Generate shard package.")] - [CommandOption("--gen-shard")] - public bool GeneratePackageOutput { get; set; } - - [Description("Ignore cache.")] - [CommandOption("--ignore-cache")] - public bool IgnoreCache { get; set; } - - [Description("Override generated version")] - [CommandOption("--override-version", IsHidden = true)] - public string OverrideVersion { get; set; } -} - - [ExcludeFromCodeCoverage] public class CompileCommand : AsyncCommandWithProject { diff --git a/tools/compiler/shards/ShardRegistryQuery.cs b/tools/compiler/shards/ShardRegistryQuery.cs deleted file mode 100644 index 00bd98a6..00000000 --- a/tools/compiler/shards/ShardRegistryQuery.cs +++ /dev/null @@ -1,134 +0,0 @@ -namespace vein; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Flurl.Http; -using Newtonsoft.Json; -using project; -using project.shards; - -public class ShardRegistryQuery -{ - private readonly Uri _endpoint; - private IFlurlClient _client; - private IShardStorage _storage; - - public ShardRegistryQuery(Uri endpoint) - { - var settings = new JsonSerializerSettings - { - ReferenceLoopHandling = ReferenceLoopHandling.Ignore - }; - var serializer = new Flurl.Http.Newtonsoft.NewtonsoftJsonSerializer(settings); - - _endpoint = endpoint; - _client = new FlurlClient($"{endpoint}").WithSettings(x => - { - x.JsonSerializer = serializer; - }); - - } - - public ShardRegistryQuery WithStorage(IShardStorage storage) - { - _storage = storage; - return this; - } - - public ShardRegistryQuery WithApiKey(string apiKey) - { - _client = _client.WithHeader("X-VEIN-API-KEY", apiKey); - return this; - } - - public async ValueTask DownloadShardAsync(RegistryPackage manifest, - CancellationToken token = default) - { - if (_storage.IsAvailable(manifest)) - return manifest; - - var path = _storage.EnsureSpace(manifest); - var name = manifest.Name; - var version = manifest.Version.ToNormalizedString(); - - var result = await _client - .Request($"@/packages/{name}/{version}") - .AllowHttpStatus("404") - .GetAsync(cancellationToken: token); - - if (result is { StatusCode: 404 }) - return null; - - var package = path.File(_storage.TemplateName(manifest)); - - using (var file = package.OpenWrite()) - using (var remote = await result.GetStreamAsync()) - await remote.CopyToAsync(file, token); - - var shard = await Shard.OpenAsync(package); - - shard.ExtractTo(path); - - return manifest; - } - public async ValueTask DownloadShardAsync(string name, string version, - CancellationToken token = default) - { - var manifest = await FindByName(name, version); - - if (manifest is null) - return null; - - return await DownloadShardAsync(manifest, token); - } - public async ValueTask FindByName(string name, string version, bool includeUnlisted = false, - CancellationToken token = default) - { - var result = await _client - .Request($"@/package/{name}/{version}") - .SetQueryParam(nameof(includeUnlisted), includeUnlisted) - .AllowHttpStatus("404") - .GetAsync(cancellationToken: token); - - if (result is { StatusCode: 404 }) - return null; - - return await result.GetJsonAsync(); - } - - public async ValueTask<(RegistryResponse response, int status)> PublishPackage(FileInfo info) - { - if (!info.Extension.Equals(".shard")) - throw new ShardPackageCorruptedException($"File is not shard package."); - var shard = await Shard.OpenAsync(info); - var pkg = _storage.TemplateName(shard.Name, shard.Version); - - var response = await _client.Request("@/publish") - .AllowHttpStatus("400,409,201,403,500") - .PostMultipartAsync(x => x.AddFile(pkg, info.FullName, "binary/octet-stream", fileName: pkg)); - - return (await response.GetJsonAsync(), response.StatusCode); - } - - public async ValueTask> SearchAsync(string q, - int skip = 0, - int take = 20, - bool prerelease = false, - CancellationToken cancellationToken = default) => - await _client.Request("@/search/index") - .SetQueryParam(nameof(q), q) - .SetQueryParam(nameof(skip), skip) - .SetQueryParam(nameof(take), take) - .SetQueryParam(nameof(prerelease), prerelease) - .GetJsonAsync>(cancellationToken: cancellationToken); -} - - -public class RegistryResponse -{ - public string message { get; set; } - public string traceId { get; set; } -} diff --git a/tools/compiler/shards/ShardStorage.cs b/tools/compiler/shards/ShardStorage.cs deleted file mode 100644 index c626a96a..00000000 --- a/tools/compiler/shards/ShardStorage.cs +++ /dev/null @@ -1,113 +0,0 @@ -namespace vein; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using MoreLinq; -using Newtonsoft.Json; -using NuGet.Versioning; -using project; - -public class ShardStorage : IShardStorage -{ - public static readonly DirectoryInfo RootFolder = - new DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".vein", - "shards")); - - public void EnsureDefaultDirectory() - { - if (!RootFolder.Exists) RootFolder.Create(); - } - - public DirectoryInfo EnsureSpace(RegistryPackage package) - { - EnsureDefaultDirectory(); - - var space = GetPackageSpace(package); - - space.Create(); - - return space; - } - - public bool IsAvailable(RegistryPackage package) - => IsAvailable(package.Name, package.Version); - - public bool IsAvailable(string name, NuGetVersion version) - => GetShardByName(name, version).Exists; - - public FileInfo GetShardByName(string name, NuGetVersion version) - => GetPackageSpace(name, version).File(TemplateName(name, version)); - - public FileInfo GetShardByName(RegistryPackage package) - => GetShardByName(package.Name, package.Version); - - public DirectoryInfo GetPackageSpace(RegistryPackage package) - => GetPackageSpace(package.Name, package.Version); - - public DirectoryInfo GetPackageSpace(string name, NuGetVersion version) - => RootFolder - .SubDirectory(name) - .SubDirectory(version.ToNormalizedString()); - - public void Prune() => - RootFolder.EnumerateFiles("*.*", SearchOption.AllDirectories) - .Pipe(x => x.Delete()); - - public List GetAvailableVersions(string name) => - RootFolder - .SubDirectory(name) - .EnumerateDirectories() - .Where(x => NuGetVersion.TryParse(x.Name, out _)) - .Select(x => NuGetVersion.Parse(x.Name)) - .ToList(); - - public List GetBinaries(string name, NuGetVersion version) - { - var bin = GetPackageSpace(name, version).SubDirectory("lib"); - if (bin.Exists) return bin.EnumerateFiles("*.wll").ToList(); - return new(); - } - - public List GetBinaries(RegistryPackage package) - => GetBinaries(package.Name, package.Version); - - public string TemplateName(string name, NuGetVersion version) => - $"{name}-{version}.shard"; - public string TemplateName(RegistryPackage package) => - TemplateName(package.Name, package.Version); - - public RegistryPackage GetManifest(string name, NuGetVersion version) - { - if (!IsAvailable(name, version)) - return null; - - var json = GetPackageSpace(name, version).File("manifest.json"); - return JsonConvert.DeserializeObject(json.ReadToEnd()); - } -} - - -public interface IShardStorage -{ - bool IsAvailable(RegistryPackage package); - bool IsAvailable(string name, NuGetVersion version); - DirectoryInfo EnsureSpace(RegistryPackage package); - FileInfo GetShardByName(string name, NuGetVersion version); - FileInfo GetShardByName(RegistryPackage package); - DirectoryInfo GetPackageSpace(RegistryPackage package); - DirectoryInfo GetPackageSpace(string name, NuGetVersion version); - void Prune(); - - List GetAvailableVersions(string name); - - List GetBinaries(string name, NuGetVersion version); - List GetBinaries(RegistryPackage package); - - string TemplateName(string name, NuGetVersion version); - - string TemplateName(RegistryPackage package); - - RegistryPackage GetManifest(string name, NuGetVersion version); -} From 6a41eb119b84407c61a0086feef8d00ba30d5c3a Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:01:58 +0300 Subject: [PATCH 03/22] add support additional objects output --- tools/compiler/pipes/CompilerPipeline.cs | 2 ++ tools/compiler/pipes/WriteOutputPipe.cs | 25 +++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/tools/compiler/pipes/CompilerPipeline.cs b/tools/compiler/pipes/CompilerPipeline.cs index 32c823f4..695c7e74 100644 --- a/tools/compiler/pipes/CompilerPipeline.cs +++ b/tools/compiler/pipes/CompilerPipeline.cs @@ -9,6 +9,8 @@ public abstract class CompilerPipeline { protected DirectoryInfo OutputDirectory => new(Path.Combine(Project.WorkDir.FullName, "bin")); + protected DirectoryInfo ObjectDirectory + => new(Path.Combine(Project.WorkDir.FullName, "obj")); protected FileInfo OutputBinaryPath => new(Path.Combine(OutputDirectory.FullName, $"{Project.Name}.wll")); diff --git a/tools/compiler/pipes/WriteOutputPipe.cs b/tools/compiler/pipes/WriteOutputPipe.cs index 8625b7c1..d4bb3928 100644 --- a/tools/compiler/pipes/WriteOutputPipe.cs +++ b/tools/compiler/pipes/WriteOutputPipe.cs @@ -13,25 +13,40 @@ public override void Action() else if (Target.HasChanged) OutputDirectory.EnumerateFiles("*.*", SearchOption.AllDirectories).ForEach(x => x.Delete()); + + var wil_file = ObjectDirectory.File($"{Project.Name}.o"); + var dir = ObjectDirectory.SubDirectory("fragments").Ensure(); - var wil_file = new FileInfo(Path.Combine(OutputDirectory.FullName, $"{Project.Name}.wll.bin")); - + dir.EnumerateFiles("*.*").ForEach(x => x.Delete()); if (Target.HasChanged) { var wil_data = Module.BakeByteArray(); - Assembly = new IshtarAssembly(Module); IshtarAssembly.WriteTo(Assembly, OutputBinaryPath.FullName); File.WriteAllBytes(wil_file.FullName, wil_data); + + var dict = new ConcurrentDictionary(); + Parallel.ForEachAsync(Module.class_table.OfType(), + async (baker, token) => + { + if (baker is ClassBuilder clazz) + { + var g = Guid.NewGuid().ToString("N"); + dict.TryAdd($"class:{clazz.Name.name}", g); + await dir.File($"{g}.o").WriteAllBytesAsync(baker.BakeByteArray(), token); + await dir.File($"{g}.symbol").WriteAllTextAsync(baker.BakeDebugString(), token); + await dir.File($"{g}.e").WriteAllTextAsync(baker.BakeDiagnosticDebugString(), token); + } + }).Wait(); + ObjectDirectory.File("db.json").WriteAllText(JsonConvert.SerializeObject(dict)); + ObjectDirectory.File($"{Project.Name}.symbol.lay").WriteAllText(IshtarAssembly.GetDebugData(Assembly)); } - SaveArtifacts(new ILArtifact(wil_file, Project.Name)); SaveArtifacts(new BinaryArtifact(OutputBinaryPath, Project.Name)); - SaveArtifacts(new DebugSymbolArtifact(new FileInfo($"{wil_file.FullName}.lay"), Project.Name)); } public override bool CanApply(CompileSettings flags) => true; From 5621ada1bdbe7a4907f853c3bbd55b7de4a2a866 Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:02:27 +0300 Subject: [PATCH 04/22] add shared compile settings --- lib/vein.compiler.shared/CompileSettings.cs | 44 +++++++++++++++++++ .../vein.compiler.shared.csproj | 13 ++++++ 2 files changed, 57 insertions(+) create mode 100644 lib/vein.compiler.shared/CompileSettings.cs create mode 100644 lib/vein.compiler.shared/vein.compiler.shared.csproj diff --git a/lib/vein.compiler.shared/CompileSettings.cs b/lib/vein.compiler.shared/CompileSettings.cs new file mode 100644 index 00000000..0d4ecbfb --- /dev/null +++ b/lib/vein.compiler.shared/CompileSettings.cs @@ -0,0 +1,44 @@ +namespace vein.compiler.shared; + +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; +using Spectre.Console.Cli; + +[ExcludeFromCodeCoverage] +public class CompileSettings : CommandSettings, IProjectSettingProvider +{ + [Description("Path to vproj file")] + [CommandArgument(0, "[PROJECT]")] + public string Project { get; set; } + + [Description("Display exported types table")] + [CommandOption("--print-result-types")] + public bool PrintResultType { get; set; } + + [Description("Display exported types table")] + [CommandOption("--disable-optimization|-O")] + public bool DisableOptimization { get; set; } + + [Description("Compile into single file")] + [CommandOption("--single-file|-s")] + public bool HasSingleFile { get; set; } + + [Description("Wait to attach debbugger (ONLY DEBUG COMPILER)")] + [CommandOption("--sys-debugger")] + public bool IsNeedDebuggerAttach { get; set; } + [Description("Enable stacktrace printing when error.")] + [CommandOption("--sys-stack-trace")] + public bool DisplayStacktraceGenerator { get; set; } + + [Description("Generate shard package.")] + [CommandOption("--gen-shard")] + public bool GeneratePackageOutput { get; set; } + + [Description("Ignore cache.")] + [CommandOption("--ignore-cache")] + public bool IgnoreCache { get; set; } + + [Description("Override generated version")] + [CommandOption("--override-version", IsHidden = true)] + public string OverrideVersion { get; set; } +} diff --git a/lib/vein.compiler.shared/vein.compiler.shared.csproj b/lib/vein.compiler.shared/vein.compiler.shared.csproj new file mode 100644 index 00000000..88311c46 --- /dev/null +++ b/lib/vein.compiler.shared/vein.compiler.shared.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + From 0099ec6c13ae6f9ad4b463d09002e73483328a82 Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:02:48 +0300 Subject: [PATCH 05/22] bump spectre console --- lib/spectre.console | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spectre.console b/lib/spectre.console index ccc02996..98b6a432 160000 --- a/lib/spectre.console +++ b/lib/spectre.console @@ -1 +1 @@ -Subproject commit ccc029960470ddbfeb2ba3d23cf5da879de7d614 +Subproject commit 98b6a4328ac4263a26794576ea886215c1a687ae From ce0da93f4bc1a3ae500fe674d6991542e0591ba7 Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:03:17 +0300 Subject: [PATCH 06/22] additional guards, fix expose name in workload converters --- lib/projectsystem/Workload.converters.cs | 61 +++++++++++++++++++----- lib/projectsystem/Workload.cs | 9 +++- 2 files changed, 55 insertions(+), 15 deletions(-) diff --git a/lib/projectsystem/Workload.converters.cs b/lib/projectsystem/Workload.converters.cs index 93192c24..75f43d85 100644 --- a/lib/projectsystem/Workload.converters.cs +++ b/lib/projectsystem/Workload.converters.cs @@ -14,10 +14,9 @@ public override void WriteJson(JsonWriter writer, WorkloadKey value, JsonSeriali public override WorkloadKey ReadJson(JsonReader reader, Type objectType, WorkloadKey existingValue, bool hasExistingValue, JsonSerializer serializer) { - if (hasExistingValue) - throw new NotSupportedException(); - - return new((string)reader.Value); + if (reader.Value is not string str) + throw new InvalidOperationException(); + return new(str); } } public class PackageKeyContactConverter : JsonConverter @@ -28,9 +27,9 @@ public override void WriteJson(JsonWriter writer, PackageKey value, JsonSerializ public override PackageKey ReadJson(JsonReader reader, Type objectType, PackageKey existingValue, bool hasExistingValue, JsonSerializer serializer) { - if (hasExistingValue) - throw new NotSupportedException(); - return new((string)reader.Value); + if (reader.Value is not string str) + throw new InvalidOperationException(); + return new(str); } } public class PlatformKeyContactConverter : JsonConverter @@ -41,9 +40,9 @@ public override void WriteJson(JsonWriter writer, PlatformKey value, JsonSeriali public override PlatformKey ReadJson(JsonReader reader, Type objectType, PlatformKey existingValue, bool hasExistingValue, JsonSerializer serializer) { - if (hasExistingValue) - throw new NotSupportedException(); - return new((string)reader.Value); + if (reader.Value is not string str) + throw new InvalidOperationException(); + return new(str); } } public class PackageKindKeyContactConverter : JsonConverter @@ -54,9 +53,9 @@ public override void WriteJson(JsonWriter writer, PackageKindKey value, JsonSeri public override PackageKindKey ReadJson(JsonReader reader, Type objectType, PackageKindKey existingValue, bool hasExistingValue, JsonSerializer serializer) { - if (hasExistingValue) - throw new NotSupportedException(); - return new((string)reader.Value); + if (reader.Value is not string str) + throw new InvalidOperationException(); + return new(str); } } public class WorkloadPackageBaseConverter : JsonConverter> @@ -123,6 +122,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist foreach (var property in jsonObject.Properties()) { + property.Value["name"] = property.Name; var workload = property.Value.ToObject(serializer); workloads[new WorkloadKey(property.Name)] = workload; } @@ -179,6 +179,40 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s } } +public class DictionaryWithPackageKeyConverter : JsonConverter +{ + public override bool CanConvert(Type objectType) + => typeof(Dictionary).IsAssignableFrom(objectType); + + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + var packages = new Dictionary(); + var jsonObject = JObject.Load(reader); + + foreach (var property in jsonObject.Properties()) + { + var package = property.Value.ToObject(serializer); + packages[new PackageKey(property.Name)] = package; + } + + return packages; + } + + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + var packages = (Dictionary)value; + writer.WriteStartObject(); + + foreach (var kvp in packages) + { + writer.WritePropertyName(kvp.Key.key); + serializer.Serialize(writer, kvp.Value); + } + + writer.WriteEndObject(); + } +} + public class WorkloadPackageConverter : JsonConverter { public override bool CanConvert(Type objectType) @@ -191,6 +225,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist foreach (var property in jsonObject.Properties()) { + property.Value["name"] = property.Name; var package = property.Value.ToObject(serializer); packages[new PackageKey(property.Name)] = package; } diff --git a/lib/projectsystem/Workload.cs b/lib/projectsystem/Workload.cs index d15cb760..e762214e 100644 --- a/lib/projectsystem/Workload.cs +++ b/lib/projectsystem/Workload.cs @@ -12,15 +12,17 @@ namespace vein.project; using NuGet.Versioning; -public record Workload([field: JsonIgnore] WorkloadKey name) +public record Workload { + public required WorkloadKey name { get; init; } public required List Platforms { get; init; } = new(); public required List Packages { get; init; } = new(); public required string Description { get; init; } } -public record WorkloadPackage([field: JsonIgnore] PackageKey name) +public record WorkloadPackage { + public required PackageKey name { get; init; } public required PackageKindKey Kind { get; init; } [JsonConverter(typeof(DictionaryAliasesConverter))] public required Dictionary Aliases { get; init; } = new(); @@ -131,6 +133,9 @@ public static PlatformKey GetCurrentPlatform() [JsonConverter(typeof(PackageKeyContactConverter))] public readonly record struct PackageKey(string key) { + public static PackageKey VeinCompilerPackage = new("vein-compiler-package"); + public static PackageKey VeinRuntimePackage = new("vein-runtime-package"); + public override string ToString() => key; } From bf063feca666a2cee21dfec2aeb6740e9415fcec Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:03:28 +0300 Subject: [PATCH 07/22] add spectre DI host support --- .../di/SpectreConsoleHostBuilderExtensions.cs | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 lib/vein.cli.core/di/SpectreConsoleHostBuilderExtensions.cs diff --git a/lib/vein.cli.core/di/SpectreConsoleHostBuilderExtensions.cs b/lib/vein.cli.core/di/SpectreConsoleHostBuilderExtensions.cs new file mode 100644 index 00000000..e497cc1c --- /dev/null +++ b/lib/vein.cli.core/di/SpectreConsoleHostBuilderExtensions.cs @@ -0,0 +1,122 @@ +namespace vein.cli; + +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Spectre.Console.Cli; +using ITypeResolver = Spectre.Console.Cli.ITypeResolver; + +public static class SpectreConsoleHostBuilderExtensions +{ + public static IHostBuilder UseSpectreConsole(this IHostBuilder builder, Action configureCommandApp) + { + builder = builder ?? throw new ArgumentNullException(nameof(builder)); + + builder.ConfigureServices((_, collection) => + { + var command = new CommandApp(new TypeRegistrar(collection)); + command.Configure(configureCommandApp); + collection.AddSingleton(command); + collection.AddHostedService(); + } + ); + + return builder; + } + + public static IHostBuilder UseSpectreConsole(this IHostBuilder builder, + Action? configureCommandApp = null) + where TDefaultCommand : class, ICommand + { + builder = builder ?? throw new ArgumentNullException(nameof(builder)); + + builder.ConfigureServices((_, collection) => + { + var command = new CommandApp(new TypeRegistrar(collection)); + if (configureCommandApp != null) + { + command.Configure(configureCommandApp); + } + + collection.AddSingleton(command); + collection.AddHostedService(); + } + ); + + return builder; + } +} +public sealed class TypeResolver(IServiceProvider serviceProvider) : ITypeResolver, IDisposable +{ + private readonly IServiceProvider _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); + + public void Dispose() + { + if (_serviceProvider is IDisposable disposable) + { + disposable.Dispose(); + } + } + + public object? Resolve(Type? type) + { + if (type == null) + { + return null; + } + + return _serviceProvider.GetService(type) ?? Activator.CreateInstance(type); + } +} +public sealed class TypeRegistrar(IServiceCollection builder) : ITypeRegistrar +{ + public ITypeResolver Build() => new TypeResolver(builder.BuildServiceProvider()); + + public void Register(Type service, Type implementation) => builder.AddSingleton(service, implementation); + + public void RegisterInstance(Type service, object implementation) => builder.AddSingleton(service, implementation); + + public void RegisterLazy(Type service, Func func) + { + if (func is null) + throw new ArgumentNullException(nameof(func)); + + builder.AddSingleton(service, _ => func()); + } +} + +public class SpectreConsoleWorker( + ILogger logger, + ICommandApp commandApp, + IHostApplicationLifetime hostLifetime) + : IHostedService +{ + private int _exitCode; + + public Task StartAsync(CancellationToken cancellationToken) => + Task.Factory.StartNew(async () => { + try + { + var args = GetArgs(); + await Task.Delay(100, cancellationToken); + _exitCode = await commandApp.RunAsync(args); + } + catch (Exception ex) + { + logger.LogError(ex, "An unexpected error occurred"); + _exitCode = 1; + } + finally + { + hostLifetime.StopApplication(); + } + }, cancellationToken); + + public Task StopAsync(CancellationToken cancellationToken) + { + Environment.ExitCode = _exitCode; + return Task.CompletedTask; + } + + private static string[] GetArgs() => Environment.GetCommandLineArgs().Skip(1).Where(x => !x.StartsWith("+")).ToArray(); +} From 0808a4c41dc6d39cb1ddc2453c63965c2fcd5a9e Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:03:50 +0300 Subject: [PATCH 08/22] move shard storage and query to base project --- .../vein.cli.core}/ShardRegistryQuery.cs | 0 .../shards => lib/vein.cli.core}/ShardStorage.cs | 13 ++++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) rename {tools/rune-cli/shards => lib/vein.cli.core}/ShardRegistryQuery.cs (100%) rename {tools/rune-cli/shards => lib/vein.cli.core}/ShardStorage.cs (95%) diff --git a/tools/rune-cli/shards/ShardRegistryQuery.cs b/lib/vein.cli.core/ShardRegistryQuery.cs similarity index 100% rename from tools/rune-cli/shards/ShardRegistryQuery.cs rename to lib/vein.cli.core/ShardRegistryQuery.cs diff --git a/tools/rune-cli/shards/ShardStorage.cs b/lib/vein.cli.core/ShardStorage.cs similarity index 95% rename from tools/rune-cli/shards/ShardStorage.cs rename to lib/vein.cli.core/ShardStorage.cs index a2ab6d06..d85a8598 100644 --- a/tools/rune-cli/shards/ShardStorage.cs +++ b/lib/vein.cli.core/ShardStorage.cs @@ -15,7 +15,10 @@ namespace vein; public class ShardStorage : IShardStorage { - public static readonly DirectoryInfo RootFolder = + public static readonly DirectoryInfo VeinRootFolder = + new(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".vein")); + + public static readonly DirectoryInfo ShardRootFolder = new(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".vein", "shards")); @@ -27,7 +30,7 @@ public class ShardStorage : IShardStorage private void EnsureDefaultDirectory() { - if (!RootFolder.Exists) RootFolder.Create(); + if (!ShardRootFolder.Exists) ShardRootFolder.Create(); if (!RootFolderWorkloads.Exists) RootFolderWorkloads.Create(); if (!RootFolderNugets.Exists) RootFolderNugets.Create(); } @@ -74,16 +77,16 @@ public DirectoryInfo GetPackageSpace(NuspecReader package) => ToNugetFolder(package.GetId(), package.GetVersion()); public DirectoryInfo GetPackageSpace(string name, NuGetVersion version) - => RootFolder + => ShardRootFolder .SubDirectory(name) .SubDirectory(version.ToNormalizedString()); public void Prune() => - RootFolder.EnumerateFiles("*.*", SearchOption.AllDirectories) + ShardRootFolder.EnumerateFiles("*.*", SearchOption.AllDirectories) .Pipe(x => x.Delete()); public List GetAvailableVersions(string name) => - RootFolder + ShardRootFolder .SubDirectory(name) .EnumerateDirectories() .Where(x => NuGetVersion.TryParse(x.Name, out _)) From 0bc6fc566d90579016ac25de4b1af30104ce0671 Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:04:08 +0300 Subject: [PATCH 09/22] add fork console support --- lib/vein.cli.core/RawConsole.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/vein.cli.core/RawConsole.cs b/lib/vein.cli.core/RawConsole.cs index e05078c3..29b843c0 100644 --- a/lib/vein.cli.core/RawConsole.cs +++ b/lib/vein.cli.core/RawConsole.cs @@ -17,4 +17,20 @@ public static IAnsiConsole Create() => UseDefaultEnrichers = false, }, }); + + public static IAnsiConsole CreateForkConsole() => + AnsiConsole.Create(new AnsiConsoleSettings + { + Ansi = AnsiSupport.Yes, + ColorSystem = (ColorSystemSupport)ColorSystem.TrueColor, + Out = new ForkConsole(Console.Out), + Interactive = InteractionSupport.Yes + }); +} + +public class ForkConsole(TextWriter writer) : AnsiConsoleOutput(writer) +{ + public override bool IsTerminal => true; + public override int Width => int.Parse(Environment.GetEnvironmentVariable("FORK_CONSOLE_W")!); + public override int Height => int.Parse(Environment.GetEnvironmentVariable("FORK_CONSOLE_H")!); } From 6728fb2a083f3f2de119d318aaf5908816570d93 Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:04:17 +0300 Subject: [PATCH 10/22] additional dependecies --- lib/vein.cli.core/vein.cli.core.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/vein.cli.core/vein.cli.core.csproj b/lib/vein.cli.core/vein.cli.core.csproj index df09e53e..6927c15a 100644 --- a/lib/vein.cli.core/vein.cli.core.csproj +++ b/lib/vein.cli.core/vein.cli.core.csproj @@ -13,6 +13,10 @@ + + + + From bfeeb4dbe5ba5974bd2a09c2bceed0facb535a02 Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:04:33 +0300 Subject: [PATCH 11/22] add file and directory additional extensions --- runtime/common/extensions/FileEntityEx.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/runtime/common/extensions/FileEntityEx.cs b/runtime/common/extensions/FileEntityEx.cs index 26bd0ce6..36920df8 100644 --- a/runtime/common/extensions/FileEntityEx.cs +++ b/runtime/common/extensions/FileEntityEx.cs @@ -3,6 +3,7 @@ namespace vein; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Threading; using System.Threading.Tasks; public static class FileEntityEx @@ -40,8 +41,18 @@ public static FileInfo File(this DirectoryInfo info, string name) return new FileInfo(Path.Combine(info.FullName, name)); } + public static string SanitizeFileSystemName(this string name) + => Path.GetInvalidFileNameChars().Concat([' ', ')', '(', '\\', '/', ',', '@']).Aggregate(name, (current, c) => current.Replace(c.ToString(), "")); + public static void WriteAllText(this FileInfo info, string content) => System.IO.File.WriteAllText(info.FullName, content); + public static void WriteAllBytes(this FileInfo info, byte[] content) + => System.IO.File.WriteAllBytes(info.FullName, content); + + public static Task WriteAllTextAsync(this FileInfo info, string content, CancellationToken ct = default) + => System.IO.File.WriteAllTextAsync(info.FullName, content, ct); + public static Task WriteAllBytesAsync(this FileInfo info, byte[] content, CancellationToken ct = default) + => System.IO.File.WriteAllBytesAsync(info.FullName, content, ct); public static string ReadToEnd(this FileInfo info) => System.IO.File.ReadAllText(info.FullName); From 4de3aa6df961f87f8ce2aa39dd67588788295ec3 Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:04:39 +0300 Subject: [PATCH 12/22] add BakeDiagnosticDebugString --- runtime/common/reflection/IBaker.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/common/reflection/IBaker.cs b/runtime/common/reflection/IBaker.cs index 30bed0e4..55d3aeb6 100644 --- a/runtime/common/reflection/IBaker.cs +++ b/runtime/common/reflection/IBaker.cs @@ -4,5 +4,6 @@ public interface IBaker { byte[] BakeByteArray(); string BakeDebugString(); + string BakeDiagnosticDebugString(); } } From c26c3389123135a3013c1851f217e2bbc1335ed3 Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:04:59 +0300 Subject: [PATCH 13/22] add use BakeDiagnosticDebugString in typical generators --- runtime/ishtar.base/emit/ClassBuilder.cs | 16 ++++++++++++++ runtime/ishtar.base/emit/ILGenerator.cs | 10 ++++++++- runtime/ishtar.base/emit/MethodBuilder.cs | 22 +++++++++++++++++++ runtime/ishtar.base/emit/VeinModuleBuilder.cs | 2 ++ runtime/ishtar.base/fs/IshtarAssembly.cs | 5 ++--- 5 files changed, 51 insertions(+), 4 deletions(-) diff --git a/runtime/ishtar.base/emit/ClassBuilder.cs b/runtime/ishtar.base/emit/ClassBuilder.cs index 5a438657..0b8bcf2e 100644 --- a/runtime/ishtar.base/emit/ClassBuilder.cs +++ b/runtime/ishtar.base/emit/ClassBuilder.cs @@ -246,6 +246,22 @@ string IBaker.BakeDebugString() return str.ToString(); } + public string BakeDiagnosticDebugString() + { + var str = new StringBuilder(); + str.AppendLine($".namespace '{FullName.Namespace}'"); + if (IsInterface) str.Append($".interface "); + else if (IsValueType) str.Append($".struct "); + else str.Append($".class "); + str.Append($"'{FullName.Name}' {Flags.EnumerateFlags([ClassFlags.None, ClassFlags.Interface]).Join(' ').ToLowerInvariant()}"); + str.AppendLine($" extends {Parents.Select(x => $"'{x.Name}'").Join(", ")}"); + str.AppendLine("{"); + foreach (var method in Methods.OfType().Select(method => method.BakeDiagnosticDebugString())) + str.AppendLine($"{method.Split("\n").Select(x => $"\t{x}").Join("\n").TrimEnd('\n')}"); + str.AppendLine("}"); + return str.ToString(); + } + #region Overrides of VeinClass protected override VeinMethod GetOrCreateTor(string name, bool isStatic = false) diff --git a/runtime/ishtar.base/emit/ILGenerator.cs b/runtime/ishtar.base/emit/ILGenerator.cs index 8a9b2b4d..ac570750 100644 --- a/runtime/ishtar.base/emit/ILGenerator.cs +++ b/runtime/ishtar.base/emit/ILGenerator.cs @@ -21,6 +21,7 @@ public sealed class ILGenerator private List _debug_list = []; internal readonly MethodBuilder _methodBuilder; private readonly StringBuilder _debugBuilder = new (); + private readonly StringBuilder _diagnosticDebugBuilder = new (); public static bool DoNotGenDebugInfo = true; internal int LocalsSize { get; set; } @@ -583,6 +584,8 @@ internal byte[] BakeByteArray() internal string BakeDebugString() => _position == 0 ? "" : $"{LocalsBuilder}\n{_debugBuilder}"; + internal string BakeDiagnosticDebugString() + => _position == 0 ? "" : $"{LocalsBuilder}\n{_diagnosticDebugBuilder}"; [MethodImpl(MethodImplOptions.AggressiveInlining)] internal void PutInteger4(int value) @@ -665,7 +668,12 @@ internal static T[] IncreaseCapacity(T[] incoming, int requiredSize) public void StoreIntoMetadata(string key, object o) => Metadata.Add(key, o); public bool HasMetadata(string key) => Metadata.ContainsKey(key); - private void DebugAppendLine(string s) => _debugBuilder.AppendLine(s); + private void DebugAppendLine(string s) + { + _debugBuilder.AppendLine(s); + _diagnosticDebugBuilder.AppendLine(s); + _diagnosticDebugBuilder.AppendLine(Environment.StackTrace); + } } diff --git a/runtime/ishtar.base/emit/MethodBuilder.cs b/runtime/ishtar.base/emit/MethodBuilder.cs index 9d6e07d9..bc4e8638 100644 --- a/runtime/ishtar.base/emit/MethodBuilder.cs +++ b/runtime/ishtar.base/emit/MethodBuilder.cs @@ -103,6 +103,28 @@ public string BakeDebugString() return str.ToString(); } + public string BakeDiagnosticDebugString() + { + var str = new StringBuilder(); + var args = Signature.ToTemplateString(true); + if (Flags.HasFlag(Extern)) + return ""; + if (Flags.HasFlag(Extern)) + return ""; + if (Flags.HasFlag(Abstract)) + return ""; + str.AppendLine($".method {(IsSpecial ? "special " : "")}'{RawName}' [{Signature.Arguments.Where(x => x.IsGeneric).Select(x => x.TypeArg!.ToTemplateString()).Join(',')}] {args} {Flags.EnumerateFlags([None, Extern]).Join(' ').ToLowerInvariant()}"); + var body = _generator.BakeDiagnosticDebugString(); + str.AppendLine("{"); + if (!string.IsNullOrEmpty(body)) + { + str.AppendLine($"\t"); + str.AppendLine($"{body.Split("\n").Select(x => $"\t{x}").Join("\n").TrimEnd('\n')}"); + } + str.AppendLine("}"); + return str.ToString(); + } + #region Arg&Locals manage (NEED REFACTORING) internal int? GetArgumentIndex(FieldName @ref) diff --git a/runtime/ishtar.base/emit/VeinModuleBuilder.cs b/runtime/ishtar.base/emit/VeinModuleBuilder.cs index 40430326..1ef702df 100644 --- a/runtime/ishtar.base/emit/VeinModuleBuilder.cs +++ b/runtime/ishtar.base/emit/VeinModuleBuilder.cs @@ -281,5 +281,7 @@ public string BakeDebugString() return str.ToString(); } + + public string BakeDiagnosticDebugString() => throw new NotImplementedException(); } } diff --git a/runtime/ishtar.base/fs/IshtarAssembly.cs b/runtime/ishtar.base/fs/IshtarAssembly.cs index bb5ee5ce..0c0d3755 100644 --- a/runtime/ishtar.base/fs/IshtarAssembly.cs +++ b/runtime/ishtar.base/fs/IshtarAssembly.cs @@ -192,9 +192,8 @@ internal static void WriteTo(IshtarAssembly asm, string file) using var fs = File.Create(file); WriteElf(memory.ToArray(), fs, asm.metadata); - - if (!string.IsNullOrEmpty(asm.DebugData)) - File.WriteAllText($"{file}.lay", asm.DebugData); } + + public static string GetDebugData(IshtarAssembly asm) => asm.DebugData; } } From 4cf71045f5577aaa8ae24fb29501423bc1d26e9a Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:05:09 +0300 Subject: [PATCH 14/22] fix builder --- .nuke/Build.cs | 1 + .nuke/build.csproj | 1 + 2 files changed, 2 insertions(+) diff --git a/.nuke/Build.cs b/.nuke/Build.cs index 6bfe2318..382f39e9 100644 --- a/.nuke/Build.cs +++ b/.nuke/Build.cs @@ -41,6 +41,7 @@ using Nuke.Common.Tools.Git; using Nuke.Common.Tools.GitVersion; using vein.cmd; +using vein.compiler.shared; using vein.json; using vein.project; diff --git a/.nuke/build.csproj b/.nuke/build.csproj index d4be5b91..dc5f4a3f 100644 --- a/.nuke/build.csproj +++ b/.nuke/build.csproj @@ -23,6 +23,7 @@ + From 8a55fac88003cc3d9e74114631775093bc523845 Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:05:38 +0300 Subject: [PATCH 15/22] add using host builder in compiler, remove unused code --- tools/compiler/Program.cs | 51 +++++++++++++++---------------------- tools/compiler/veinc.csproj | 1 + 2 files changed, 21 insertions(+), 31 deletions(-) diff --git a/tools/compiler/Program.cs b/tools/compiler/Program.cs index 94c2634a..8c7de5c1 100644 --- a/tools/compiler/Program.cs +++ b/tools/compiler/Program.cs @@ -10,22 +10,12 @@ using vein.cli; using static Spectre.Console.AnsiConsole; using vein.json; - - - [assembly: InternalsVisibleTo("veinc_test")] if (Environment.GetEnvironmentVariable("NO_CONSOLE") is not null) AnsiConsole.Console = RawConsole.Create(); - -if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD)) -{ - MarkupLine("Platform is not supported."); - return -1; -} - -var skipIntro = - Environment.GetEnvironmentVariable("VEINC_NOVID") is not null; +else if (Environment.GetEnvironmentVariable("FORK_CONSOLE") is not null) + AnsiConsole.Console = RawConsole.CreateForkConsole(); var watch = Stopwatch.StartNew(); @@ -45,24 +35,23 @@ } }; - -AppFlags.RegisterArgs(ref args); - - -var app = new CommandApp(); - -app.Configure(config => -{ - config.AddCommand("build") - .WithDescription("Build current project."); - - config.SetExceptionHandler((ex) => { - WriteException(ex); - }); -}); - -var result = app.Run(args); +await Host.CreateDefaultBuilder(args) + .ConfigureLogging(x => x.SetMinimumLevel(LogLevel.None)) + .UseConsoleLifetime() + .UseSpectreConsole(config => + { + config.AddCommand("build") + .WithDescription("Build current project."); + + config.SetExceptionHandler((ex) => { + WriteException(ex); + }); + }) + .ConfigureServices( + (_, services) => + { + }) + .RunConsoleAsync(); watch.Stop(); - -return result; +return Environment.ExitCode; diff --git a/tools/compiler/veinc.csproj b/tools/compiler/veinc.csproj index a7800f6f..1203574f 100644 --- a/tools/compiler/veinc.csproj +++ b/tools/compiler/veinc.csproj @@ -11,6 +11,7 @@ + From f0b7362ba04cd681e02a5afe10f5db8fed4f3acf Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:05:58 +0300 Subject: [PATCH 16/22] refactoring --- tools/rune-cli/Log.cs | 63 ------------------- tools/rune-cli/cmd/AddCommand.cs | 11 +--- tools/rune-cli/cmd/InstallWorkloadCommand.cs | 47 ++++++++------ .../cmd/ListInstalledWorkloadCommand.cs | 7 +-- .../rune-cli/cmd/UninstallWorkloadCommand.cs | 8 +-- tools/rune-cli/cmd/UpdateWorkloadCommand.cs | 6 +- 6 files changed, 39 insertions(+), 103 deletions(-) diff --git a/tools/rune-cli/Log.cs b/tools/rune-cli/Log.cs index 4d355bcb..1fabf86c 100644 --- a/tools/rune-cli/Log.cs +++ b/tools/rune-cli/Log.cs @@ -1,12 +1,6 @@ namespace vein; using System; -using System.Collections.Generic; -using System.Text; -using compilation; -using ishtar; -using MoreLinq; -using syntax; using static Spectre.Console.AnsiConsole; @@ -14,65 +8,8 @@ namespace vein; [ExcludeFromCodeCoverage] public static class Log { - public static CompilationState State = new(); - - public static class Defer - { - public static void Warn(string text, BaseSyntax posed, DocumentDeclaration doc) - => _print(text, posed, doc, State.warnings); - public static void Error(string text, BaseSyntax posed, DocumentDeclaration doc) - => _print(text, posed, doc, State.errors); - public static void Info(string text, BaseSyntax posed, DocumentDeclaration doc) - => _print(text, posed, doc, State.infos); - - } - - public static void EnqueueErrorsRange(IEnumerable s) => s.Pipe(x => State.errors.Enqueue(x)).Consume(); - public static void EnqueueInfosRange(IEnumerable s) => s.Pipe(x => State.infos.Enqueue(x)).Consume(); - public static void EnqueueWarnsRange(IEnumerable s) => s.Pipe(x => State.warnings.Enqueue(x)).Consume(); - - public static void Info(string s) => MarkupLine($"[aqua]INFO[/]: {s}"); public static void Warn(string s) => MarkupLine($"[orange]WARN[/]: {s}"); public static void Error(string s) => MarkupLine($"[red]ERROR[/]: {s}"); public static void Error(Exception s) => WriteException(s); - - public static void Info(string s, CompilationTarget t) => t.Logs.Info.Enqueue($"[aqua]INFO[/]: {s}"); - public static void Warn(string s, CompilationTarget t) => t.Logs.Warn.Enqueue($"[orange]WARN[/]: {s}"); - public static void Error(string s, CompilationTarget t) => t.Logs.Error.Enqueue($"[red]ERROR[/]: {s}"); - - private static void _print(string text, BaseSyntax posed, DocumentDeclaration doc, Queue queue) - { - if (posed is { Transform: null }) - { - State.errors.Enqueue(new CompilationEventData(doc, posed, text)); - return; - } - - var strBuilder = new StringBuilder(); - - strBuilder.Append($"{text.EscapeArgumentSymbols()}\n"); - - - - if (posed is not null) - { - strBuilder.Append( - $"\tat '[orange bold]{posed.Transform.pos.Line} line, {posed.Transform.pos.Column} column[/]' \n"); - } - - if (doc is not null) - { - strBuilder.Append( - $"\tin '[orange bold]{doc}[/]'."); - } - - if (posed is not null && doc is not null) - { - var diff_err = posed.Transform.DiffErrorFull(doc); - strBuilder.Append($"\t\t{diff_err}"); - } - - queue.Enqueue(new CompilationEventData(doc, posed, strBuilder.ToString())); - } } diff --git a/tools/rune-cli/cmd/AddCommand.cs b/tools/rune-cli/cmd/AddCommand.cs index 3169d7be..ceb7de5b 100644 --- a/tools/rune-cli/cmd/AddCommand.cs +++ b/tools/rune-cli/cmd/AddCommand.cs @@ -10,19 +10,14 @@ namespace vein.cmd; using Spectre.Console; [ExcludeFromCodeCoverage] -public class AddCommand : AsyncCommandWithProject -{ - public static readonly Uri VEIN_GALLERY = new Uri("https://api.vein-lang.org/"); - public override async Task ExecuteAsync(CommandContext context, AddCommandSettings settings, VeinProject project) +public class AddCommand(ShardRegistryQuery query) : AsyncCommandWithProject +{ public override async Task ExecuteAsync(CommandContext context, AddCommandSettings settings, VeinProject project) { var name = settings.PackageName ?? throw new ArgumentNullException(nameof(settings.PackageName)); var version = settings.PackageVersion ?? "latest"; project._project.Packages ??= new List(); - - var query = new ShardRegistryQuery(VEIN_GALLERY) - .WithStorage(new ShardStorage()); - + var result = await query.DownloadShardAsync(name, version); if (result is null) diff --git a/tools/rune-cli/cmd/InstallWorkloadCommand.cs b/tools/rune-cli/cmd/InstallWorkloadCommand.cs index b92ca9e8..823b467c 100644 --- a/tools/rune-cli/cmd/InstallWorkloadCommand.cs +++ b/tools/rune-cli/cmd/InstallWorkloadCommand.cs @@ -5,8 +5,8 @@ namespace vein.cmd; using System.Threading.Tasks; using Expressive; using Flurl.Http; -using MoreLinq; using NuGet.Versioning; +using Org.BouncyCastle.Bcpg; using project; using project.shards; using Spectre.Console; @@ -29,26 +29,34 @@ public class InstallWorkloadCommandSettings : CommandSettings public string? ManifestFile { get; init; } } -public class InstallWorkloadCommand : AsyncCommandWithProgress +public record WorkloadInstallingContext( + ShardRegistryQuery query, + ShardStorage storage, + WorkloadDb workloadDb, + PackageKey PackageName, + string? PackageVersion, + string? manifestFile, + ProgressContext ctx); + +public class InstallWorkloadCommand(ShardRegistryQuery query, ShardStorage storage, WorkloadDb workloadDb) : AsyncCommandWithProgress { public override async Task ExecuteAsync(ProgressContext context, InstallWorkloadCommandSettings settings) - => await WorkloadRegistryLoader.InstallWorkloadAsync( + => await WorkloadRegistryLoader.InstallWorkloadAsync(new (query, storage, workloadDb, new PackageKey(settings.PackageName), settings.PackageVersion, settings.ManifestFile, - context); + context)); } -public class WorkloadRegistryLoader(WorkloadManifest manifest, DirectoryInfo directory, ProgressContext ctx) +public class WorkloadRegistryLoader(ShardRegistryQuery query, ShardStorage storage, WorkloadManifest manifest, DirectoryInfo directory, WorkloadDb workloadDb, ProgressContext ctx) { private readonly SymlinkCollector Symlink = new(SecurityStorage.RootFolder); private static readonly DirectoryInfo WorkloadDirectory = SecurityStorage.RootFolder.SubDirectory("workloads"); - private static readonly Uri VEIN_GALLERY = new("https://api.vein-lang.org/"); - private static readonly ShardStorage Storage = new(); - public static async Task InstallWorkloadAsync(PackageKey PackageName, string? PackageVersion, string? manifestFile, ProgressContext ctx) + public static async Task InstallWorkloadAsync(WorkloadInstallingContext context) { + var (query, storage, workloadDb, PackageName, PackageVersion, manifestFile, ctx) = context; using var task = ctx.AddTask($"fetch [orange3]'{PackageName.key}'[/] workload...") .IsIndeterminate(); @@ -58,8 +66,6 @@ public static async Task InstallWorkloadAsync(PackageKey PackageName, strin if (string.IsNullOrEmpty(manifestFile)) { - var query = new ShardRegistryQuery(VEIN_GALLERY).WithStorage(Storage); - var result = await query.FindByName(name, version); if (result is null) @@ -73,7 +79,7 @@ public static async Task InstallWorkloadAsync(PackageKey PackageName, strin await query.DownloadShardAsync(result); - manifest = await Storage.GetWorkloadManifestAsync(result); + manifest = await storage.GetWorkloadManifestAsync(result); if (manifest is null) { @@ -104,7 +110,7 @@ public static async Task InstallWorkloadAsync(PackageKey PackageName, strin - var loader = new WorkloadRegistryLoader(manifest, tagFolder, ctx); + var loader = new WorkloadRegistryLoader(query, storage, manifest, tagFolder, workloadDb, ctx); if (await loader.InstallManifestForCurrentOS()) { @@ -166,7 +172,7 @@ private async Task InstallDependencies(WorkloadPackage package) { foreach (var (key, version) in package.Dependencies) { - var loader = await InstallWorkloadAsync(key, version.ToNormalizedString(), null, ctx); + var loader = await InstallWorkloadAsync(new WorkloadInstallingContext(query, storage, workloadDb, key, version.ToNormalizedString(), null, ctx)); if (loader != 0) return false; } @@ -238,7 +244,7 @@ private async Task InstallSdk(WorkloadPackage sdk, DirectoryInfo targetFol var packageVersion = fullAlias.Split('@').Last(); - var nugetDirectory = await Storage.EnsureNuGetPackage(packageName, NuGetVersion.Parse(packageVersion)); + var nugetDirectory = await storage.EnsureNuGetPackage(packageName, NuGetVersion.Parse(packageVersion)); CopyFilesRecursively(nugetDirectory, targetFolder); @@ -247,14 +253,18 @@ private async Task InstallSdk(WorkloadPackage sdk, DirectoryInfo targetFol foreach (var packageSdk in sdk.Definition.OfType()) { + if (packageSdk.Aliases.TryGetValue(currentOs, out alias)) { + await workloadDb.RegistrySdkAsync(packageSdk.SdkTarget, alias.Replace("root://", ""), targetFolder); pathBuilder.AppendLine($"{packageSdk.SdkTarget},{alias.Replace("root://", "")};"); } } - targetFolder.File("sdk.target").WriteAllText(pathBuilder.ToString()); + await targetFolder.File("sdk.target").WriteAllTextAsync(pathBuilder.ToString()); + + return true; } @@ -278,6 +288,7 @@ private async Task InstallTool(WorkloadPackage pkg, DirectoryInfo targetFo task.Description("linking tools..."); foreach (var tool in tools) { + await workloadDb.RegistryTool(pkg.name, tool, packageFolder); if (!tool.ExportSymlink) continue; var file = new FileInfo(Symlink.ToExec(tool.ExecPath)); @@ -288,7 +299,9 @@ private async Task InstallTool(WorkloadPackage pkg, DirectoryInfo targetFo tool.OverrideName, toolExec); await Task.Delay(500); } + + return true; } @@ -347,9 +360,7 @@ private async Task DownloadWorkloadAndInstallPackage( } return packageFolder; } - - var query = new ShardRegistryQuery(VEIN_GALLERY); - + var shardManifest = await query.FindByName(alias, version.ToNormalizedString(), true); if (shardManifest is null) diff --git a/tools/rune-cli/cmd/ListInstalledWorkloadCommand.cs b/tools/rune-cli/cmd/ListInstalledWorkloadCommand.cs index 88b7de3b..a066a197 100644 --- a/tools/rune-cli/cmd/ListInstalledWorkloadCommand.cs +++ b/tools/rune-cli/cmd/ListInstalledWorkloadCommand.cs @@ -5,17 +5,14 @@ namespace vein.cmd; using Spectre.Console.Cli; [ExcludeFromCodeCoverage] -public class ListInstalledWorkloadCommand : AsyncCommandWithProgress +public class ListInstalledWorkloadCommand(ShardStorage storage) : AsyncCommandWithProgress { [ExcludeFromCodeCoverage] public class ListWorkloadCommandSettings : CommandSettings; - - public static readonly ShardStorage Storage = new(); - public override async Task ExecuteAsync(ProgressContext context, ListWorkloadCommandSettings settings) { - var manifests = await Storage.GetInstalledWorkloads(); + var manifests = await storage.GetInstalledWorkloads(); if (manifests.Count == 0) { diff --git a/tools/rune-cli/cmd/UninstallWorkloadCommand.cs b/tools/rune-cli/cmd/UninstallWorkloadCommand.cs index b183144b..9cea5cb2 100644 --- a/tools/rune-cli/cmd/UninstallWorkloadCommand.cs +++ b/tools/rune-cli/cmd/UninstallWorkloadCommand.cs @@ -12,14 +12,12 @@ public class UninstallWorkloadCommandSettings : CommandSettings { [Description("A package name.")] [CommandArgument(0, "[PACKAGE]")] - public required string PackageName { get; set; } + public required string PackageName { get; init; } } public class UninstallWorkloadCommand : AsyncCommandWithProgress { - public static readonly DirectoryInfo WorkloadDirectory = SecurityStorage.RootFolder.SubDirectory("workloads"); - public static readonly Uri VEIN_GALLERY = new("https://api.vein-lang.org/"); - public static readonly ShardStorage Storage = new(); - public SymlinkCollector Symlink = new(SecurityStorage.RootFolder); + private static readonly DirectoryInfo WorkloadDirectory = SecurityStorage.RootFolder.SubDirectory("workloads"); + private readonly SymlinkCollector Symlink = new(SecurityStorage.RootFolder); public override async Task ExecuteAsync(ProgressContext context, UninstallWorkloadCommandSettings settings) { diff --git a/tools/rune-cli/cmd/UpdateWorkloadCommand.cs b/tools/rune-cli/cmd/UpdateWorkloadCommand.cs index 3a8821ef..a1f1c6dc 100644 --- a/tools/rune-cli/cmd/UpdateWorkloadCommand.cs +++ b/tools/rune-cli/cmd/UpdateWorkloadCommand.cs @@ -21,11 +21,9 @@ public class UpdateWorkloadCommandSettings : CommandSettings public string? ManifestFile { get; set; } } -public class UpdateWorkloadCommand : AsyncCommandWithProgress +public class UpdateWorkloadCommand(ShardRegistryQuery query, ShardStorage storage, WorkloadDb db) : AsyncCommandWithProgress { public static readonly DirectoryInfo WorkloadDirectory = SecurityStorage.RootFolder.SubDirectory("workloads"); - public static readonly Uri VEIN_GALLERY = new("https://api.vein-lang.org/"); - public static readonly ShardStorage Storage = new(); public override async Task ExecuteAsync(ProgressContext context, UpdateWorkloadCommandSettings settings) { @@ -36,7 +34,7 @@ public override async Task ExecuteAsync(ProgressContext context, UpdateWork }); if (uninstallResult != 0) return uninstallResult; - var installResult = await new InstallWorkloadCommand().ExecuteAsync(context, + var installResult = await new InstallWorkloadCommand(query, storage, db).ExecuteAsync(context, new InstallWorkloadCommandSettings() { PackageName = settings.PackageName, From 2584e81454d031cdb82411d881b1c3ceea4a437d Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:06:13 +0300 Subject: [PATCH 17/22] add run command with support expose boot config --- tools/rune-cli/cmd/RunCommand.cs | 120 +++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 tools/rune-cli/cmd/RunCommand.cs diff --git a/tools/rune-cli/cmd/RunCommand.cs b/tools/rune-cli/cmd/RunCommand.cs new file mode 100644 index 00000000..d6bb9ed3 --- /dev/null +++ b/tools/rune-cli/cmd/RunCommand.cs @@ -0,0 +1,120 @@ +namespace vein.cmd; + +using System.ComponentModel; +using compiler.shared; +using project; +using Spectre.Console; +using Spectre.Console.Cli; + + +[ExcludeFromCodeCoverage] +public class RunSettings : CommandSettings, IProjectSettingProvider +{ + [Description("Override generated boot config")] + [CommandOption("--override-boot-cfg")] + public string OverrideBootCfg { get; set; } + + [Description("Path to vproj file")] + [CommandArgument(0, "[PROJECT]")] + public string Project { get; set; } +} + +[ExcludeFromCodeCoverage] +public class RunCommand(WorkloadDb db) : AsyncCommandWithProject +{ + // todo + private static readonly string bootCfg = + """ + [vm] + skip_validate_args=true + use_console=true + no_trace=false + + [vm:jit] + enable=true + target="auto" + asm_parser=false + disassembler=false + target_info=false + target_mc=false + asm_printer=false + defer_context=true + + [vm:scheduler] + defer_loop=true + """; + + public override async Task ExecuteAsync(CommandContext context, RunSettings settings, VeinProject project) + { + var execFile = project.WorkDir.SubDirectory("bin").File($"{project.Name}.wll"); + + if (!execFile.Exists) + { + var ask = AnsiConsole.Prompt( + new SelectionPrompt() + .Title("Project is [red]not[/] compiled, should start building?") + .AddChoices([ + "Yes", "No", "I don't know" + ])); + + if (ask == "Yes") + { + await new BuildCommand(db).ExecuteAsync(new CommandContext(null, "", null, ["build"]), new CompileSettings + { + Project = settings.Project + }, project); + } + else if (ask == "No") + return 0; + else + { + Log.Info("It's sad to be you..."); + return -1; + } + } + + + var tool = await db.TakeTool(PackageKey.VeinRuntimePackage, "ishtar", false); + if (tool is null) + { + Log.Error($"'[orange]{PackageKey.VeinRuntimePackage}[/]' package not found, it may need to be installed by '[gray]rune workload install vein.runtime[/]'?"); + return -1; + } + + var boot_config_data = bootCfg; + + if (!string.IsNullOrEmpty(settings.OverrideBootCfg)) + { + var fullyPath = ""; + if (!Path.IsPathFullyQualified(settings.OverrideBootCfg)) + { + if (settings.OverrideBootCfg.StartsWith("@")) // this a root of project + fullyPath = Path.Combine(project.WorkDir.FullName, settings.OverrideBootCfg.Replace("@", "")); + else + { + Log.Error($"Relative '[orange]{settings.OverrideBootCfg}[/]' not supported, use a @ symbol for mark a root path (at project base)"); + return -1; + } + } + + + var file = new FileInfo(fullyPath); + + if (!file.Exists) + { + Log.Error($"'[orange]{settings.OverrideBootCfg}[/]' not found, [red]failed[/] override boot config '[gray]rune workload install vein.compiler[/]'?"); + return -1; + } + + boot_config_data = await file.ReadToEndAsync(); + } + await project.WorkDir + .SubDirectory("obj") + .Ensure() + .File("boot.ini") + .WriteAllTextAsync(boot_config_data); + + + return await new VeinIshtarProxy(tool, [execFile.FullName], project.WorkDir).ExecuteAsync(); + } +} From 153ce37aa79cf7b40886fda8a67b7215db44e007 Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:06:42 +0300 Subject: [PATCH 18/22] add build command, update package command for use proxy fork proccess --- tools/rune-cli/cmd/BuildCommand.cs | 21 +++++++++++++++++++++ tools/rune-cli/cmd/PackageCommand.cs | 18 ++++++++++++------ 2 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 tools/rune-cli/cmd/BuildCommand.cs diff --git a/tools/rune-cli/cmd/BuildCommand.cs b/tools/rune-cli/cmd/BuildCommand.cs new file mode 100644 index 00000000..e184cce6 --- /dev/null +++ b/tools/rune-cli/cmd/BuildCommand.cs @@ -0,0 +1,21 @@ +namespace vein.cmd; + +using compiler.shared; +using project; +using Spectre.Console.Cli; + +[ExcludeFromCodeCoverage] +public class BuildCommand(WorkloadDb db) : AsyncCommandWithProject +{ + public override async Task ExecuteAsync(CommandContext context, CompileSettings settings, VeinProject project) + { + var tool = await db.TakeTool(PackageKey.VeinCompilerPackage, "veinc", false); + if (tool is null) + { + Log.Error($"'[orange]{PackageKey.VeinCompilerPackage}[/]' package not found, it may need to be installed by '[gray]rune workload install vein.compiler[/]'?"); + return -1; + } + + return await new VeinCompilerProxy(tool, context.Arguments).ExecuteAsync(); + } +} diff --git a/tools/rune-cli/cmd/PackageCommand.cs b/tools/rune-cli/cmd/PackageCommand.cs index 5c7064e0..509bed0e 100644 --- a/tools/rune-cli/cmd/PackageCommand.cs +++ b/tools/rune-cli/cmd/PackageCommand.cs @@ -1,16 +1,22 @@ namespace vein.cmd; +using compiler.shared; +using project; using Spectre.Console.Cli; +using System.ComponentModel; [ExcludeFromCodeCoverage] -public class PackageCommand : Command +public class PackageCommand(WorkloadDb db) : AsyncCommandWithProject { - public override int Execute(CommandContext context, CompileSettings settings) + public override async Task ExecuteAsync(CommandContext context, CompileSettings settings, VeinProject project) { - var store = new ShardStorage(); + var tool = await db.TakeTool(PackageKey.VeinCompilerPackage, "veinc", false); + if (tool is null) + { + Log.Error($"'[orange]{PackageKey.VeinCompilerPackage}[/]' package not found, it may need to be installed by '[gray]rune workload install vein.compiler[/]'?"); + return -1; + } - - settings.GeneratePackageOutput = true; - return new CompileCommand().Execute(context, settings); + return await new VeinCompilerProxy(tool, context.Arguments.Concat(["--gen-shard"])).ExecuteAsync(); } } From ad2f6102aa7dd64dc6de21b62cc7d85898c5486a Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:07:07 +0300 Subject: [PATCH 19/22] add compiler and ishtar proxy fork process, add mutex for lock file --- tools/rune-cli/services/AppMutex.cs | 44 ++++++++++++++++++ tools/rune-cli/services/VeinCompilerProxy.cs | 49 ++++++++++++++++++++ tools/rune-cli/services/VeinIshtarProxy.cs | 39 ++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 tools/rune-cli/services/AppMutex.cs create mode 100644 tools/rune-cli/services/VeinCompilerProxy.cs create mode 100644 tools/rune-cli/services/VeinIshtarProxy.cs diff --git a/tools/rune-cli/services/AppMutex.cs b/tools/rune-cli/services/AppMutex.cs new file mode 100644 index 00000000..96099c4f --- /dev/null +++ b/tools/rune-cli/services/AppMutex.cs @@ -0,0 +1,44 @@ +namespace vein.services; + +using System.Diagnostics; +using Spectre.Console; + +public static class AppMutex +{ + private static FileInfo LockFile => SecurityStorage.RootFolder.File(".lock"); + public static async Task Begin() + { + if (LockFile.Exists) + { + var pid = int.Parse(await LockFile.ReadToEndAsync()); + if (Process.GetCurrentProcess().Id == pid) + return; + if (ProcessHasExist(pid)) + { + AnsiConsole.Markup($"Lockfile [gray]{LockFile.FullName}[/] exist, currently rune cli already active, processId: [red]{pid}[/]"); + Environment.Exit(-1); + } + } + await LockFile.WriteAllTextAsync(Process.GetCurrentProcess().Id.ToString()); + } + + public static async Task End() + { + if (LockFile.Exists) + LockFile.Delete(); + } + + private static bool ProcessHasExist(int pid) + { + try + { + Process.GetProcessById(pid); + return true; + } + catch (Exception e) + { + return false; + } + } + +} diff --git a/tools/rune-cli/services/VeinCompilerProxy.cs b/tools/rune-cli/services/VeinCompilerProxy.cs new file mode 100644 index 00000000..56c92b12 --- /dev/null +++ b/tools/rune-cli/services/VeinCompilerProxy.cs @@ -0,0 +1,49 @@ +namespace vein.cmd; + +using System.Diagnostics; +using Spectre.Console; + +public class VeinCompilerProxy(FileInfo compilerPath, IEnumerable args) : IDisposable +{ + private readonly Process _process = new() + { + StartInfo = new ProcessStartInfo + { + FileName = compilerPath.FullName, + Arguments = string.Join(" ", args), + RedirectStandardOutput = true, + RedirectStandardError = false, + UseShellExecute = false, + CreateNoWindow = true, + WorkingDirectory = Directory.GetCurrentDirectory(), + EnvironmentVariables = + { + { "FORK_CONSOLE", "true" }, + { "FORK_CONSOLE_W", (ConsoleHelper.GetSafeWidth() - 1).ToString() }, + { "FORK_CONSOLE_H", (ConsoleHelper.GetSafeHeight() - 1).ToString() } + } + } + }; + + public async ValueTask ExecuteAsync() + { + if (Environment.GetEnvironmentVariable("NO_CONSOLE") is not null || Environment.GetEnvironmentVariable("NO_COLOR") is not null) + _process.StartInfo.EnvironmentVariables.Add("NO_CONSOLE", "NO_COLOR"); + + var outputTask = Task.Run(async () => + { + _process.Start(); + using var reader = _process.StandardOutput; + char[] buffer = new char[1024]; + int charsRead; + while ((charsRead = await reader.ReadAsync(buffer, 0, buffer.Length)) > 0) + await Console.Out.WriteAsync(new string(buffer, 0, charsRead)); + }); + + await Task.WhenAll(outputTask, _process.WaitForExitAsync()); + + return _process.ExitCode; + } + + public void Dispose() => _process.Dispose(); +} diff --git a/tools/rune-cli/services/VeinIshtarProxy.cs b/tools/rune-cli/services/VeinIshtarProxy.cs new file mode 100644 index 00000000..55e0b7c0 --- /dev/null +++ b/tools/rune-cli/services/VeinIshtarProxy.cs @@ -0,0 +1,39 @@ +namespace vein.cmd; + +using System.Diagnostics; + +public class VeinIshtarProxy(FileInfo compilerPath, IEnumerable args, DirectoryInfo baseFolder) : IDisposable +{ + private readonly Process _process = new() + { + StartInfo = new() + { + FileName = compilerPath.FullName, + Arguments = string.Join(" ", args), + RedirectStandardOutput = true, + RedirectStandardError = false, + UseShellExecute = false, + CreateNoWindow = true, + WorkingDirectory = baseFolder.FullName + } + }; + + public async ValueTask ExecuteAsync() + { + var outputTask = Task.Run(async () => + { + _process.Start(); + using var reader = _process.StandardOutput; + char[] buffer = new char[1024]; + int charsRead; + while ((charsRead = await reader.ReadAsync(buffer, 0, buffer.Length)) > 0) + await Console.Out.WriteAsync(new string(buffer, 0, charsRead)); + }); + + await Task.WhenAll(outputTask, _process.WaitForExitAsync()); + + return _process.ExitCode; + } + + public void Dispose() => _process.Dispose(); +} From 2c2feccfc005b85f1896e4a005eff1e608e23e26 Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:07:22 +0300 Subject: [PATCH 20/22] add unified class for working with workloads assets --- tools/rune-cli/WorkloadDb.cs | 72 ++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 tools/rune-cli/WorkloadDb.cs diff --git a/tools/rune-cli/WorkloadDb.cs b/tools/rune-cli/WorkloadDb.cs new file mode 100644 index 00000000..90b32315 --- /dev/null +++ b/tools/rune-cli/WorkloadDb.cs @@ -0,0 +1,72 @@ +namespace vein; + +using collections; +using Newtonsoft.Json; +using project; + +public class NotFoundToolException(string tool, PackageKey key) : Exception($"Tool '{tool}' not found in '{key.key}', maybe not installed package?"); + +public class WorkloadDb +{ + private static readonly SymlinkCollector Symlink = new(SecurityStorage.RootFolder); + public async Task RegistryTool(PackageKey key, WorkloadPackageTool tool, DirectoryInfo baseFolder) + { + var db = await OpenAsync(); + db.tools.TryAdd(key, new Dictionary()); + + + var file = new FileInfo(Symlink.ToExec(tool.ExecPath)); + var toolExec = baseFolder.Combine(file); + var name = string.IsNullOrEmpty(tool.OverrideName) + ? Path.GetFileNameWithoutExtension(file.Name) + : tool.OverrideName; + db.tools[key][name] = toolExec; + await SaveAsync(db); + } + + public async Task RegistrySdkAsync(string sdkTarget, string alias, DirectoryInfo baseFolder) + { + var db = await OpenAsync(); + db.sdks.TryAdd(sdkTarget, new UniqueList()); + + db.sdks[sdkTarget].Add(baseFolder.Combine(new FileInfo(alias)).FullName); + await SaveAsync(db); + } + + public async Task TakeTool(PackageKey key, string name, bool throwIfNotFound = true) + { + var db = await OpenAsync(); + + if (db.tools.TryGetValue(key, out var tools)) + { + if (tools.TryGetValue(name, out var result)) + return result; + } + if (throwIfNotFound) + throw new NotFoundToolException(name, key); + return null; + } + + private async Task OpenAsync() + { + var dbFile = SecurityStorage.RootFolder.File("workloads.json"); + if (!dbFile.Exists) return new WorkloadDatabase(); + + var txt = await dbFile.ReadToEndAsync(); + return JsonConvert.DeserializeObject(txt)!; + } + + private async Task SaveAsync(WorkloadDatabase db) + { + var dbFile = SecurityStorage.RootFolder.File("workloads.json"); + + await dbFile.WriteAllTextAsync(JsonConvert.SerializeObject(db)); + } +} + +public record WorkloadDatabase +{ + [JsonConverter(typeof(DictionaryWithPackageKeyConverter>))] + public Dictionary> tools = new(); + public Dictionary> sdks = new(); +} From e17e19cc06855045f6c9be4aab6be3bad9d5bbfd Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:07:46 +0300 Subject: [PATCH 21/22] migrate to host builder, add toml configurator --- tools/rune-cli/Program.cs | 161 ++++++++++-------- tools/rune-cli/Properties/launchSettings.json | 2 +- tools/rune-cli/rune-cli.csproj | 6 +- 3 files changed, 89 insertions(+), 80 deletions(-) diff --git a/tools/rune-cli/Program.cs b/tools/rune-cli/Program.cs index 2bb580ad..317e41cb 100644 --- a/tools/rune-cli/Program.cs +++ b/tools/rune-cli/Program.cs @@ -8,16 +8,23 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; -using NuGet.Versioning; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; using vein; using vein.cmd; using vein.json; using vein.project; using static Spectre.Console.AnsiConsole; using static vein.GlobalVersion; -[assembly: InternalsVisibleTo("veinc_test")] +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Tomlyn.Extensions.Configuration; +using vein.cli; +using vein.services; +[assembly: InternalsVisibleTo("veinc_test")] +await AppMutex.Begin(); JsonConvert.DefaultSettings = () => new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, @@ -41,14 +48,9 @@ if (Environment.GetEnvironmentVariable("NO_CONSOLE") is not null) AnsiConsole.Console = RawConsole.Create(); -if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD)) -{ - MarkupLine("Platform is not supported."); - return -1; -} - -var skipIntro = SecurityStorage.HasKey("app:novid") || - Environment.GetEnvironmentVariable("VEINC_NOVID") is not null; +var skipIntro = + SecurityStorage.HasKey("app:novid") || + Environment.GetEnvironmentVariable("VEINC_NOVID") is not null; var watch = Stopwatch.StartNew(); @@ -66,76 +68,87 @@ AppFlags.RegisterArgs(ref args); -var app = new CommandApp(); - -app.Configure(config => -{ - config.Settings.ApplicationVersion +await Host.CreateDefaultBuilder(args) + .ConfigureLogging(x => x.SetMinimumLevel(LogLevel.None)) + .ConfigureAppConfiguration(x => x.AddTomlFile(ShardStorage.VeinRootFolder.File("rune.toml").FullName, true)) + .UseConsoleLifetime() + .UseSpectreConsole(config => { + config.Settings.ApplicationVersion = $"Vein Rune CLI {AssemblySemFileVer}\nBranch: {BranchName}+{ShortSha}\nCall rune workloads list for view installed workloads and other version"; - config.AddCommand("new") - .WithDescription("Create new project."); - config.AddCommand("build") - .WithDescription("Build current project."); - config.AddCommand("package") - .WithDescription("Prepare and build project to publish into package registry."); - config.AddCommand("clean") - .WithDescription("Clean project cache"); - config.AddCommand("restore") - .WithDescription("Restore dependencies in project."); - config.AddCommand("add") - .WithDescription("Find and add package into project from registry") - .WithExample(["add std@0.12.1"]); - config.AddCommand("publish") - .WithDescription("Publish shard package into vein gallery. (need set 'packable: true' in project or call 'vein package')") - .WithExample(["--project ./foo.vproj"]); - config.AddBranch("workload", x => - { - x.AddCommand("list") - .WithDescription($"Get list of installed workloads"); - x.AddCommand("install") - .WithDescription("Install workload into global"); - x.AddCommand("add") - .IsHidden() - .WithDescription("Install workload into global"); - x.AddCommand("update") - .WithDescription("Update workload."); - x.AddCommand("uninstall") - .WithDescription("Uninstall workload."); - x.AddCommand("delete") - .IsHidden() - .WithDescription("Uninstall workload."); - x.AddCommand("remove") - .IsHidden() - .WithDescription("Uninstall workload."); - }); - config.AddBranch("config", x => - { - x.AddCommand("set") - .WithExample(["set foo:bar value"]) - .WithExample(["set foo:zoo 'a sample value'"]) - .WithDescription("Set value config by key in global storage."); - x.AddCommand("get") - .WithExample(["get foo:bar"]) - .WithDescription("Get value config by key from global storage."); - x.AddCommand("list") - .WithDescription("Get all keys."); - x.AddCommand("remove") - .WithDescription("Remove key from global config."); - }); - - config.SetExceptionHandler((ex) => { + config.AddCommand("new") + .WithDescription("Create new project."); + config.AddCommand("build") + .WithDescription("Build current project."); + config.AddCommand("package") + .WithDescription("Prepare and build project to publish into package registry."); + config.AddCommand("clean") + .WithDescription("Clean project cache"); + config.AddCommand("restore") + .WithDescription("Restore dependencies in project."); + config.AddCommand("add") + .WithDescription("Find and add package into project from registry") + .WithExample(["add std@0.12.1"]); + config.AddCommand("publish") + .WithDescription("Publish shard package into vein gallery. (need set 'packable: true' in project or call 'vein package')") + .WithExample(["--project ./foo.vproj"]); + config.AddBranch("workload", x => + { + x.AddCommand("list") + .WithDescription($"Get list of installed workloads"); + x.AddCommand("install") + .WithDescription("Install workload into global"); + x.AddCommand("add") + .IsHidden() + .WithDescription("Install workload into global"); + x.AddCommand("update") + .WithDescription("Update workload."); + x.AddCommand("uninstall") + .WithDescription("Uninstall workload."); + x.AddCommand("delete") + .IsHidden() + .WithDescription("Uninstall workload."); + x.AddCommand("remove") + .IsHidden() + .WithDescription("Uninstall workload."); + }); + config.AddBranch("config", x => + { + x.AddCommand("set") + .WithExample(["set foo:bar value"]) + .WithExample(["set foo:zoo 'a sample value'"]) + .WithDescription("Set value config by key in global storage."); + x.AddCommand("get") + .WithExample(["get foo:bar"]) + .WithDescription("Get value config by key from global storage."); + x.AddCommand("list") + .WithDescription("Get all keys."); + x.AddCommand("remove") + .WithDescription("Remove key from global config."); + }); + + config.SetExceptionHandler((ex) => { #if DEBUG - WriteException(ex); + WriteException(ex); #else - File.WriteAllText($"rune-error-{DateTimeOffset.Now:s}.txt", ex.ToString()); + File.WriteAllText($"rune-error-{DateTimeOffset.Now:s}.txt", ex.ToString()); #endif - }); -}); - -var result = app.Run(args); + }); + }) + .ConfigureServices( + (ctx, services) => + { + services.AddSingleton(); + services.AddScoped((x) => new ShardRegistryQuery( + new(ctx.Configuration.GetValue("galleryUrl", "https://api.vein-lang.org/")!)) + .WithStorage(x.GetRequiredService())); + services.AddSingleton(); + }) + .RunConsoleAsync(); watch.Stop(); +await AppMutex.End(); MarkupLine($":sparkles: Done in [lime]{watch.Elapsed.TotalSeconds:00.000}s[/]."); +return Environment.ExitCode; + -return result; diff --git a/tools/rune-cli/Properties/launchSettings.json b/tools/rune-cli/Properties/launchSettings.json index 31765c43..12a4ba8b 100644 --- a/tools/rune-cli/Properties/launchSettings.json +++ b/tools/rune-cli/Properties/launchSettings.json @@ -6,7 +6,7 @@ }, "install workload with manifest": { "commandName": "Project", - "commandLineArgs": "workload install vein.runtime --manifest C:\\git\\vein.lang\\workloads\\runtime\\workload.manifest.json" + "commandLineArgs": "build proj -O" } } } \ No newline at end of file diff --git a/tools/rune-cli/rune-cli.csproj b/tools/rune-cli/rune-cli.csproj index c3f7f2d5..0076e2b1 100644 --- a/tools/rune-cli/rune-cli.csproj +++ b/tools/rune-cli/rune-cli.csproj @@ -15,17 +15,13 @@ - - - + - - From bb705ed0e6be5b2bb82c69a1a16f7b6112be5df1 Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Thu, 15 Aug 2024 11:07:52 +0300 Subject: [PATCH 22/22] bump --- vein_lang.sln | 15 +++++++++++++++ vein_lang.sln.DotSettings | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/vein_lang.sln b/vein_lang.sln index 942b4d15..3d8bd2fe 100644 --- a/vein_lang.sln +++ b/vein_lang.sln @@ -73,6 +73,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "vein.cli.core", "lib\vein.c EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "build", ".nuke\build.csproj", "{7148A46B-2FB4-419B-8C4A-3FC0C0A58C73}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vein.compiler.shared", "lib\vein.compiler.shared\vein.compiler.shared.csproj", "{59A5A3DB-506E-47CA-B688-4478BFBE39A4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -393,6 +395,18 @@ Global {7148A46B-2FB4-419B-8C4A-3FC0C0A58C73}.Release|x64.Build.0 = Release|Any CPU {7148A46B-2FB4-419B-8C4A-3FC0C0A58C73}.Release|x86.ActiveCfg = Release|Any CPU {7148A46B-2FB4-419B-8C4A-3FC0C0A58C73}.Release|x86.Build.0 = Release|Any CPU + {59A5A3DB-506E-47CA-B688-4478BFBE39A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {59A5A3DB-506E-47CA-B688-4478BFBE39A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {59A5A3DB-506E-47CA-B688-4478BFBE39A4}.Debug|x64.ActiveCfg = Debug|Any CPU + {59A5A3DB-506E-47CA-B688-4478BFBE39A4}.Debug|x64.Build.0 = Debug|Any CPU + {59A5A3DB-506E-47CA-B688-4478BFBE39A4}.Debug|x86.ActiveCfg = Debug|Any CPU + {59A5A3DB-506E-47CA-B688-4478BFBE39A4}.Debug|x86.Build.0 = Debug|Any CPU + {59A5A3DB-506E-47CA-B688-4478BFBE39A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {59A5A3DB-506E-47CA-B688-4478BFBE39A4}.Release|Any CPU.Build.0 = Release|Any CPU + {59A5A3DB-506E-47CA-B688-4478BFBE39A4}.Release|x64.ActiveCfg = Release|Any CPU + {59A5A3DB-506E-47CA-B688-4478BFBE39A4}.Release|x64.Build.0 = Release|Any CPU + {59A5A3DB-506E-47CA-B688-4478BFBE39A4}.Release|x86.ActiveCfg = Release|Any CPU + {59A5A3DB-506E-47CA-B688-4478BFBE39A4}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -420,6 +434,7 @@ Global {4546557D-B44E-4A64-A82C-5E1828D1A787} = {2A92D5A1-53AF-4E15-816C-3E64E2FAC9E4} {7AD0D9EA-3320-4068-BB7D-ECEF7625E9D1} = {B79D9C1A-8074-4105-8447-93A5A059A2CB} {7148A46B-2FB4-419B-8C4A-3FC0C0A58C73} = {2A92D5A1-53AF-4E15-816C-3E64E2FAC9E4} + {59A5A3DB-506E-47CA-B688-4478BFBE39A4} = {B79D9C1A-8074-4105-8447-93A5A059A2CB} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {E2BB3994-6F65-4E41-BA44-6258F00A3A28} diff --git a/vein_lang.sln.DotSettings b/vein_lang.sln.DotSettings index 0fa1dd1d..a977c32e 100644 --- a/vein_lang.sln.DotSettings +++ b/vein_lang.sln.DotSettings @@ -81,6 +81,7 @@ True True True + True True True True @@ -104,6 +105,7 @@ True True True + True True True True @@ -117,10 +119,12 @@ True True True + True True True True True True True + True True \ No newline at end of file