本文整理汇总了PHP中Generator::lookupProjectByName方法的典型用法代码示例。如果您正苦于以下问题:PHP Generator::lookupProjectByName方法的具体用法?PHP Generator::lookupProjectByName怎么用?PHP Generator::lookupProjectByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generator
的用法示例。
在下文中一共展示了Generator::lookupProjectByName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
public function generate($tpl, $platform, $root_dir)
{
// Project container for templates
$projects = array();
$refs = array();
// make sure that startup project is the first in the solution
if (getGameProjectName()) {
array_push($refs, getGameProjectName());
}
foreach ($this->project_refs as $pname) {
if (getGameProjectName() && $pname == getGameProjectName()) {
continue;
}
array_push($refs, $pname);
}
// Look up each project ref and add its info to the list
foreach ($refs as $pname) {
$project = Generator::lookupProjectByName($pname);
if (isset($project)) {
echo " - project ref: " . $pname . " = " . $project->guid . "\n";
array_push($projects, $project);
// Let the project update any dependencies
$project->validateDependencies();
} else {
trigger_error("Solution::generate() - project ref not found: " . $pname . "\n", E_USER_ERROR);
}
}
// No use going forward if there were no projects for this solution is there?
// (Would we ever want to generate an empty solution at all?)
if (count($projects) == 0) {
echo "Solution::generate() - no project refs found for solution: " . $this->name . "\n";
continue;
}
//
//sort( $projects );
// Set smarty params that dont change during loop once here
$tpl->assign_by_ref("solution_guid", $this->guid);
$tpl->assign_by_ref("projects", $projects);
$tpl->assign_by_ref("projectExtRefs", $this->project_extRefs);
// Generate a solution file for all outputs for this solution
foreach ($this->outputs as $output) {
// Supported platform?
if (!$output->supportsPlatform($platform)) {
//echo( " # Skipping output: '$outputName'.\n" );
continue;
}
// Reset to base dir
chdir($root_dir);
// Then offset
if (!FileUtil::prepareOutputDir($output->output_dir) || !$output->template_sln) {
continue;
}
$outfile = $this->name . $output->solution_ext;
echo " - Writing solution file: " . $output->output_dir . "/" . $outfile;
// Project filenames are <projectname>.<outputext> where ext is set per output.
// The template builds each project output using the project name and this ext.
$tpl->assign_by_ref("project_ext", $output->output_ext);
if ($f = fopen($outfile, 'w')) {
fputs($f, $tpl->fetch($output->template_sln));
fclose($f);
echo " - success " . "\n";
} else {
trigger_error("\nCould not write output file: " . $outfile, E_USER_ERROR);
}
}
}
示例2: setTemplateParams
private function setTemplateParams($tpl, $output, &$projectFiles)
{
// Set the template delimiters
$tpl->left_delimiter = $output->ldelim ? $output->ldelim : '{';
$tpl->right_delimiter = $output->rdelim ? $output->rdelim : '}';
// Evaluate template into a file.
$tpl->assign_by_ref('projSettings', $this);
$tpl->assign_by_ref('projOutput', $output);
$tpl->assign_by_ref('fileArray', $projectFiles);
$tpl->assign_by_ref('projName', $this->name);
$tpl->assign_by_ref('projOutName', $this->outputName);
$tpl->assign_by_ref('gameFolder', $this->game_dir);
$tpl->assign_by_ref('GUID', $this->guid);
$tpl->assign_by_ref('projDefines', $this->defines);
$tpl->assign_by_ref('projDisabledWarnings', $this->disabledWarnings);
$tpl->assign_by_ref('projIncludes', $this->includes);
$tpl->assign_by_ref('projLibs', $this->libs);
$tpl->assign_by_ref('projLibDirs', $this->lib_dirs);
$tpl->assign_by_ref('projDepend', $this->dependencies);
$tpl->assign_by_ref('gameProjectName', getGameProjectName());
$tpl->assign_by_ref('projModuleDefinitionFile', $this->moduleDefinitionFile);
$tpl->assign_by_ref('projSubSystem', $this->projSubSystem);
if (Generator::$useDLLRuntime) {
// /MD and /MDd
$tpl->assign('projRuntimeRelease', 2);
$tpl->assign('projRuntimeDebug', 3);
} else {
// /MT and /MTd
$tpl->assign('projRuntimeRelease', 0);
$tpl->assign('projRuntimeDebug', 1);
}
if (!$this->commandDebug && ($this->isSharedLib() || $this->isSharedApp())) {
$command = "\$(TargetDir)\\" . $this->outputName;
$tpl->assign('commandDebug', $command . "_DEBUG.exe");
$tpl->assign('commandRelease', $command . ".exe");
$tpl->assign('commandOptimized', $command . "_OPTIMIZEDDEBUG.exe");
} else {
$tpl->assign_by_ref('commandDebug', $this->commandDebug);
$tpl->assign_by_ref('commandRelease', $this->commandRelease);
$tpl->assign_by_ref('commandOptimized', $this->commandOptimized);
}
$tpl->assign_by_ref('argsDebug', $this->argsDebug);
$tpl->assign_by_ref('argsRelease', $this->argsRelease);
$tpl->assign_by_ref('argsOptimized', $this->argsOptimized);
$ptypes = array();
$projectDepends = array();
foreach ($this->dependencies as $pname) {
$p = Generator::lookupProjectByName($pname);
$projectDepends[$pname] = $p;
if ($p) {
$ptypes[$pname] = $p->isSharedLib() || $p->isSafari();
}
}
$tpl->assign_by_ref('projTypes', $ptypes);
$tpl->assign_by_ref('projectDepends', $projectDepends);
// Assign some handy paths for the template to reference
$tpl->assign('projectOffset', $output->project_rel_path);
if (Generator::$absPath) {
$tpl->assign('srcDir', Generator::$absPath . "/" . str_replace("../", "", getAppEngineSrcDir()));
} else {
$tpl->assign('srcDir', $output->project_rel_path . getAppEngineSrcDir());
}
if (Generator::$absPath) {
$tpl->assign('libDir', Generator::$absPath . "/" . str_replace("../", "", getAppLibSrcDir()));
} else {
$tpl->assign('libDir', $output->project_rel_path . getAppLibSrcDir());
}
if (Generator::$absPath) {
$tpl->assign('binDir', Generator::$absPath . "/" . str_replace("../", "", getAppEngineBinDir()));
} else {
$tpl->assign('binDir', $output->project_rel_path . getAppEngineBinDir());
}
$tpl->assign('uniformOutputFile', $this->uniformOutputFile);
}