Skip to content

Commit

Permalink
b
Browse files Browse the repository at this point in the history
  • Loading branch information
polterguy committed Dec 27, 2023
1 parent 68d4498 commit 7a23bc7
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
.:magic.signals.contracts
code
type:csharp
mandatory:bool:false
mandatory:bool:true
default:@"using System;
using magic.node;
using magic.node.extensions;
Expand Down
62 changes: 62 additions & 0 deletions backend/files/misc/workflows/actions/misc/compile-csharp-file.hl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

/*
* Compiles the specified C# file and loads the resulting assembly into the AppDomain.
*
* Notice, will not compile the specified file if [assembly-name] already exists in
* AppDomain, unless [recompile] is true.
*/
.arguments
assembly-name
type:string
mandatory:bool:true
default:your-assembly-name.dll
recompile
type:bool
mandatory:bool:true
default:bool:true
references
type:array
mandatory:bool:true
default
.:netstandard
.:System.Runtime
.:System.ComponentModel
.:System.Private.CoreLib
.:magic.node
.:magic.node.extensions
.:magic.signals.contracts
file
type:string
mandatory:bool:true
.icon:rocket_launch

// Sanity checking invocation.
validators.mandatory:x:@.arguments/*/file
validators.mandatory:x:@.arguments/*/references
validators.mandatory:x:@.arguments/*/assembly-name

/*
* We only compile C# file if the assembly does not already exist in AppDomain,
* unless caller explicitly specifies [recompile] as true.
*/
system.plugin.list
if
or
get-value:x:@.arguments/*/recompile
not-exists:x:@system.plugin.list/*/={@.arguments/*/assembly-name}
.lambda

// Parametrizing [system.compile] invocation.
add:x:./*/system.compile
get-nodes:x:@.arguments/*/references
get-nodes:x:@.arguments/*/assembly-name

// Loading file.
load-file:x:@.arguments/*/file

// Compiling C# code.
system.compile
code:x:@load-file

// Loading assembly into AppDomain.
system.plugin.load:x:@system.compile

0 comments on commit 7a23bc7

Please sign in to comment.