Skip to content

Commit 3e68692

Browse files
committed
update RunCommand
update the use of the Launcher
1 parent 112ebdf commit 3e68692

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/Commands/RunCommand.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,28 +86,16 @@ public function execute(array $parameters, array $arguments): void
8686
return;
8787
}
8888

89-
$projectFile = simplexml_load_file($projectPath);
89+
$launcher = Launcher::initialize($projectPath);
9090

91-
if (!$projectFile) {
91+
if (!$launcher) {
9292
Console::foregroundColor(ConsoleColor::Red);
93-
Console::writeLine("Project file type not supported!");
93+
Console::writeLine("Invalid project file format!");
9494
Console::resetColor();
9595
return;
9696
}
9797

98-
$projectRoot = dirname($projectPath);
99-
$mainClass = $projectFile->Properties->EntryPoint;
100-
$packages = $projectFile->Dependencies->Package ?? [];
101-
102-
foreach ($packages as $package) {
103-
$include = (string)$package->attributes()->include;
104-
if (file_exists($projectRoot . '/' . $include)) {
105-
require $projectRoot . ' /' . $include;
106-
}
107-
}
108-
109-
$launcher = new Launcher($projectRoot);
110-
$result = $launcher->launch($mainClass, $arguments);
98+
$result = $launcher->launch($arguments);
11199

112100
switch ($result) {
113101
case 1:

0 commit comments

Comments
 (0)