コード例 #1
0
def copy_binaries(project, project_path, export_path, silent):
    """
    Copies the projects binaries files (.dll) and
    related files such as debug symbols.
    """
    plugins = cryproject.plugins_list(project)

    if not plugins:
        return

    for plugin in plugins:
        path = plugin.get("path")
        plugin_type = plugin.get("type")

        if not path:
            continue

        # Skip engine plugins. They're not included in the backup.
        if not path.endswith(".dll"):
            continue

        files = []

        if plugin_type == "EPluginType::Native":
            for bin_dir in BIN_DIRS:
                # Try to apply the selected engine configuration to the plugin as well.
                # This does assume plugins follow the same naming-rules as the engine does, as defined in bin_dirs.
                file_path = os.path.join(bin_dir, os.path.basename(path))
                src_file = os.path.join(project_path, file_path)
                if os.path.isfile(src_file):
                    dst_file = os.path.join(export_path, file_path)
                    files.append((src_file, dst_file))

        if not files:
            src_file = os.path.join(project_path, path)
            dst_file = os.path.join(export_path, path)
            files.append((src_file, dst_file))

        for src_file, dst_file in files:
            if os.path.isfile(src_file):
                os.makedirs(os.path.dirname(dst_file), exist_ok=True)
                shutil.copy2(src_file, dst_file)

                # Copy debug symbols
                src_file = "{}.pdb".format(os.path.splitext(src_file)[0])
                if os.path.isfile(src_file):
                    dst_file = "{}.pdb".format(os.path.splitext(dst_file)[0])
                    shutil.copy2(src_file, dst_file)
            elif not silent:
                print(
                    'Unable to copy plugin because the file "{}" doesn\'t exist!'
                    .format(src_file))
コード例 #2
0
def copy_plugins(project, project_path, export_path):
    """
    Copies all .dll files that belong to the plugins of the project.
    """
    plugins = cryproject.plugins_list(project)
    for plugin in plugins:
        path = plugin.get("path")

        if path == None:
            continue

        if not path.endswith(".dll"):
            continue

        src_file = os.path.join(project_path, path)
        dst_file = os.path.join(export_path, path)
        if os.path.isfile(src_file):
            shutil.copyfile(src_file, dst_file)
        else:
            print("Failed to copy plugin file '" + path + "'!")
            print(src_file)
コード例 #3
0
def copy_project_plugins(project, project_path, export_path, config_path,
                         config_type, include_symbols):
    """
    Copies all .dll files that belong to the plugins of the project.
    """
    plugins = cryproject.plugins_list(project)
    for plugin in plugins:
        path = plugin.get("path")
        plugin_type = plugin.get("type")
        platforms = plugin.get("platforms")

        if not path:
            continue

        # Skip engine plugins. They are copied elsewhere.
        if not path.endswith(".dll"):
            continue

        if platforms:
            current_platform = CONFIGURATION_PLATFORM_LOOKUP[config_type]
            platform_included = current_platform in platforms
            if not platform_included:
                continue

        src_file = os.path.join(project_path, path)
        dst_file = os.path.join(export_path, path)

        if plugin_type == "EPluginType::Native":
            # Try to apply the selected engine configuration to the plugin as well.
            # This prevents mixing release with profile configurations for example.
            # This does assume plugins follow the same naming-rules as the engine does, as defined in DEFAULT_CONFIGURATIONS.
            adjusted_src_file = os.path.join(project_path, config_path,
                                             os.path.basename(path))
            if os.path.isfile(adjusted_src_file):
                src_file = adjusted_src_file

        if os.path.isfile(src_file):
            os.makedirs(os.path.dirname(dst_file), exist_ok=True)
            shutil.copyfile(src_file, dst_file)

            # Copy debug symbols
            if include_symbols:
                src_file = "{}.pdb".format(os.path.splitext(src_file)[0])
                if os.path.isfile(src_file):
                    dst_file = "{}.pdb".format(os.path.splitext(dst_file)[0])
                    shutil.copyfile(src_file, dst_file)
        else:
            print("Failed to copy plugin file '{}' from {}!".format(
                path, src_file))

    # Also copy the assembly generated from C# assets
    asset_assembly = os.path.join("bin", "CRYENGINE.CSharp.dll")
    src_file = os.path.join(project_path, asset_assembly)
    if os.path.isfile(src_file):
        dst_file = os.path.join(export_path, asset_assembly)
        os.makedirs(os.path.dirname(dst_file), exist_ok=True)
        shutil.copyfile(src_file, dst_file)

        if include_symbols:
            src_file = "{}.pdb".format(os.path.splitext(src_file)[0])
            if os.path.isfile(src_file):
                dst_file = "{}.pdb".format(os.path.splitext(dst_file)[0])
                shutil.copyfile(src_file, dst_file)
            else:
                src_file = "{}.dll.mdb".format(os.path.splitext(src_file)[0])
                if os.path.isfile(src_file):
                    dst_file = "{}.dll.mdb".format(
                        os.path.splitext(dst_file)[0])
                    shutil.copyfile(src_file, dst_file)