Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
# Everything below is downloaded by `make fetch` at a pinned version.
# The enabled-plugin set is user state, not source.
.DS_Store
# Compiled templates, written into a packaged copy of app/ by cli/latte-precompile.php.
# Compiled templates, written only into a packaged copy of app/.
/app/latte-cache/
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -587,12 +587,13 @@ DIST = build.noindex/pkg/adminer-desktop
# the same tree a release carries. composer strips the dev tooling app/vendor carries for qa
# (dresscode, playwright: nothing the shipped app runs), reconciling the copy down to
# production deps in place. No precompile on windows: Latte locks even a precompiled template
# there, so app/ would have to be writable. app/cli/ is build tooling, so it does not ship.
# there, so app/ would have to be writable. app/cli/ is build tooling, so it does not ship: the
# precompile goes first, through the copy's own run.php, because it has to load the copy's classes.
define package-app
$(if $(EXE),,./bin/frankenphp php-cli $(1)/cli/run.php latte-precompile)
rm -rf $(1)/cli
$(COMPOSER) install --no-dev --no-interaction --working-dir=$(1)
rm -f $(1)/*.neon
$(if $(EXE),,./bin/frankenphp php-cli cli/latte-precompile.php $(1))
endef

dist: build app/vendor ## Stage the Linux/Windows folder layout
Expand Down
17 changes: 17 additions & 0 deletions app/cli/Command/LattePrecompile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);

namespace Desktop\Cli\Command;

use Desktop\Latte;

/** Compiles every template of the app/ tree this file sits in into its latte-cache/, so a packaged
* build never compiles one on the user's machine (~95 ms on the first launch). Run from the packaged
* copy, not the checkout: Desktop\Latte keys each compiled file by its path relative to the app/ it
* was loaded from.
*/
class LattePrecompile {
static function run(): void {
echo "latte: precompiled " . Latte::precompile() . " templates\n";
}
}
2 changes: 2 additions & 0 deletions app/cli/run.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
// The one entry the Makefile calls for build tooling: `$(CLI) <command>`.

use Desktop\Cli\Command\I18n;
use Desktop\Cli\Command\LattePrecompile;
use Desktop\Cli\Command\WindowsIco;

require dirname(__DIR__) . "/vendor/autoload.php";

$commands = [
"i18n" => I18n::run(...),
"i18n-check" => I18n::check(...),
"latte-precompile" => LattePrecompile::run(...),
"windows-ico" => WindowsIco::run(...),
];

Expand Down
11 changes: 0 additions & 11 deletions cli/latte-precompile.php

This file was deleted.

Loading