MCPcopy Create free account
hub / github.com/defold/defold / create_bundle

Function create_bundle

editor/scripts/bundle.py:536–628  ·  view source on GitHub ↗
(jdk, platform, options)

Source from the content-addressed store, hash-verified

534
535
536def create_bundle(jdk, platform, options):
537 mkdirs('target/editor')
538 jar_file = create_standalone_editor_jar(jdk, platform)
539 log("Creating bundle for platform %s..." % platform)
540 rmtree('tmp')
541 tmp_dir = "tmp"
542 is_mac = platform_is_macos(platform)
543 if is_mac:
544 resources_dir = os.path.join(tmp_dir, 'Defold.app/Contents/Resources')
545 packages_dir = os.path.join(tmp_dir, 'Defold.app/Contents/Resources/packages')
546 bundle_dir = os.path.join(tmp_dir, 'Defold.app')
547 exe_dir = os.path.join(tmp_dir, 'Defold.app/Contents/MacOS')
548 icon = 'logo.icns'
549 else:
550 resources_dir = os.path.join(tmp_dir, 'Defold')
551 packages_dir = os.path.join(tmp_dir, 'Defold/packages')
552 bundle_dir = os.path.join(tmp_dir, 'Defold')
553 exe_dir = os.path.join(tmp_dir, 'Defold')
554 icon = 'logo_blue.png'
555
556 mkdirs(tmp_dir)
557 mkdirs(bundle_dir)
558 mkdirs(exe_dir)
559 mkdirs(resources_dir)
560 mkdirs(packages_dir)
561
562 if is_mac:
563 shutil.copy('bundle-resources/Info.plist', '%s/Contents' % bundle_dir)
564 shutil.copy('bundle-resources/Assets.car', resources_dir)
565 shutil.copy('bundle-resources/document_legacy.icns', resources_dir)
566 if icon:
567 shutil.copy('bundle-resources/%s' % icon, resources_dir)
568
569 # creating editor config file
570 config = configparser.ConfigParser()
571 config.read('bundle-resources/config')
572 config.set('build', 'editor_sha1', options.editor_sha1)
573 config.set('build', 'engine_sha1', options.engine_sha1 or '')
574 config.set('build', 'version', options.version)
575 config.set('build', 'time', datetime.datetime.now().isoformat())
576 config.set('build', 'archive_domain', options.archive_domain)
577
578 if options.channel:
579 config.set('build', 'channel', options.channel)
580
581 with open('%s/config' % resources_dir, 'w') as f:
582 config.write(f)
583
584 defold_jar = '%s/defold-%s.jar' % (packages_dir, options.editor_sha1)
585 shutil.copy(jar_file, defold_jar)
586
587 # strip tools and libs for the platforms we're not currently bundling
588 remove_platform_files_from_archive(platform, defold_jar, jdk)
589 validate_android_vkquality_files(defold_jar)
590
591 # copy editor executable (the launcher)
592 launcher = launcher_path(options, platform, get_exe_suffix(platform))
593 defold_exe = '%s/Defold%s' % (exe_dir, get_exe_suffix(platform))

Callers 1

buildFunction · 0.85

Calls 15

mkdirsFunction · 0.85
rmtreeFunction · 0.85
platform_is_macosFunction · 0.85
launcher_pathFunction · 0.85
get_exe_suffixFunction · 0.85
platform_is_windowsFunction · 0.85
ziptreeFunction · 0.85
platform_is_linuxFunction · 0.85
gz_treeFunction · 0.85

Tested by

no test coverage detected