def _PreHandleIosPrj_Sign(xcode_project): global developmentTeam global code_sign_identity global provisioning_profile_specifier global bundle_id if SIGN_TYPE == 'Inhouse': if PROFILE_TYPE == 'Development': # 暂时没有development类型的pp log_tool.show_error('Have not Inhouse Development Provioning Profile') exit(1) elif PROFILE_TYPE == 'Distribution': developmentTeam = globalvalue_tool.get_value("development_team_inhouse") code_sign_identity = globalvalue_tool.get_value("code_sign_identity_inhouse_distribution") provisioning_profile_specifier = globalvalue_tool.get_value("provisioning_profile_specifier_inhouse_distribuion") bundle_id = globalvalue_tool.get_value("bundle_id_ios_inhouse") elif SIGN_TYPE == 'AppStore': if PROFILE_TYPE == 'Development': # 暂时没有development类型的pp log_tool.show_error('Have not AppStore Development Provioning Profile') exit(1) elif PROFILE_TYPE == 'Distribution': developmentTeam = globalvalue_tool.get_value("development_team_appstore") code_sign_identity = globalvalue_tool.get_value("code_sign_identity_appstore_distribution") provisioning_profile_specifier = globalvalue_tool.get_value("provisioning_profile_specifier_appstore_distribuion") bundle_id = globalvalue_tool.get_value("bundle_id_ios_appstore") else: log_tool.show_error("Invalid SignType {}".format(SIGN_TYPE)) exit(1) # 设置手动签名 xcode_project.set_flags('CODE_SIGN_STYLE', 'Manual') for st in xcode_project.get_build_phases_by_name('PBXProject'): for t in xcode_project.get_build_phases_by_name('PBXNativeTarget'): log_tool.show_info("Handling target[{}], Set 'ProvisioningStyle = Manual'".format(t.name)) st.set_provisioning_style('Manual', t) st.attributes.TargetAttributes[u'1D6058900D05DD3D006BFB54'].parse({'DevelopmentTeam': developmentTeam}) st.attributes.TargetAttributes[u'1D6058900D05DD3D006BFB54'].SystemCapabilities.parse( {'com.apple.Push': {'enabled': '1'}}) st.attributes.TargetAttributes[u'1D6058900D05DD3D006BFB54'].SystemCapabilities.parse( {'com.apple.Keychain': {'enabled': '0'}}) xcode_project.set_flags('DEVELOPMENT_TEAM', developmentTeam, target_name='Unity-iPhone') xcode_project.set_flags('CODE_SIGN_IDENTITY', code_sign_identity) xcode_project.set_flags('CODE_SIGN_IDENTITY[sdk=iphoneos*]', code_sign_identity) xcode_project.set_flags('PROVISIONING_PROFILE_SPECIFIER', provisioning_profile_specifier, target_name='Unity-iPhone')
def __init__(self, workspace, branch_name='master'): # 工程目录相关 self.workspace = workspace self.branch_name = branch_name # svn info self.product_url = globalvalue_tool.get_value('product_url') # 本地库路径 self.product_path = common.full_path(self.workspace) # Unity 工程 self.unity_project_path = os.path.join(self.product_path, 'Game') # Unity插件目录 self.unity_plugins_path = os.path.join(self.unity_project_path, 'Assets/Plugins') # PackSetting self.pack_setting = None # UpdatePackageSetting self.update_package_setting = None
# 参数判空处理 if VERSION_NUMBER is None: VERSION_NUMBER = '' # current path CURRENT_PATH = os.path.dirname(os.path.abspath(__file__)) # InitWorkSpace workdirbase = os.path.dirname(os.path.dirname(CURRENT_PATH)) if not os.path.isdir(workdirbase): os.makedirs(workdirbase) workspace = WorkSpace(workdirbase, BRANCH_NAME) # UnityPath UNITY_PATH = globalvalue_tool.get_value("windows_unity_path") if common.is_macos(): UNITY_PATH = globalvalue_tool.get_value("macos_uinty_path") # Product Update def UpdateProduct(): if VERSION_NUMBER != '': workspace.up_product(VERSION_NUMBER) else: workspace.up_product() # 打包AB def BuildAssetBundle(): # 先更新到最新
# -*- coding: utf-8 -*- # Author: xiewenzhe<*****@*****.**> # Date: 2019/12/31 # FileName: updater_pack.py # Description: import os import sys import project_globalvalue from buildtools import common from buildtools import globalvalue_tool as globalvalue_tool from workspace import WorkSpace CURRENT_PATH = os.path.abspath(__file__) RESOURCES_PACKER_PATH = os.path.join(os.path.dirname(CURRENT_PATH), 'resources_packer.py') PACKAGE_NAME_PREFIX = globalvalue_tool.get_value("package_name_prefix") def pack(svn_branch, svn_version, main_version, platform, project_path, project_name, package_setting, is_packbase, is_restart=False, is_bacekground_update=True): """生成更新包""" # 不指定版本,默认将置为0 if (svn_version == ''): svn_version = '0' svn_name = svn_branch if '/' not in svn_branch else svn_branch.replace('/', '_') hot_package_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(project_path))), 'FtpShare/HotPackage') hot_package_dir = os.path.join(hot_package_dir, project_name) package_dir_base = os.path.join(hot_package_dir, svn_name) package_path = os.path.join(package_dir_base, main_version) package_dir = os.path.join(package_path, '{}/{}'.format(platform, package_setting.package_dir_name)) package_name = PACKAGE_NAME_PREFIX + "." + main_version
if BRANCH_NAME: LOCAL_OP = False MAIN_VERSION = os.environ.get('MAIN_VERSION') PLATFORM = os.environ.get('PLATFORM') DELETE_VERSION_NUMBER = int(os.environ.get('DELETE_VERSION_NUMBER')) PACK_DIR = os.environ.get('PACK_DIR') else: LOCAL_OP = True BRANCH_NAME = 'master' MAIN_VERSION = '0.1.0.0' PLATFORM = 'Android' DELETE_VERSION_NUMBER = -1 PACK_DIR = 'Base' # ProjectName PROJECT_NAME = globalvalue_tool.get_value("project_name") # PackageNamePrefix PACKAGE_NAME_PREFIX = globalvalue_tool.get_value("package_name_prefix") # current path CURRENT_PATH = os.path.dirname(os.path.abspath(__file__)) # InitWorkSpace workdirbase = os.path.dirname(os.path.dirname(CURRENT_PATH)) if not os.path.isdir(workdirbase): os.makedirs(workdirbase) workspace = WorkSpace(workdirbase, BRANCH_NAME) # 获取热更包目录
# VERSION_NUMBER = '' VERSION_TYPE = 'Alpha' IS_PRODUCT = False MAJOR_NUMBER = '0' MINOR_NUMBER = '1' PATCH_NUMBER = '0' BUILD_NUMBER = '0' ONLY_EXPORT = False SIGN_TYPE = 'Inhouse' PROFILE_TYPE = 'Distribution' APP_SHOW_NAME = '合家欢测试V2' IS_OBB_VERSION = False NEED_DOWNLOAD_OBB = False # ProjectName PROJECT_NAME = globalvalue_tool.get_value("project_name") # ProductName PRODUCT_NAME = globalvalue_tool.get_value("product_name") # 定义签名相关全局变量, 具体赋值在_PreHandleIosPrj_Sign中,不同项目记得做修改 # TeamId developmentTeam = '' # 签名类型 code_sign_identity = '' # 描述文件名 provisioning_profile_specifier = '' # 包名 bundle_id = '' # 参数判空处理
if BRANCH_NAME: LOCAL_OP = False MAIN_VERSION = os.environ.get('MAIN_VERSION') PLATFORM = os.environ.get('PLATFORM') UPDATE_VERSION_NUMBER = int(os.environ.get('UPDATE_VERSION_NUMBER')) PACK_DIR = os.environ.get('PACK_DIR') else: LOCAL_OP = True BRANCH_NAME = 'master' MAIN_VERSION = '0.1.0.0' PLATFORM = 'Android' UPDATE_VERSION_NUMBER = -1 PACK_DIR = 'Base' # ProjectName PROJECT_NAME = globalvalue_tool.get_value("project_name") # PackageNamePrefix PACKAGE_NAME_PREFIX = globalvalue_tool.get_value("package_name_prefix") # 热更包支持的最大版本间隔 MAX_VERSION_SPAN = globalvalue_tool.get_value("max_package_version_span") # current path CURRENT_PATH = os.path.dirname(os.path.abspath(__file__)) # InitWorkSpace workdirbase = os.path.dirname(os.path.dirname(CURRENT_PATH)) if not os.path.isdir(workdirbase): os.makedirs(workdirbase) workspace = WorkSpace(workdirbase, BRANCH_NAME)
LOCAL_OP = True BRANCH_NAME = 'master' LANGUAGE = 'zh_CN' VERSION_NUMBER = '' VERSION_TYPE = 'Alpha' IS_PRODUCT = False MAJOR_NUMBER = '0' MINOR_NUMBER = '1' PATCH_NUMBER = '0' BUILD_NUMBER = '0' IS_OBB_VERSION = False NEED_DOWNLOAD_OBB = False APP_SHOW_NAME = '牌乐门' # ProjectName PROJECT_NAME = globalvalue_tool.get_value("project_name") # BundleId BUNDLE_ID = globalvalue_tool.get_value("bundle_id_android") # ProductName PRODUCT_NAME = globalvalue_tool.get_value("product_name") # 参数判空处理 if VERSION_NUMBER is None: VERSION_NUMBER = '' # UnityPath UNITY_PATH = globalvalue_tool.get_value("windows_unity_path") if common.is_macos(): UNITY_PATH = globalvalue_tool.get_value("macos_uinty_path")
import argparse import os import sys import zipfile import csv import StringIO import hashlib import datetime import shutil import errno import json import project_globalvalue from buildtools import globalvalue_tool as globalvalue_tool MANIFEST_FILE_NAME = globalvalue_tool.get_value("package_manifest_file_suffix") MANIFEST_HEADERS = globalvalue_tool.get_value("package_manifest_headers") MAX_PACKAGE_VERSION_SPAN = globalvalue_tool.get_value( "max_package_version_span") def init_args(args): """ 初始化args,放入参数 """ args.version_file = '%s/%s.resource_version.txt' % (args.artifact_dir, args.package_name) if not os.path.isfile(args.version_file): # 不存在则创建默认Versionfile版本号0 _mkdir_p(args.artifact_dir)