Skip to content

Commit

Permalink
Removed compiled class file generation
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Dec 27, 2016
1 parent 9e51e89 commit 09964cc
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 288 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"php": ">=5.6.4",
"ext-mbstring": "*",
"ext-openssl": "*",
"classpreloader/classpreloader": "~3.0",
"doctrine/inflector": "~1.0",
"erusev/parsedown": "~1.6",
"league/flysystem": "~1.0",
Expand Down
7 changes: 0 additions & 7 deletions src/Illuminate/Contracts/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@ public function booting($callback);
*/
public function booted($callback);

/**
* Get the path to the cached "compiled.php" file.
*
* @return string
*/
public function getCachedCompilePath();

/**
* Get the path to the cached services.php file.
*
Expand Down
10 changes: 0 additions & 10 deletions src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -860,16 +860,6 @@ public function getCachedRoutesPath()
return $this->bootstrapPath().'/cache/routes.php';
}

/**
* Get the path to the cached "compiled.php" file.
*
* @return string
*/
public function getCachedCompilePath()
{
return $this->bootstrapPath().'/cache/compiled.php';
}

/**
* Get the path to the cached services.php file.
*
Expand Down
4 changes: 0 additions & 4 deletions src/Illuminate/Foundation/ComposerScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ protected static function clearCompiled()
{
$laravel = new Application(getcwd());

if (file_exists($compiledPath = $laravel->getCachedCompilePath())) {
@unlink($compiledPath);
}

if (file_exists($servicesPath = $laravel->getCachedServicesPath())) {
@unlink($servicesPath);
}
Expand Down
7 changes: 1 addition & 6 deletions src/Illuminate/Foundation/Console/ClearCompiledCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,12 @@ class ClearCompiledCommand extends Command
*/
public function fire()
{
$compiledPath = $this->laravel->getCachedCompilePath();
$servicesPath = $this->laravel->getCachedServicesPath();

if (file_exists($compiledPath)) {
@unlink($compiledPath);
}

if (file_exists($servicesPath)) {
@unlink($servicesPath);
}

$this->info('The compiled class file has been removed.');
$this->info('The compiled services file has been removed.');
}
}
207 changes: 0 additions & 207 deletions src/Illuminate/Foundation/Console/Optimize/config.php

This file was deleted.

53 changes: 1 addition & 52 deletions src/Illuminate/Foundation/Console/OptimizeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

namespace Illuminate\Foundation\Console;

use ClassPreloader\Factory;
use Illuminate\Console\Command;
use Illuminate\Support\Composer;
use Symfony\Component\Console\Input\InputOption;
use ClassPreloader\Exceptions\VisitorExceptionInterface;

class OptimizeCommand extends Command
{
Expand Down Expand Up @@ -59,54 +57,7 @@ public function fire()
$this->composer->dumpOptimized();
}

if ($this->option('force') || ! $this->laravel['config']['app.debug']) {
$this->info('Compiling common classes');
$this->compileClasses();
} else {
$this->call('clear-compiled');
}
}

/**
* Generate the compiled class file.
*
* @return void
*/
protected function compileClasses()
{
$preloader = (new Factory)->create(['skip' => true]);

$handle = $preloader->prepareOutput($this->laravel->getCachedCompilePath());

foreach ($this->getClassFiles() as $file) {
try {
fwrite($handle, $preloader->getCode($file, false)."\n");
} catch (VisitorExceptionInterface $e) {
//
}
}

fclose($handle);
}

/**
* Get the classes that should be combined and compiled.
*
* @return array
*/
protected function getClassFiles()
{
$app = $this->laravel;

$core = require __DIR__.'/Optimize/config.php';

$files = array_merge($core, $app['config']->get('compile.files', []));

foreach ($app['config']->get('compile.providers', []) as $provider) {
$files = array_merge($files, forward_static_call([$provider, 'compiles']));
}

return array_map('realpath', $files);
$this->call('clear-compiled');
}

/**
Expand All @@ -117,8 +68,6 @@ protected function getClassFiles()
protected function getOptions()
{
return [
['force', null, InputOption::VALUE_NONE, 'Force the compiled class file to be written.'],

['psr', null, InputOption::VALUE_NONE, 'Do not optimize Composer dump-autoload.'],
];
}
Expand Down
1 change: 0 additions & 1 deletion src/Illuminate/Support/Facades/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* @method static void boot()
* @method static void booting(mixed $callback)
* @method static void booted(mixed $callback)
* @method static string getCachedCompilePath()
* @method static string getCachedServicesPath()
*
* @see \Illuminate\Foundation\Application
Expand Down

1 comment on commit 09964cc

@jhdxr
Copy link
Contributor

@jhdxr jhdxr commented on 09964cc Feb 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should be documented in the upgrade guide section. or the compiled file generated in 5.3 will lead to fatal error in 5.4.

Please sign in to comment.