public function getBuildCfg($key = null) { if ($this->_buildCfg) { return $key ? $this->_buildCfg[$key] : $this->_buildCfg; } // try to get from shared cache - this seems annoying and unecessary # $cacheKey = "app/$this->_name/config"; # # if($this->_buildCfg = Cache::fetch($cacheKey)) # { # return $key ? $this->_buildCfg[$key] : $this->_buildCfg; # } // get from filesystem $configPath = array('sencha-workspace', $this->_name, '.sencha', 'app', 'sencha.cfg'); if (!($configNode = Site::resolvePath($configPath, true, false))) { throw new Exception('Could not find .sencha/app/sencha.cfg for ' . $this->_name); } $this->_buildCfg = Sencha::loadProperties($configNode->RealPath); if ($jsonCfg = $this->getAppCfg()) { Emergence\Util\Data::collapseTreeToDottedKeys($jsonCfg, $this->_buildCfg, 'app'); } // store in cache # Cache::store($cacheKey, $this->_buildCfg); return $key ? $this->_buildCfg[$key] : $this->_buildCfg; }
Benchmark::mark("exported {$workspaceConfigPath} to {$workspaceConfigTmpPath}: " . http_build_query($exportResult)); // ... packages if (!($requiredPackages = $App->getRequiredPackages()) || !is_array($requiredPackages)) { $requiredPackages = array(); } Benchmark::mark("aggregating classpaths from packages"); $classPaths = array_merge($classPaths, Sencha::aggregateClassPathsForPackages($requiredPackages)); foreach ($requiredPackages as $packageName) { $cachedFiles = Emergence_FS::cacheTree("{$packagesPath}/{$packageName}"); Benchmark::mark("precached {$cachedFiles} files in {$packagesPath}/{$packageName}"); $exportResult = Emergence_FS::exportTree("{$packagesPath}/{$packageName}", "{$packagesTmpPath}/{$packageName}"); Benchmark::mark("exported {$packagesPath}/{$packageName} to {$packagesTmpPath}/{$packageName}: " . http_build_query($exportResult)); // append package-level classpaths $packageBuildConfigPath = "{$packagesTmpPath}/{$packageName}/.sencha/package/sencha.cfg"; if (file_exists($packageBuildConfigPath)) { $packageBuildConfig = Sencha::loadProperties($packageBuildConfigPath); $classPaths = array_merge($classPaths, explode(',', $packageBuildConfig['package.classpath'])); } } // ... framework $cachedFiles = Emergence_FS::cacheTree($frameworkPath); Benchmark::mark("precached {$cachedFiles} files in {$frameworkPath}"); $exportResult = Emergence_FS::exportTree($frameworkPath, $frameworkTmpPath); Benchmark::mark("exported {$frameworkPath} to {$frameworkTmpPath}: " . http_build_query($exportResult)); // ... app $cachedFiles = Emergence_FS::cacheTree($appPath); Benchmark::mark("precached {$cachedFiles} files in {$appPath}"); $exportResult = Emergence_FS::exportTree($appPath, $appTmpPath); Benchmark::mark("exported {$appPath} to {$appTmpPath}: " . http_build_query($exportResult)); // write any libraries from classpath foreach (array_unique($classPaths) as $classPath) {
public static function getWorkspaceCfg($key = null) { if (!static::$_workspaceCfg) { // get from filesystem $configPath = array('sencha-workspace', '.sencha', 'workspace', 'sencha.cfg'); if ($configNode = Site::resolvePath($configPath, true, false)) { static::$_workspaceCfg = Sencha::loadProperties($configNode->RealPath); } else { static::$_workspaceCfg = array(); } } return $key ? static::$_workspaceCfg[$key] : static::$_workspaceCfg; }
* Page class files may indicate package dependencies with header comments in the following format: * ``` * // @require-package my-package-name * ```` * * TODO: * - For packages required by pages, all files within all packages' overrides folder should be automatically included in that page's build * */ $GLOBALS['Session']->requireAccountLevel('Developer'); set_time_limit(0); if (empty($_GET['dumpWorkspace'])) { Benchmark::startLive(); } // load build cfg $buildConfig = Sencha::loadProperties(Site::resolvePath('sencha-workspace/pages/.sencha/workspace/sencha.cfg')->RealPath); $framework = $buildConfig['pages.framework']; $frameworkVersion = Sencha::normalizeFrameworkVersion($framework, $buildConfig['pages.framework.version']); $cmdVersion = $buildConfig['workspace.cmd.version']; if (!$framework) { die("app.framework not found in sencha.cfg"); } // set paths $pagesPath = 'sencha-workspace/pages'; $frameworkPath = "sencha-workspace/{$framework}-{$frameworkVersion}"; // get temporary directory and set paths $tmpPath = Emergence_FS::getTmpDir(); Benchmark::mark("created tmp: {$tmpPath}"); // change into tmpPath chdir($tmpPath); Benchmark::mark("chdir to: {$tmpPath}");