Skip to content

Commit

Permalink
from_local: stop doing a "composer install" because we launch "compos…
Browse files Browse the repository at this point in the history
…er require" right after,

stop trying to copy vendor/ because it did not work and Composer 2 is faster
  • Loading branch information
clemzarch committed Sep 13, 2023
1 parent 29c0450 commit 565968f
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 35 deletions.
14 changes: 0 additions & 14 deletions src/Adapter/Composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,6 @@ public function autoload(array $autoloads): void
file_put_contents($this->workdir.'/composer.json', json_encode($composer, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES));
}

public function install(): void
{
$this->command(
'composer',
'install',
'--prefer-dist',
'--no-progress',
'--prefer-stable',
'--sort-packages',
'--optimize-autoloader',
'--no-dev',
);
}

public function addGithubRepository(string $name, string $url): void
{
$this->command(
Expand Down
3 changes: 0 additions & 3 deletions src/Adapter/Docker/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ public function __invoke(array $configuration): Configurator\SatelliteBuilderInt
} else {
$builder->withComposerFile(new Packaging\Asset\LocalFile('composer.json'));
}
if (file_exists('vendor')) {
$builder->withDirectory(new Packaging\Directory('vendor/'));
}
}

if (\array_key_exists('autoload', $configuration['composer']) && \array_key_exists('psr4', $configuration['composer']['autoload'])) {
Expand Down
6 changes: 3 additions & 3 deletions src/Adapter/Docker/Satellite.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ final class Satellite implements Configurator\SatelliteInterface
{
/** @var string[] */
private array $imageTags = [];
/** @var iterable<Packaging\DirectoryInterface|Packaging\FileInterface> */
/** @var iterable<Packaging\AssetInterface|Packaging\DirectoryInterface> */
private iterable $files;
private iterable $dependencies = [];

public function __construct(
private readonly Dockerfile\Dockerfile $dockerfile,
private readonly string $workdir,
Packaging\FileInterface|Packaging\DirectoryInterface ...$files
Packaging\AssetInterface|Packaging\DirectoryInterface ...$files
) {
$this->files = $files;
}
Expand All @@ -34,7 +34,7 @@ public function addTags(string ...$imageTags): self
return $this;
}

public function withFile(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): self
public function withFile(Packaging\AssetInterface|Packaging\DirectoryInterface ...$files): self
{
array_push($this->files, ...$files);

Expand Down
1 change: 0 additions & 1 deletion src/Adapter/Docker/SatelliteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ public function build(): Configurator\SatelliteInterface
}

$dockerfile->push(new Dockerfile\PHP\Composer());
$dockerfile->push(new Dockerfile\PHP\ComposerInstall());
} else {
$dockerfile->push(new Dockerfile\PHP\Composer());
$dockerfile->push(new Dockerfile\PHP\ComposerInit(sprintf('satellite/%s', substr(hash('sha512', random_bytes(64)), 0, 64))));
Expand Down
3 changes: 0 additions & 3 deletions src/Adapter/Filesystem/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public function __invoke(array $configuration): Configurator\SatelliteBuilderInt
new Packaging\Asset\LocalFile('composer.json'),
);
}
if (file_exists('vendor')) {
$builder->withDirectory(new Packaging\Directory('vendor/'));
}
}

if (\array_key_exists('autoload', $configuration['composer']) && \array_key_exists('psr4', $configuration['composer']['autoload'])) {
Expand Down
6 changes: 3 additions & 3 deletions src/Adapter/Filesystem/Satellite.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@

final class Satellite implements Configurator\SatelliteInterface
{
/** @var iterable<Packaging\DirectoryInterface|Packaging\FileInterface> */
/** @var iterable<Packaging\AssetInterface|Packaging\DirectoryInterface> */
private iterable $files;
private iterable $dependencies = [];

public function __construct(
private readonly string $workdir,
private readonly Composer $composer,
Packaging\FileInterface|Packaging\DirectoryInterface ...$files
Packaging\AssetInterface|Packaging\DirectoryInterface ...$files
) {
$this->files = $files;
}

public function withFile(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): self
public function withFile(Packaging\AssetInterface|Packaging\DirectoryInterface ...$files): self
{
array_push($this->files, ...$files);

Expand Down
2 changes: 0 additions & 2 deletions src/Adapter/Filesystem/SatelliteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ public function build(): Configurator\SatelliteInterface
if (null !== $this->composerLockFile) {
$satellite->withFile($this->composerLockFile);
}

$composer->install();
} else {
$composer->init(sprintf('satellite/%s', substr(hash('sha512', random_bytes(64)), 0, 64)));
$composer->minimumStability('dev');
Expand Down
3 changes: 0 additions & 3 deletions src/Adapter/Tar/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ public function __invoke(array $configuration): Configurator\SatelliteBuilderInt
} else {
$builder->withComposerFile(new Packaging\Asset\LocalFile('composer.json'));
}
if (file_exists('vendor')) {
$builder->withDirectory(new Packaging\Directory('vendor/'));
}
}

if (\array_key_exists('autoload', $configuration['composer']) && \array_key_exists('psr4', $configuration['composer']['autoload'])) {
Expand Down
6 changes: 3 additions & 3 deletions src/Adapter/Tar/Satellite.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ final class Satellite implements Configurator\SatelliteInterface
{
/** @var string[] */
private array $imageTags = [];
/** @var iterable<Packaging\DirectoryInterface|Packaging\FileInterface> */
/** @var iterable<Packaging\AssetInterface|Packaging\DirectoryInterface> */
private iterable $files;
private iterable $dependencies = [];

public function __construct(
private readonly string $outputPath,
Packaging\FileInterface|Packaging\DirectoryInterface ...$files
Packaging\AssetInterface|Packaging\DirectoryInterface ...$files
) {
$this->files = $files;
}
Expand All @@ -31,7 +31,7 @@ public function addTags(string ...$imageTags): self
return $this;
}

public function withFile(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): self
public function withFile(Packaging\AssetInterface|Packaging\DirectoryInterface ...$files): self
{
array_push($this->files, ...$files);

Expand Down

0 comments on commit 565968f

Please sign in to comment.