MCPcopy Create free account
hub / github.com/chukong/quick-cocos2d-x / compileModules

Method compileModules

bin/lib/quick/ScriptsCompiler.php:249–279  ·  view source on GitHub ↗
(array $modules, $key = null, $sign = null)

Source from the content-addressed store, hash-verified

247 }
248
249 protected function compileModules(array $modules, $key = null, $sign = null)
250 {
251 $xxtea = null;
252 if (!empty($key))
253 {
254 $xxtea = new XXTEA();
255 $xxtea->setKey($key);
256 }
257
258 $modulesBytes = array();
259 foreach ($modules as $path => $module)
260 {
261 $bytes = getScriptFileBytecodes($path, $module['tempFilePath'], $this->config['jit']);
262 if ($xxtea)
263 {
264 $bytes = $sign . $xxtea->encrypt($bytes);
265 file_put_contents($module['tempFilePath'], $bytes);
266 }
267 if (!$bytes)
268 {
269 print("\n");
270 return false;
271 }
272 $modulesBytes[$path] = $bytes;
273 if (!$this->config['quiet'])
274 {
275 printf(" > get bytes [% 3d KB] %s\n", ceil(strlen($bytes) / 1024), $module['moduleName']);
276 }
277 }
278 return $modulesBytes;
279 }
280
281 protected function createOutputZIP(array $modules, array $bytes)
282 {

Callers 1

runMethod · 0.95

Calls 3

getScriptFileBytecodesFunction · 0.85
setKeyMethod · 0.80
encryptMethod · 0.80

Tested by

no test coverage detected