Skip to content

AOT: phpc build --project preflight validates include graph before compile #504

Description

@PurHur

Problem

phpc build --project reads phpc.json entry, includes[], and bundles literal __DIR__ includes (#452 ✅). Failures surface late as linker or missing-symbol errors when:

#59 tracks full project graph mode; this issue adds a fast preflight developers can run locally before LLVM compile.

Goal

phpc build --project examples/003-MiniWebApp --dry-run
# or: phpc lint --project examples/003-MiniWebApp

Exit 0 with a printed file list (entry + transitive static includes + manifest paths). Exit 1 with actionable errors before bin/compile.php invokes LLVM.

Implementation hints

Step Files Notes
Graph BFS new lib/AOT/ProjectGraph.php (shared with #59) Reuse LiteralIncludeDiscovery + ProjectManifest::includes()
CLI bin/phpc.php, bin/compile.php --dry-run / --project flag
Lint integration lib/Lint/ProjectLint.php Optional: same graph for phpc lint --all
Tests test/unit/ProjectGraphTest.php MiniWebApp manifest lists Router.php, config.php, templates via includes from entry

Acceptance criteria

docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \
  ./phpc build --project examples/003-MiniWebApp --dry-run

Prints ≥ public/index.php, src/Router.php, config.php, and discovered template paths. Removing a file from includes[] fails preflight with a clear message.

Verification (local / Docker only)

vendor/bin/phpunit --filter ProjectGraph

No .github/workflows/*.

Dependencies

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions