output build logs
This commit is contained in:
33
src/SharpIDE.Godot/Features/Build/BuildPanel.cs
Normal file
33
src/SharpIDE.Godot/Features/Build/BuildPanel.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using GDExtensionBindgen;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SharpIDE.Godot.Features.Build;
|
||||||
|
|
||||||
|
public partial class BuildPanel : Control
|
||||||
|
{
|
||||||
|
private Terminal _terminal = null!;
|
||||||
|
private Task _writeTask = Task.CompletedTask;
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
_terminal = new Terminal(GetNode<Control>("%Terminal"));
|
||||||
|
Singletons.BuildService.BuildStarted += OnBuildStarted;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnBuildStarted()
|
||||||
|
{
|
||||||
|
if (_writeTask.IsCompleted is not true)
|
||||||
|
{
|
||||||
|
// If the write task is already running, just clear the terminal - we reuse the channel for the build output 🤷♂️
|
||||||
|
await this.InvokeAsync(() => _terminal.Clear());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_writeTask = GodotTask.Run(async () =>
|
||||||
|
{
|
||||||
|
await this.InvokeAsync(() => _terminal.Clear());
|
||||||
|
await foreach (var str in Singletons.BuildService.BuildTextWriter.ConsoleChannel.Reader.ReadAllAsync().ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
await this.InvokeAsync(() => _terminal.Write(str));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
1
src/SharpIDE.Godot/Features/Build/BuildPanel.cs.uid
Normal file
1
src/SharpIDE.Godot/Features/Build/BuildPanel.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dt46krpl6ds28
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
[gd_scene format=3 uid="uid://co6dkhdolriej"]
|
[gd_scene load_steps=2 format=3 uid="uid://co6dkhdolriej"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dt46krpl6ds28" path="res://Features/Build/BuildPanel.cs" id="1_tx1bg"]
|
||||||
|
|
||||||
[node name="BuildPanel" type="Control"]
|
[node name="BuildPanel" type="Control"]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
@@ -7,6 +9,7 @@ anchor_right = 1.0
|
|||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_tx1bg")
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
@@ -33,6 +36,7 @@ layout_mode = 2
|
|||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
|
||||||
[node name="Terminal" type="Terminal" parent="VBoxContainer/TerminalContainer"]
|
[node name="Terminal" type="Terminal" parent="VBoxContainer/TerminalContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
|||||||
Reference in New Issue
Block a user