Skip to content

Commit

Permalink
Allow to dynamically build input to RunParallel block. (ZeraGmbH#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
JMS-1 authored Oct 14, 2024
1 parent 2ed8b6c commit ded0d98
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion Library/Extensions/RunScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace BlocklyNet.Extensions;
"run_script_by_name",
"Scripts",
@"{
""message0"": ""RunScript %1 %2 %3 %4 %5"",
""message0"": ""RunScript %1 %2 %3 %4 %5 %6 %7"",
""args0"": [
{
""type"": ""input_dummy""
Expand All @@ -39,6 +39,16 @@ namespace BlocklyNet.Extensions;
""type"": ""input_value"",
""name"": ""ARGS"",
""check"": [""Array(run_script_parameter)"", ""Array""]
},
{
""type"": ""field_label_serializable"",
""name"": ""BUILDONLY"",
""text"": ""Do not execute""
},
{
""type"": ""input_value"",
""name"": ""BUILDONLY"",
""check"": ""Boolean""
}
],
""output"": null,
Expand All @@ -55,6 +65,14 @@ namespace BlocklyNet.Extensions;
""TEXT"": """"
}
}
},
""BUILDONLY"": {
""shadow"": {
""type"": ""logic_boolean"",
""fields"": {
""BOOL"": ""FALSE""
}
}
}
}
}"
Expand Down Expand Up @@ -96,6 +114,11 @@ public async Task<StartScript> ReadConfigurationAsync(Context context)
/* We are prepared to be run in parallel to other scripts. */
if (context.ParallelMode > 0) return this;

/* Or we are hust building. */
var buildOnly = await Values.EvaluateAsync<bool?>("BUILDONLY", context, true);

if (buildOnly == true) return this;

/* Run the script and report the result - in a new isolated environment. */
var result = await context.Engine.RunAsync<GenericResult>(await ReadConfigurationAsync(context));

Expand Down

0 comments on commit ded0d98

Please sign in to comment.