Skip to content

DevEx: phpc build --project --list-units for AOT debug (#764) #847

@PurHur

Description

@PurHur

Problem

When phpc build --project examples/003-MiniWebApp links but .phpc/bin/app prints 0 stdout bytes (#764), contributors grep lib/Cli/PhpcBuild.php and re-run full ci-local.sh llvm phases.

There is no lightweight way to see which PHP files entered the project graph, link order, and whether public/index.php is the LLVM entry.

Goal

phpc build --project examples/003-MiniWebApp --list-units
# or: phpc build --project . --list-units --dry-run

Prints to stderr (stable, grep-friendly):

  • Resolved phpc.json entry + includes[]
  • Sorted translation unit paths (bundled vs on-disk)
  • Native entry symbol / main script path
  • Optional: skipped files with reason (lint, unsupported syntax)

Exit 0 without requiring link when combined with existing --dry-run.

Scope

Implementation hints

Piece File Notes
CLI lib/Cli/PhpcBuild.php Parse --list-units before compile
Manifest lib/Web/ProjectManifest.php entry, includes, binary
Bundler lib/Web/SourceBundler.php Same graph as link
Tests test/unit/PhpcBuildProjectTest.php Assert stdout lists public/index.php + src/Router.php for 003

Example output

entry: public/index.php
units: config.php, src/Router.php, templates/layout.php, …
binary: .phpc/bin/app

Acceptance criteria

./phpc build --project examples/003-MiniWebApp --list-units --dry-run | grep Router.php

Docker:

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

Dependencies

Verification

Local/Docker only. No GitHub Actions.

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions