Skip to content

Commit c708381

Browse files
committed
Beta-3
1 parent bc59a15 commit c708381

File tree

5 files changed

+49
-18
lines changed

5 files changed

+49
-18
lines changed

develnext/launcher/DevelNext.exe

0 Bytes
Binary file not shown.

develnext/misc/history.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Bate-3
1515
- В редакторе кода дополнение кавычек стало происходить более разумным способом.
1616
- Во внутренней системе IDE была переработана система пакетов и расширений для дальнейшего развития.
1717
- Исправлен баг с CSS классами, в некоторых случаях классы не применялись к объектам в запущенной программе.
18+
- Исправлен баг компиляции в байткод, в некоторых случаях возникала ошибка Class not found.
1819

1920

2021
Patch-A

develnext/src/ide/autocomplete/php/PhpBasicAutoCompleteTypeRule.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ protected function findReturnType(SimpleToken $token, $previousType = null, Auto
203203
public function identifyType($string, AutoCompleteRegion $region)
204204
{
205205
$tokens = SyntaxAnalyzer::analyzeExpressionForDetectType($string);
206+
206207
$type = null;
207208

208209
$accessType = '';

develnext/src/ide/misc/GradleBuildConfig.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ public function __construct($filename)
9191
public function stopDaemon()
9292
{
9393
if ($ide = Ide::get()) {
94+
$this->daemon = false;
95+
9496
Logger::info("Stop gradle daemon ...");
9597

9698
$process = new Process(
@@ -100,9 +102,8 @@ public function stopDaemon()
100102
);
101103

102104
$process->start();
103-
$this->daemon = false;
104105

105-
//Logger::info("Gradle daemon is stopped.");
106+
Logger::info("Gradle daemon is stopped.");
106107
}
107108
}
108109

@@ -120,7 +121,6 @@ public function startDaemon()
120121
);
121122

122123
$process = $process->start();
123-
//Logger::info("Daemon is started, exit code = " . $process->getExitValue());
124124
}
125125
}
126126
}

develnext/src/ide/project/behaviours/PhpProjectBehaviour.php

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,44 @@ public function doCompile($env, callable $log = null)
160160

161161
if ($useByteCode && $this->isByteCodeEnabled()) {
162162
$scope = new Environment(null, Environment::HOT_RELOAD);
163+
$scope->importClass(FileUtils::class);
163164

164165
$jarLibraries = $this->externalJarLibraries;
165166

166167
$generatedDirectory = $this->project->getSrcFile('', true);
168+
$dirs = [$this->project->getSrcFile('')];
169+
170+
$includedFiles = [];
167171

168-
$scope->execute(function () use ($jarLibraries, $generatedDirectory) {
172+
if ($bundle = BundleProjectBehaviour::get()) {
173+
foreach ($bundle->fetchAllBundles($env) as $one) {
174+
$dirs[] = $one->getProjectVendorDirectory();
175+
}
176+
}
177+
178+
$scope->execute(function () use ($jarLibraries, $generatedDirectory, $dirs, &$includedFiles) {
169179
ob_implicit_flush(true);
170180

171-
spl_autoload_register(function ($name) use ($jarLibraries, $generatedDirectory) {
181+
spl_autoload_register(function ($name) use ($jarLibraries, $generatedDirectory, $dirs, &$includedFiles) {
182+
echo("Try class '$name' auto load");
183+
184+
foreach ($dirs as $dir) {
185+
$filename = "$dir/$name.php";
186+
187+
if (fs::exists($filename)) {
188+
echo "Find class '$name' in ", $filename, "\n";
189+
190+
$compiled = new File($generatedDirectory, $name . ".phb");
191+
fs::ensureParent($compiled);
192+
193+
$includedFiles[FileUtils::hashName($filename)] = true;
194+
195+
$module = new Module($filename, false, true);
196+
$module->dump($compiled, true);
197+
return;
198+
}
199+
}
200+
172201
foreach ($jarLibraries as $file) {
173202
if (!fs::exists($file)) {
174203
echo "SKIP $file, is not exists.\n";
@@ -192,9 +221,7 @@ public function doCompile($env, callable $log = null)
192221

193222
$compiled = new File($generatedDirectory, $name . ".phb");
194223

195-
if ($compiled->getParentFile() && !$compiled->getParentFile()->isDirectory()) {
196-
$compiled->getParentFile()->mkdirs();
197-
}
224+
fs::ensureParent($compiled);
198225

199226
$module->dump($compiled, true);
200227

@@ -206,17 +233,13 @@ public function doCompile($env, callable $log = null)
206233
});
207234
});
208235

209-
$dirs = [$this->project->getSrcFile('')];
210-
211-
if ($bundle = BundleProjectBehaviour::get()) {
212-
foreach ($bundle->fetchAllBundles($env) as $one) {
213-
$dirs[] = $one->getProjectVendorDirectory();
214-
}
215-
}
216-
217236
foreach ($dirs as $dir) {
218-
fs::scan($dir, function ($filename) use ($log, $scope, $useByteCode, $generatedDirectory, $dir) {
237+
fs::scan($dir, function ($filename) use ($log, $scope, $useByteCode, $generatedDirectory, $dir, &$includedFiles) {
219238
if (str::endsWith($filename, '.php')) {
239+
if ($includedFiles[FileUtils::hashName($filename)]) {
240+
return;
241+
}
242+
220243
$filename = fs::normalize($filename);
221244

222245
if ($log) {
@@ -230,6 +253,7 @@ public function doCompile($env, callable $log = null)
230253
$compiledFile->getParentFile()->mkdirs();
231254
}
232255

256+
$includedFiles[FileUtils::hashName($filename)] = true;
233257
$scope->execute(function () use ($filename, $compiledFile) {
234258
$module = new Module($filename, false, true);
235259
$module->dump($compiledFile, true);
@@ -238,14 +262,19 @@ public function doCompile($env, callable $log = null)
238262
});
239263
}
240264

241-
fs::scan($generatedDirectory, function ($filename) use ($log, $scope, $useByteCode) {
265+
fs::scan($generatedDirectory, function ($filename) use ($log, $scope, $useByteCode, &$includedFiles) {
242266
if (fs::ext($filename) == 'php') {
267+
if ($includedFiles[FileUtils::hashName($filename)]) {
268+
return;
269+
}
270+
243271
$filename = fs::normalize($filename);
244272

245273
if ($log) $log(":compile $filename");
246274

247275
$compiledFile = fs::pathNoExt($filename) . '.phb';
248276

277+
$includedFiles[FileUtils::hashName($filename)] = true;
249278
$scope->execute(function () use ($filename, $compiledFile) {
250279
$module = new Module($filename, false, true);
251280
$module->dump($compiledFile);

0 commit comments

Comments
 (0)