This repository was archived by the owner on Aug 25, 2025. It is now read-only.
Support for generating executables
This release adds the following to the CodegenFile class:
setShebangLine(string s);setShebangLinef(format, ...);setPseudoMainHeader(string);setPseudoMainHeaderf(format, ...);setPseudoMainFooter(string);setPseudoMainFooterf(format, ...);
For example:
$factory->codegenFile($path)
->setShebangLine('#!/usr/bin/env hhvm')
->setPseudoMainHeader('require_once("vendor/autoload.php");')
->addFunction($factory->codegenFunction('main')/*... */ )
->setPseudoMainFooter('main();')
->save();These new methods can not be used with <?hh // strict files - as <?hh // strict bans pseudomain code, it's not currently possible to have strict scripts in Hack.