8000 bug #26128 Make kernel build time optionally deterministic (lstrojny) · symfony/symfony@eb53c7d · GitHub
[go: up one dir, main page]

Skip to content

Commit eb53c7d

Browse files
bug #26128 Make kernel build time optionally deterministic (lstrojny)
This PR was merged into the 3.4 branch. Discussion ---------- Make kernel build time optionally deterministic | Q | A | ------------- | --- | Branch? | master for features / 2.7 up to 4.0 for bug fixes <!-- see below --> | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - As part of the effort to enable reproducible builds, this PR allows setting a deterministic build time for the dumped kernel. Parent issue is #25958. Commits ------- 48e8249 Make kernel build time optionally deterministic
2 parents cecda0b + 48e8249 commit eb53c7d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public function dump(array $options = array())
119119
'debug' => true,
120120
'hot_path_tag' => 'container.hot_path',
121121
'inline_class_loader_parameter' => 'container.dumper.inline_class_loader',
122+
'build_time' => time(),
122123
), $options);
123124

124125
$this->namespace = $options['namespace'];
@@ -216,7 +217,7 @@ public function dump(array $options = array())
216217
array_pop($code);
217218
$code["Container{$hash}/{$options['class']}.php"] = substr_replace($files[$options['class'].'.php'], "<?php\n\nnamespace Container{$hash};\n", 0, 6);
218219
$namespaceLine = $this->namespace ? "\nnamespace {$this->namespace};\n" : '';
219-
$time = time();
220+
$time = $options['build_time'];
220221
$id = hash('crc32', $hash.$time);
221222

222223
$code[$options['class'].'.php'] = <<<EOF

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,7 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container
855855
'as_files' => true,
856856
'debug' => $this->debug,
857857
'inline_class_loader_parameter' => \PHP_VERSION_ID >= 70000 && !$this->loadClassCache && !class_exists(ClassCollectionLoader::class, false) ? 'container.dumper.inline_class_loader' : null,
858+
'build_time' => $container->hasParameter('kernel.container_build_time') ? $container->getParameter('kernel.container_build_time') : time(),
858859
));
859860

860861
$rootCode = array_pop($content);

0 commit comments

Comments
 (0)
0