44use Illuminate \Support \Facades \Route ;
55use Illuminate \Support \ServiceProvider ;
66use ProcessMaker \Traits \PluginServiceProviderTrait ;
7- use ProcessMaker \Package \Packages \Events \PackageEvent ;
8- use ProcessMaker \Package \WebEntry \Listeners \PackageListener ;
7+ use ProcessMaker \Models \ScriptExecutor ;
98
109class DockerExecutorCSharpServiceProvider extends ServiceProvider
1110{
1211 use PluginServiceProviderTrait;
1312
14- const version = '0 .0.1 ' ; // Required for PluginServiceProviderTrait
13+ const version = '1 .0.0 ' ; // Required for PluginServiceProviderTrait
1514
1615 public function register ()
1716 {
@@ -28,21 +27,42 @@ public function register()
2827 public function boot ()
2928 {
3029 \Artisan::command ('docker-executor-csharp:install ' , function () {
31- // nothing to do here
30+ $ scriptExecutor = ScriptExecutor::install ([
31+ 'language ' => 'csharp ' ,
32+ 'title ' => 'C# Executor ' ,
33+ 'description ' => 'Default C# Executor ' ,
34+ ]);
35+
36+ // Build the instance image. This is the same as if you were to build it from the admin UI
37+ \Artisan::call ('processmaker:build-script-executor csharp ' );
38+
39+ // Restart the workers so they know about the new supported language
40+ \Artisan::call ('horizon:terminate ' );
3241 });
3342
3443 $ config = [
3544 'name ' => 'C# ' ,
3645 'runner ' => 'CSharpRunner ' ,
3746 'mime_type ' => 'text/plain ' ,
38- 'image ' => env ('SCRIPTS_CSHARP_IMAGE ' , 'processmaker4/executor-csharp ' ),
3947 'options ' => [
4048 'packageName ' => "ProcessMakerSDK " ,
41- ]
49+ ],
50+ 'init_dockerfile ' => [
51+ "ARG SDK_DIR " ,
52+ 'COPY $SDK_DIR /opt/sdk-csharp ' ,
53+ 'WORKDIR /opt/sdk-csharp ' ,
54+ 'RUN chmod 755 build.sh ' ,
55+ '# OpenAPI Builder for csharp is broken ' ,
56+ '# RUN ./build.sh ' ,
57+ 'WORKDIR /opt/executor ' ,
58+ '# RUN mv ../sdk-csharp/bin . && rm -rf ../sdk-csharp ' ,
59+ ],
60+ 'package_path ' => __DIR__ . '/.. ' ,
61+ 'package_version ' => self ::version,
4262 ];
4363 config (['script-runners.csharp ' => $ config ]);
4464
45- $ this ->app ['events ' ]->listen (PackageEvent::class, PackageListener::class);
65+ // $this->app['events']->listen(PackageEvent::class, PackageListener::class);
4666
4767 // Complete the plugin booting
4868 $ this ->completePluginBoot ();
0 commit comments