Skip to content

Commit 0980413

Browse files
authoredAug 7, 2024
Merge pull request #4 from ecsact-dev/chore/add-ci
chore: add ci
2 parents 9a1e0c0 + c687607 commit 0980413

File tree

5 files changed

+122
-79
lines changed

5 files changed

+122
-79
lines changed
 

‎.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,15 @@ insert_final_newline = true
66
indent_size = 4
77
indent_style = tab
88

9+
[*.{yml,yaml}]
10+
indent_size = 2
11+
indent_style = space
12+
13+
[*.clang-format]
14+
indent_size = 2
15+
indent_style = space
16+
17+
[*.{cc,hh,cpp,hpp,h,cpp}]
18+
# matching .clang-format IndentWidth
19+
indent_size = 2
20+
indent_style = tab

‎.github/workflows/main.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: main
2+
3+
on:
4+
pull_request:
5+
merge_group:
6+
7+
jobs:
8+
typos-check:
9+
name: Typos Check
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: crate-ci/typos@cfe759ac8dd421e203cc293a373396fbc6fe0d4b # v1.22.7
14+
15+
formatting-check:
16+
name: Formatting Check
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: greut/eclint-action@v0
21+
- uses: jidicula/clang-format-action@v4.11.0
22+
with: { clang-format-version: "18" }

‎Source/EcsactEditor/Private/EcsactEditor.cpp

Lines changed: 82 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,11 @@ auto FEcsactEditorModule::RunCodegen() -> void {
212212

213213
auto FEcsactEditorModule::RunBuild() -> void {
214214
const auto* settings = GetDefault<UEcsactSettings>();
215-
auto ecsact_runtime_path = FPaths::Combine(
216-
FPaths::ProjectDir(),
217-
TEXT("Binaries/Win64/EcsactRuntime.dll")
218-
);
215+
216+
auto ecsact_runtime_path = FPaths::Combine(
217+
FPaths::ProjectDir(),
218+
TEXT("Binaries/Win64/EcsactRuntime.dll")
219+
);
219220
auto temp_dir = FPaths::CreateTempFilename(TEXT("EcsactBuild"));
220221

221222
auto ecsact_files = GetAllEcsactFiles();
@@ -290,86 +291,89 @@ auto FEcsactEditorModule::OnReceiveEcsactCliJsonMessage(FString Json) -> void {
290291
auto json_object = TSharedPtr<FJsonObject>{};
291292
auto reader = TJsonReaderFactory<>::Create(Json);
292293

293-
if(FJsonSerializer::Deserialize(reader, json_object) &&
294-
json_object.IsValid()) {
295-
auto message_type = json_object->GetStringField(TEXT("type"));
296-
297-
if(message_type == "info") {
298-
UE_LOG(
299-
EcsactEditor,
300-
Log,
301-
TEXT("%s"),
302-
*json_object->GetStringField(TEXT("content"))
303-
);
304-
} else if(message_type == "error") {
305-
UE_LOG(
306-
EcsactEditor,
307-
Error,
308-
TEXT("%s"),
309-
*json_object->GetStringField(TEXT("content"))
310-
);
311-
} else if(message_type == "warning") {
312-
UE_LOG(
313-
EcsactEditor,
314-
Warning,
315-
TEXT("%s"),
316-
*json_object->GetStringField(TEXT("content"))
317-
);
318-
} else if(message_type == "subcommand_start") {
319-
UE_LOG(
320-
EcsactEditor,
321-
Log,
322-
TEXT("subcommand(%i): %s"),
323-
json_object->GetIntegerField(TEXT("id")),
324-
*json_object->GetStringField(TEXT("executable"))
325-
);
326-
} else if(message_type == "subcommand_end") {
327-
UE_LOG(
328-
EcsactEditor,
329-
Log,
330-
TEXT("subcommand(%i): exit code %i"),
331-
json_object->GetIntegerField(TEXT("id")),
332-
json_object->GetIntegerField(TEXT("exit_code"))
333-
);
334-
} else if(message_type == "subcommand_stdout") {
335-
UE_LOG(
336-
EcsactEditor,
337-
Log,
338-
TEXT("subcommand(%i): %s"),
339-
json_object->GetIntegerField(TEXT("id")),
340-
*json_object->GetStringField(TEXT("line"))
341-
);
342-
} else if(message_type == "subcommand_stderr") {
343-
UE_LOG(
344-
EcsactEditor,
345-
Error,
346-
TEXT("subcommand(%i): %s"),
347-
json_object->GetIntegerField(TEXT("id")),
348-
*json_object->GetStringField(TEXT("line"))
349-
);
350-
} else if(message_type == "success") {
351-
UE_LOG(
352-
EcsactEditor,
353-
Log,
354-
TEXT("%s"),
355-
*json_object->GetStringField(TEXT("content"))
356-
);
357-
} else {
358-
UE_LOG(
359-
EcsactEditor,
360-
Warning,
361-
TEXT("Unhandled Message (%s): %s"),
362-
*message_type,
363-
*Json
364-
);
365-
}
366-
} else {
294+
if(!FJsonSerializer::Deserialize(reader, json_object)) {
367295
UE_LOG(
368296
EcsactEditor,
369297
Error,
370298
TEXT("Failed to parse JSON message: %s"),
371299
*Json
372300
);
301+
return;
302+
}
303+
if(!json_object.IsValid()) {
304+
return;
305+
}
306+
307+
auto message_type = json_object->GetStringField(TEXT("type"));
308+
309+
if(message_type == "info") {
310+
UE_LOG(
311+
EcsactEditor,
312+
Log,
313+
TEXT("%s"),
314+
*json_object->GetStringField(TEXT("content"))
315+
);
316+
} else if(message_type == "error") {
317+
UE_LOG(
318+
EcsactEditor,
319+
Error,
320+
TEXT("%s"),
321+
*json_object->GetStringField(TEXT("content"))
322+
);
323+
} else if(message_type == "warning") {
324+
UE_LOG(
325+
EcsactEditor,
326+
Warning,
327+
TEXT("%s"),
328+
*json_object->GetStringField(TEXT("content"))
329+
);
330+
} else if(message_type == "subcommand_start") {
331+
UE_LOG(
332+
EcsactEditor,
333+
Log,
334+
TEXT("subcommand(%i): %s"),
335+
json_object->GetIntegerField(TEXT("id")),
336+
*json_object->GetStringField(TEXT("executable"))
337+
);
338+
} else if(message_type == "subcommand_end") {
339+
UE_LOG(
340+
EcsactEditor,
341+
Log,
342+
TEXT("subcommand(%i): exit code %i"),
343+
json_object->GetIntegerField(TEXT("id")),
344+
json_object->GetIntegerField(TEXT("exit_code"))
345+
);
346+
} else if(message_type == "subcommand_stdout") {
347+
UE_LOG(
348+
EcsactEditor,
349+
Log,
350+
TEXT("subcommand(%i): %s"),
351+
json_object->GetIntegerField(TEXT("id")),
352+
*json_object->GetStringField(TEXT("line"))
353+
);
354+
} else if(message_type == "subcommand_stderr") {
355+
UE_LOG(
356+
EcsactEditor,
357+
Error,
358+
TEXT("subcommand(%i): %s"),
359+
json_object->GetIntegerField(TEXT("id")),
360+
*json_object->GetStringField(TEXT("line"))
361+
);
362+
} else if(message_type == "success") {
363+
UE_LOG(
364+
EcsactEditor,
365+
Log,
366+
TEXT("%s"),
367+
*json_object->GetStringField(TEXT("content"))
368+
);
369+
} else {
370+
UE_LOG(
371+
EcsactEditor,
372+
Warning,
373+
TEXT("Unhandled Message (%s): %s"),
374+
*message_type,
375+
*Json
376+
);
373377
}
374378
}
375379

‎Source/EcsactEditor/Private/EcsactSettings.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22

33
UEcsactSettings::UEcsactSettings() {
44
}
5-

‎typos.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[files]
2+
extend-exclude = ["CHANGELOG.md"]
3+
4+
[default]
5+
extend-ignore-re = ["(?Rm)^.*(#|//)\\s*typos:disable-line$"]
6+
extend-ignore-words-re = ["UE"]

0 commit comments

Comments
 (0)